2 * arch/arm/mach-tegra/include/mach/tegra_usb_phy.h
4 * Copyright (c) 2012-2014, NVIDIA CORPORATION. All rights reserved.
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #ifndef __MACH_TEGRA_USB_PHY_H
18 #define __MACH_TEGRA_USB_PHY_H
20 #include <linux/usb/otg.h>
23 * defines USB port speeds supported in USB2.0
25 enum usb_phy_port_speed {
26 USB_PHY_PORT_SPEED_FULL = 0,
27 USB_PHY_PORT_SPEED_LOW,
28 USB_PHY_PORT_SPEED_HIGH,
29 USB_PHY_PORT_SPEED_UNKNOWN,
33 * defines structure for oscillator dependent parameters
35 struct tegra_xtal_freq {
46 * pre decleration of the usb phy data structure
51 * defines function pointers used for differnt phy interfaces
53 struct tegra_usb_phy_ops {
54 int (*open)(struct tegra_usb_phy *phy);
55 void (*close)(struct tegra_usb_phy *phy);
56 int (*irq)(struct tegra_usb_phy *phy);
57 int (*init)(struct tegra_usb_phy *phy);
58 int (*reset)(struct tegra_usb_phy *phy);
59 int (*pre_suspend)(struct tegra_usb_phy *phy);
60 int (*suspend)(struct tegra_usb_phy *phy);
61 int (*post_suspend)(struct tegra_usb_phy *phy);
62 int (*pre_resume)(struct tegra_usb_phy *phy, bool remote_wakeup);
63 int (*resume)(struct tegra_usb_phy *phy);
64 int (*post_resume)(struct tegra_usb_phy *phy);
65 int (*port_power)(struct tegra_usb_phy *phy);
66 int (*bus_reset)(struct tegra_usb_phy *phy);
67 int (*power_off)(struct tegra_usb_phy *phy);
68 int (*power_on)(struct tegra_usb_phy *phy);
69 bool (*charger_detect)(struct tegra_usb_phy *phy);
70 bool (*cdp_charger_detect)(struct tegra_usb_phy *phy);
71 bool (*qc2_charger_detect)(struct tegra_usb_phy *phy, int max_voltage);
72 bool (*maxim_charger_14675)(struct tegra_usb_phy *phy);
73 bool (*nv_charger_detect)(struct tegra_usb_phy *phy);
74 bool (*apple_charger_1000ma_detect)(struct tegra_usb_phy *phy);
75 bool (*apple_charger_2000ma_detect)(struct tegra_usb_phy *phy);
76 bool (*apple_charger_500ma_detect)(struct tegra_usb_phy *phy);
77 void (*pmc_disable) (struct tegra_usb_phy *phy);
81 * defines usb phy data structure
83 struct tegra_usb_phy {
84 /* Don't move below variable 'phy', from first place*/
86 struct platform_device *pdev;
87 struct tegra_usb_platform_data *pdata;
89 struct clk *ctrlr_clk;
91 struct clk *utmi_pad_clk;
94 struct regulator *vdd_reg;
95 struct regulator *hsic_reg;
96 struct regulator *vbus_reg;
97 struct regulator *pllu_reg;
98 struct tegra_usb_phy_ops *ops;
99 struct tegra_xtal_freq *freq;
100 struct usb_phy *ulpi_vp;
101 enum usb_phy_port_speed port_speed;
102 signed char utmi_xcvr_setup;
109 bool pmc_remote_wakeup;
110 bool pmc_hotplug_wakeup;
112 bool ulpi_clk_padout_ena;
117 bool ctrlr_suspended;
120 int usb_phy_reg_status_wait(void __iomem *reg, u32 mask,
121 u32 result, u32 timeout);
123 int tegra3_usb_phy_init_ops(struct tegra_usb_phy *phy);
124 int tegra2_usb_phy_init_ops(struct tegra_usb_phy *phy);
125 int tegra11x_usb_phy_init_ops(struct tegra_usb_phy *phy);
128 #endif /* __MACH_TEGRA_USB_PHY_H */