diff options
68 files changed, 1186 insertions, 1024 deletions
diff --git a/arch/arm/mach-imx/mx31moboard-devboard.c b/arch/arm/mach-imx/mx31moboard-devboard.c index 0aa25364360..cc285e50728 100644 --- a/arch/arm/mach-imx/mx31moboard-devboard.c +++ b/arch/arm/mach-imx/mx31moboard-devboard.c | |||
@@ -158,7 +158,7 @@ static int devboard_usbh1_hw_init(struct platform_device *pdev) | |||
158 | #define USBH1_VBUSEN_B IOMUX_TO_GPIO(MX31_PIN_NFRE_B) | 158 | #define USBH1_VBUSEN_B IOMUX_TO_GPIO(MX31_PIN_NFRE_B) |
159 | #define USBH1_MODE IOMUX_TO_GPIO(MX31_PIN_NFALE) | 159 | #define USBH1_MODE IOMUX_TO_GPIO(MX31_PIN_NFALE) |
160 | 160 | ||
161 | static int devboard_isp1105_init(struct otg_transceiver *otg) | 161 | static int devboard_isp1105_init(struct usb_phy *otg) |
162 | { | 162 | { |
163 | int ret = gpio_request(USBH1_MODE, "usbh1-mode"); | 163 | int ret = gpio_request(USBH1_MODE, "usbh1-mode"); |
164 | if (ret) | 164 | if (ret) |
@@ -177,7 +177,7 @@ static int devboard_isp1105_init(struct otg_transceiver *otg) | |||
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
180 | static int devboard_isp1105_set_vbus(struct otg_transceiver *otg, bool on) | 180 | static int devboard_isp1105_set_vbus(struct usb_otg *otg, bool on) |
181 | { | 181 | { |
182 | if (on) | 182 | if (on) |
183 | gpio_set_value(USBH1_VBUSEN_B, 0); | 183 | gpio_set_value(USBH1_VBUSEN_B, 0); |
@@ -194,18 +194,24 @@ static struct mxc_usbh_platform_data usbh1_pdata __initdata = { | |||
194 | 194 | ||
195 | static int __init devboard_usbh1_init(void) | 195 | static int __init devboard_usbh1_init(void) |
196 | { | 196 | { |
197 | struct otg_transceiver *otg; | 197 | struct usb_phy *phy; |
198 | struct platform_device *pdev; | 198 | struct platform_device *pdev; |
199 | 199 | ||
200 | otg = kzalloc(sizeof(*otg), GFP_KERNEL); | 200 | phy = kzalloc(sizeof(*phy), GFP_KERNEL); |
201 | if (!otg) | 201 | if (!phy) |
202 | return -ENOMEM; | 202 | return -ENOMEM; |
203 | 203 | ||
204 | otg->label = "ISP1105"; | 204 | phy->otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL); |
205 | otg->init = devboard_isp1105_init; | 205 | if (!phy->otg) { |
206 | otg->set_vbus = devboard_isp1105_set_vbus; | 206 | kfree(phy); |
207 | return -ENOMEM; | ||
208 | } | ||
209 | |||
210 | phy->label = "ISP1105"; | ||
211 | phy->init = devboard_isp1105_init; | ||
212 | phy->otg->set_vbus = devboard_isp1105_set_vbus; | ||
207 | 213 | ||
208 | usbh1_pdata.otg = otg; | 214 | usbh1_pdata.otg = phy; |
209 | 215 | ||
210 | pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata); | 216 | pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata); |
211 | if (IS_ERR(pdev)) | 217 | if (IS_ERR(pdev)) |
diff --git a/arch/arm/mach-imx/mx31moboard-marxbot.c b/arch/arm/mach-imx/mx31moboard-marxbot.c index bb639cbda4e..135c90e3a45 100644 --- a/arch/arm/mach-imx/mx31moboard-marxbot.c +++ b/arch/arm/mach-imx/mx31moboard-marxbot.c | |||
@@ -272,7 +272,7 @@ static int marxbot_usbh1_hw_init(struct platform_device *pdev) | |||
272 | #define USBH1_VBUSEN_B IOMUX_TO_GPIO(MX31_PIN_NFRE_B) | 272 | #define USBH1_VBUSEN_B IOMUX_TO_GPIO(MX31_PIN_NFRE_B) |
273 | #define USBH1_MODE IOMUX_TO_GPIO(MX31_PIN_NFALE) | 273 | #define USBH1_MODE IOMUX_TO_GPIO(MX31_PIN_NFALE) |
274 | 274 | ||
275 | static int marxbot_isp1105_init(struct otg_transceiver *otg) | 275 | static int marxbot_isp1105_init(struct usb_phy *otg) |
276 | { | 276 | { |
277 | int ret = gpio_request(USBH1_MODE, "usbh1-mode"); | 277 | int ret = gpio_request(USBH1_MODE, "usbh1-mode"); |
278 | if (ret) | 278 | if (ret) |
@@ -291,7 +291,7 @@ static int marxbot_isp1105_init(struct otg_transceiver *otg) | |||
291 | } | 291 | } |
292 | 292 | ||
293 | 293 | ||
294 | static int marxbot_isp1105_set_vbus(struct otg_transceiver *otg, bool on) | 294 | static int marxbot_isp1105_set_vbus(struct usb_otg *otg, bool on) |
295 | { | 295 | { |
296 | if (on) | 296 | if (on) |
297 | gpio_set_value(USBH1_VBUSEN_B, 0); | 297 | gpio_set_value(USBH1_VBUSEN_B, 0); |
@@ -308,18 +308,24 @@ static struct mxc_usbh_platform_data usbh1_pdata __initdata = { | |||
308 | 308 | ||
309 | static int __init marxbot_usbh1_init(void) | 309 | static int __init marxbot_usbh1_init(void) |
310 | { | 310 | { |
311 | struct otg_transceiver *otg; | 311 | struct usb_phy *phy; |
312 | struct platform_device *pdev; | 312 | struct platform_device *pdev; |
313 | 313 | ||
314 | otg = kzalloc(sizeof(*otg), GFP_KERNEL); | 314 | phy = kzalloc(sizeof(*phy), GFP_KERNEL); |
315 | if (!otg) | 315 | if (!phy) |
316 | return -ENOMEM; | 316 | return -ENOMEM; |
317 | 317 | ||
318 | otg->label = "ISP1105"; | 318 | phy->otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL); |
319 | otg->init = marxbot_isp1105_init; | 319 | if (!phy->otg) { |
320 | otg->set_vbus = marxbot_isp1105_set_vbus; | 320 | kfree(phy); |
321 | return -ENOMEM; | ||
322 | } | ||
323 | |||
324 | phy->label = "ISP1105"; | ||
325 | phy->init = marxbot_isp1105_init; | ||
326 | phy->otg->set_vbus = marxbot_isp1105_set_vbus; | ||
321 | 327 | ||
322 | usbh1_pdata.otg = otg; | 328 | usbh1_pdata.otg = phy; |
323 | 329 | ||
324 | pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata); | 330 | pdev = imx31_add_mxc_ehci_hs(1, &usbh1_pdata); |
325 | if (IS_ERR(pdev)) | 331 | if (IS_ERR(pdev)) |
diff --git a/arch/arm/mach-pxa/pxa3xx-ulpi.c b/arch/arm/mach-pxa/pxa3xx-ulpi.c index e28dfb88827..5ead6d480c6 100644 --- a/arch/arm/mach-pxa/pxa3xx-ulpi.c +++ b/arch/arm/mach-pxa/pxa3xx-ulpi.c | |||
@@ -33,7 +33,7 @@ struct pxa3xx_u2d_ulpi { | |||
33 | struct clk *clk; | 33 | struct clk *clk; |
34 | void __iomem *mmio_base; | 34 | void __iomem *mmio_base; |
35 | 35 | ||
36 | struct otg_transceiver *otg; | 36 | struct usb_phy *otg; |
37 | unsigned int ulpi_mode; | 37 | unsigned int ulpi_mode; |
38 | }; | 38 | }; |
39 | 39 | ||
@@ -79,7 +79,7 @@ static int pxa310_ulpi_poll(void) | |||
79 | return -ETIMEDOUT; | 79 | return -ETIMEDOUT; |
80 | } | 80 | } |
81 | 81 | ||
82 | static int pxa310_ulpi_read(struct otg_transceiver *otg, u32 reg) | 82 | static int pxa310_ulpi_read(struct usb_phy *otg, u32 reg) |
83 | { | 83 | { |
84 | int err; | 84 | int err; |
85 | 85 | ||
@@ -98,7 +98,7 @@ static int pxa310_ulpi_read(struct otg_transceiver *otg, u32 reg) | |||
98 | return u2d_readl(U2DOTGUCR) & U2DOTGUCR_RDATA; | 98 | return u2d_readl(U2DOTGUCR) & U2DOTGUCR_RDATA; |
99 | } | 99 | } |
100 | 100 | ||
101 | static int pxa310_ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg) | 101 | static int pxa310_ulpi_write(struct usb_phy *otg, u32 val, u32 reg) |
102 | { | 102 | { |
103 | if (pxa310_ulpi_get_phymode() != SYNCH) { | 103 | if (pxa310_ulpi_get_phymode() != SYNCH) { |
104 | pr_warning("%s: PHY is not in SYNCH mode!\n", __func__); | 104 | pr_warning("%s: PHY is not in SYNCH mode!\n", __func__); |
@@ -111,7 +111,7 @@ static int pxa310_ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg) | |||
111 | return pxa310_ulpi_poll(); | 111 | return pxa310_ulpi_poll(); |
112 | } | 112 | } |
113 | 113 | ||
114 | struct otg_io_access_ops pxa310_ulpi_access_ops = { | 114 | struct usb_phy_io_ops pxa310_ulpi_access_ops = { |
115 | .read = pxa310_ulpi_read, | 115 | .read = pxa310_ulpi_read, |
116 | .write = pxa310_ulpi_write, | 116 | .write = pxa310_ulpi_write, |
117 | }; | 117 | }; |
@@ -139,19 +139,19 @@ static int pxa310_start_otg_host_transcvr(struct usb_bus *host) | |||
139 | 139 | ||
140 | pxa310_otg_transceiver_rtsm(); | 140 | pxa310_otg_transceiver_rtsm(); |
141 | 141 | ||
142 | err = otg_init(u2d->otg); | 142 | err = usb_phy_init(u2d->otg); |
143 | if (err) { | 143 | if (err) { |
144 | pr_err("OTG transceiver init failed"); | 144 | pr_err("OTG transceiver init failed"); |
145 | return err; | 145 | return err; |
146 | } | 146 | } |
147 | 147 | ||
148 | err = otg_set_vbus(u2d->otg, 1); | 148 | err = otg_set_vbus(u2d->otg->otg, 1); |
149 | if (err) { | 149 | if (err) { |
150 | pr_err("OTG transceiver VBUS set failed"); | 150 | pr_err("OTG transceiver VBUS set failed"); |
151 | return err; | 151 | return err; |
152 | } | 152 | } |
153 | 153 | ||
154 | err = otg_set_host(u2d->otg, host); | 154 | err = otg_set_host(u2d->otg->otg, host); |
155 | if (err) | 155 | if (err) |
156 | pr_err("OTG transceiver Host mode set failed"); | 156 | pr_err("OTG transceiver Host mode set failed"); |
157 | 157 | ||
@@ -189,9 +189,9 @@ static void pxa310_stop_otg_hc(void) | |||
189 | { | 189 | { |
190 | pxa310_otg_transceiver_rtsm(); | 190 | pxa310_otg_transceiver_rtsm(); |
191 | 191 | ||
192 | otg_set_host(u2d->otg, NULL); | 192 | otg_set_host(u2d->otg->otg, NULL); |
193 | otg_set_vbus(u2d->otg, 0); | 193 | otg_set_vbus(u2d->otg->otg, 0); |
194 | otg_shutdown(u2d->otg); | 194 | usb_phy_shutdown(u2d->otg); |
195 | } | 195 | } |
196 | 196 | ||
197 | static void pxa310_u2d_setup_otg_hc(void) | 197 | static void pxa310_u2d_setup_otg_hc(void) |
diff --git a/arch/arm/mach-tegra/include/mach/usb_phy.h b/arch/arm/mach-tegra/include/mach/usb_phy.h index d4b8f9e298a..de1a0f602b2 100644 --- a/arch/arm/mach-tegra/include/mach/usb_phy.h +++ b/arch/arm/mach-tegra/include/mach/usb_phy.h | |||
@@ -58,7 +58,7 @@ struct tegra_usb_phy { | |||
58 | struct clk *pad_clk; | 58 | struct clk *pad_clk; |
59 | enum tegra_usb_phy_mode mode; | 59 | enum tegra_usb_phy_mode mode; |
60 | void *config; | 60 | void *config; |
61 | struct otg_transceiver *ulpi; | 61 | struct usb_phy *ulpi; |
62 | }; | 62 | }; |
63 | 63 | ||
64 | struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs, | 64 | struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs, |
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c index 37576a721ae..ad321f9e2bb 100644 --- a/arch/arm/mach-tegra/usb_phy.c +++ b/arch/arm/mach-tegra/usb_phy.c | |||
@@ -608,13 +608,13 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy) | |||
608 | writel(val, base + ULPI_TIMING_CTRL_1); | 608 | writel(val, base + ULPI_TIMING_CTRL_1); |
609 | 609 | ||
610 | /* Fix VbusInvalid due to floating VBUS */ | 610 | /* Fix VbusInvalid due to floating VBUS */ |
611 | ret = otg_io_write(phy->ulpi, 0x40, 0x08); | 611 | ret = usb_phy_io_write(phy->ulpi, 0x40, 0x08); |
612 | if (ret) { | 612 | if (ret) { |
613 | pr_err("%s: ulpi write failed\n", __func__); | 613 | pr_err("%s: ulpi write failed\n", __func__); |
614 | return ret; | 614 | return ret; |
615 | } | 615 | } |
616 | 616 | ||
617 | ret = otg_io_write(phy->ulpi, 0x80, 0x0B); | 617 | ret = usb_phy_io_write(phy->ulpi, 0x80, 0x0B); |
618 | if (ret) { | 618 | if (ret) { |
619 | pr_err("%s: ulpi write failed\n", __func__); | 619 | pr_err("%s: ulpi write failed\n", __func__); |
620 | return ret; | 620 | return ret; |
diff --git a/arch/arm/plat-mxc/include/mach/mxc_ehci.h b/arch/arm/plat-mxc/include/mach/mxc_ehci.h index 2c159dc2398..9ffd1bbe615 100644 --- a/arch/arm/plat-mxc/include/mach/mxc_ehci.h +++ b/arch/arm/plat-mxc/include/mach/mxc_ehci.h | |||
@@ -44,7 +44,7 @@ struct mxc_usbh_platform_data { | |||
44 | int (*exit)(struct platform_device *pdev); | 44 | int (*exit)(struct platform_device *pdev); |
45 | 45 | ||
46 | unsigned int portsc; | 46 | unsigned int portsc; |
47 | struct otg_transceiver *otg; | 47 | struct usb_phy *otg; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | int mx51_initialize_usb_hw(int port, unsigned int flags); | 50 | int mx51_initialize_usb_hw(int port, unsigned int flags); |
diff --git a/arch/arm/plat-mxc/include/mach/ulpi.h b/arch/arm/plat-mxc/include/mach/ulpi.h index f9161c96d7b..42bdaca6d7d 100644 --- a/arch/arm/plat-mxc/include/mach/ulpi.h +++ b/arch/arm/plat-mxc/include/mach/ulpi.h | |||
@@ -2,15 +2,15 @@ | |||
2 | #define __MACH_ULPI_H | 2 | #define __MACH_ULPI_H |
3 | 3 | ||
4 | #ifdef CONFIG_USB_ULPI | 4 | #ifdef CONFIG_USB_ULPI |
5 | struct otg_transceiver *imx_otg_ulpi_create(unsigned int flags); | 5 | struct usb_phy *imx_otg_ulpi_create(unsigned int flags); |
6 | #else | 6 | #else |
7 | static inline struct otg_transceiver *imx_otg_ulpi_create(unsigned int flags) | 7 | static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags) |
8 | { | 8 | { |
9 | return NULL; | 9 | return NULL; |
10 | } | 10 | } |
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | extern struct otg_io_access_ops mxc_ulpi_access_ops; | 13 | extern struct usb_phy_io_ops mxc_ulpi_access_ops; |
14 | 14 | ||
15 | #endif /* __MACH_ULPI_H */ | 15 | #endif /* __MACH_ULPI_H */ |
16 | 16 | ||
diff --git a/arch/arm/plat-mxc/ulpi.c b/arch/arm/plat-mxc/ulpi.c index 477e45bea1b..d2963427184 100644 --- a/arch/arm/plat-mxc/ulpi.c +++ b/arch/arm/plat-mxc/ulpi.c | |||
@@ -58,7 +58,7 @@ static int ulpi_poll(void __iomem *view, u32 bit) | |||
58 | return -ETIMEDOUT; | 58 | return -ETIMEDOUT; |
59 | } | 59 | } |
60 | 60 | ||
61 | static int ulpi_read(struct otg_transceiver *otg, u32 reg) | 61 | static int ulpi_read(struct usb_phy *otg, u32 reg) |
62 | { | 62 | { |
63 | int ret; | 63 | int ret; |
64 | void __iomem *view = otg->io_priv; | 64 | void __iomem *view = otg->io_priv; |
@@ -84,7 +84,7 @@ static int ulpi_read(struct otg_transceiver *otg, u32 reg) | |||
84 | return (__raw_readl(view) >> ULPIVW_RDATA_SHIFT) & ULPIVW_RDATA_MASK; | 84 | return (__raw_readl(view) >> ULPIVW_RDATA_SHIFT) & ULPIVW_RDATA_MASK; |
85 | } | 85 | } |
86 | 86 | ||
87 | static int ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg) | 87 | static int ulpi_write(struct usb_phy *otg, u32 val, u32 reg) |
88 | { | 88 | { |
89 | int ret; | 89 | int ret; |
90 | void __iomem *view = otg->io_priv; | 90 | void __iomem *view = otg->io_priv; |
@@ -106,13 +106,13 @@ static int ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg) | |||
106 | return ulpi_poll(view, ULPIVW_RUN); | 106 | return ulpi_poll(view, ULPIVW_RUN); |
107 | } | 107 | } |
108 | 108 | ||
109 | struct otg_io_access_ops mxc_ulpi_access_ops = { | 109 | struct usb_phy_io_ops mxc_ulpi_access_ops = { |
110 | .read = ulpi_read, | 110 | .read = ulpi_read, |
111 | .write = ulpi_write, | 111 | .write = ulpi_write, |
112 | }; | 112 | }; |
113 | EXPORT_SYMBOL_GPL(mxc_ulpi_access_ops); | 113 | EXPORT_SYMBOL_GPL(mxc_ulpi_access_ops); |
114 | 114 | ||
115 | struct otg_transceiver *imx_otg_ulpi_create(unsigned int flags) | 115 | struct usb_phy *imx_otg_ulpi_create(unsigned int flags) |
116 | { | 116 | { |
117 | return otg_ulpi_create(&mxc_ulpi_access_ops, flags); | 117 | return otg_ulpi_create(&mxc_ulpi_access_ops, flags); |
118 | } | 118 | } |
diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c index b806667b59a..1289a5f790a 100644 --- a/drivers/power/isp1704_charger.c +++ b/drivers/power/isp1704_charger.c | |||
@@ -56,7 +56,7 @@ static u16 isp170x_id[] = { | |||
56 | struct isp1704_charger { | 56 | struct isp1704_charger { |
57 | struct device *dev; | 57 | struct device *dev; |
58 | struct power_supply psy; | 58 | struct power_supply psy; |
59 | struct otg_transceiver *otg; | 59 | struct usb_phy *phy; |
60 | struct notifier_block nb; | 60 | struct notifier_block nb; |
61 | struct work_struct work; | 61 | struct work_struct work; |
62 | 62 | ||
@@ -71,6 +71,16 @@ struct isp1704_charger { | |||
71 | unsigned max_power; | 71 | unsigned max_power; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static inline int isp1704_read(struct isp1704_charger *isp, u32 reg) | ||
75 | { | ||
76 | return usb_phy_io_read(isp->phy, reg); | ||
77 | } | ||
78 | |||
79 | static inline int isp1704_write(struct isp1704_charger *isp, u32 val, u32 reg) | ||
80 | { | ||
81 | return usb_phy_io_write(isp->phy, val, reg); | ||
82 | } | ||
83 | |||
74 | /* | 84 | /* |
75 | * Disable/enable the power from the isp1704 if a function for it | 85 | * Disable/enable the power from the isp1704 if a function for it |
76 | * has been provided with platform data. | 86 | * has been provided with platform data. |
@@ -97,31 +107,31 @@ static inline int isp1704_charger_type(struct isp1704_charger *isp) | |||
97 | u8 otg_ctrl; | 107 | u8 otg_ctrl; |
98 | int type = POWER_SUPPLY_TYPE_USB_DCP; | 108 | int type = POWER_SUPPLY_TYPE_USB_DCP; |
99 | 109 | ||
100 | func_ctrl = otg_io_read(isp->otg, ULPI_FUNC_CTRL); | 110 | func_ctrl = isp1704_read(isp, ULPI_FUNC_CTRL); |
101 | otg_ctrl = otg_io_read(isp->otg, ULPI_OTG_CTRL); | 111 | otg_ctrl = isp1704_read(isp, ULPI_OTG_CTRL); |
102 | 112 | ||
103 | /* disable pulldowns */ | 113 | /* disable pulldowns */ |
104 | reg = ULPI_OTG_CTRL_DM_PULLDOWN | ULPI_OTG_CTRL_DP_PULLDOWN; | 114 | reg = ULPI_OTG_CTRL_DM_PULLDOWN | ULPI_OTG_CTRL_DP_PULLDOWN; |
105 | otg_io_write(isp->otg, ULPI_CLR(ULPI_OTG_CTRL), reg); | 115 | isp1704_write(isp, ULPI_CLR(ULPI_OTG_CTRL), reg); |
106 | 116 | ||
107 | /* full speed */ | 117 | /* full speed */ |
108 | otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL), | 118 | isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL), |
109 | ULPI_FUNC_CTRL_XCVRSEL_MASK); | 119 | ULPI_FUNC_CTRL_XCVRSEL_MASK); |
110 | otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), | 120 | isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL), |
111 | ULPI_FUNC_CTRL_FULL_SPEED); | 121 | ULPI_FUNC_CTRL_FULL_SPEED); |
112 | 122 | ||
113 | /* Enable strong pull-up on DP (1.5K) and reset */ | 123 | /* Enable strong pull-up on DP (1.5K) and reset */ |
114 | reg = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET; | 124 | reg = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET; |
115 | otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), reg); | 125 | isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL), reg); |
116 | usleep_range(1000, 2000); | 126 | usleep_range(1000, 2000); |
117 | 127 | ||
118 | reg = otg_io_read(isp->otg, ULPI_DEBUG); | 128 | reg = isp1704_read(isp, ULPI_DEBUG); |
119 | if ((reg & 3) != 3) | 129 | if ((reg & 3) != 3) |
120 | type = POWER_SUPPLY_TYPE_USB_CDP; | 130 | type = POWER_SUPPLY_TYPE_USB_CDP; |
121 | 131 | ||
122 | /* recover original state */ | 132 | /* recover original state */ |
123 | otg_io_write(isp->otg, ULPI_FUNC_CTRL, func_ctrl); | 133 | isp1704_write(isp, ULPI_FUNC_CTRL, func_ctrl); |
124 | otg_io_write(isp->otg, ULPI_OTG_CTRL, otg_ctrl); | 134 | isp1704_write(isp, ULPI_OTG_CTRL, otg_ctrl); |
125 | 135 | ||
126 | return type; | 136 | return type; |
127 | } | 137 | } |
@@ -136,28 +146,28 @@ static inline int isp1704_charger_verify(struct isp1704_charger *isp) | |||
136 | u8 r; | 146 | u8 r; |
137 | 147 | ||
138 | /* Reset the transceiver */ | 148 | /* Reset the transceiver */ |
139 | r = otg_io_read(isp->otg, ULPI_FUNC_CTRL); | 149 | r = isp1704_read(isp, ULPI_FUNC_CTRL); |
140 | r |= ULPI_FUNC_CTRL_RESET; | 150 | r |= ULPI_FUNC_CTRL_RESET; |
141 | otg_io_write(isp->otg, ULPI_FUNC_CTRL, r); | 151 | isp1704_write(isp, ULPI_FUNC_CTRL, r); |
142 | usleep_range(1000, 2000); | 152 | usleep_range(1000, 2000); |
143 | 153 | ||
144 | /* Set normal mode */ | 154 | /* Set normal mode */ |
145 | r &= ~(ULPI_FUNC_CTRL_RESET | ULPI_FUNC_CTRL_OPMODE_MASK); | 155 | r &= ~(ULPI_FUNC_CTRL_RESET | ULPI_FUNC_CTRL_OPMODE_MASK); |
146 | otg_io_write(isp->otg, ULPI_FUNC_CTRL, r); | 156 | isp1704_write(isp, ULPI_FUNC_CTRL, r); |
147 | 157 | ||
148 | /* Clear the DP and DM pull-down bits */ | 158 | /* Clear the DP and DM pull-down bits */ |
149 | r = ULPI_OTG_CTRL_DP_PULLDOWN | ULPI_OTG_CTRL_DM_PULLDOWN; | 159 | r = ULPI_OTG_CTRL_DP_PULLDOWN | ULPI_OTG_CTRL_DM_PULLDOWN; |
150 | otg_io_write(isp->otg, ULPI_CLR(ULPI_OTG_CTRL), r); | 160 | isp1704_write(isp, ULPI_CLR(ULPI_OTG_CTRL), r); |
151 | 161 | ||
152 | /* Enable strong pull-up on DP (1.5K) and reset */ | 162 | /* Enable strong pull-up on DP (1.5K) and reset */ |
153 | r = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET; | 163 | r = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET; |
154 | otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), r); | 164 | isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL), r); |
155 | usleep_range(1000, 2000); | 165 | usleep_range(1000, 2000); |
156 | 166 | ||
157 | /* Read the line state */ | 167 | /* Read the line state */ |
158 | if (!otg_io_read(isp->otg, ULPI_DEBUG)) { | 168 | if (!isp1704_read(isp, ULPI_DEBUG)) { |
159 | /* Disable strong pull-up on DP (1.5K) */ | 169 | /* Disable strong pull-up on DP (1.5K) */ |
160 | otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL), | 170 | isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL), |
161 | ULPI_FUNC_CTRL_TERMSELECT); | 171 | ULPI_FUNC_CTRL_TERMSELECT); |
162 | return 1; | 172 | return 1; |
163 | } | 173 | } |
@@ -165,23 +175,23 @@ static inline int isp1704_charger_verify(struct isp1704_charger *isp) | |||
165 | /* Is it a charger or PS/2 connection */ | 175 | /* Is it a charger or PS/2 connection */ |
166 | 176 | ||
167 | /* Enable weak pull-up resistor on DP */ | 177 | /* Enable weak pull-up resistor on DP */ |
168 | otg_io_write(isp->otg, ULPI_SET(ISP1704_PWR_CTRL), | 178 | isp1704_write(isp, ULPI_SET(ISP1704_PWR_CTRL), |
169 | ISP1704_PWR_CTRL_DP_WKPU_EN); | 179 | ISP1704_PWR_CTRL_DP_WKPU_EN); |
170 | 180 | ||
171 | /* Disable strong pull-up on DP (1.5K) */ | 181 | /* Disable strong pull-up on DP (1.5K) */ |
172 | otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL), | 182 | isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL), |
173 | ULPI_FUNC_CTRL_TERMSELECT); | 183 | ULPI_FUNC_CTRL_TERMSELECT); |
174 | 184 | ||
175 | /* Enable weak pull-down resistor on DM */ | 185 | /* Enable weak pull-down resistor on DM */ |
176 | otg_io_write(isp->otg, ULPI_SET(ULPI_OTG_CTRL), | 186 | isp1704_write(isp, ULPI_SET(ULPI_OTG_CTRL), |
177 | ULPI_OTG_CTRL_DM_PULLDOWN); | 187 | ULPI_OTG_CTRL_DM_PULLDOWN); |
178 | 188 | ||
179 | /* It's a charger if the line states are clear */ | 189 | /* It's a charger if the line states are clear */ |
180 | if (!(otg_io_read(isp->otg, ULPI_DEBUG))) | 190 | if (!(isp1704_read(isp, ULPI_DEBUG))) |
181 | ret = 1; | 191 | ret = 1; |
182 | 192 | ||
183 | /* Disable weak pull-up resistor on DP */ | 193 | /* Disable weak pull-up resistor on DP */ |
184 | otg_io_write(isp->otg, ULPI_CLR(ISP1704_PWR_CTRL), | 194 | isp1704_write(isp, ULPI_CLR(ISP1704_PWR_CTRL), |
185 | ISP1704_PWR_CTRL_DP_WKPU_EN); | 195 | ISP1704_PWR_CTRL_DP_WKPU_EN); |
186 | 196 | ||
187 | return ret; | 197 | return ret; |
@@ -193,14 +203,14 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp) | |||
193 | u8 pwr_ctrl; | 203 | u8 pwr_ctrl; |
194 | int ret = 0; | 204 | int ret = 0; |
195 | 205 | ||
196 | pwr_ctrl = otg_io_read(isp->otg, ISP1704_PWR_CTRL); | 206 | pwr_ctrl = isp1704_read(isp, ISP1704_PWR_CTRL); |
197 | 207 | ||
198 | /* set SW control bit in PWR_CTRL register */ | 208 | /* set SW control bit in PWR_CTRL register */ |
199 | otg_io_write(isp->otg, ISP1704_PWR_CTRL, | 209 | isp1704_write(isp, ISP1704_PWR_CTRL, |
200 | ISP1704_PWR_CTRL_SWCTRL); | 210 | ISP1704_PWR_CTRL_SWCTRL); |
201 | 211 | ||
202 | /* enable manual charger detection */ | 212 | /* enable manual charger detection */ |
203 | otg_io_write(isp->otg, ULPI_SET(ISP1704_PWR_CTRL), | 213 | isp1704_write(isp, ULPI_SET(ISP1704_PWR_CTRL), |
204 | ISP1704_PWR_CTRL_SWCTRL | 214 | ISP1704_PWR_CTRL_SWCTRL |
205 | | ISP1704_PWR_CTRL_DPVSRC_EN); | 215 | | ISP1704_PWR_CTRL_DPVSRC_EN); |
206 | usleep_range(1000, 2000); | 216 | usleep_range(1000, 2000); |
@@ -208,7 +218,7 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp) | |||
208 | timeout = jiffies + msecs_to_jiffies(300); | 218 | timeout = jiffies + msecs_to_jiffies(300); |
209 | do { | 219 | do { |
210 | /* Check if there is a charger */ | 220 | /* Check if there is a charger */ |
211 | if (otg_io_read(isp->otg, ISP1704_PWR_CTRL) | 221 | if (isp1704_read(isp, ISP1704_PWR_CTRL) |
212 | & ISP1704_PWR_CTRL_VDAT_DET) { | 222 | & ISP1704_PWR_CTRL_VDAT_DET) { |
213 | ret = isp1704_charger_verify(isp); | 223 | ret = isp1704_charger_verify(isp); |
214 | break; | 224 | break; |
@@ -216,7 +226,7 @@ static inline int isp1704_charger_detect(struct isp1704_charger *isp) | |||
216 | } while (!time_after(jiffies, timeout) && isp->online); | 226 | } while (!time_after(jiffies, timeout) && isp->online); |
217 | 227 | ||
218 | /* recover original state */ | 228 | /* recover original state */ |
219 | otg_io_write(isp->otg, ISP1704_PWR_CTRL, pwr_ctrl); | 229 | isp1704_write(isp, ISP1704_PWR_CTRL, pwr_ctrl); |
220 | 230 | ||
221 | return ret; | 231 | return ret; |
222 | } | 232 | } |
@@ -264,8 +274,8 @@ static void isp1704_charger_work(struct work_struct *data) | |||
264 | case POWER_SUPPLY_TYPE_USB: | 274 | case POWER_SUPPLY_TYPE_USB: |
265 | default: | 275 | default: |
266 | /* enable data pullups */ | 276 | /* enable data pullups */ |
267 | if (isp->otg->gadget) | 277 | if (isp->phy->otg->gadget) |
268 | usb_gadget_connect(isp->otg->gadget); | 278 | usb_gadget_connect(isp->phy->otg->gadget); |
269 | } | 279 | } |
270 | break; | 280 | break; |
271 | case USB_EVENT_NONE: | 281 | case USB_EVENT_NONE: |
@@ -283,8 +293,8 @@ static void isp1704_charger_work(struct work_struct *data) | |||
283 | * chargers. The pullups may be enabled elsewhere, so this can | 293 | * chargers. The pullups may be enabled elsewhere, so this can |
284 | * not be the final solution. | 294 | * not be the final solution. |
285 | */ | 295 | */ |
286 | if (isp->otg->gadget) | 296 | if (isp->phy->otg->gadget) |
287 | usb_gadget_disconnect(isp->otg->gadget); | 297 | usb_gadget_disconnect(isp->phy->otg->gadget); |
288 | 298 | ||
289 | isp1704_charger_set_power(isp, 0); | 299 | isp1704_charger_set_power(isp, 0); |
290 | break; | 300 | break; |
@@ -364,11 +374,11 @@ static inline int isp1704_test_ulpi(struct isp1704_charger *isp) | |||
364 | int ret = -ENODEV; | 374 | int ret = -ENODEV; |
365 | 375 | ||
366 | /* Test ULPI interface */ | 376 | /* Test ULPI interface */ |
367 | ret = otg_io_write(isp->otg, ULPI_SCRATCH, 0xaa); | 377 | ret = isp1704_write(isp, ULPI_SCRATCH, 0xaa); |
368 | if (ret < 0) | 378 | if (ret < 0) |
369 | return ret; | 379 | return ret; |
370 | 380 | ||
371 | ret = otg_io_read(isp->otg, ULPI_SCRATCH); | 381 | ret = isp1704_read(isp, ULPI_SCRATCH); |
372 | if (ret < 0) | 382 | if (ret < 0) |
373 | return ret; | 383 | return ret; |
374 | 384 | ||
@@ -376,13 +386,13 @@ static inline int isp1704_test_ulpi(struct isp1704_charger *isp) | |||
376 | return -ENODEV; | 386 | return -ENODEV; |
377 | 387 | ||
378 | /* Verify the product and vendor id matches */ | 388 | /* Verify the product and vendor id matches */ |
379 | vendor = otg_io_read(isp->otg, ULPI_VENDOR_ID_LOW); | 389 | vendor = isp1704_read(isp, ULPI_VENDOR_ID_LOW); |
380 | vendor |= otg_io_read(isp->otg, ULPI_VENDOR_ID_HIGH) << 8; | 390 | vendor |= isp1704_read(isp, ULPI_VENDOR_ID_HIGH) << 8; |
381 | if (vendor != NXP_VENDOR_ID) | 391 | if (vendor != NXP_VENDOR_ID) |
382 | return -ENODEV; | 392 | return -ENODEV; |
383 | 393 | ||
384 | product = otg_io_read(isp->otg, ULPI_PRODUCT_ID_LOW); | 394 | product = isp1704_read(isp, ULPI_PRODUCT_ID_LOW); |
385 | product |= otg_io_read(isp->otg, ULPI_PRODUCT_ID_HIGH) << 8; | 395 | product |= isp1704_read(isp, ULPI_PRODUCT_ID_HIGH) << 8; |
386 | 396 | ||
387 | for (i = 0; i < ARRAY_SIZE(isp170x_id); i++) { | 397 | for (i = 0; i < ARRAY_SIZE(isp170x_id); i++) { |
388 | if (product == isp170x_id[i]) { | 398 | if (product == isp170x_id[i]) { |
@@ -405,8 +415,8 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev) | |||
405 | if (!isp) | 415 | if (!isp) |
406 | return -ENOMEM; | 416 | return -ENOMEM; |
407 | 417 | ||
408 | isp->otg = otg_get_transceiver(); | 418 | isp->phy = usb_get_transceiver(); |
409 | if (!isp->otg) | 419 | if (!isp->phy) |
410 | goto fail0; | 420 | goto fail0; |
411 | 421 | ||
412 | isp->dev = &pdev->dev; | 422 | isp->dev = &pdev->dev; |
@@ -429,14 +439,14 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev) | |||
429 | goto fail1; | 439 | goto fail1; |
430 | 440 | ||
431 | /* | 441 | /* |
432 | * REVISIT: using work in order to allow the otg notifications to be | 442 | * REVISIT: using work in order to allow the usb notifications to be |
433 | * made atomically in the future. | 443 | * made atomically in the future. |
434 | */ | 444 | */ |
435 | INIT_WORK(&isp->work, isp1704_charger_work); | 445 | INIT_WORK(&isp->work, isp1704_charger_work); |
436 | 446 | ||
437 | isp->nb.notifier_call = isp1704_notifier_call; | 447 | isp->nb.notifier_call = isp1704_notifier_call; |
438 | 448 | ||
439 | ret = otg_register_notifier(isp->otg, &isp->nb); | 449 | ret = usb_register_notifier(isp->phy, &isp->nb); |
440 | if (ret) | 450 | if (ret) |
441 | goto fail2; | 451 | goto fail2; |
442 | 452 | ||
@@ -449,13 +459,13 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev) | |||
449 | * enumerated. The charger driver should be always loaded before any | 459 | * enumerated. The charger driver should be always loaded before any |
450 | * gadget is loaded. | 460 | * gadget is loaded. |
451 | */ | 461 | */ |
452 | if (isp->otg->gadget) | 462 | if (isp->phy->otg->gadget) |
453 | usb_gadget_disconnect(isp->otg->gadget); | 463 | usb_gadget_disconnect(isp->phy->otg->gadget); |
454 | 464 | ||
455 | /* Detect charger if VBUS is valid (the cable was already plugged). */ | 465 | /* Detect charger if VBUS is valid (the cable was already plugged). */ |
456 | ret = otg_io_read(isp->otg, ULPI_USB_INT_STS); | 466 | ret = isp1704_read(isp, ULPI_USB_INT_STS); |
457 | isp1704_charger_set_power(isp, 0); | 467 | isp1704_charger_set_power(isp, 0); |
458 | if ((ret & ULPI_INT_VBUS_VALID) && !isp->otg->default_a) { | 468 | if ((ret & ULPI_INT_VBUS_VALID) && !isp->phy->otg->default_a) { |
459 | isp->event = USB_EVENT_VBUS; | 469 | isp->event = USB_EVENT_VBUS; |
460 | schedule_work(&isp->work); | 470 | schedule_work(&isp->work); |
461 | } | 471 | } |
@@ -464,7 +474,7 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev) | |||
464 | fail2: | 474 | fail2: |
465 | power_supply_unregister(&isp->psy); | 475 | power_supply_unregister(&isp->psy); |
466 | fail1: | 476 | fail1: |
467 | otg_put_transceiver(isp->otg); | 477 | usb_put_transceiver(isp->phy); |
468 | fail0: | 478 | fail0: |
469 | kfree(isp); | 479 | kfree(isp); |
470 | 480 | ||
@@ -477,9 +487,9 @@ static int __devexit isp1704_charger_remove(struct platform_device *pdev) | |||
477 | { | 487 | { |
478 | struct isp1704_charger *isp = platform_get_drvdata(pdev); | 488 | struct isp1704_charger *isp = platform_get_drvdata(pdev); |
479 | 489 | ||
480 | otg_unregister_notifier(isp->otg, &isp->nb); | 490 | usb_unregister_notifier(isp->phy, &isp->nb); |
481 | power_supply_unregister(&isp->psy); | 491 | power_supply_unregister(&isp->psy); |
482 | otg_put_transceiver(isp->otg); | 492 | usb_put_transceiver(isp->phy); |
483 | isp1704_charger_set_power(isp, 0); | 493 | isp1704_charger_set_power(isp, 0); |
484 | kfree(isp); | 494 | kfree(isp); |
485 | 495 | ||
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c index fd49689738a..214468f4444 100644 --- a/drivers/power/pda_power.c +++ b/drivers/power/pda_power.c | |||
@@ -40,7 +40,7 @@ static struct timer_list polling_timer; | |||
40 | static int polling; | 40 | static int polling; |
41 | 41 | ||
42 | #ifdef CONFIG_USB_OTG_UTILS | 42 | #ifdef CONFIG_USB_OTG_UTILS |
43 | static struct otg_transceiver *transceiver; | 43 | static struct usb_phy *transceiver; |
44 | static struct notifier_block otg_nb; | 44 | static struct notifier_block otg_nb; |
45 | #endif | 45 | #endif |
46 | 46 | ||
@@ -321,7 +321,7 @@ static int pda_power_probe(struct platform_device *pdev) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | #ifdef CONFIG_USB_OTG_UTILS | 323 | #ifdef CONFIG_USB_OTG_UTILS |
324 | transceiver = otg_get_transceiver(); | 324 | transceiver = usb_get_transceiver(); |
325 | if (transceiver && !pdata->is_usb_online) { | 325 | if (transceiver && !pdata->is_usb_online) { |
326 | pdata->is_usb_online = otg_is_usb_online; | 326 | pdata->is_usb_online = otg_is_usb_online; |
327 | } | 327 | } |
@@ -375,7 +375,7 @@ static int pda_power_probe(struct platform_device *pdev) | |||
375 | #ifdef CONFIG_USB_OTG_UTILS | 375 | #ifdef CONFIG_USB_OTG_UTILS |
376 | if (transceiver && pdata->use_otg_notifier) { | 376 | if (transceiver && pdata->use_otg_notifier) { |
377 | otg_nb.notifier_call = otg_handle_notification; | 377 | otg_nb.notifier_call = otg_handle_notification; |
378 | ret = otg_register_notifier(transceiver, &otg_nb); | 378 | ret = usb_register_notifier(transceiver, &otg_nb); |
379 | if (ret) { | 379 | if (ret) { |
380 | dev_err(dev, "failure to register otg notifier\n"); | 380 | dev_err(dev, "failure to register otg notifier\n"); |
381 | goto otg_reg_notifier_failed; | 381 | goto otg_reg_notifier_failed; |
@@ -409,7 +409,7 @@ usb_supply_failed: | |||
409 | free_irq(ac_irq->start, &pda_psy_ac); | 409 | free_irq(ac_irq->start, &pda_psy_ac); |
410 | #ifdef CONFIG_USB_OTG_UTILS | 410 | #ifdef CONFIG_USB_OTG_UTILS |
411 | if (transceiver) | 411 | if (transceiver) |
412 | otg_put_transceiver(transceiver); | 412 | usb_put_transceiver(transceiver); |
413 | #endif | 413 | #endif |
414 | ac_irq_failed: | 414 | ac_irq_failed: |
415 | if (pdata->is_ac_online) | 415 | if (pdata->is_ac_online) |
@@ -444,7 +444,7 @@ static int pda_power_remove(struct platform_device *pdev) | |||
444 | power_supply_unregister(&pda_psy_ac); | 444 | power_supply_unregister(&pda_psy_ac); |
445 | #ifdef CONFIG_USB_OTG_UTILS | 445 | #ifdef CONFIG_USB_OTG_UTILS |
446 | if (transceiver) | 446 | if (transceiver) |
447 | otg_put_transceiver(transceiver); | 447 | usb_put_transceiver(transceiver); |
448 | #endif | 448 | #endif |
449 | if (ac_draw) { | 449 | if (ac_draw) { |
450 | regulator_put(ac_draw); | 450 | regulator_put(ac_draw); |
diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c index 54b9198fa57..fdad850c77d 100644 --- a/drivers/power/twl4030_charger.c +++ b/drivers/power/twl4030_charger.c | |||
@@ -69,8 +69,8 @@ struct twl4030_bci { | |||
69 | struct device *dev; | 69 | struct device *dev; |
70 | struct power_supply ac; | 70 | struct power_supply ac; |
71 | struct power_supply usb; | 71 | struct power_supply usb; |
72 | struct otg_transceiver *transceiver; | 72 | struct usb_phy *transceiver; |
73 | struct notifier_block otg_nb; | 73 | struct notifier_block usb_nb; |
74 | struct work_struct work; | 74 | struct work_struct work; |
75 | int irq_chg; | 75 | int irq_chg; |
76 | int irq_bci; | 76 | int irq_bci; |
@@ -279,7 +279,7 @@ static void twl4030_bci_usb_work(struct work_struct *data) | |||
279 | static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val, | 279 | static int twl4030_bci_usb_ncb(struct notifier_block *nb, unsigned long val, |
280 | void *priv) | 280 | void *priv) |
281 | { | 281 | { |
282 | struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, otg_nb); | 282 | struct twl4030_bci *bci = container_of(nb, struct twl4030_bci, usb_nb); |
283 | 283 | ||
284 | dev_dbg(bci->dev, "OTG notify %lu\n", val); | 284 | dev_dbg(bci->dev, "OTG notify %lu\n", val); |
285 | 285 | ||
@@ -479,10 +479,10 @@ static int __init twl4030_bci_probe(struct platform_device *pdev) | |||
479 | 479 | ||
480 | INIT_WORK(&bci->work, twl4030_bci_usb_work); | 480 | INIT_WORK(&bci->work, twl4030_bci_usb_work); |
481 | 481 | ||
482 | bci->transceiver = otg_get_transceiver(); | 482 | bci->transceiver = usb_get_transceiver(); |
483 | if (bci->transceiver != NULL) { | 483 | if (bci->transceiver != NULL) { |
484 | bci->otg_nb.notifier_call = twl4030_bci_usb_ncb; | 484 | bci->usb_nb.notifier_call = twl4030_bci_usb_ncb; |
485 | otg_register_notifier(bci->transceiver, &bci->otg_nb); | 485 | usb_register_notifier(bci->transceiver, &bci->usb_nb); |
486 | } | 486 | } |
487 | 487 | ||
488 | /* Enable interrupts now. */ | 488 | /* Enable interrupts now. */ |
@@ -508,8 +508,8 @@ static int __init twl4030_bci_probe(struct platform_device *pdev) | |||
508 | 508 | ||
509 | fail_unmask_interrupts: | 509 | fail_unmask_interrupts: |
510 | if (bci->transceiver != NULL) { | 510 | if (bci->transceiver != NULL) { |
511 | otg_unregister_notifier(bci->transceiver, &bci->otg_nb); | 511 | usb_unregister_notifier(bci->transceiver, &bci->usb_nb); |
512 | otg_put_transceiver(bci->transceiver); | 512 | usb_put_transceiver(bci->transceiver); |
513 | } | 513 | } |
514 | free_irq(bci->irq_bci, bci); | 514 | free_irq(bci->irq_bci, bci); |
515 | fail_bci_irq: | 515 | fail_bci_irq: |
@@ -539,8 +539,8 @@ static int __exit twl4030_bci_remove(struct platform_device *pdev) | |||
539 | TWL4030_INTERRUPTS_BCIIMR2A); | 539 | TWL4030_INTERRUPTS_BCIIMR2A); |
540 | 540 | ||
541 | if (bci->transceiver != NULL) { | 541 | if (bci->transceiver != NULL) { |
542 | otg_unregister_notifier(bci->transceiver, &bci->otg_nb); | 542 | usb_unregister_notifier(bci->transceiver, &bci->usb_nb); |
543 | otg_put_transceiver(bci->transceiver); | 543 | usb_put_transceiver(bci->transceiver); |
544 | } | 544 | } |
545 | free_irq(bci->irq_bci, bci); | 545 | free_irq(bci->irq_bci, bci); |
546 | free_irq(bci->irq_chg, bci); | 546 | free_irq(bci->irq_chg, bci); |
diff --git a/drivers/usb/gadget/ci13xxx_msm.c b/drivers/usb/gadget/ci13xxx_msm.c index 1fc612914c5..d07e44c05e9 100644 --- a/drivers/usb/gadget/ci13xxx_msm.c +++ b/drivers/usb/gadget/ci13xxx_msm.c | |||
@@ -37,10 +37,10 @@ static void ci13xxx_msm_notify_event(struct ci13xxx *udc, unsigned event) | |||
37 | * Put the transceiver in non-driving mode. Otherwise host | 37 | * Put the transceiver in non-driving mode. Otherwise host |
38 | * may not detect soft-disconnection. | 38 | * may not detect soft-disconnection. |
39 | */ | 39 | */ |
40 | val = otg_io_read(udc->transceiver, ULPI_FUNC_CTRL); | 40 | val = usb_phy_io_read(udc->transceiver, ULPI_FUNC_CTRL); |
41 | val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; | 41 | val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; |
42 | val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; | 42 | val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; |
43 | otg_io_write(udc->transceiver, val, ULPI_FUNC_CTRL); | 43 | usb_phy_io_write(udc->transceiver, val, ULPI_FUNC_CTRL); |
44 | break; | 44 | break; |
45 | default: | 45 | default: |
46 | dev_dbg(dev, "unknown ci13xxx_udc event\n"); | 46 | dev_dbg(dev, "unknown ci13xxx_udc event\n"); |
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 27e31371842..b27cb0b0077 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c | |||
@@ -2537,7 +2537,7 @@ static int ci13xxx_vbus_draw(struct usb_gadget *_gadget, unsigned mA) | |||
2537 | struct ci13xxx *udc = container_of(_gadget, struct ci13xxx, gadget); | 2537 | struct ci13xxx *udc = container_of(_gadget, struct ci13xxx, gadget); |
2538 | 2538 | ||
2539 | if (udc->transceiver) | 2539 | if (udc->transceiver) |
2540 | return otg_set_power(udc->transceiver, mA); | 2540 | return usb_phy_set_power(udc->transceiver, mA); |
2541 | return -ENOTSUPP; | 2541 | return -ENOTSUPP; |
2542 | } | 2542 | } |
2543 | 2543 | ||
@@ -2900,7 +2900,7 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev, | |||
2900 | if (retval < 0) | 2900 | if (retval < 0) |
2901 | goto free_udc; | 2901 | goto free_udc; |
2902 | 2902 | ||
2903 | udc->transceiver = otg_get_transceiver(); | 2903 | udc->transceiver = usb_get_transceiver(); |
2904 | 2904 | ||
2905 | if (udc->udc_driver->flags & CI13XXX_REQUIRE_TRANSCEIVER) { | 2905 | if (udc->udc_driver->flags & CI13XXX_REQUIRE_TRANSCEIVER) { |
2906 | if (udc->transceiver == NULL) { | 2906 | if (udc->transceiver == NULL) { |
@@ -2928,7 +2928,8 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev, | |||
2928 | goto unreg_device; | 2928 | goto unreg_device; |
2929 | 2929 | ||
2930 | if (udc->transceiver) { | 2930 | if (udc->transceiver) { |
2931 | retval = otg_set_peripheral(udc->transceiver, &udc->gadget); | 2931 | retval = otg_set_peripheral(udc->transceiver->otg, |
2932 | &udc->gadget); | ||
2932 | if (retval) | 2933 | if (retval) |
2933 | goto remove_dbg; | 2934 | goto remove_dbg; |
2934 | } | 2935 | } |
@@ -2945,8 +2946,8 @@ static int udc_probe(struct ci13xxx_udc_driver *driver, struct device *dev, | |||
2945 | 2946 | ||
2946 | remove_trans: | 2947 | remove_trans: |
2947 | if (udc->transceiver) { | 2948 | if (udc->transceiver) { |
2948 | otg_set_peripheral(udc->transceiver, &udc->gadget); | 2949 | otg_set_peripheral(udc->transceiver->otg, &udc->gadget); |
2949 | otg_put_transceiver(udc->transceiver); | 2950 | usb_put_transceiver(udc->transceiver); |
2950 | } | 2951 | } |
2951 | 2952 | ||
2952 | err("error = %i", retval); | 2953 | err("error = %i", retval); |
@@ -2958,7 +2959,7 @@ unreg_device: | |||
2958 | device_unregister(&udc->gadget.dev); | 2959 | device_unregister(&udc->gadget.dev); |
2959 | put_transceiver: | 2960 | put_transceiver: |
2960 | if (udc->transceiver) | 2961 | if (udc->transceiver) |
2961 | otg_put_transceiver(udc->transceiver); | 2962 | usb_put_transceiver(udc->transceiver); |
2962 | free_udc: | 2963 | free_udc: |
2963 | kfree(udc); | 2964 | kfree(udc); |
2964 | _udc = NULL; | 2965 | _udc = NULL; |
@@ -2981,8 +2982,8 @@ static void udc_remove(void) | |||
2981 | usb_del_gadget_udc(&udc->gadget); | 2982 | usb_del_gadget_udc(&udc->gadget); |
2982 | 2983 | ||
2983 | if (udc->transceiver) { | 2984 | if (udc->transceiver) { |
2984 | otg_set_peripheral(udc->transceiver, &udc->gadget); | 2985 | otg_set_peripheral(udc->transceiver->otg, &udc->gadget); |
2985 | otg_put_transceiver(udc->transceiver); | 2986 | usb_put_transceiver(udc->transceiver); |
2986 | } | 2987 | } |
2987 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES | 2988 | #ifdef CONFIG_USB_GADGET_DEBUG_FILES |
2988 | dbg_remove_files(&udc->gadget.dev); | 2989 | dbg_remove_files(&udc->gadget.dev); |
diff --git a/drivers/usb/gadget/ci13xxx_udc.h b/drivers/usb/gadget/ci13xxx_udc.h index f4871e1fac5..0d31af56c98 100644 --- a/drivers/usb/gadget/ci13xxx_udc.h +++ b/drivers/usb/gadget/ci13xxx_udc.h | |||
@@ -136,7 +136,7 @@ struct ci13xxx { | |||
136 | struct usb_gadget_driver *driver; /* 3rd party gadget driver */ | 136 | struct usb_gadget_driver *driver; /* 3rd party gadget driver */ |
137 | struct ci13xxx_udc_driver *udc_driver; /* device controller driver */ | 137 | struct ci13xxx_udc_driver *udc_driver; /* device controller driver */ |
138 | int vbus_active; /* is VBUS active */ | 138 | int vbus_active; /* is VBUS active */ |
139 | struct otg_transceiver *transceiver; /* Transceiver struct */ | 139 | struct usb_phy *transceiver; /* Transceiver struct */ |
140 | }; | 140 | }; |
141 | 141 | ||
142 | /****************************************************************************** | 142 | /****************************************************************************** |
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index b04712f19f1..1e8c0c425fa 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c | |||
@@ -1217,7 +1217,7 @@ static int fsl_vbus_draw(struct usb_gadget *gadget, unsigned mA) | |||
1217 | 1217 | ||
1218 | udc = container_of(gadget, struct fsl_udc, gadget); | 1218 | udc = container_of(gadget, struct fsl_udc, gadget); |
1219 | if (udc->transceiver) | 1219 | if (udc->transceiver) |
1220 | return otg_set_power(udc->transceiver, mA); | 1220 | return usb_phy_set_power(udc->transceiver, mA); |
1221 | return -ENOTSUPP; | 1221 | return -ENOTSUPP; |
1222 | } | 1222 | } |
1223 | 1223 | ||
@@ -1966,7 +1966,8 @@ static int fsl_start(struct usb_gadget_driver *driver, | |||
1966 | 1966 | ||
1967 | /* connect to bus through transceiver */ | 1967 | /* connect to bus through transceiver */ |
1968 | if (udc_controller->transceiver) { | 1968 | if (udc_controller->transceiver) { |
1969 | retval = otg_set_peripheral(udc_controller->transceiver, | 1969 | retval = otg_set_peripheral( |
1970 | udc_controller->transceiver->otg, | ||
1970 | &udc_controller->gadget); | 1971 | &udc_controller->gadget); |
1971 | if (retval < 0) { | 1972 | if (retval < 0) { |
1972 | ERR("can't bind to transceiver\n"); | 1973 | ERR("can't bind to transceiver\n"); |
@@ -2006,7 +2007,7 @@ static int fsl_stop(struct usb_gadget_driver *driver) | |||
2006 | return -EINVAL; | 2007 | return -EINVAL; |
2007 | 2008 | ||
2008 | if (udc_controller->transceiver) | 2009 | if (udc_controller->transceiver) |
2009 | otg_set_peripheral(udc_controller->transceiver, NULL); | 2010 | otg_set_peripheral(udc_controller->transceiver->otg, NULL); |
2010 | 2011 | ||
2011 | /* stop DR, disable intr */ | 2012 | /* stop DR, disable intr */ |
2012 | dr_controller_stop(udc_controller); | 2013 | dr_controller_stop(udc_controller); |
@@ -2430,7 +2431,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev) | |||
2430 | 2431 | ||
2431 | #ifdef CONFIG_USB_OTG | 2432 | #ifdef CONFIG_USB_OTG |
2432 | if (pdata->operating_mode == FSL_USB2_DR_OTG) { | 2433 | if (pdata->operating_mode == FSL_USB2_DR_OTG) { |
2433 | udc_controller->transceiver = otg_get_transceiver(); | 2434 | udc_controller->transceiver = usb_get_transceiver(); |
2434 | if (!udc_controller->transceiver) { | 2435 | if (!udc_controller->transceiver) { |
2435 | ERR("Can't find OTG driver!\n"); | 2436 | ERR("Can't find OTG driver!\n"); |
2436 | ret = -ENODEV; | 2437 | ret = -ENODEV; |
diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h index f781f5dec41..e651469fd39 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.h +++ b/drivers/usb/gadget/fsl_usb2_udc.h | |||
@@ -471,7 +471,7 @@ struct fsl_udc { | |||
471 | 471 | ||
472 | struct usb_ctrlrequest local_setup_buff; | 472 | struct usb_ctrlrequest local_setup_buff; |
473 | spinlock_t lock; | 473 | spinlock_t lock; |
474 | struct otg_transceiver *transceiver; | 474 | struct usb_phy *transceiver; |
475 | unsigned softconnect:1; | 475 | unsigned softconnect:1; |
476 | unsigned vbus_active:1; | 476 | unsigned vbus_active:1; |
477 | unsigned stopped:1; | 477 | unsigned stopped:1; |
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c index e2293c1588e..42a88b680f2 100644 --- a/drivers/usb/gadget/langwell_udc.c +++ b/drivers/usb/gadget/langwell_udc.c | |||
@@ -1261,9 +1261,9 @@ static int langwell_vbus_draw(struct usb_gadget *_gadget, unsigned mA) | |||
1261 | dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__); | 1261 | dev_vdbg(&dev->pdev->dev, "---> %s()\n", __func__); |
1262 | 1262 | ||
1263 | if (dev->transceiver) { | 1263 | if (dev->transceiver) { |
1264 | dev_vdbg(&dev->pdev->dev, "otg_set_power\n"); | 1264 | dev_vdbg(&dev->pdev->dev, "usb_phy_set_power\n"); |
1265 | dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__); | 1265 | dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__); |
1266 | return otg_set_power(dev->transceiver, mA); | 1266 | return usb_phy_set_power(dev->transceiver, mA); |
1267 | } | 1267 | } |
1268 | 1268 | ||
1269 | dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__); | 1269 | dev_vdbg(&dev->pdev->dev, "<--- %s()\n", __func__); |
@@ -1906,7 +1906,7 @@ static int langwell_stop(struct usb_gadget *g, | |||
1906 | 1906 | ||
1907 | /* unbind OTG transceiver */ | 1907 | /* unbind OTG transceiver */ |
1908 | if (dev->transceiver) | 1908 | if (dev->transceiver) |
1909 | (void)otg_set_peripheral(dev->transceiver, 0); | 1909 | (void)otg_set_peripheral(dev->transceiver->otg, 0); |
1910 | 1910 | ||
1911 | /* disable interrupt and set controller to stop state */ | 1911 | /* disable interrupt and set controller to stop state */ |
1912 | langwell_udc_stop(dev); | 1912 | langwell_udc_stop(dev); |
diff --git a/drivers/usb/gadget/langwell_udc.h b/drivers/usb/gadget/langwell_udc.h index d6e78accaff..8c8087abb48 100644 --- a/drivers/usb/gadget/langwell_udc.h +++ b/drivers/usb/gadget/langwell_udc.h | |||
@@ -162,7 +162,7 @@ struct langwell_udc { | |||
162 | spinlock_t lock; /* device lock */ | 162 | spinlock_t lock; /* device lock */ |
163 | struct langwell_ep *ep; | 163 | struct langwell_ep *ep; |
164 | struct usb_gadget_driver *driver; | 164 | struct usb_gadget_driver *driver; |
165 | struct otg_transceiver *transceiver; | 165 | struct usb_phy *transceiver; |
166 | u8 dev_addr; | 166 | u8 dev_addr; |
167 | u32 usb_state; | 167 | u32 usb_state; |
168 | u32 resume_state; | 168 | u32 resume_state; |
diff --git a/drivers/usb/gadget/mv_udc.h b/drivers/usb/gadget/mv_udc.h index 34aadfae723..e2be9519abb 100644 --- a/drivers/usb/gadget/mv_udc.h +++ b/drivers/usb/gadget/mv_udc.h | |||
@@ -217,7 +217,7 @@ struct mv_udc { | |||
217 | struct work_struct vbus_work; | 217 | struct work_struct vbus_work; |
218 | struct workqueue_struct *qwork; | 218 | struct workqueue_struct *qwork; |
219 | 219 | ||
220 | struct otg_transceiver *transceiver; | 220 | struct usb_phy *transceiver; |
221 | 221 | ||
222 | struct mv_usb_platform_data *pdata; | 222 | struct mv_usb_platform_data *pdata; |
223 | 223 | ||
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c index f97e737d26f..7369fd92c03 100644 --- a/drivers/usb/gadget/mv_udc_core.c +++ b/drivers/usb/gadget/mv_udc_core.c | |||
@@ -1384,7 +1384,8 @@ static int mv_udc_start(struct usb_gadget_driver *driver, | |||
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | if (udc->transceiver) { | 1386 | if (udc->transceiver) { |
1387 | retval = otg_set_peripheral(udc->transceiver, &udc->gadget); | 1387 | retval = otg_set_peripheral(udc->transceiver->otg, |
1388 | &udc->gadget); | ||
1388 | if (retval) { | 1389 | if (retval) { |
1389 | dev_err(&udc->dev->dev, | 1390 | dev_err(&udc->dev->dev, |
1390 | "unable to register peripheral to otg\n"); | 1391 | "unable to register peripheral to otg\n"); |
@@ -2181,7 +2182,7 @@ static int __devinit mv_udc_probe(struct platform_device *dev) | |||
2181 | 2182 | ||
2182 | #ifdef CONFIG_USB_OTG_UTILS | 2183 | #ifdef CONFIG_USB_OTG_UTILS |
2183 | if (pdata->mode == MV_USB_MODE_OTG) | 2184 | if (pdata->mode == MV_USB_MODE_OTG) |
2184 | udc->transceiver = otg_get_transceiver(); | 2185 | udc->transceiver = usb_get_transceiver(); |
2185 | #endif | 2186 | #endif |
2186 | 2187 | ||
2187 | udc->clknum = pdata->clknum; | 2188 | udc->clknum = pdata->clknum; |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 576cd8578b4..ace8a652b32 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -1213,7 +1213,7 @@ static int omap_wakeup(struct usb_gadget *gadget) | |||
1213 | /* NOTE: non-OTG systems may use SRP TOO... */ | 1213 | /* NOTE: non-OTG systems may use SRP TOO... */ |
1214 | } else if (!(udc->devstat & UDC_ATT)) { | 1214 | } else if (!(udc->devstat & UDC_ATT)) { |
1215 | if (udc->transceiver) | 1215 | if (udc->transceiver) |
1216 | retval = otg_start_srp(udc->transceiver); | 1216 | retval = otg_start_srp(udc->transceiver->otg); |
1217 | } | 1217 | } |
1218 | spin_unlock_irqrestore(&udc->lock, flags); | 1218 | spin_unlock_irqrestore(&udc->lock, flags); |
1219 | 1219 | ||
@@ -1345,7 +1345,7 @@ static int omap_vbus_draw(struct usb_gadget *gadget, unsigned mA) | |||
1345 | 1345 | ||
1346 | udc = container_of(gadget, struct omap_udc, gadget); | 1346 | udc = container_of(gadget, struct omap_udc, gadget); |
1347 | if (udc->transceiver) | 1347 | if (udc->transceiver) |
1348 | return otg_set_power(udc->transceiver, mA); | 1348 | return usb_phy_set_power(udc->transceiver, mA); |
1349 | return -EOPNOTSUPP; | 1349 | return -EOPNOTSUPP; |
1350 | } | 1350 | } |
1351 | 1351 | ||
@@ -1839,11 +1839,13 @@ static void devstate_irq(struct omap_udc *udc, u16 irq_src) | |||
1839 | spin_lock(&udc->lock); | 1839 | spin_lock(&udc->lock); |
1840 | } | 1840 | } |
1841 | if (udc->transceiver) | 1841 | if (udc->transceiver) |
1842 | otg_set_suspend(udc->transceiver, 1); | 1842 | usb_phy_set_suspend( |
1843 | udc->transceiver, 1); | ||
1843 | } else { | 1844 | } else { |
1844 | VDBG("resume\n"); | 1845 | VDBG("resume\n"); |
1845 | if (udc->transceiver) | 1846 | if (udc->transceiver) |
1846 | otg_set_suspend(udc->transceiver, 0); | 1847 | usb_phy_set_suspend( |
1848 | udc->transceiver, 0); | ||
1847 | if (udc->gadget.speed == USB_SPEED_FULL | 1849 | if (udc->gadget.speed == USB_SPEED_FULL |
1848 | && udc->driver->resume) { | 1850 | && udc->driver->resume) { |
1849 | spin_unlock(&udc->lock); | 1851 | spin_unlock(&udc->lock); |
@@ -2154,7 +2156,8 @@ static int omap_udc_start(struct usb_gadget_driver *driver, | |||
2154 | 2156 | ||
2155 | /* connect to bus through transceiver */ | 2157 | /* connect to bus through transceiver */ |
2156 | if (udc->transceiver) { | 2158 | if (udc->transceiver) { |
2157 | status = otg_set_peripheral(udc->transceiver, &udc->gadget); | 2159 | status = otg_set_peripheral(udc->transceiver->otg, |
2160 | &udc->gadget); | ||
2158 | if (status < 0) { | 2161 | if (status < 0) { |
2159 | ERR("can't bind to transceiver\n"); | 2162 | ERR("can't bind to transceiver\n"); |
2160 | if (driver->unbind) { | 2163 | if (driver->unbind) { |
@@ -2200,7 +2203,7 @@ static int omap_udc_stop(struct usb_gadget_driver *driver) | |||
2200 | omap_vbus_session(&udc->gadget, 0); | 2203 | omap_vbus_session(&udc->gadget, 0); |
2201 | 2204 | ||
2202 | if (udc->transceiver) | 2205 | if (udc->transceiver) |
2203 | (void) otg_set_peripheral(udc->transceiver, NULL); | 2206 | (void) otg_set_peripheral(udc->transceiver->otg, NULL); |
2204 | else | 2207 | else |
2205 | pullup_disable(udc); | 2208 | pullup_disable(udc); |
2206 | 2209 | ||
@@ -2650,7 +2653,7 @@ static void omap_udc_release(struct device *dev) | |||
2650 | } | 2653 | } |
2651 | 2654 | ||
2652 | static int __init | 2655 | static int __init |
2653 | omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv) | 2656 | omap_udc_setup(struct platform_device *odev, struct usb_phy *xceiv) |
2654 | { | 2657 | { |
2655 | unsigned tmp, buf; | 2658 | unsigned tmp, buf; |
2656 | 2659 | ||
@@ -2790,7 +2793,7 @@ static int __init omap_udc_probe(struct platform_device *pdev) | |||
2790 | { | 2793 | { |
2791 | int status = -ENODEV; | 2794 | int status = -ENODEV; |
2792 | int hmc; | 2795 | int hmc; |
2793 | struct otg_transceiver *xceiv = NULL; | 2796 | struct usb_phy *xceiv = NULL; |
2794 | const char *type = NULL; | 2797 | const char *type = NULL; |
2795 | struct omap_usb_config *config = pdev->dev.platform_data; | 2798 | struct omap_usb_config *config = pdev->dev.platform_data; |
2796 | struct clk *dc_clk; | 2799 | struct clk *dc_clk; |
@@ -2863,7 +2866,7 @@ static int __init omap_udc_probe(struct platform_device *pdev) | |||
2863 | * use it. Except for OTG, we don't _need_ to talk to one; | 2866 | * use it. Except for OTG, we don't _need_ to talk to one; |
2864 | * but not having one probably means no VBUS detection. | 2867 | * but not having one probably means no VBUS detection. |
2865 | */ | 2868 | */ |
2866 | xceiv = otg_get_transceiver(); | 2869 | xceiv = usb_get_transceiver(); |
2867 | if (xceiv) | 2870 | if (xceiv) |
2868 | type = xceiv->label; | 2871 | type = xceiv->label; |
2869 | else if (config->otg) { | 2872 | else if (config->otg) { |
@@ -3009,7 +3012,7 @@ cleanup1: | |||
3009 | 3012 | ||
3010 | cleanup0: | 3013 | cleanup0: |
3011 | if (xceiv) | 3014 | if (xceiv) |
3012 | otg_put_transceiver(xceiv); | 3015 | usb_put_transceiver(xceiv); |
3013 | 3016 | ||
3014 | if (cpu_is_omap16xx() || cpu_is_omap24xx() || cpu_is_omap7xx()) { | 3017 | if (cpu_is_omap16xx() || cpu_is_omap24xx() || cpu_is_omap7xx()) { |
3015 | clk_disable(hhc_clk); | 3018 | clk_disable(hhc_clk); |
@@ -3039,7 +3042,7 @@ static int __exit omap_udc_remove(struct platform_device *pdev) | |||
3039 | 3042 | ||
3040 | pullup_disable(udc); | 3043 | pullup_disable(udc); |
3041 | if (udc->transceiver) { | 3044 | if (udc->transceiver) { |
3042 | otg_put_transceiver(udc->transceiver); | 3045 | usb_put_transceiver(udc->transceiver); |
3043 | udc->transceiver = NULL; | 3046 | udc->transceiver = NULL; |
3044 | } | 3047 | } |
3045 | omap_writew(0, UDC_SYSCON1); | 3048 | omap_writew(0, UDC_SYSCON1); |
diff --git a/drivers/usb/gadget/omap_udc.h b/drivers/usb/gadget/omap_udc.h index 29edc51b6b2..59d3b2213cb 100644 --- a/drivers/usb/gadget/omap_udc.h +++ b/drivers/usb/gadget/omap_udc.h | |||
@@ -164,7 +164,7 @@ struct omap_udc { | |||
164 | struct omap_ep ep[32]; | 164 | struct omap_ep ep[32]; |
165 | u16 devstat; | 165 | u16 devstat; |
166 | u16 clr_halt; | 166 | u16 clr_halt; |
167 | struct otg_transceiver *transceiver; | 167 | struct usb_phy *transceiver; |
168 | struct list_head iso; | 168 | struct list_head iso; |
169 | unsigned softconnect:1; | 169 | unsigned softconnect:1; |
170 | unsigned vbus_active:1; | 170 | unsigned vbus_active:1; |
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index dd470635f4f..df681b5cd69 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -995,7 +995,7 @@ static int pxa25x_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA) | |||
995 | udc = container_of(_gadget, struct pxa25x_udc, gadget); | 995 | udc = container_of(_gadget, struct pxa25x_udc, gadget); |
996 | 996 | ||
997 | if (udc->transceiver) | 997 | if (udc->transceiver) |
998 | return otg_set_power(udc->transceiver, mA); | 998 | return usb_phy_set_power(udc->transceiver, mA); |
999 | return -EOPNOTSUPP; | 999 | return -EOPNOTSUPP; |
1000 | } | 1000 | } |
1001 | 1001 | ||
@@ -1301,7 +1301,8 @@ fail: | |||
1301 | 1301 | ||
1302 | /* connect to bus through transceiver */ | 1302 | /* connect to bus through transceiver */ |
1303 | if (dev->transceiver) { | 1303 | if (dev->transceiver) { |
1304 | retval = otg_set_peripheral(dev->transceiver, &dev->gadget); | 1304 | retval = otg_set_peripheral(dev->transceiver->otg, |
1305 | &dev->gadget); | ||
1305 | if (retval) { | 1306 | if (retval) { |
1306 | DMSG("can't bind to transceiver\n"); | 1307 | DMSG("can't bind to transceiver\n"); |
1307 | if (driver->unbind) | 1308 | if (driver->unbind) |
@@ -1360,7 +1361,7 @@ static int pxa25x_stop(struct usb_gadget_driver *driver) | |||
1360 | local_irq_enable(); | 1361 | local_irq_enable(); |
1361 | 1362 | ||
1362 | if (dev->transceiver) | 1363 | if (dev->transceiver) |
1363 | (void) otg_set_peripheral(dev->transceiver, NULL); | 1364 | (void) otg_set_peripheral(dev->transceiver->otg, NULL); |
1364 | 1365 | ||
1365 | driver->unbind(&dev->gadget); | 1366 | driver->unbind(&dev->gadget); |
1366 | dev->gadget.dev.driver = NULL; | 1367 | dev->gadget.dev.driver = NULL; |
@@ -2159,7 +2160,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2159 | dev->dev = &pdev->dev; | 2160 | dev->dev = &pdev->dev; |
2160 | dev->mach = pdev->dev.platform_data; | 2161 | dev->mach = pdev->dev.platform_data; |
2161 | 2162 | ||
2162 | dev->transceiver = otg_get_transceiver(); | 2163 | dev->transceiver = usb_get_transceiver(); |
2163 | 2164 | ||
2164 | if (gpio_is_valid(dev->mach->gpio_pullup)) { | 2165 | if (gpio_is_valid(dev->mach->gpio_pullup)) { |
2165 | if ((retval = gpio_request(dev->mach->gpio_pullup, | 2166 | if ((retval = gpio_request(dev->mach->gpio_pullup, |
@@ -2238,7 +2239,7 @@ lubbock_fail0: | |||
2238 | gpio_free(dev->mach->gpio_pullup); | 2239 | gpio_free(dev->mach->gpio_pullup); |
2239 | err_gpio_pullup: | 2240 | err_gpio_pullup: |
2240 | if (dev->transceiver) { | 2241 | if (dev->transceiver) { |
2241 | otg_put_transceiver(dev->transceiver); | 2242 | usb_put_transceiver(dev->transceiver); |
2242 | dev->transceiver = NULL; | 2243 | dev->transceiver = NULL; |
2243 | } | 2244 | } |
2244 | clk_put(dev->clk); | 2245 | clk_put(dev->clk); |
@@ -2280,7 +2281,7 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) | |||
2280 | clk_put(dev->clk); | 2281 | clk_put(dev->clk); |
2281 | 2282 | ||
2282 | if (dev->transceiver) { | 2283 | if (dev->transceiver) { |
2283 | otg_put_transceiver(dev->transceiver); | 2284 | usb_put_transceiver(dev->transceiver); |
2284 | dev->transceiver = NULL; | 2285 | dev->transceiver = NULL; |
2285 | } | 2286 | } |
2286 | 2287 | ||
diff --git a/drivers/usb/gadget/pxa25x_udc.h b/drivers/usb/gadget/pxa25x_udc.h index 8eaf4e43726..893e917f048 100644 --- a/drivers/usb/gadget/pxa25x_udc.h +++ b/drivers/usb/gadget/pxa25x_udc.h | |||
@@ -119,7 +119,7 @@ struct pxa25x_udc { | |||
119 | struct device *dev; | 119 | struct device *dev; |
120 | struct clk *clk; | 120 | struct clk *clk; |
121 | struct pxa2xx_udc_mach_info *mach; | 121 | struct pxa2xx_udc_mach_info *mach; |
122 | struct otg_transceiver *transceiver; | 122 | struct usb_phy *transceiver; |
123 | u64 dma_mask; | 123 | u64 dma_mask; |
124 | struct pxa25x_ep ep [PXA_UDC_NUM_ENDPOINTS]; | 124 | struct pxa25x_ep ep [PXA_UDC_NUM_ENDPOINTS]; |
125 | 125 | ||
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index f4c44eb806c..98acb3ab9e1 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c | |||
@@ -1666,7 +1666,7 @@ static int pxa_udc_vbus_draw(struct usb_gadget *_gadget, unsigned mA) | |||
1666 | 1666 | ||
1667 | udc = to_gadget_udc(_gadget); | 1667 | udc = to_gadget_udc(_gadget); |
1668 | if (udc->transceiver) | 1668 | if (udc->transceiver) |
1669 | return otg_set_power(udc->transceiver, mA); | 1669 | return usb_phy_set_power(udc->transceiver, mA); |
1670 | return -EOPNOTSUPP; | 1670 | return -EOPNOTSUPP; |
1671 | } | 1671 | } |
1672 | 1672 | ||
@@ -1835,7 +1835,8 @@ static int pxa27x_udc_start(struct usb_gadget_driver *driver, | |||
1835 | driver->driver.name); | 1835 | driver->driver.name); |
1836 | 1836 | ||
1837 | if (udc->transceiver) { | 1837 | if (udc->transceiver) { |
1838 | retval = otg_set_peripheral(udc->transceiver, &udc->gadget); | 1838 | retval = otg_set_peripheral(udc->transceiver->otg, |
1839 | &udc->gadget); | ||
1839 | if (retval) { | 1840 | if (retval) { |
1840 | dev_err(udc->dev, "can't bind to transceiver\n"); | 1841 | dev_err(udc->dev, "can't bind to transceiver\n"); |
1841 | goto transceiver_fail; | 1842 | goto transceiver_fail; |
@@ -1908,7 +1909,7 @@ static int pxa27x_udc_stop(struct usb_gadget_driver *driver) | |||
1908 | driver->driver.name); | 1909 | driver->driver.name); |
1909 | 1910 | ||
1910 | if (udc->transceiver) | 1911 | if (udc->transceiver) |
1911 | return otg_set_peripheral(udc->transceiver, NULL); | 1912 | return otg_set_peripheral(udc->transceiver->otg, NULL); |
1912 | return 0; | 1913 | return 0; |
1913 | } | 1914 | } |
1914 | 1915 | ||
@@ -2463,7 +2464,7 @@ static int __init pxa_udc_probe(struct platform_device *pdev) | |||
2463 | 2464 | ||
2464 | udc->dev = &pdev->dev; | 2465 | udc->dev = &pdev->dev; |
2465 | udc->mach = pdev->dev.platform_data; | 2466 | udc->mach = pdev->dev.platform_data; |
2466 | udc->transceiver = otg_get_transceiver(); | 2467 | udc->transceiver = usb_get_transceiver(); |
2467 | 2468 | ||
2468 | gpio = udc->mach->gpio_pullup; | 2469 | gpio = udc->mach->gpio_pullup; |
2469 | if (gpio_is_valid(gpio)) { | 2470 | if (gpio_is_valid(gpio)) { |
@@ -2542,7 +2543,7 @@ static int __exit pxa_udc_remove(struct platform_device *_dev) | |||
2542 | if (gpio_is_valid(gpio)) | 2543 | if (gpio_is_valid(gpio)) |
2543 | gpio_free(gpio); | 2544 | gpio_free(gpio); |
2544 | 2545 | ||
2545 | otg_put_transceiver(udc->transceiver); | 2546 | usb_put_transceiver(udc->transceiver); |
2546 | 2547 | ||
2547 | udc->transceiver = NULL; | 2548 | udc->transceiver = NULL; |
2548 | platform_set_drvdata(_dev, NULL); | 2549 | platform_set_drvdata(_dev, NULL); |
diff --git a/drivers/usb/gadget/pxa27x_udc.h b/drivers/usb/gadget/pxa27x_udc.h index 7f4e8f424e8..a1d268c6f2c 100644 --- a/drivers/usb/gadget/pxa27x_udc.h +++ b/drivers/usb/gadget/pxa27x_udc.h | |||
@@ -447,7 +447,7 @@ struct pxa_udc { | |||
447 | struct usb_gadget_driver *driver; | 447 | struct usb_gadget_driver *driver; |
448 | struct device *dev; | 448 | struct device *dev; |
449 | struct pxa2xx_udc_mach_info *mach; | 449 | struct pxa2xx_udc_mach_info *mach; |
450 | struct otg_transceiver *transceiver; | 450 | struct usb_phy *transceiver; |
451 | 451 | ||
452 | enum ep0_state ep0state; | 452 | enum ep0_state ep0state; |
453 | struct udc_stats stats; | 453 | struct udc_stats stats; |
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c index df8661d266c..c2f3aa65058 100644 --- a/drivers/usb/gadget/s3c-hsudc.c +++ b/drivers/usb/gadget/s3c-hsudc.c | |||
@@ -145,7 +145,7 @@ struct s3c_hsudc { | |||
145 | struct usb_gadget_driver *driver; | 145 | struct usb_gadget_driver *driver; |
146 | struct device *dev; | 146 | struct device *dev; |
147 | struct s3c24xx_hsudc_platdata *pd; | 147 | struct s3c24xx_hsudc_platdata *pd; |
148 | struct otg_transceiver *transceiver; | 148 | struct usb_phy *transceiver; |
149 | struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsudc_supply_names)]; | 149 | struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsudc_supply_names)]; |
150 | spinlock_t lock; | 150 | spinlock_t lock; |
151 | void __iomem *regs; | 151 | void __iomem *regs; |
@@ -1166,7 +1166,8 @@ static int s3c_hsudc_start(struct usb_gadget *gadget, | |||
1166 | 1166 | ||
1167 | /* connect to bus through transceiver */ | 1167 | /* connect to bus through transceiver */ |
1168 | if (hsudc->transceiver) { | 1168 | if (hsudc->transceiver) { |
1169 | ret = otg_set_peripheral(hsudc->transceiver, &hsudc->gadget); | 1169 | ret = otg_set_peripheral(hsudc->transceiver->otg, |
1170 | &hsudc->gadget); | ||
1170 | if (ret) { | 1171 | if (ret) { |
1171 | dev_err(hsudc->dev, "%s: can't bind to transceiver\n", | 1172 | dev_err(hsudc->dev, "%s: can't bind to transceiver\n", |
1172 | hsudc->gadget.name); | 1173 | hsudc->gadget.name); |
@@ -1214,7 +1215,7 @@ static int s3c_hsudc_stop(struct usb_gadget *gadget, | |||
1214 | spin_unlock_irqrestore(&hsudc->lock, flags); | 1215 | spin_unlock_irqrestore(&hsudc->lock, flags); |
1215 | 1216 | ||
1216 | if (hsudc->transceiver) | 1217 | if (hsudc->transceiver) |
1217 | (void) otg_set_peripheral(hsudc->transceiver, NULL); | 1218 | (void) otg_set_peripheral(hsudc->transceiver->otg, NULL); |
1218 | 1219 | ||
1219 | disable_irq(hsudc->irq); | 1220 | disable_irq(hsudc->irq); |
1220 | 1221 | ||
@@ -1243,7 +1244,7 @@ static int s3c_hsudc_vbus_draw(struct usb_gadget *gadget, unsigned mA) | |||
1243 | return -ENODEV; | 1244 | return -ENODEV; |
1244 | 1245 | ||
1245 | if (hsudc->transceiver) | 1246 | if (hsudc->transceiver) |
1246 | return otg_set_power(hsudc->transceiver, mA); | 1247 | return usb_phy_set_power(hsudc->transceiver, mA); |
1247 | 1248 | ||
1248 | return -EOPNOTSUPP; | 1249 | return -EOPNOTSUPP; |
1249 | } | 1250 | } |
@@ -1275,7 +1276,7 @@ static int __devinit s3c_hsudc_probe(struct platform_device *pdev) | |||
1275 | hsudc->dev = dev; | 1276 | hsudc->dev = dev; |
1276 | hsudc->pd = pdev->dev.platform_data; | 1277 | hsudc->pd = pdev->dev.platform_data; |
1277 | 1278 | ||
1278 | hsudc->transceiver = otg_get_transceiver(); | 1279 | hsudc->transceiver = usb_get_transceiver(); |
1279 | 1280 | ||
1280 | for (i = 0; i < ARRAY_SIZE(hsudc->supplies); i++) | 1281 | for (i = 0; i < ARRAY_SIZE(hsudc->supplies); i++) |
1281 | hsudc->supplies[i].supply = s3c_hsudc_supply_names[i]; | 1282 | hsudc->supplies[i].supply = s3c_hsudc_supply_names[i]; |
@@ -1377,7 +1378,7 @@ err_remap: | |||
1377 | release_mem_region(res->start, resource_size(res)); | 1378 | release_mem_region(res->start, resource_size(res)); |
1378 | err_res: | 1379 | err_res: |
1379 | if (hsudc->transceiver) | 1380 | if (hsudc->transceiver) |
1380 | otg_put_transceiver(hsudc->transceiver); | 1381 | usb_put_transceiver(hsudc->transceiver); |
1381 | 1382 | ||
1382 | regulator_bulk_free(ARRAY_SIZE(hsudc->supplies), hsudc->supplies); | 1383 | regulator_bulk_free(ARRAY_SIZE(hsudc->supplies), hsudc->supplies); |
1383 | err_supplies: | 1384 | err_supplies: |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 7a15c223575..cf5666735a8 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -142,12 +142,12 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, | |||
142 | if (pdata->operating_mode == FSL_USB2_DR_OTG) { | 142 | if (pdata->operating_mode == FSL_USB2_DR_OTG) { |
143 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 143 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
144 | 144 | ||
145 | ehci->transceiver = otg_get_transceiver(); | 145 | ehci->transceiver = usb_get_transceiver(); |
146 | dev_dbg(&pdev->dev, "hcd=0x%p ehci=0x%p, transceiver=0x%p\n", | 146 | dev_dbg(&pdev->dev, "hcd=0x%p ehci=0x%p, transceiver=0x%p\n", |
147 | hcd, ehci, ehci->transceiver); | 147 | hcd, ehci, ehci->transceiver); |
148 | 148 | ||
149 | if (ehci->transceiver) { | 149 | if (ehci->transceiver) { |
150 | retval = otg_set_host(ehci->transceiver, | 150 | retval = otg_set_host(ehci->transceiver->otg, |
151 | &ehci_to_hcd(ehci)->self); | 151 | &ehci_to_hcd(ehci)->self); |
152 | if (retval) { | 152 | if (retval) { |
153 | if (ehci->transceiver) | 153 | if (ehci->transceiver) |
@@ -194,7 +194,7 @@ static void usb_hcd_fsl_remove(struct usb_hcd *hcd, | |||
194 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 194 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
195 | 195 | ||
196 | if (ehci->transceiver) { | 196 | if (ehci->transceiver) { |
197 | otg_set_host(ehci->transceiver, NULL); | 197 | otg_set_host(ehci->transceiver->otg, NULL); |
198 | put_device(ehci->transceiver->dev); | 198 | put_device(ehci->transceiver->dev); |
199 | } | 199 | } |
200 | 200 | ||
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 01011dd0cb5..256fbd42e48 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -727,7 +727,7 @@ static int ehci_hub_control ( | |||
727 | #ifdef CONFIG_USB_OTG | 727 | #ifdef CONFIG_USB_OTG |
728 | if ((hcd->self.otg_port == (wIndex + 1)) | 728 | if ((hcd->self.otg_port == (wIndex + 1)) |
729 | && hcd->self.b_hnp_enable) { | 729 | && hcd->self.b_hnp_enable) { |
730 | otg_start_hnp(ehci->transceiver); | 730 | otg_start_hnp(ehci->transceiver->otg); |
731 | break; | 731 | break; |
732 | } | 732 | } |
733 | #endif | 733 | #endif |
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c index 592d5f76803..9803a55fd5f 100644 --- a/drivers/usb/host/ehci-msm.c +++ b/drivers/usb/host/ehci-msm.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #define MSM_USB_BASE (hcd->regs) | 33 | #define MSM_USB_BASE (hcd->regs) |
34 | 34 | ||
35 | static struct otg_transceiver *otg; | 35 | static struct usb_phy *phy; |
36 | 36 | ||
37 | static int ehci_msm_reset(struct usb_hcd *hcd) | 37 | static int ehci_msm_reset(struct usb_hcd *hcd) |
38 | { | 38 | { |
@@ -145,14 +145,14 @@ static int ehci_msm_probe(struct platform_device *pdev) | |||
145 | * powering up VBUS, mapping of registers address space and power | 145 | * powering up VBUS, mapping of registers address space and power |
146 | * management. | 146 | * management. |
147 | */ | 147 | */ |
148 | otg = otg_get_transceiver(); | 148 | phy = usb_get_transceiver(); |
149 | if (!otg) { | 149 | if (!phy) { |
150 | dev_err(&pdev->dev, "unable to find transceiver\n"); | 150 | dev_err(&pdev->dev, "unable to find transceiver\n"); |
151 | ret = -ENODEV; | 151 | ret = -ENODEV; |
152 | goto unmap; | 152 | goto unmap; |
153 | } | 153 | } |
154 | 154 | ||
155 | ret = otg_set_host(otg, &hcd->self); | 155 | ret = otg_set_host(phy->otg, &hcd->self); |
156 | if (ret < 0) { | 156 | if (ret < 0) { |
157 | dev_err(&pdev->dev, "unable to register with transceiver\n"); | 157 | dev_err(&pdev->dev, "unable to register with transceiver\n"); |
158 | goto put_transceiver; | 158 | goto put_transceiver; |
@@ -169,7 +169,7 @@ static int ehci_msm_probe(struct platform_device *pdev) | |||
169 | return 0; | 169 | return 0; |
170 | 170 | ||
171 | put_transceiver: | 171 | put_transceiver: |
172 | otg_put_transceiver(otg); | 172 | usb_put_transceiver(phy); |
173 | unmap: | 173 | unmap: |
174 | iounmap(hcd->regs); | 174 | iounmap(hcd->regs); |
175 | put_hcd: | 175 | put_hcd: |
@@ -186,8 +186,8 @@ static int __devexit ehci_msm_remove(struct platform_device *pdev) | |||
186 | pm_runtime_disable(&pdev->dev); | 186 | pm_runtime_disable(&pdev->dev); |
187 | pm_runtime_set_suspended(&pdev->dev); | 187 | pm_runtime_set_suspended(&pdev->dev); |
188 | 188 | ||
189 | otg_set_host(otg, NULL); | 189 | otg_set_host(phy->otg, NULL); |
190 | otg_put_transceiver(otg); | 190 | usb_put_transceiver(phy); |
191 | 191 | ||
192 | usb_put_hcd(hcd); | 192 | usb_put_hcd(hcd); |
193 | 193 | ||
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c index 52a604fb932..a936bbcff8f 100644 --- a/drivers/usb/host/ehci-mv.c +++ b/drivers/usb/host/ehci-mv.c | |||
@@ -28,7 +28,7 @@ struct ehci_hcd_mv { | |||
28 | void __iomem *cap_regs; | 28 | void __iomem *cap_regs; |
29 | void __iomem *op_regs; | 29 | void __iomem *op_regs; |
30 | 30 | ||
31 | struct otg_transceiver *otg; | 31 | struct usb_phy *otg; |
32 | 32 | ||
33 | struct mv_usb_platform_data *pdata; | 33 | struct mv_usb_platform_data *pdata; |
34 | 34 | ||
@@ -253,7 +253,7 @@ static int mv_ehci_probe(struct platform_device *pdev) | |||
253 | ehci_mv->mode = pdata->mode; | 253 | ehci_mv->mode = pdata->mode; |
254 | if (ehci_mv->mode == MV_USB_MODE_OTG) { | 254 | if (ehci_mv->mode == MV_USB_MODE_OTG) { |
255 | #ifdef CONFIG_USB_OTG_UTILS | 255 | #ifdef CONFIG_USB_OTG_UTILS |
256 | ehci_mv->otg = otg_get_transceiver(); | 256 | ehci_mv->otg = usb_get_transceiver(); |
257 | if (!ehci_mv->otg) { | 257 | if (!ehci_mv->otg) { |
258 | dev_err(&pdev->dev, | 258 | dev_err(&pdev->dev, |
259 | "unable to find transceiver\n"); | 259 | "unable to find transceiver\n"); |
@@ -261,7 +261,7 @@ static int mv_ehci_probe(struct platform_device *pdev) | |||
261 | goto err_disable_clk; | 261 | goto err_disable_clk; |
262 | } | 262 | } |
263 | 263 | ||
264 | retval = otg_set_host(ehci_mv->otg, &hcd->self); | 264 | retval = otg_set_host(ehci_mv->otg->otg, &hcd->self); |
265 | if (retval < 0) { | 265 | if (retval < 0) { |
266 | dev_err(&pdev->dev, | 266 | dev_err(&pdev->dev, |
267 | "unable to register with transceiver\n"); | 267 | "unable to register with transceiver\n"); |
@@ -303,7 +303,7 @@ err_set_vbus: | |||
303 | #ifdef CONFIG_USB_OTG_UTILS | 303 | #ifdef CONFIG_USB_OTG_UTILS |
304 | err_put_transceiver: | 304 | err_put_transceiver: |
305 | if (ehci_mv->otg) | 305 | if (ehci_mv->otg) |
306 | otg_put_transceiver(ehci_mv->otg); | 306 | usb_put_transceiver(ehci_mv->otg); |
307 | #endif | 307 | #endif |
308 | err_disable_clk: | 308 | err_disable_clk: |
309 | mv_ehci_disable(ehci_mv); | 309 | mv_ehci_disable(ehci_mv); |
@@ -332,8 +332,8 @@ static int mv_ehci_remove(struct platform_device *pdev) | |||
332 | usb_remove_hcd(hcd); | 332 | usb_remove_hcd(hcd); |
333 | 333 | ||
334 | if (ehci_mv->otg) { | 334 | if (ehci_mv->otg) { |
335 | otg_set_host(ehci_mv->otg, NULL); | 335 | otg_set_host(ehci_mv->otg->otg, NULL); |
336 | otg_put_transceiver(ehci_mv->otg); | 336 | usb_put_transceiver(ehci_mv->otg); |
337 | } | 337 | } |
338 | 338 | ||
339 | if (ehci_mv->mode == MV_USB_MODE_HOST) { | 339 | if (ehci_mv->mode == MV_USB_MODE_HOST) { |
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index 55978fcfa4b..a797d51ecbe 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c | |||
@@ -220,13 +220,13 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
220 | /* Initialize the transceiver */ | 220 | /* Initialize the transceiver */ |
221 | if (pdata->otg) { | 221 | if (pdata->otg) { |
222 | pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET; | 222 | pdata->otg->io_priv = hcd->regs + ULPI_VIEWPORT_OFFSET; |
223 | ret = otg_init(pdata->otg); | 223 | ret = usb_phy_init(pdata->otg); |
224 | if (ret) { | 224 | if (ret) { |
225 | dev_err(dev, "unable to init transceiver, probably missing\n"); | 225 | dev_err(dev, "unable to init transceiver, probably missing\n"); |
226 | ret = -ENODEV; | 226 | ret = -ENODEV; |
227 | goto err_add; | 227 | goto err_add; |
228 | } | 228 | } |
229 | ret = otg_set_vbus(pdata->otg, 1); | 229 | ret = otg_set_vbus(pdata->otg->otg, 1); |
230 | if (ret) { | 230 | if (ret) { |
231 | dev_err(dev, "unable to enable vbus on transceiver\n"); | 231 | dev_err(dev, "unable to enable vbus on transceiver\n"); |
232 | goto err_add; | 232 | goto err_add; |
@@ -247,9 +247,11 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) | |||
247 | * It's in violation of USB specs | 247 | * It's in violation of USB specs |
248 | */ | 248 | */ |
249 | if (machine_is_mx51_efikamx() || machine_is_mx51_efikasb()) { | 249 | if (machine_is_mx51_efikamx() || machine_is_mx51_efikasb()) { |
250 | flags = otg_io_read(pdata->otg, ULPI_OTG_CTRL); | 250 | flags = usb_phy_io_read(pdata->otg, |
251 | ULPI_OTG_CTRL); | ||
251 | flags |= ULPI_OTG_CTRL_CHRGVBUS; | 252 | flags |= ULPI_OTG_CTRL_CHRGVBUS; |
252 | ret = otg_io_write(pdata->otg, flags, ULPI_OTG_CTRL); | 253 | ret = usb_phy_io_write(pdata->otg, flags, |
254 | ULPI_OTG_CTRL); | ||
253 | if (ret) { | 255 | if (ret) { |
254 | dev_err(dev, "unable to set CHRVBUS\n"); | 256 | dev_err(dev, "unable to set CHRVBUS\n"); |
255 | goto err_add; | 257 | goto err_add; |
@@ -297,7 +299,7 @@ static int __exit ehci_mxc_drv_remove(struct platform_device *pdev) | |||
297 | pdata->exit(pdev); | 299 | pdata->exit(pdev); |
298 | 300 | ||
299 | if (pdata->otg) | 301 | if (pdata->otg) |
300 | otg_shutdown(pdata->otg); | 302 | usb_phy_shutdown(pdata->otg); |
301 | 303 | ||
302 | usb_remove_hcd(hcd); | 304 | usb_remove_hcd(hcd); |
303 | iounmap(hcd->regs); | 305 | iounmap(hcd->regs); |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index dbc7fe8ca9e..3de48a2d795 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -35,7 +35,7 @@ struct tegra_ehci_hcd { | |||
35 | struct tegra_usb_phy *phy; | 35 | struct tegra_usb_phy *phy; |
36 | struct clk *clk; | 36 | struct clk *clk; |
37 | struct clk *emc_clk; | 37 | struct clk *emc_clk; |
38 | struct otg_transceiver *transceiver; | 38 | struct usb_phy *transceiver; |
39 | int host_resumed; | 39 | int host_resumed; |
40 | int bus_suspended; | 40 | int bus_suspended; |
41 | int port_resuming; | 41 | int port_resuming; |
@@ -733,9 +733,9 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
733 | 733 | ||
734 | #ifdef CONFIG_USB_OTG_UTILS | 734 | #ifdef CONFIG_USB_OTG_UTILS |
735 | if (pdata->operating_mode == TEGRA_USB_OTG) { | 735 | if (pdata->operating_mode == TEGRA_USB_OTG) { |
736 | tegra->transceiver = otg_get_transceiver(); | 736 | tegra->transceiver = usb_get_transceiver(); |
737 | if (tegra->transceiver) | 737 | if (tegra->transceiver) |
738 | otg_set_host(tegra->transceiver, &hcd->self); | 738 | otg_set_host(tegra->transceiver->otg, &hcd->self); |
739 | } | 739 | } |
740 | #endif | 740 | #endif |
741 | 741 | ||
@@ -750,8 +750,8 @@ static int tegra_ehci_probe(struct platform_device *pdev) | |||
750 | fail: | 750 | fail: |
751 | #ifdef CONFIG_USB_OTG_UTILS | 751 | #ifdef CONFIG_USB_OTG_UTILS |
752 | if (tegra->transceiver) { | 752 | if (tegra->transceiver) { |
753 | otg_set_host(tegra->transceiver, NULL); | 753 | otg_set_host(tegra->transceiver->otg, NULL); |
754 | otg_put_transceiver(tegra->transceiver); | 754 | usb_put_transceiver(tegra->transceiver); |
755 | } | 755 | } |
756 | #endif | 756 | #endif |
757 | tegra_usb_phy_close(tegra->phy); | 757 | tegra_usb_phy_close(tegra->phy); |
@@ -808,8 +808,8 @@ static int tegra_ehci_remove(struct platform_device *pdev) | |||
808 | 808 | ||
809 | #ifdef CONFIG_USB_OTG_UTILS | 809 | #ifdef CONFIG_USB_OTG_UTILS |
810 | if (tegra->transceiver) { | 810 | if (tegra->transceiver) { |
811 | otg_set_host(tegra->transceiver, NULL); | 811 | otg_set_host(tegra->transceiver->otg, NULL); |
812 | otg_put_transceiver(tegra->transceiver); | 812 | usb_put_transceiver(tegra->transceiver); |
813 | } | 813 | } |
814 | #endif | 814 | #endif |
815 | 815 | ||
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 0a5fda73b3f..8f9acbc96fd 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -176,7 +176,7 @@ struct ehci_hcd { /* one per controller */ | |||
176 | /* | 176 | /* |
177 | * OTG controllers and transceivers need software interaction | 177 | * OTG controllers and transceivers need software interaction |
178 | */ | 178 | */ |
179 | struct otg_transceiver *transceiver; | 179 | struct usb_phy *transceiver; |
180 | }; | 180 | }; |
181 | 181 | ||
182 | /* convert between an HCD pointer and the corresponding EHCI_HCD */ | 182 | /* convert between an HCD pointer and the corresponding EHCI_HCD */ |
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index db3968656d2..96451e41ee8 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -171,7 +171,7 @@ static void start_hnp(struct ohci_hcd *ohci) | |||
171 | unsigned long flags; | 171 | unsigned long flags; |
172 | u32 l; | 172 | u32 l; |
173 | 173 | ||
174 | otg_start_hnp(ohci->transceiver); | 174 | otg_start_hnp(ohci->transceiver->otg); |
175 | 175 | ||
176 | local_irq_save(flags); | 176 | local_irq_save(flags); |
177 | ohci->transceiver->state = OTG_STATE_A_SUSPEND; | 177 | ohci->transceiver->state = OTG_STATE_A_SUSPEND; |
@@ -210,9 +210,9 @@ static int ohci_omap_init(struct usb_hcd *hcd) | |||
210 | 210 | ||
211 | #ifdef CONFIG_USB_OTG | 211 | #ifdef CONFIG_USB_OTG |
212 | if (need_transceiver) { | 212 | if (need_transceiver) { |
213 | ohci->transceiver = otg_get_transceiver(); | 213 | ohci->transceiver = usb_get_transceiver(); |
214 | if (ohci->transceiver) { | 214 | if (ohci->transceiver) { |
215 | int status = otg_set_host(ohci->transceiver, | 215 | int status = otg_set_host(ohci->transceiver->otg, |
216 | &ohci_to_hcd(ohci)->self); | 216 | &ohci_to_hcd(ohci)->self); |
217 | dev_dbg(hcd->self.controller, "init %s transceiver, status %d\n", | 217 | dev_dbg(hcd->self.controller, "init %s transceiver, status %d\n", |
218 | ohci->transceiver->label, status); | 218 | ohci->transceiver->label, status); |
@@ -404,7 +404,7 @@ usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev) | |||
404 | 404 | ||
405 | usb_remove_hcd(hcd); | 405 | usb_remove_hcd(hcd); |
406 | if (ohci->transceiver) { | 406 | if (ohci->transceiver) { |
407 | (void) otg_set_host(ohci->transceiver, 0); | 407 | (void) otg_set_host(ohci->transceiver->otg, 0); |
408 | put_device(ohci->transceiver->dev); | 408 | put_device(ohci->transceiver->dev); |
409 | } | 409 | } |
410 | if (machine_is_omap_osk()) | 410 | if (machine_is_omap_osk()) |
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 8ff6f7ea96f..1b19aea25a2 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h | |||
@@ -376,7 +376,7 @@ struct ohci_hcd { | |||
376 | * OTG controllers and transceivers need software interaction; | 376 | * OTG controllers and transceivers need software interaction; |
377 | * other external transceivers should be software-transparent | 377 | * other external transceivers should be software-transparent |
378 | */ | 378 | */ |
379 | struct otg_transceiver *transceiver; | 379 | struct usb_phy *transceiver; |
380 | void (*start_hnp)(struct ohci_hcd *ohci); | 380 | void (*start_hnp)(struct ohci_hcd *ohci); |
381 | 381 | ||
382 | /* | 382 | /* |
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 5285bda1dc4..9f3eda91ea4 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c | |||
@@ -226,6 +226,7 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci) | |||
226 | struct device *dev = musb->controller; | 226 | struct device *dev = musb->controller; |
227 | struct musb_hdrc_platform_data *plat = dev->platform_data; | 227 | struct musb_hdrc_platform_data *plat = dev->platform_data; |
228 | struct omap_musb_board_data *data = plat->board_data; | 228 | struct omap_musb_board_data *data = plat->board_data; |
229 | struct usb_otg *otg = musb->xceiv->otg; | ||
229 | unsigned long flags; | 230 | unsigned long flags; |
230 | irqreturn_t ret = IRQ_NONE; | 231 | irqreturn_t ret = IRQ_NONE; |
231 | u32 epintr, usbintr; | 232 | u32 epintr, usbintr; |
@@ -289,14 +290,14 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci) | |||
289 | WARNING("VBUS error workaround (delay coming)\n"); | 290 | WARNING("VBUS error workaround (delay coming)\n"); |
290 | } else if (is_host_enabled(musb) && drvvbus) { | 291 | } else if (is_host_enabled(musb) && drvvbus) { |
291 | MUSB_HST_MODE(musb); | 292 | MUSB_HST_MODE(musb); |
292 | musb->xceiv->default_a = 1; | 293 | otg->default_a = 1; |
293 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 294 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; |
294 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); | 295 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); |
295 | del_timer(&otg_workaround); | 296 | del_timer(&otg_workaround); |
296 | } else { | 297 | } else { |
297 | musb->is_active = 0; | 298 | musb->is_active = 0; |
298 | MUSB_DEV_MODE(musb); | 299 | MUSB_DEV_MODE(musb); |
299 | musb->xceiv->default_a = 0; | 300 | otg->default_a = 0; |
300 | musb->xceiv->state = OTG_STATE_B_IDLE; | 301 | musb->xceiv->state = OTG_STATE_B_IDLE; |
301 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); | 302 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); |
302 | } | 303 | } |
@@ -363,7 +364,7 @@ static int am35x_musb_init(struct musb *musb) | |||
363 | return -ENODEV; | 364 | return -ENODEV; |
364 | 365 | ||
365 | usb_nop_xceiv_register(); | 366 | usb_nop_xceiv_register(); |
366 | musb->xceiv = otg_get_transceiver(); | 367 | musb->xceiv = usb_get_transceiver(); |
367 | if (!musb->xceiv) | 368 | if (!musb->xceiv) |
368 | return -ENODEV; | 369 | return -ENODEV; |
369 | 370 | ||
@@ -405,7 +406,7 @@ static int am35x_musb_exit(struct musb *musb) | |||
405 | if (data->set_phy_power) | 406 | if (data->set_phy_power) |
406 | data->set_phy_power(0); | 407 | data->set_phy_power(0); |
407 | 408 | ||
408 | otg_put_transceiver(musb->xceiv); | 409 | usb_put_transceiver(musb->xceiv); |
409 | usb_nop_xceiv_unregister(); | 410 | usb_nop_xceiv_unregister(); |
410 | 411 | ||
411 | return 0; | 412 | return 0; |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 261af3487b5..a087ed6c3be 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -317,7 +317,7 @@ static void bfin_musb_set_vbus(struct musb *musb, int is_on) | |||
317 | musb_readb(musb->mregs, MUSB_DEVCTL)); | 317 | musb_readb(musb->mregs, MUSB_DEVCTL)); |
318 | } | 318 | } |
319 | 319 | ||
320 | static int bfin_musb_set_power(struct otg_transceiver *x, unsigned mA) | 320 | static int bfin_musb_set_power(struct usb_phy *x, unsigned mA) |
321 | { | 321 | { |
322 | return 0; | 322 | return 0; |
323 | } | 323 | } |
@@ -415,7 +415,7 @@ static int bfin_musb_init(struct musb *musb) | |||
415 | gpio_direction_output(musb->config->gpio_vrsel, 0); | 415 | gpio_direction_output(musb->config->gpio_vrsel, 0); |
416 | 416 | ||
417 | usb_nop_xceiv_register(); | 417 | usb_nop_xceiv_register(); |
418 | musb->xceiv = otg_get_transceiver(); | 418 | musb->xceiv = usb_get_transceiver(); |
419 | if (!musb->xceiv) { | 419 | if (!musb->xceiv) { |
420 | gpio_free(musb->config->gpio_vrsel); | 420 | gpio_free(musb->config->gpio_vrsel); |
421 | return -ENODEV; | 421 | return -ENODEV; |
@@ -440,7 +440,7 @@ static int bfin_musb_exit(struct musb *musb) | |||
440 | { | 440 | { |
441 | gpio_free(musb->config->gpio_vrsel); | 441 | gpio_free(musb->config->gpio_vrsel); |
442 | 442 | ||
443 | otg_put_transceiver(musb->xceiv); | 443 | usb_put_transceiver(musb->xceiv); |
444 | usb_nop_xceiv_unregister(); | 444 | usb_nop_xceiv_unregister(); |
445 | return 0; | 445 | return 0; |
446 | } | 446 | } |
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 01c8f2ece08..8bd9566f3fb 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -294,6 +294,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) | |||
294 | { | 294 | { |
295 | struct musb *musb = hci; | 295 | struct musb *musb = hci; |
296 | void __iomem *reg_base = musb->ctrl_base; | 296 | void __iomem *reg_base = musb->ctrl_base; |
297 | struct usb_otg *otg = musb->xceiv->otg; | ||
297 | unsigned long flags; | 298 | unsigned long flags; |
298 | irqreturn_t ret = IRQ_NONE; | 299 | irqreturn_t ret = IRQ_NONE; |
299 | u32 status; | 300 | u32 status; |
@@ -351,14 +352,14 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) | |||
351 | WARNING("VBUS error workaround (delay coming)\n"); | 352 | WARNING("VBUS error workaround (delay coming)\n"); |
352 | } else if (is_host_enabled(musb) && drvvbus) { | 353 | } else if (is_host_enabled(musb) && drvvbus) { |
353 | MUSB_HST_MODE(musb); | 354 | MUSB_HST_MODE(musb); |
354 | musb->xceiv->default_a = 1; | 355 | otg->default_a = 1; |
355 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 356 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; |
356 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); | 357 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); |
357 | del_timer(&otg_workaround); | 358 | del_timer(&otg_workaround); |
358 | } else { | 359 | } else { |
359 | musb->is_active = 0; | 360 | musb->is_active = 0; |
360 | MUSB_DEV_MODE(musb); | 361 | MUSB_DEV_MODE(musb); |
361 | musb->xceiv->default_a = 0; | 362 | otg->default_a = 0; |
362 | musb->xceiv->state = OTG_STATE_B_IDLE; | 363 | musb->xceiv->state = OTG_STATE_B_IDLE; |
363 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); | 364 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); |
364 | } | 365 | } |
@@ -424,7 +425,7 @@ static int da8xx_musb_init(struct musb *musb) | |||
424 | goto fail; | 425 | goto fail; |
425 | 426 | ||
426 | usb_nop_xceiv_register(); | 427 | usb_nop_xceiv_register(); |
427 | musb->xceiv = otg_get_transceiver(); | 428 | musb->xceiv = usb_get_transceiver(); |
428 | if (!musb->xceiv) | 429 | if (!musb->xceiv) |
429 | goto fail; | 430 | goto fail; |
430 | 431 | ||
@@ -457,7 +458,7 @@ static int da8xx_musb_exit(struct musb *musb) | |||
457 | 458 | ||
458 | phy_off(); | 459 | phy_off(); |
459 | 460 | ||
460 | otg_put_transceiver(musb->xceiv); | 461 | usb_put_transceiver(musb->xceiv); |
461 | usb_nop_xceiv_unregister(); | 462 | usb_nop_xceiv_unregister(); |
462 | 463 | ||
463 | return 0; | 464 | return 0; |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 0ba3e75285c..97ab975fa44 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -265,6 +265,7 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci) | |||
265 | unsigned long flags; | 265 | unsigned long flags; |
266 | irqreturn_t retval = IRQ_NONE; | 266 | irqreturn_t retval = IRQ_NONE; |
267 | struct musb *musb = __hci; | 267 | struct musb *musb = __hci; |
268 | struct usb_otg *otg = musb->xceiv->otg; | ||
268 | void __iomem *tibase = musb->ctrl_base; | 269 | void __iomem *tibase = musb->ctrl_base; |
269 | struct cppi *cppi; | 270 | struct cppi *cppi; |
270 | u32 tmp; | 271 | u32 tmp; |
@@ -331,14 +332,14 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci) | |||
331 | WARNING("VBUS error workaround (delay coming)\n"); | 332 | WARNING("VBUS error workaround (delay coming)\n"); |
332 | } else if (is_host_enabled(musb) && drvvbus) { | 333 | } else if (is_host_enabled(musb) && drvvbus) { |
333 | MUSB_HST_MODE(musb); | 334 | MUSB_HST_MODE(musb); |
334 | musb->xceiv->default_a = 1; | 335 | otg->default_a = 1; |
335 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 336 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; |
336 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); | 337 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); |
337 | del_timer(&otg_workaround); | 338 | del_timer(&otg_workaround); |
338 | } else { | 339 | } else { |
339 | musb->is_active = 0; | 340 | musb->is_active = 0; |
340 | MUSB_DEV_MODE(musb); | 341 | MUSB_DEV_MODE(musb); |
341 | musb->xceiv->default_a = 0; | 342 | otg->default_a = 0; |
342 | musb->xceiv->state = OTG_STATE_B_IDLE; | 343 | musb->xceiv->state = OTG_STATE_B_IDLE; |
343 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); | 344 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); |
344 | } | 345 | } |
@@ -383,7 +384,7 @@ static int davinci_musb_init(struct musb *musb) | |||
383 | u32 revision; | 384 | u32 revision; |
384 | 385 | ||
385 | usb_nop_xceiv_register(); | 386 | usb_nop_xceiv_register(); |
386 | musb->xceiv = otg_get_transceiver(); | 387 | musb->xceiv = usb_get_transceiver(); |
387 | if (!musb->xceiv) | 388 | if (!musb->xceiv) |
388 | return -ENODEV; | 389 | return -ENODEV; |
389 | 390 | ||
@@ -442,7 +443,7 @@ static int davinci_musb_init(struct musb *musb) | |||
442 | return 0; | 443 | return 0; |
443 | 444 | ||
444 | fail: | 445 | fail: |
445 | otg_put_transceiver(musb->xceiv); | 446 | usb_put_transceiver(musb->xceiv); |
446 | usb_nop_xceiv_unregister(); | 447 | usb_nop_xceiv_unregister(); |
447 | return -ENODEV; | 448 | return -ENODEV; |
448 | } | 449 | } |
@@ -464,7 +465,7 @@ static int davinci_musb_exit(struct musb *musb) | |||
464 | davinci_musb_source_power(musb, 0 /*off*/, 1); | 465 | davinci_musb_source_power(musb, 0 /*off*/, 1); |
465 | 466 | ||
466 | /* delay, to avoid problems with module reload */ | 467 | /* delay, to avoid problems with module reload */ |
467 | if (is_host_enabled(musb) && musb->xceiv->default_a) { | 468 | if (is_host_enabled(musb) && musb->xceiv->otg->default_a) { |
468 | int maxdelay = 30; | 469 | int maxdelay = 30; |
469 | u8 devctl, warn = 0; | 470 | u8 devctl, warn = 0; |
470 | 471 | ||
@@ -491,7 +492,7 @@ static int davinci_musb_exit(struct musb *musb) | |||
491 | 492 | ||
492 | phy_off(); | 493 | phy_off(); |
493 | 494 | ||
494 | otg_put_transceiver(musb->xceiv); | 495 | usb_put_transceiver(musb->xceiv); |
495 | usb_nop_xceiv_unregister(); | 496 | usb_nop_xceiv_unregister(); |
496 | 497 | ||
497 | return 0; | 498 | return 0; |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 3746fff628b..b527e9e6dba 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -131,9 +131,9 @@ static inline struct musb *dev_to_musb(struct device *dev) | |||
131 | /*-------------------------------------------------------------------------*/ | 131 | /*-------------------------------------------------------------------------*/ |
132 | 132 | ||
133 | #ifndef CONFIG_BLACKFIN | 133 | #ifndef CONFIG_BLACKFIN |
134 | static int musb_ulpi_read(struct otg_transceiver *otg, u32 offset) | 134 | static int musb_ulpi_read(struct usb_phy *phy, u32 offset) |
135 | { | 135 | { |
136 | void __iomem *addr = otg->io_priv; | 136 | void __iomem *addr = phy->io_priv; |
137 | int i = 0; | 137 | int i = 0; |
138 | u8 r; | 138 | u8 r; |
139 | u8 power; | 139 | u8 power; |
@@ -165,10 +165,9 @@ static int musb_ulpi_read(struct otg_transceiver *otg, u32 offset) | |||
165 | return musb_readb(addr, MUSB_ULPI_REG_DATA); | 165 | return musb_readb(addr, MUSB_ULPI_REG_DATA); |
166 | } | 166 | } |
167 | 167 | ||
168 | static int musb_ulpi_write(struct otg_transceiver *otg, | 168 | static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) |
169 | u32 offset, u32 data) | ||
170 | { | 169 | { |
171 | void __iomem *addr = otg->io_priv; | 170 | void __iomem *addr = phy->io_priv; |
172 | int i = 0; | 171 | int i = 0; |
173 | u8 r = 0; | 172 | u8 r = 0; |
174 | u8 power; | 173 | u8 power; |
@@ -200,7 +199,7 @@ static int musb_ulpi_write(struct otg_transceiver *otg, | |||
200 | #define musb_ulpi_write NULL | 199 | #define musb_ulpi_write NULL |
201 | #endif | 200 | #endif |
202 | 201 | ||
203 | static struct otg_io_access_ops musb_ulpi_access = { | 202 | static struct usb_phy_io_ops musb_ulpi_access = { |
204 | .read = musb_ulpi_read, | 203 | .read = musb_ulpi_read, |
205 | .write = musb_ulpi_write, | 204 | .write = musb_ulpi_write, |
206 | }; | 205 | }; |
@@ -414,6 +413,7 @@ void musb_hnp_stop(struct musb *musb) | |||
414 | static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | 413 | static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, |
415 | u8 devctl, u8 power) | 414 | u8 devctl, u8 power) |
416 | { | 415 | { |
416 | struct usb_otg *otg = musb->xceiv->otg; | ||
417 | irqreturn_t handled = IRQ_NONE; | 417 | irqreturn_t handled = IRQ_NONE; |
418 | 418 | ||
419 | dev_dbg(musb->controller, "<== Power=%02x, DevCtl=%02x, int_usb=0x%x\n", power, devctl, | 419 | dev_dbg(musb->controller, "<== Power=%02x, DevCtl=%02x, int_usb=0x%x\n", power, devctl, |
@@ -626,7 +626,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
626 | case OTG_STATE_B_PERIPHERAL: | 626 | case OTG_STATE_B_PERIPHERAL: |
627 | musb_g_suspend(musb); | 627 | musb_g_suspend(musb); |
628 | musb->is_active = is_otg_enabled(musb) | 628 | musb->is_active = is_otg_enabled(musb) |
629 | && musb->xceiv->gadget->b_hnp_enable; | 629 | && otg->gadget->b_hnp_enable; |
630 | if (musb->is_active) { | 630 | if (musb->is_active) { |
631 | musb->xceiv->state = OTG_STATE_B_WAIT_ACON; | 631 | musb->xceiv->state = OTG_STATE_B_WAIT_ACON; |
632 | dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n"); | 632 | dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n"); |
@@ -643,7 +643,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
643 | case OTG_STATE_A_HOST: | 643 | case OTG_STATE_A_HOST: |
644 | musb->xceiv->state = OTG_STATE_A_SUSPEND; | 644 | musb->xceiv->state = OTG_STATE_A_SUSPEND; |
645 | musb->is_active = is_otg_enabled(musb) | 645 | musb->is_active = is_otg_enabled(musb) |
646 | && musb->xceiv->host->b_hnp_enable; | 646 | && otg->host->b_hnp_enable; |
647 | break; | 647 | break; |
648 | case OTG_STATE_B_HOST: | 648 | case OTG_STATE_B_HOST: |
649 | /* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */ | 649 | /* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */ |
@@ -1961,11 +1961,11 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1961 | if (is_host_enabled(musb)) { | 1961 | if (is_host_enabled(musb)) { |
1962 | struct usb_hcd *hcd = musb_to_hcd(musb); | 1962 | struct usb_hcd *hcd = musb_to_hcd(musb); |
1963 | 1963 | ||
1964 | otg_set_host(musb->xceiv, &hcd->self); | 1964 | otg_set_host(musb->xceiv->otg, &hcd->self); |
1965 | 1965 | ||
1966 | if (is_otg_enabled(musb)) | 1966 | if (is_otg_enabled(musb)) |
1967 | hcd->self.otg_port = 1; | 1967 | hcd->self.otg_port = 1; |
1968 | musb->xceiv->host = &hcd->self; | 1968 | musb->xceiv->otg->host = &hcd->self; |
1969 | hcd->power_budget = 2 * (plat->power ? : 250); | 1969 | hcd->power_budget = 2 * (plat->power ? : 250); |
1970 | 1970 | ||
1971 | /* program PHY to use external vBus if required */ | 1971 | /* program PHY to use external vBus if required */ |
@@ -1984,7 +1984,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1984 | struct usb_hcd *hcd = musb_to_hcd(musb); | 1984 | struct usb_hcd *hcd = musb_to_hcd(musb); |
1985 | 1985 | ||
1986 | MUSB_HST_MODE(musb); | 1986 | MUSB_HST_MODE(musb); |
1987 | musb->xceiv->default_a = 1; | 1987 | musb->xceiv->otg->default_a = 1; |
1988 | musb->xceiv->state = OTG_STATE_A_IDLE; | 1988 | musb->xceiv->state = OTG_STATE_A_IDLE; |
1989 | 1989 | ||
1990 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); | 1990 | status = usb_add_hcd(musb_to_hcd(musb), -1, 0); |
@@ -1999,7 +1999,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1999 | 1999 | ||
2000 | } else /* peripheral is enabled */ { | 2000 | } else /* peripheral is enabled */ { |
2001 | MUSB_DEV_MODE(musb); | 2001 | MUSB_DEV_MODE(musb); |
2002 | musb->xceiv->default_a = 0; | 2002 | musb->xceiv->otg->default_a = 0; |
2003 | musb->xceiv->state = OTG_STATE_B_IDLE; | 2003 | musb->xceiv->state = OTG_STATE_B_IDLE; |
2004 | 2004 | ||
2005 | status = musb_gadget_setup(musb); | 2005 | status = musb_gadget_setup(musb); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 3d28fb8a2dc..93de517a32a 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -372,7 +372,7 @@ struct musb { | |||
372 | u16 int_rx; | 372 | u16 int_rx; |
373 | u16 int_tx; | 373 | u16 int_tx; |
374 | 374 | ||
375 | struct otg_transceiver *xceiv; | 375 | struct usb_phy *xceiv; |
376 | u8 xceiv_event; | 376 | u8 xceiv_event; |
377 | 377 | ||
378 | int nIrq; | 378 | int nIrq; |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 957d9ca3d06..a495a3079c0 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -1642,7 +1642,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget) | |||
1642 | } | 1642 | } |
1643 | 1643 | ||
1644 | spin_unlock_irqrestore(&musb->lock, flags); | 1644 | spin_unlock_irqrestore(&musb->lock, flags); |
1645 | otg_start_srp(musb->xceiv); | 1645 | otg_start_srp(musb->xceiv->otg); |
1646 | spin_lock_irqsave(&musb->lock, flags); | 1646 | spin_lock_irqsave(&musb->lock, flags); |
1647 | 1647 | ||
1648 | /* Block idling for at least 1s */ | 1648 | /* Block idling for at least 1s */ |
@@ -1721,7 +1721,7 @@ static int musb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) | |||
1721 | 1721 | ||
1722 | if (!musb->xceiv->set_power) | 1722 | if (!musb->xceiv->set_power) |
1723 | return -EOPNOTSUPP; | 1723 | return -EOPNOTSUPP; |
1724 | return otg_set_power(musb->xceiv, mA); | 1724 | return usb_phy_set_power(musb->xceiv, mA); |
1725 | } | 1725 | } |
1726 | 1726 | ||
1727 | static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) | 1727 | static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) |
@@ -1916,6 +1916,7 @@ static int musb_gadget_start(struct usb_gadget *g, | |||
1916 | struct usb_gadget_driver *driver) | 1916 | struct usb_gadget_driver *driver) |
1917 | { | 1917 | { |
1918 | struct musb *musb = gadget_to_musb(g); | 1918 | struct musb *musb = gadget_to_musb(g); |
1919 | struct usb_otg *otg = musb->xceiv->otg; | ||
1919 | unsigned long flags; | 1920 | unsigned long flags; |
1920 | int retval = -EINVAL; | 1921 | int retval = -EINVAL; |
1921 | 1922 | ||
@@ -1932,7 +1933,7 @@ static int musb_gadget_start(struct usb_gadget *g, | |||
1932 | spin_lock_irqsave(&musb->lock, flags); | 1933 | spin_lock_irqsave(&musb->lock, flags); |
1933 | musb->is_active = 1; | 1934 | musb->is_active = 1; |
1934 | 1935 | ||
1935 | otg_set_peripheral(musb->xceiv, &musb->g); | 1936 | otg_set_peripheral(otg, &musb->g); |
1936 | musb->xceiv->state = OTG_STATE_B_IDLE; | 1937 | musb->xceiv->state = OTG_STATE_B_IDLE; |
1937 | 1938 | ||
1938 | /* | 1939 | /* |
@@ -1963,8 +1964,8 @@ static int musb_gadget_start(struct usb_gadget *g, | |||
1963 | } | 1964 | } |
1964 | 1965 | ||
1965 | if ((musb->xceiv->last_event == USB_EVENT_ID) | 1966 | if ((musb->xceiv->last_event == USB_EVENT_ID) |
1966 | && musb->xceiv->set_vbus) | 1967 | && otg->set_vbus) |
1967 | otg_set_vbus(musb->xceiv, 1); | 1968 | otg_set_vbus(otg, 1); |
1968 | 1969 | ||
1969 | hcd->self.uses_pio_for_control = 1; | 1970 | hcd->self.uses_pio_for_control = 1; |
1970 | } | 1971 | } |
@@ -2046,7 +2047,7 @@ static int musb_gadget_stop(struct usb_gadget *g, | |||
2046 | 2047 | ||
2047 | musb->xceiv->state = OTG_STATE_UNDEFINED; | 2048 | musb->xceiv->state = OTG_STATE_UNDEFINED; |
2048 | stop_activity(musb, driver); | 2049 | stop_activity(musb, driver); |
2049 | otg_set_peripheral(musb->xceiv, NULL); | 2050 | otg_set_peripheral(musb->xceiv->otg, NULL); |
2050 | 2051 | ||
2051 | dev_dbg(musb->controller, "unregistering driver %s\n", driver->function); | 2052 | dev_dbg(musb->controller, "unregistering driver %s\n", driver->function); |
2052 | 2053 | ||
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c index e9f80adc45a..22ec3e37998 100644 --- a/drivers/usb/musb/musb_virthub.c +++ b/drivers/usb/musb/musb_virthub.c | |||
@@ -47,6 +47,7 @@ | |||
47 | 47 | ||
48 | static void musb_port_suspend(struct musb *musb, bool do_suspend) | 48 | static void musb_port_suspend(struct musb *musb, bool do_suspend) |
49 | { | 49 | { |
50 | struct usb_otg *otg = musb->xceiv->otg; | ||
50 | u8 power; | 51 | u8 power; |
51 | void __iomem *mbase = musb->mregs; | 52 | void __iomem *mbase = musb->mregs; |
52 | 53 | ||
@@ -81,7 +82,7 @@ static void musb_port_suspend(struct musb *musb, bool do_suspend) | |||
81 | case OTG_STATE_A_HOST: | 82 | case OTG_STATE_A_HOST: |
82 | musb->xceiv->state = OTG_STATE_A_SUSPEND; | 83 | musb->xceiv->state = OTG_STATE_A_SUSPEND; |
83 | musb->is_active = is_otg_enabled(musb) | 84 | musb->is_active = is_otg_enabled(musb) |
84 | && musb->xceiv->host->b_hnp_enable; | 85 | && otg->host->b_hnp_enable; |
85 | if (musb->is_active) | 86 | if (musb->is_active) |
86 | mod_timer(&musb->otg_timer, jiffies | 87 | mod_timer(&musb->otg_timer, jiffies |
87 | + msecs_to_jiffies( | 88 | + msecs_to_jiffies( |
@@ -91,7 +92,7 @@ static void musb_port_suspend(struct musb *musb, bool do_suspend) | |||
91 | case OTG_STATE_B_HOST: | 92 | case OTG_STATE_B_HOST: |
92 | musb->xceiv->state = OTG_STATE_B_WAIT_ACON; | 93 | musb->xceiv->state = OTG_STATE_B_WAIT_ACON; |
93 | musb->is_active = is_otg_enabled(musb) | 94 | musb->is_active = is_otg_enabled(musb) |
94 | && musb->xceiv->host->b_hnp_enable; | 95 | && otg->host->b_hnp_enable; |
95 | musb_platform_try_idle(musb, 0); | 96 | musb_platform_try_idle(musb, 0); |
96 | break; | 97 | break; |
97 | default: | 98 | default: |
@@ -179,6 +180,8 @@ static void musb_port_reset(struct musb *musb, bool do_reset) | |||
179 | 180 | ||
180 | void musb_root_disconnect(struct musb *musb) | 181 | void musb_root_disconnect(struct musb *musb) |
181 | { | 182 | { |
183 | struct usb_otg *otg = musb->xceiv->otg; | ||
184 | |||
182 | musb->port1_status = USB_PORT_STAT_POWER | 185 | musb->port1_status = USB_PORT_STAT_POWER |
183 | | (USB_PORT_STAT_C_CONNECTION << 16); | 186 | | (USB_PORT_STAT_C_CONNECTION << 16); |
184 | 187 | ||
@@ -188,7 +191,7 @@ void musb_root_disconnect(struct musb *musb) | |||
188 | switch (musb->xceiv->state) { | 191 | switch (musb->xceiv->state) { |
189 | case OTG_STATE_A_SUSPEND: | 192 | case OTG_STATE_A_SUSPEND: |
190 | if (is_otg_enabled(musb) | 193 | if (is_otg_enabled(musb) |
191 | && musb->xceiv->host->b_hnp_enable) { | 194 | && otg->host->b_hnp_enable) { |
192 | musb->xceiv->state = OTG_STATE_A_PERIPHERAL; | 195 | musb->xceiv->state = OTG_STATE_A_PERIPHERAL; |
193 | musb->g.is_a_peripheral = 1; | 196 | musb->g.is_a_peripheral = 1; |
194 | break; | 197 | break; |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index da430c31ebe..2ae0bb30999 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -132,6 +132,7 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout) | |||
132 | 132 | ||
133 | static void omap2430_musb_set_vbus(struct musb *musb, int is_on) | 133 | static void omap2430_musb_set_vbus(struct musb *musb, int is_on) |
134 | { | 134 | { |
135 | struct usb_otg *otg = musb->xceiv->otg; | ||
135 | u8 devctl; | 136 | u8 devctl; |
136 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); | 137 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
137 | int ret = 1; | 138 | int ret = 1; |
@@ -163,11 +164,11 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on) | |||
163 | } | 164 | } |
164 | } | 165 | } |
165 | 166 | ||
166 | if (ret && musb->xceiv->set_vbus) | 167 | if (ret && otg->set_vbus) |
167 | otg_set_vbus(musb->xceiv, 1); | 168 | otg_set_vbus(otg, 1); |
168 | } else { | 169 | } else { |
169 | musb->is_active = 1; | 170 | musb->is_active = 1; |
170 | musb->xceiv->default_a = 1; | 171 | otg->default_a = 1; |
171 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 172 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; |
172 | devctl |= MUSB_DEVCTL_SESSION; | 173 | devctl |= MUSB_DEVCTL_SESSION; |
173 | MUSB_HST_MODE(musb); | 174 | MUSB_HST_MODE(musb); |
@@ -179,7 +180,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on) | |||
179 | * jumping right to B_IDLE... | 180 | * jumping right to B_IDLE... |
180 | */ | 181 | */ |
181 | 182 | ||
182 | musb->xceiv->default_a = 0; | 183 | otg->default_a = 0; |
183 | musb->xceiv->state = OTG_STATE_B_IDLE; | 184 | musb->xceiv->state = OTG_STATE_B_IDLE; |
184 | devctl &= ~MUSB_DEVCTL_SESSION; | 185 | devctl &= ~MUSB_DEVCTL_SESSION; |
185 | 186 | ||
@@ -246,7 +247,7 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work) | |||
246 | 247 | ||
247 | if (!is_otg_enabled(musb) || musb->gadget_driver) { | 248 | if (!is_otg_enabled(musb) || musb->gadget_driver) { |
248 | pm_runtime_get_sync(musb->controller); | 249 | pm_runtime_get_sync(musb->controller); |
249 | otg_init(musb->xceiv); | 250 | usb_phy_init(musb->xceiv); |
250 | omap2430_musb_set_vbus(musb, 1); | 251 | omap2430_musb_set_vbus(musb, 1); |
251 | } | 252 | } |
252 | break; | 253 | break; |
@@ -256,7 +257,7 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work) | |||
256 | 257 | ||
257 | if (musb->gadget_driver) | 258 | if (musb->gadget_driver) |
258 | pm_runtime_get_sync(musb->controller); | 259 | pm_runtime_get_sync(musb->controller); |
259 | otg_init(musb->xceiv); | 260 | usb_phy_init(musb->xceiv); |
260 | break; | 261 | break; |
261 | 262 | ||
262 | case USB_EVENT_NONE: | 263 | case USB_EVENT_NONE: |
@@ -269,10 +270,10 @@ static void musb_otg_notifier_work(struct work_struct *data_notifier_work) | |||
269 | } | 270 | } |
270 | 271 | ||
271 | if (data->interface_type == MUSB_INTERFACE_UTMI) { | 272 | if (data->interface_type == MUSB_INTERFACE_UTMI) { |
272 | if (musb->xceiv->set_vbus) | 273 | if (musb->xceiv->otg->set_vbus) |
273 | otg_set_vbus(musb->xceiv, 0); | 274 | otg_set_vbus(musb->xceiv->otg, 0); |
274 | } | 275 | } |
275 | otg_shutdown(musb->xceiv); | 276 | usb_phy_shutdown(musb->xceiv); |
276 | break; | 277 | break; |
277 | default: | 278 | default: |
278 | dev_dbg(musb->controller, "ID float\n"); | 279 | dev_dbg(musb->controller, "ID float\n"); |
@@ -290,7 +291,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
290 | * up through ULPI. TWL4030-family PMICs include one, | 291 | * up through ULPI. TWL4030-family PMICs include one, |
291 | * which needs a driver, drivers aren't always needed. | 292 | * which needs a driver, drivers aren't always needed. |
292 | */ | 293 | */ |
293 | musb->xceiv = otg_get_transceiver(); | 294 | musb->xceiv = usb_get_transceiver(); |
294 | if (!musb->xceiv) { | 295 | if (!musb->xceiv) { |
295 | pr_err("HS USB OTG: no transceiver configured\n"); | 296 | pr_err("HS USB OTG: no transceiver configured\n"); |
296 | return -ENODEV; | 297 | return -ENODEV; |
@@ -325,7 +326,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
325 | musb_readl(musb->mregs, OTG_SIMENABLE)); | 326 | musb_readl(musb->mregs, OTG_SIMENABLE)); |
326 | 327 | ||
327 | musb->nb.notifier_call = musb_otg_notifications; | 328 | musb->nb.notifier_call = musb_otg_notifications; |
328 | status = otg_register_notifier(musb->xceiv, &musb->nb); | 329 | status = usb_register_notifier(musb->xceiv, &musb->nb); |
329 | 330 | ||
330 | if (status) | 331 | if (status) |
331 | dev_dbg(musb->controller, "notification register failed\n"); | 332 | dev_dbg(musb->controller, "notification register failed\n"); |
@@ -349,7 +350,7 @@ static void omap2430_musb_enable(struct musb *musb) | |||
349 | switch (musb->xceiv->last_event) { | 350 | switch (musb->xceiv->last_event) { |
350 | 351 | ||
351 | case USB_EVENT_ID: | 352 | case USB_EVENT_ID: |
352 | otg_init(musb->xceiv); | 353 | usb_phy_init(musb->xceiv); |
353 | if (data->interface_type != MUSB_INTERFACE_UTMI) | 354 | if (data->interface_type != MUSB_INTERFACE_UTMI) |
354 | break; | 355 | break; |
355 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | 356 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); |
@@ -368,7 +369,7 @@ static void omap2430_musb_enable(struct musb *musb) | |||
368 | break; | 369 | break; |
369 | 370 | ||
370 | case USB_EVENT_VBUS: | 371 | case USB_EVENT_VBUS: |
371 | otg_init(musb->xceiv); | 372 | usb_phy_init(musb->xceiv); |
372 | break; | 373 | break; |
373 | 374 | ||
374 | default: | 375 | default: |
@@ -379,7 +380,7 @@ static void omap2430_musb_enable(struct musb *musb) | |||
379 | static void omap2430_musb_disable(struct musb *musb) | 380 | static void omap2430_musb_disable(struct musb *musb) |
380 | { | 381 | { |
381 | if (musb->xceiv->last_event) | 382 | if (musb->xceiv->last_event) |
382 | otg_shutdown(musb->xceiv); | 383 | usb_phy_shutdown(musb->xceiv); |
383 | } | 384 | } |
384 | 385 | ||
385 | static int omap2430_musb_exit(struct musb *musb) | 386 | static int omap2430_musb_exit(struct musb *musb) |
@@ -388,7 +389,7 @@ static int omap2430_musb_exit(struct musb *musb) | |||
388 | cancel_work_sync(&musb->otg_notifier_work); | 389 | cancel_work_sync(&musb->otg_notifier_work); |
389 | 390 | ||
390 | omap2430_low_level_exit(musb); | 391 | omap2430_low_level_exit(musb); |
391 | otg_put_transceiver(musb->xceiv); | 392 | usb_put_transceiver(musb->xceiv); |
392 | 393 | ||
393 | return 0; | 394 | return 0; |
394 | } | 395 | } |
@@ -494,7 +495,7 @@ static int omap2430_runtime_suspend(struct device *dev) | |||
494 | OTG_INTERFSEL); | 495 | OTG_INTERFSEL); |
495 | 496 | ||
496 | omap2430_low_level_exit(musb); | 497 | omap2430_low_level_exit(musb); |
497 | otg_set_suspend(musb->xceiv, 1); | 498 | usb_phy_set_suspend(musb->xceiv, 1); |
498 | 499 | ||
499 | return 0; | 500 | return 0; |
500 | } | 501 | } |
@@ -508,7 +509,7 @@ static int omap2430_runtime_resume(struct device *dev) | |||
508 | musb_writel(musb->mregs, OTG_INTERFSEL, | 509 | musb_writel(musb->mregs, OTG_INTERFSEL, |
509 | musb->context.otg_interfsel); | 510 | musb->context.otg_interfsel); |
510 | 511 | ||
511 | otg_set_suspend(musb->xceiv, 0); | 512 | usb_phy_set_suspend(musb->xceiv, 0); |
512 | 513 | ||
513 | return 0; | 514 | return 0; |
514 | } | 515 | } |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index b387f12d05b..de1355946a8 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -277,7 +277,7 @@ static struct musb *the_musb; | |||
277 | * mode), or low power Default-B sessions, something else supplies power. | 277 | * mode), or low power Default-B sessions, something else supplies power. |
278 | * Caller must take care of locking. | 278 | * Caller must take care of locking. |
279 | */ | 279 | */ |
280 | static int tusb_draw_power(struct otg_transceiver *x, unsigned mA) | 280 | static int tusb_draw_power(struct usb_phy *x, unsigned mA) |
281 | { | 281 | { |
282 | struct musb *musb = the_musb; | 282 | struct musb *musb = the_musb; |
283 | void __iomem *tbase = musb->ctrl_base; | 283 | void __iomem *tbase = musb->ctrl_base; |
@@ -293,7 +293,7 @@ static int tusb_draw_power(struct otg_transceiver *x, unsigned mA) | |||
293 | * The actual current usage would be very board-specific. For now, | 293 | * The actual current usage would be very board-specific. For now, |
294 | * it's simpler to just use an aggregate (also board-specific). | 294 | * it's simpler to just use an aggregate (also board-specific). |
295 | */ | 295 | */ |
296 | if (x->default_a || mA < (musb->min_power << 1)) | 296 | if (x->otg->default_a || mA < (musb->min_power << 1)) |
297 | mA = 0; | 297 | mA = 0; |
298 | 298 | ||
299 | reg = musb_readl(tbase, TUSB_PRCM_MNGMT); | 299 | reg = musb_readl(tbase, TUSB_PRCM_MNGMT); |
@@ -510,6 +510,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on) | |||
510 | void __iomem *tbase = musb->ctrl_base; | 510 | void __iomem *tbase = musb->ctrl_base; |
511 | u32 conf, prcm, timer; | 511 | u32 conf, prcm, timer; |
512 | u8 devctl; | 512 | u8 devctl; |
513 | struct usb_otg *otg = musb->xceiv->otg; | ||
513 | 514 | ||
514 | /* HDRC controls CPEN, but beware current surges during device | 515 | /* HDRC controls CPEN, but beware current surges during device |
515 | * connect. They can trigger transient overcurrent conditions | 516 | * connect. They can trigger transient overcurrent conditions |
@@ -522,7 +523,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on) | |||
522 | 523 | ||
523 | if (is_on) { | 524 | if (is_on) { |
524 | timer = OTG_TIMER_MS(OTG_TIME_A_WAIT_VRISE); | 525 | timer = OTG_TIMER_MS(OTG_TIME_A_WAIT_VRISE); |
525 | musb->xceiv->default_a = 1; | 526 | otg->default_a = 1; |
526 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 527 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; |
527 | devctl |= MUSB_DEVCTL_SESSION; | 528 | devctl |= MUSB_DEVCTL_SESSION; |
528 | 529 | ||
@@ -548,11 +549,11 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on) | |||
548 | musb->xceiv->state = OTG_STATE_A_IDLE; | 549 | musb->xceiv->state = OTG_STATE_A_IDLE; |
549 | } | 550 | } |
550 | musb->is_active = 0; | 551 | musb->is_active = 0; |
551 | musb->xceiv->default_a = 1; | 552 | otg->default_a = 1; |
552 | MUSB_HST_MODE(musb); | 553 | MUSB_HST_MODE(musb); |
553 | } else { | 554 | } else { |
554 | musb->is_active = 0; | 555 | musb->is_active = 0; |
555 | musb->xceiv->default_a = 0; | 556 | otg->default_a = 0; |
556 | musb->xceiv->state = OTG_STATE_B_IDLE; | 557 | musb->xceiv->state = OTG_STATE_B_IDLE; |
557 | MUSB_DEV_MODE(musb); | 558 | MUSB_DEV_MODE(musb); |
558 | } | 559 | } |
@@ -644,6 +645,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
644 | { | 645 | { |
645 | u32 otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT); | 646 | u32 otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT); |
646 | unsigned long idle_timeout = 0; | 647 | unsigned long idle_timeout = 0; |
648 | struct usb_otg *otg = musb->xceiv->otg; | ||
647 | 649 | ||
648 | /* ID pin */ | 650 | /* ID pin */ |
649 | if ((int_src & TUSB_INT_SRC_ID_STATUS_CHNG)) { | 651 | if ((int_src & TUSB_INT_SRC_ID_STATUS_CHNG)) { |
@@ -654,7 +656,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
654 | else | 656 | else |
655 | default_a = is_host_enabled(musb); | 657 | default_a = is_host_enabled(musb); |
656 | dev_dbg(musb->controller, "Default-%c\n", default_a ? 'A' : 'B'); | 658 | dev_dbg(musb->controller, "Default-%c\n", default_a ? 'A' : 'B'); |
657 | musb->xceiv->default_a = default_a; | 659 | otg->default_a = default_a; |
658 | tusb_musb_set_vbus(musb, default_a); | 660 | tusb_musb_set_vbus(musb, default_a); |
659 | 661 | ||
660 | /* Don't allow idling immediately */ | 662 | /* Don't allow idling immediately */ |
@@ -666,7 +668,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
666 | if (int_src & TUSB_INT_SRC_VBUS_SENSE_CHNG) { | 668 | if (int_src & TUSB_INT_SRC_VBUS_SENSE_CHNG) { |
667 | 669 | ||
668 | /* B-dev state machine: no vbus ~= disconnect */ | 670 | /* B-dev state machine: no vbus ~= disconnect */ |
669 | if ((is_otg_enabled(musb) && !musb->xceiv->default_a) | 671 | if ((is_otg_enabled(musb) && !otg->default_a) |
670 | || !is_host_enabled(musb)) { | 672 | || !is_host_enabled(musb)) { |
671 | /* ? musb_root_disconnect(musb); */ | 673 | /* ? musb_root_disconnect(musb); */ |
672 | musb->port1_status &= | 674 | musb->port1_status &= |
@@ -1076,7 +1078,7 @@ static int tusb_musb_init(struct musb *musb) | |||
1076 | int ret; | 1078 | int ret; |
1077 | 1079 | ||
1078 | usb_nop_xceiv_register(); | 1080 | usb_nop_xceiv_register(); |
1079 | musb->xceiv = otg_get_transceiver(); | 1081 | musb->xceiv = usb_get_transceiver(); |
1080 | if (!musb->xceiv) | 1082 | if (!musb->xceiv) |
1081 | return -ENODEV; | 1083 | return -ENODEV; |
1082 | 1084 | ||
@@ -1128,7 +1130,7 @@ done: | |||
1128 | if (sync) | 1130 | if (sync) |
1129 | iounmap(sync); | 1131 | iounmap(sync); |
1130 | 1132 | ||
1131 | otg_put_transceiver(musb->xceiv); | 1133 | usb_put_transceiver(musb->xceiv); |
1132 | usb_nop_xceiv_unregister(); | 1134 | usb_nop_xceiv_unregister(); |
1133 | } | 1135 | } |
1134 | return ret; | 1136 | return ret; |
@@ -1144,7 +1146,7 @@ static int tusb_musb_exit(struct musb *musb) | |||
1144 | 1146 | ||
1145 | iounmap(musb->sync_va); | 1147 | iounmap(musb->sync_va); |
1146 | 1148 | ||
1147 | otg_put_transceiver(musb->xceiv); | 1149 | usb_put_transceiver(musb->xceiv); |
1148 | usb_nop_xceiv_unregister(); | 1150 | usb_nop_xceiv_unregister(); |
1149 | return 0; | 1151 | return 0; |
1150 | } | 1152 | } |
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index bcfc48f4854..aa09dd417b9 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c | |||
@@ -37,7 +37,7 @@ struct ux500_glue { | |||
37 | 37 | ||
38 | static int ux500_musb_init(struct musb *musb) | 38 | static int ux500_musb_init(struct musb *musb) |
39 | { | 39 | { |
40 | musb->xceiv = otg_get_transceiver(); | 40 | musb->xceiv = usb_get_transceiver(); |
41 | if (!musb->xceiv) { | 41 | if (!musb->xceiv) { |
42 | pr_err("HS USB OTG: no transceiver configured\n"); | 42 | pr_err("HS USB OTG: no transceiver configured\n"); |
43 | return -ENODEV; | 43 | return -ENODEV; |
@@ -48,7 +48,7 @@ static int ux500_musb_init(struct musb *musb) | |||
48 | 48 | ||
49 | static int ux500_musb_exit(struct musb *musb) | 49 | static int ux500_musb_exit(struct musb *musb) |
50 | { | 50 | { |
51 | otg_put_transceiver(musb->xceiv); | 51 | usb_put_transceiver(musb->xceiv); |
52 | 52 | ||
53 | return 0; | 53 | return 0; |
54 | } | 54 | } |
@@ -160,7 +160,7 @@ static int ux500_suspend(struct device *dev) | |||
160 | struct ux500_glue *glue = dev_get_drvdata(dev); | 160 | struct ux500_glue *glue = dev_get_drvdata(dev); |
161 | struct musb *musb = glue_to_musb(glue); | 161 | struct musb *musb = glue_to_musb(glue); |
162 | 162 | ||
163 | otg_set_suspend(musb->xceiv, 1); | 163 | usb_phy_set_suspend(musb->xceiv, 1); |
164 | clk_disable(glue->clk); | 164 | clk_disable(glue->clk); |
165 | 165 | ||
166 | return 0; | 166 | return 0; |
@@ -178,7 +178,7 @@ static int ux500_resume(struct device *dev) | |||
178 | return ret; | 178 | return ret; |
179 | } | 179 | } |
180 | 180 | ||
181 | otg_set_suspend(musb->xceiv, 0); | 181 | usb_phy_set_suspend(musb->xceiv, 0); |
182 | 182 | ||
183 | return 0; | 183 | return 0; |
184 | } | 184 | } |
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig index 735ef4c2339..5c87db06b59 100644 --- a/drivers/usb/otg/Kconfig +++ b/drivers/usb/otg/Kconfig | |||
@@ -23,7 +23,7 @@ config USB_GPIO_VBUS | |||
23 | select USB_OTG_UTILS | 23 | select USB_OTG_UTILS |
24 | help | 24 | help |
25 | Provides simple GPIO VBUS sensing for controllers with an | 25 | Provides simple GPIO VBUS sensing for controllers with an |
26 | internal transceiver via the otg_transceiver interface, and | 26 | internal transceiver via the usb_phy interface, and |
27 | optionally control of a D+ pullup GPIO as well as a VBUS | 27 | optionally control of a D+ pullup GPIO as well as a VBUS |
28 | current limit regulator. | 28 | current limit regulator. |
29 | 29 | ||
diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c index 74fe6e62e0f..e6371ff5f58 100644 --- a/drivers/usb/otg/ab8500-usb.c +++ b/drivers/usb/otg/ab8500-usb.c | |||
@@ -68,7 +68,7 @@ enum ab8500_usb_link_status { | |||
68 | }; | 68 | }; |
69 | 69 | ||
70 | struct ab8500_usb { | 70 | struct ab8500_usb { |
71 | struct otg_transceiver otg; | 71 | struct usb_phy phy; |
72 | struct device *dev; | 72 | struct device *dev; |
73 | int irq_num_id_rise; | 73 | int irq_num_id_rise; |
74 | int irq_num_id_fall; | 74 | int irq_num_id_fall; |
@@ -82,9 +82,9 @@ struct ab8500_usb { | |||
82 | int rev; | 82 | int rev; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static inline struct ab8500_usb *xceiv_to_ab(struct otg_transceiver *x) | 85 | static inline struct ab8500_usb *phy_to_ab(struct usb_phy *x) |
86 | { | 86 | { |
87 | return container_of(x, struct ab8500_usb, otg); | 87 | return container_of(x, struct ab8500_usb, phy); |
88 | } | 88 | } |
89 | 89 | ||
90 | static void ab8500_usb_wd_workaround(struct ab8500_usb *ab) | 90 | static void ab8500_usb_wd_workaround(struct ab8500_usb *ab) |
@@ -153,7 +153,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab) | |||
153 | u8 reg; | 153 | u8 reg; |
154 | enum ab8500_usb_link_status lsts; | 154 | enum ab8500_usb_link_status lsts; |
155 | void *v = NULL; | 155 | void *v = NULL; |
156 | enum usb_xceiv_events event; | 156 | enum usb_phy_events event; |
157 | 157 | ||
158 | abx500_get_register_interruptible(ab->dev, | 158 | abx500_get_register_interruptible(ab->dev, |
159 | AB8500_USB, | 159 | AB8500_USB, |
@@ -169,8 +169,8 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab) | |||
169 | /* TODO: Disable regulators. */ | 169 | /* TODO: Disable regulators. */ |
170 | ab8500_usb_host_phy_dis(ab); | 170 | ab8500_usb_host_phy_dis(ab); |
171 | ab8500_usb_peri_phy_dis(ab); | 171 | ab8500_usb_peri_phy_dis(ab); |
172 | ab->otg.state = OTG_STATE_B_IDLE; | 172 | ab->phy.state = OTG_STATE_B_IDLE; |
173 | ab->otg.default_a = false; | 173 | ab->phy.otg->default_a = false; |
174 | ab->vbus_draw = 0; | 174 | ab->vbus_draw = 0; |
175 | event = USB_EVENT_NONE; | 175 | event = USB_EVENT_NONE; |
176 | break; | 176 | break; |
@@ -181,22 +181,22 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab) | |||
181 | case USB_LINK_HOST_CHG_NM: | 181 | case USB_LINK_HOST_CHG_NM: |
182 | case USB_LINK_HOST_CHG_HS: | 182 | case USB_LINK_HOST_CHG_HS: |
183 | case USB_LINK_HOST_CHG_HS_CHIRP: | 183 | case USB_LINK_HOST_CHG_HS_CHIRP: |
184 | if (ab->otg.gadget) { | 184 | if (ab->phy.otg->gadget) { |
185 | /* TODO: Enable regulators. */ | 185 | /* TODO: Enable regulators. */ |
186 | ab8500_usb_peri_phy_en(ab); | 186 | ab8500_usb_peri_phy_en(ab); |
187 | v = ab->otg.gadget; | 187 | v = ab->phy.otg->gadget; |
188 | } | 188 | } |
189 | event = USB_EVENT_VBUS; | 189 | event = USB_EVENT_VBUS; |
190 | break; | 190 | break; |
191 | 191 | ||
192 | case USB_LINK_HM_IDGND: | 192 | case USB_LINK_HM_IDGND: |
193 | if (ab->otg.host) { | 193 | if (ab->phy.otg->host) { |
194 | /* TODO: Enable regulators. */ | 194 | /* TODO: Enable regulators. */ |
195 | ab8500_usb_host_phy_en(ab); | 195 | ab8500_usb_host_phy_en(ab); |
196 | v = ab->otg.host; | 196 | v = ab->phy.otg->host; |
197 | } | 197 | } |
198 | ab->otg.state = OTG_STATE_A_IDLE; | 198 | ab->phy.state = OTG_STATE_A_IDLE; |
199 | ab->otg.default_a = true; | 199 | ab->phy.otg->default_a = true; |
200 | event = USB_EVENT_ID; | 200 | event = USB_EVENT_ID; |
201 | break; | 201 | break; |
202 | 202 | ||
@@ -212,7 +212,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab) | |||
212 | break; | 212 | break; |
213 | } | 213 | } |
214 | 214 | ||
215 | atomic_notifier_call_chain(&ab->otg.notifier, event, v); | 215 | atomic_notifier_call_chain(&ab->phy.notifier, event, v); |
216 | 216 | ||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
@@ -262,27 +262,27 @@ static void ab8500_usb_phy_disable_work(struct work_struct *work) | |||
262 | struct ab8500_usb *ab = container_of(work, struct ab8500_usb, | 262 | struct ab8500_usb *ab = container_of(work, struct ab8500_usb, |
263 | phy_dis_work); | 263 | phy_dis_work); |
264 | 264 | ||
265 | if (!ab->otg.host) | 265 | if (!ab->phy.otg->host) |
266 | ab8500_usb_host_phy_dis(ab); | 266 | ab8500_usb_host_phy_dis(ab); |
267 | 267 | ||
268 | if (!ab->otg.gadget) | 268 | if (!ab->phy.otg->gadget) |
269 | ab8500_usb_peri_phy_dis(ab); | 269 | ab8500_usb_peri_phy_dis(ab); |
270 | } | 270 | } |
271 | 271 | ||
272 | static int ab8500_usb_set_power(struct otg_transceiver *otg, unsigned mA) | 272 | static int ab8500_usb_set_power(struct usb_phy *phy, unsigned mA) |
273 | { | 273 | { |
274 | struct ab8500_usb *ab; | 274 | struct ab8500_usb *ab; |
275 | 275 | ||
276 | if (!otg) | 276 | if (!phy) |
277 | return -ENODEV; | 277 | return -ENODEV; |
278 | 278 | ||
279 | ab = xceiv_to_ab(otg); | 279 | ab = phy_to_ab(phy); |
280 | 280 | ||
281 | ab->vbus_draw = mA; | 281 | ab->vbus_draw = mA; |
282 | 282 | ||
283 | if (mA) | 283 | if (mA) |
284 | atomic_notifier_call_chain(&ab->otg.notifier, | 284 | atomic_notifier_call_chain(&ab->phy.notifier, |
285 | USB_EVENT_ENUMERATED, ab->otg.gadget); | 285 | USB_EVENT_ENUMERATED, ab->phy.otg->gadget); |
286 | return 0; | 286 | return 0; |
287 | } | 287 | } |
288 | 288 | ||
@@ -290,21 +290,21 @@ static int ab8500_usb_set_power(struct otg_transceiver *otg, unsigned mA) | |||
290 | * ab->vbus_draw. | 290 | * ab->vbus_draw. |
291 | */ | 291 | */ |
292 | 292 | ||
293 | static int ab8500_usb_set_suspend(struct otg_transceiver *x, int suspend) | 293 | static int ab8500_usb_set_suspend(struct usb_phy *x, int suspend) |
294 | { | 294 | { |
295 | /* TODO */ | 295 | /* TODO */ |
296 | return 0; | 296 | return 0; |
297 | } | 297 | } |
298 | 298 | ||
299 | static int ab8500_usb_set_peripheral(struct otg_transceiver *otg, | 299 | static int ab8500_usb_set_peripheral(struct usb_otg *otg, |
300 | struct usb_gadget *gadget) | 300 | struct usb_gadget *gadget) |
301 | { | 301 | { |
302 | struct ab8500_usb *ab; | 302 | struct ab8500_usb *ab; |
303 | 303 | ||
304 | if (!otg) | 304 | if (!otg) |
305 | return -ENODEV; | 305 | return -ENODEV; |
306 | 306 | ||
307 | ab = xceiv_to_ab(otg); | 307 | ab = phy_to_ab(otg->phy); |
308 | 308 | ||
309 | /* Some drivers call this function in atomic context. | 309 | /* Some drivers call this function in atomic context. |
310 | * Do not update ab8500 registers directly till this | 310 | * Do not update ab8500 registers directly till this |
@@ -313,11 +313,11 @@ static int ab8500_usb_set_peripheral(struct otg_transceiver *otg, | |||
313 | 313 | ||
314 | if (!gadget) { | 314 | if (!gadget) { |
315 | /* TODO: Disable regulators. */ | 315 | /* TODO: Disable regulators. */ |
316 | ab->otg.gadget = NULL; | 316 | otg->gadget = NULL; |
317 | schedule_work(&ab->phy_dis_work); | 317 | schedule_work(&ab->phy_dis_work); |
318 | } else { | 318 | } else { |
319 | ab->otg.gadget = gadget; | 319 | otg->gadget = gadget; |
320 | ab->otg.state = OTG_STATE_B_IDLE; | 320 | otg->phy->state = OTG_STATE_B_IDLE; |
321 | 321 | ||
322 | /* Phy will not be enabled if cable is already | 322 | /* Phy will not be enabled if cable is already |
323 | * plugged-in. Schedule to enable phy. | 323 | * plugged-in. Schedule to enable phy. |
@@ -329,15 +329,14 @@ static int ab8500_usb_set_peripheral(struct otg_transceiver *otg, | |||
329 | return 0; | 329 | return 0; |
330 | } | 330 | } |
331 | 331 | ||
332 | static int ab8500_usb_set_host(struct otg_transceiver *otg, | 332 | static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) |
333 | struct usb_bus *host) | ||
334 | { | 333 | { |
335 | struct ab8500_usb *ab; | 334 | struct ab8500_usb *ab; |
336 | 335 | ||
337 | if (!otg) | 336 | if (!otg) |
338 | return -ENODEV; | 337 | return -ENODEV; |
339 | 338 | ||
340 | ab = xceiv_to_ab(otg); | 339 | ab = phy_to_ab(otg->phy); |
341 | 340 | ||
342 | /* Some drivers call this function in atomic context. | 341 | /* Some drivers call this function in atomic context. |
343 | * Do not update ab8500 registers directly till this | 342 | * Do not update ab8500 registers directly till this |
@@ -346,10 +345,10 @@ static int ab8500_usb_set_host(struct otg_transceiver *otg, | |||
346 | 345 | ||
347 | if (!host) { | 346 | if (!host) { |
348 | /* TODO: Disable regulators. */ | 347 | /* TODO: Disable regulators. */ |
349 | ab->otg.host = NULL; | 348 | otg->host = NULL; |
350 | schedule_work(&ab->phy_dis_work); | 349 | schedule_work(&ab->phy_dis_work); |
351 | } else { | 350 | } else { |
352 | ab->otg.host = host; | 351 | otg->host = host; |
353 | /* Phy will not be enabled if cable is already | 352 | /* Phy will not be enabled if cable is already |
354 | * plugged-in. Schedule to enable phy. | 353 | * plugged-in. Schedule to enable phy. |
355 | * Use same delay to avoid any race condition. | 354 | * Use same delay to avoid any race condition. |
@@ -472,6 +471,7 @@ static int ab8500_usb_v2_res_setup(struct platform_device *pdev, | |||
472 | static int __devinit ab8500_usb_probe(struct platform_device *pdev) | 471 | static int __devinit ab8500_usb_probe(struct platform_device *pdev) |
473 | { | 472 | { |
474 | struct ab8500_usb *ab; | 473 | struct ab8500_usb *ab; |
474 | struct usb_otg *otg; | ||
475 | int err; | 475 | int err; |
476 | int rev; | 476 | int rev; |
477 | 477 | ||
@@ -488,19 +488,28 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev) | |||
488 | if (!ab) | 488 | if (!ab) |
489 | return -ENOMEM; | 489 | return -ENOMEM; |
490 | 490 | ||
491 | otg = kzalloc(sizeof *otg, GFP_KERNEL); | ||
492 | if (!ab->phy.otg) { | ||
493 | kfree(ab); | ||
494 | return -ENOMEM; | ||
495 | } | ||
496 | |||
491 | ab->dev = &pdev->dev; | 497 | ab->dev = &pdev->dev; |
492 | ab->rev = rev; | 498 | ab->rev = rev; |
493 | ab->otg.dev = ab->dev; | 499 | ab->phy.dev = ab->dev; |
494 | ab->otg.label = "ab8500"; | 500 | ab->phy.otg = otg; |
495 | ab->otg.state = OTG_STATE_UNDEFINED; | 501 | ab->phy.label = "ab8500"; |
496 | ab->otg.set_host = ab8500_usb_set_host; | 502 | ab->phy.set_suspend = ab8500_usb_set_suspend; |
497 | ab->otg.set_peripheral = ab8500_usb_set_peripheral; | 503 | ab->phy.set_power = ab8500_usb_set_power; |
498 | ab->otg.set_suspend = ab8500_usb_set_suspend; | 504 | ab->phy.state = OTG_STATE_UNDEFINED; |
499 | ab->otg.set_power = ab8500_usb_set_power; | 505 | |
506 | otg->phy = &ab->phy; | ||
507 | otg->set_host = ab8500_usb_set_host; | ||
508 | otg->set_peripheral = ab8500_usb_set_peripheral; | ||
500 | 509 | ||
501 | platform_set_drvdata(pdev, ab); | 510 | platform_set_drvdata(pdev, ab); |
502 | 511 | ||
503 | ATOMIC_INIT_NOTIFIER_HEAD(&ab->otg.notifier); | 512 | ATOMIC_INIT_NOTIFIER_HEAD(&ab->phy.notifier); |
504 | 513 | ||
505 | /* v1: Wait for link status to become stable. | 514 | /* v1: Wait for link status to become stable. |
506 | * all: Updates form set_host and set_peripheral as they are atomic. | 515 | * all: Updates form set_host and set_peripheral as they are atomic. |
@@ -520,7 +529,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev) | |||
520 | if (err < 0) | 529 | if (err < 0) |
521 | goto fail0; | 530 | goto fail0; |
522 | 531 | ||
523 | err = otg_set_transceiver(&ab->otg); | 532 | err = usb_set_transceiver(&ab->phy); |
524 | if (err) { | 533 | if (err) { |
525 | dev_err(&pdev->dev, "Can't register transceiver\n"); | 534 | dev_err(&pdev->dev, "Can't register transceiver\n"); |
526 | goto fail1; | 535 | goto fail1; |
@@ -532,6 +541,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev) | |||
532 | fail1: | 541 | fail1: |
533 | ab8500_usb_irq_free(ab); | 542 | ab8500_usb_irq_free(ab); |
534 | fail0: | 543 | fail0: |
544 | kfree(otg); | ||
535 | kfree(ab); | 545 | kfree(ab); |
536 | return err; | 546 | return err; |
537 | } | 547 | } |
@@ -546,13 +556,14 @@ static int __devexit ab8500_usb_remove(struct platform_device *pdev) | |||
546 | 556 | ||
547 | cancel_work_sync(&ab->phy_dis_work); | 557 | cancel_work_sync(&ab->phy_dis_work); |
548 | 558 | ||
549 | otg_set_transceiver(NULL); | 559 | usb_set_transceiver(NULL); |
550 | 560 | ||
551 | ab8500_usb_host_phy_dis(ab); | 561 | ab8500_usb_host_phy_dis(ab); |
552 | ab8500_usb_peri_phy_dis(ab); | 562 | ab8500_usb_peri_phy_dis(ab); |
553 | 563 | ||
554 | platform_set_drvdata(pdev, NULL); | 564 | platform_set_drvdata(pdev, NULL); |
555 | 565 | ||
566 | kfree(ab->phy.otg); | ||
556 | kfree(ab); | 567 | kfree(ab); |
557 | 568 | ||
558 | return 0; | 569 | return 0; |
diff --git a/drivers/usb/otg/fsl_otg.c b/drivers/usb/otg/fsl_otg.c index a190850d2d3..be4a63e8302 100644 --- a/drivers/usb/otg/fsl_otg.c +++ b/drivers/usb/otg/fsl_otg.c | |||
@@ -275,7 +275,7 @@ void b_srp_end(unsigned long foo) | |||
275 | fsl_otg_dischrg_vbus(0); | 275 | fsl_otg_dischrg_vbus(0); |
276 | srp_wait_done = 1; | 276 | srp_wait_done = 1; |
277 | 277 | ||
278 | if ((fsl_otg_dev->otg.state == OTG_STATE_B_SRP_INIT) && | 278 | if ((fsl_otg_dev->phy.state == OTG_STATE_B_SRP_INIT) && |
279 | fsl_otg_dev->fsm.b_sess_vld) | 279 | fsl_otg_dev->fsm.b_sess_vld) |
280 | fsl_otg_dev->fsm.b_srp_done = 1; | 280 | fsl_otg_dev->fsm.b_srp_done = 1; |
281 | } | 281 | } |
@@ -288,7 +288,7 @@ void b_srp_end(unsigned long foo) | |||
288 | void a_wait_enum(unsigned long foo) | 288 | void a_wait_enum(unsigned long foo) |
289 | { | 289 | { |
290 | VDBG("a_wait_enum timeout\n"); | 290 | VDBG("a_wait_enum timeout\n"); |
291 | if (!fsl_otg_dev->otg.host->b_hnp_enable) | 291 | if (!fsl_otg_dev->phy.otg->host->b_hnp_enable) |
292 | fsl_otg_add_timer(a_wait_enum_tmr); | 292 | fsl_otg_add_timer(a_wait_enum_tmr); |
293 | else | 293 | else |
294 | otg_statemachine(&fsl_otg_dev->fsm); | 294 | otg_statemachine(&fsl_otg_dev->fsm); |
@@ -452,14 +452,14 @@ void otg_reset_controller(void) | |||
452 | /* Call suspend/resume routines in host driver */ | 452 | /* Call suspend/resume routines in host driver */ |
453 | int fsl_otg_start_host(struct otg_fsm *fsm, int on) | 453 | int fsl_otg_start_host(struct otg_fsm *fsm, int on) |
454 | { | 454 | { |
455 | struct otg_transceiver *xceiv = fsm->transceiver; | 455 | struct usb_otg *otg = fsm->otg; |
456 | struct device *dev; | 456 | struct device *dev; |
457 | struct fsl_otg *otg_dev = container_of(xceiv, struct fsl_otg, otg); | 457 | struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); |
458 | u32 retval = 0; | 458 | u32 retval = 0; |
459 | 459 | ||
460 | if (!xceiv->host) | 460 | if (!otg->host) |
461 | return -ENODEV; | 461 | return -ENODEV; |
462 | dev = xceiv->host->controller; | 462 | dev = otg->host->controller; |
463 | 463 | ||
464 | /* | 464 | /* |
465 | * Update a_vbus_vld state as a_vbus_vld int is disabled | 465 | * Update a_vbus_vld state as a_vbus_vld int is disabled |
@@ -518,14 +518,14 @@ end: | |||
518 | */ | 518 | */ |
519 | int fsl_otg_start_gadget(struct otg_fsm *fsm, int on) | 519 | int fsl_otg_start_gadget(struct otg_fsm *fsm, int on) |
520 | { | 520 | { |
521 | struct otg_transceiver *xceiv = fsm->transceiver; | 521 | struct usb_otg *otg = fsm->otg; |
522 | struct device *dev; | 522 | struct device *dev; |
523 | 523 | ||
524 | if (!xceiv->gadget || !xceiv->gadget->dev.parent) | 524 | if (!otg->gadget || !otg->gadget->dev.parent) |
525 | return -ENODEV; | 525 | return -ENODEV; |
526 | 526 | ||
527 | VDBG("gadget %s\n", on ? "on" : "off"); | 527 | VDBG("gadget %s\n", on ? "on" : "off"); |
528 | dev = xceiv->gadget->dev.parent; | 528 | dev = otg->gadget->dev.parent; |
529 | 529 | ||
530 | if (on) { | 530 | if (on) { |
531 | if (dev->driver->resume) | 531 | if (dev->driver->resume) |
@@ -542,14 +542,14 @@ int fsl_otg_start_gadget(struct otg_fsm *fsm, int on) | |||
542 | * Called by initialization code of host driver. Register host controller | 542 | * Called by initialization code of host driver. Register host controller |
543 | * to the OTG. Suspend host for OTG role detection. | 543 | * to the OTG. Suspend host for OTG role detection. |
544 | */ | 544 | */ |
545 | static int fsl_otg_set_host(struct otg_transceiver *otg_p, struct usb_bus *host) | 545 | static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) |
546 | { | 546 | { |
547 | struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg); | 547 | struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); |
548 | 548 | ||
549 | if (!otg_p || otg_dev != fsl_otg_dev) | 549 | if (!otg || otg_dev != fsl_otg_dev) |
550 | return -ENODEV; | 550 | return -ENODEV; |
551 | 551 | ||
552 | otg_p->host = host; | 552 | otg->host = host; |
553 | 553 | ||
554 | otg_dev->fsm.a_bus_drop = 0; | 554 | otg_dev->fsm.a_bus_drop = 0; |
555 | otg_dev->fsm.a_bus_req = 1; | 555 | otg_dev->fsm.a_bus_req = 1; |
@@ -557,8 +557,8 @@ static int fsl_otg_set_host(struct otg_transceiver *otg_p, struct usb_bus *host) | |||
557 | if (host) { | 557 | if (host) { |
558 | VDBG("host off......\n"); | 558 | VDBG("host off......\n"); |
559 | 559 | ||
560 | otg_p->host->otg_port = fsl_otg_initdata.otg_port; | 560 | otg->host->otg_port = fsl_otg_initdata.otg_port; |
561 | otg_p->host->is_b_host = otg_dev->fsm.id; | 561 | otg->host->is_b_host = otg_dev->fsm.id; |
562 | /* | 562 | /* |
563 | * must leave time for khubd to finish its thing | 563 | * must leave time for khubd to finish its thing |
564 | * before yanking the host driver out from under it, | 564 | * before yanking the host driver out from under it, |
@@ -574,7 +574,7 @@ static int fsl_otg_set_host(struct otg_transceiver *otg_p, struct usb_bus *host) | |||
574 | /* Mini-A cable connected */ | 574 | /* Mini-A cable connected */ |
575 | struct otg_fsm *fsm = &otg_dev->fsm; | 575 | struct otg_fsm *fsm = &otg_dev->fsm; |
576 | 576 | ||
577 | otg_p->state = OTG_STATE_UNDEFINED; | 577 | otg->phy->state = OTG_STATE_UNDEFINED; |
578 | fsm->protocol = PROTO_UNDEF; | 578 | fsm->protocol = PROTO_UNDEF; |
579 | } | 579 | } |
580 | } | 580 | } |
@@ -587,29 +587,29 @@ static int fsl_otg_set_host(struct otg_transceiver *otg_p, struct usb_bus *host) | |||
587 | } | 587 | } |
588 | 588 | ||
589 | /* Called by initialization code of udc. Register udc to OTG. */ | 589 | /* Called by initialization code of udc. Register udc to OTG. */ |
590 | static int fsl_otg_set_peripheral(struct otg_transceiver *otg_p, | 590 | static int fsl_otg_set_peripheral(struct usb_otg *otg, |
591 | struct usb_gadget *gadget) | 591 | struct usb_gadget *gadget) |
592 | { | 592 | { |
593 | struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg); | 593 | struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); |
594 | 594 | ||
595 | VDBG("otg_dev 0x%x\n", (int)otg_dev); | 595 | VDBG("otg_dev 0x%x\n", (int)otg_dev); |
596 | VDBG("fsl_otg_dev 0x%x\n", (int)fsl_otg_dev); | 596 | VDBG("fsl_otg_dev 0x%x\n", (int)fsl_otg_dev); |
597 | 597 | ||
598 | if (!otg_p || otg_dev != fsl_otg_dev) | 598 | if (!otg || otg_dev != fsl_otg_dev) |
599 | return -ENODEV; | 599 | return -ENODEV; |
600 | 600 | ||
601 | if (!gadget) { | 601 | if (!gadget) { |
602 | if (!otg_dev->otg.default_a) | 602 | if (!otg->default_a) |
603 | otg_p->gadget->ops->vbus_draw(otg_p->gadget, 0); | 603 | otg->gadget->ops->vbus_draw(otg->gadget, 0); |
604 | usb_gadget_vbus_disconnect(otg_dev->otg.gadget); | 604 | usb_gadget_vbus_disconnect(otg->gadget); |
605 | otg_dev->otg.gadget = 0; | 605 | otg->gadget = 0; |
606 | otg_dev->fsm.b_bus_req = 0; | 606 | otg_dev->fsm.b_bus_req = 0; |
607 | otg_statemachine(&otg_dev->fsm); | 607 | otg_statemachine(&otg_dev->fsm); |
608 | return 0; | 608 | return 0; |
609 | } | 609 | } |
610 | 610 | ||
611 | otg_p->gadget = gadget; | 611 | otg->gadget = gadget; |
612 | otg_p->gadget->is_a_peripheral = !otg_dev->fsm.id; | 612 | otg->gadget->is_a_peripheral = !otg_dev->fsm.id; |
613 | 613 | ||
614 | otg_dev->fsm.b_bus_req = 1; | 614 | otg_dev->fsm.b_bus_req = 1; |
615 | 615 | ||
@@ -625,11 +625,11 @@ static int fsl_otg_set_peripheral(struct otg_transceiver *otg_p, | |||
625 | } | 625 | } |
626 | 626 | ||
627 | /* Set OTG port power, only for B-device */ | 627 | /* Set OTG port power, only for B-device */ |
628 | static int fsl_otg_set_power(struct otg_transceiver *otg_p, unsigned mA) | 628 | static int fsl_otg_set_power(struct usb_phy *phy, unsigned mA) |
629 | { | 629 | { |
630 | if (!fsl_otg_dev) | 630 | if (!fsl_otg_dev) |
631 | return -ENODEV; | 631 | return -ENODEV; |
632 | if (otg_p->state == OTG_STATE_B_PERIPHERAL) | 632 | if (phy->state == OTG_STATE_B_PERIPHERAL) |
633 | pr_info("FSL OTG: Draw %d mA\n", mA); | 633 | pr_info("FSL OTG: Draw %d mA\n", mA); |
634 | 634 | ||
635 | return 0; | 635 | return 0; |
@@ -658,12 +658,12 @@ static void fsl_otg_event(struct work_struct *work) | |||
658 | } | 658 | } |
659 | 659 | ||
660 | /* B-device start SRP */ | 660 | /* B-device start SRP */ |
661 | static int fsl_otg_start_srp(struct otg_transceiver *otg_p) | 661 | static int fsl_otg_start_srp(struct usb_otg *otg) |
662 | { | 662 | { |
663 | struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg); | 663 | struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); |
664 | 664 | ||
665 | if (!otg_p || otg_dev != fsl_otg_dev | 665 | if (!otg || otg_dev != fsl_otg_dev |
666 | || otg_p->state != OTG_STATE_B_IDLE) | 666 | || otg->phy->state != OTG_STATE_B_IDLE) |
667 | return -ENODEV; | 667 | return -ENODEV; |
668 | 668 | ||
669 | otg_dev->fsm.b_bus_req = 1; | 669 | otg_dev->fsm.b_bus_req = 1; |
@@ -673,11 +673,11 @@ static int fsl_otg_start_srp(struct otg_transceiver *otg_p) | |||
673 | } | 673 | } |
674 | 674 | ||
675 | /* A_host suspend will call this function to start hnp */ | 675 | /* A_host suspend will call this function to start hnp */ |
676 | static int fsl_otg_start_hnp(struct otg_transceiver *otg_p) | 676 | static int fsl_otg_start_hnp(struct usb_otg *otg) |
677 | { | 677 | { |
678 | struct fsl_otg *otg_dev = container_of(otg_p, struct fsl_otg, otg); | 678 | struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); |
679 | 679 | ||
680 | if (!otg_p || otg_dev != fsl_otg_dev) | 680 | if (!otg || otg_dev != fsl_otg_dev) |
681 | return -ENODEV; | 681 | return -ENODEV; |
682 | 682 | ||
683 | DBG("start_hnp...n"); | 683 | DBG("start_hnp...n"); |
@@ -698,7 +698,7 @@ static int fsl_otg_start_hnp(struct otg_transceiver *otg_p) | |||
698 | irqreturn_t fsl_otg_isr(int irq, void *dev_id) | 698 | irqreturn_t fsl_otg_isr(int irq, void *dev_id) |
699 | { | 699 | { |
700 | struct otg_fsm *fsm = &((struct fsl_otg *)dev_id)->fsm; | 700 | struct otg_fsm *fsm = &((struct fsl_otg *)dev_id)->fsm; |
701 | struct otg_transceiver *otg = &((struct fsl_otg *)dev_id)->otg; | 701 | struct usb_otg *otg = ((struct fsl_otg *)dev_id)->phy.otg; |
702 | u32 otg_int_src, otg_sc; | 702 | u32 otg_int_src, otg_sc; |
703 | 703 | ||
704 | otg_sc = fsl_readl(&usb_dr_regs->otgsc); | 704 | otg_sc = fsl_readl(&usb_dr_regs->otgsc); |
@@ -774,6 +774,12 @@ static int fsl_otg_conf(struct platform_device *pdev) | |||
774 | if (!fsl_otg_tc) | 774 | if (!fsl_otg_tc) |
775 | return -ENOMEM; | 775 | return -ENOMEM; |
776 | 776 | ||
777 | fsl_otg_tc->phy.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL); | ||
778 | if (!fsl_otg_tc->phy.otg) { | ||
779 | kfree(fsl_otg_tc); | ||
780 | return -ENOMEM; | ||
781 | } | ||
782 | |||
777 | INIT_DELAYED_WORK(&fsl_otg_tc->otg_event, fsl_otg_event); | 783 | INIT_DELAYED_WORK(&fsl_otg_tc->otg_event, fsl_otg_event); |
778 | 784 | ||
779 | INIT_LIST_HEAD(&active_timers); | 785 | INIT_LIST_HEAD(&active_timers); |
@@ -788,17 +794,19 @@ static int fsl_otg_conf(struct platform_device *pdev) | |||
788 | fsl_otg_tc->fsm.ops = &fsl_otg_ops; | 794 | fsl_otg_tc->fsm.ops = &fsl_otg_ops; |
789 | 795 | ||
790 | /* initialize the otg structure */ | 796 | /* initialize the otg structure */ |
791 | fsl_otg_tc->otg.label = DRIVER_DESC; | 797 | fsl_otg_tc->phy.label = DRIVER_DESC; |
792 | fsl_otg_tc->otg.set_host = fsl_otg_set_host; | 798 | fsl_otg_tc->phy.set_power = fsl_otg_set_power; |
793 | fsl_otg_tc->otg.set_peripheral = fsl_otg_set_peripheral; | 799 | |
794 | fsl_otg_tc->otg.set_power = fsl_otg_set_power; | 800 | fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy; |
795 | fsl_otg_tc->otg.start_hnp = fsl_otg_start_hnp; | 801 | fsl_otg_tc->phy.otg->set_host = fsl_otg_set_host; |
796 | fsl_otg_tc->otg.start_srp = fsl_otg_start_srp; | 802 | fsl_otg_tc->phy.otg->set_peripheral = fsl_otg_set_peripheral; |
803 | fsl_otg_tc->phy.otg->start_hnp = fsl_otg_start_hnp; | ||
804 | fsl_otg_tc->phy.otg->start_srp = fsl_otg_start_srp; | ||
797 | 805 | ||
798 | fsl_otg_dev = fsl_otg_tc; | 806 | fsl_otg_dev = fsl_otg_tc; |
799 | 807 | ||
800 | /* Store the otg transceiver */ | 808 | /* Store the otg transceiver */ |
801 | status = otg_set_transceiver(&fsl_otg_tc->otg); | 809 | status = usb_set_transceiver(&fsl_otg_tc->phy); |
802 | if (status) { | 810 | if (status) { |
803 | pr_warn(FSL_OTG_NAME ": unable to register OTG transceiver.\n"); | 811 | pr_warn(FSL_OTG_NAME ": unable to register OTG transceiver.\n"); |
804 | goto err; | 812 | goto err; |
@@ -807,6 +815,7 @@ static int fsl_otg_conf(struct platform_device *pdev) | |||
807 | return 0; | 815 | return 0; |
808 | err: | 816 | err: |
809 | fsl_otg_uninit_timers(); | 817 | fsl_otg_uninit_timers(); |
818 | kfree(fsl_otg_tc->phy.otg); | ||
810 | kfree(fsl_otg_tc); | 819 | kfree(fsl_otg_tc); |
811 | return status; | 820 | return status; |
812 | } | 821 | } |
@@ -815,19 +824,19 @@ err: | |||
815 | int usb_otg_start(struct platform_device *pdev) | 824 | int usb_otg_start(struct platform_device *pdev) |
816 | { | 825 | { |
817 | struct fsl_otg *p_otg; | 826 | struct fsl_otg *p_otg; |
818 | struct otg_transceiver *otg_trans = otg_get_transceiver(); | 827 | struct usb_phy *otg_trans = usb_get_transceiver(); |
819 | struct otg_fsm *fsm; | 828 | struct otg_fsm *fsm; |
820 | int status; | 829 | int status; |
821 | struct resource *res; | 830 | struct resource *res; |
822 | u32 temp; | 831 | u32 temp; |
823 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; | 832 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; |
824 | 833 | ||
825 | p_otg = container_of(otg_trans, struct fsl_otg, otg); | 834 | p_otg = container_of(otg_trans, struct fsl_otg, phy); |
826 | fsm = &p_otg->fsm; | 835 | fsm = &p_otg->fsm; |
827 | 836 | ||
828 | /* Initialize the state machine structure with default values */ | 837 | /* Initialize the state machine structure with default values */ |
829 | SET_OTG_STATE(otg_trans, OTG_STATE_UNDEFINED); | 838 | SET_OTG_STATE(otg_trans, OTG_STATE_UNDEFINED); |
830 | fsm->transceiver = &p_otg->otg; | 839 | fsm->otg = p_otg->phy.otg; |
831 | 840 | ||
832 | /* We don't require predefined MEM/IRQ resource index */ | 841 | /* We don't require predefined MEM/IRQ resource index */ |
833 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 842 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -857,9 +866,10 @@ int usb_otg_start(struct platform_device *pdev) | |||
857 | status = request_irq(p_otg->irq, fsl_otg_isr, | 866 | status = request_irq(p_otg->irq, fsl_otg_isr, |
858 | IRQF_SHARED, driver_name, p_otg); | 867 | IRQF_SHARED, driver_name, p_otg); |
859 | if (status) { | 868 | if (status) { |
860 | dev_dbg(p_otg->otg.dev, "can't get IRQ %d, error %d\n", | 869 | dev_dbg(p_otg->phy.dev, "can't get IRQ %d, error %d\n", |
861 | p_otg->irq, status); | 870 | p_otg->irq, status); |
862 | iounmap(p_otg->dr_mem_map); | 871 | iounmap(p_otg->dr_mem_map); |
872 | kfree(p_otg->phy.otg); | ||
863 | kfree(p_otg); | 873 | kfree(p_otg); |
864 | return status; | 874 | return status; |
865 | } | 875 | } |
@@ -919,10 +929,10 @@ int usb_otg_start(struct platform_device *pdev) | |||
919 | * Also: record initial state of ID pin | 929 | * Also: record initial state of ID pin |
920 | */ | 930 | */ |
921 | if (fsl_readl(&p_otg->dr_mem_map->otgsc) & OTGSC_STS_USB_ID) { | 931 | if (fsl_readl(&p_otg->dr_mem_map->otgsc) & OTGSC_STS_USB_ID) { |
922 | p_otg->otg.state = OTG_STATE_UNDEFINED; | 932 | p_otg->phy.state = OTG_STATE_UNDEFINED; |
923 | p_otg->fsm.id = 1; | 933 | p_otg->fsm.id = 1; |
924 | } else { | 934 | } else { |
925 | p_otg->otg.state = OTG_STATE_A_IDLE; | 935 | p_otg->phy.state = OTG_STATE_A_IDLE; |
926 | p_otg->fsm.id = 0; | 936 | p_otg->fsm.id = 0; |
927 | } | 937 | } |
928 | 938 | ||
@@ -978,7 +988,7 @@ static int show_fsl_usb2_otg_state(struct device *dev, | |||
978 | /* State */ | 988 | /* State */ |
979 | t = scnprintf(next, size, | 989 | t = scnprintf(next, size, |
980 | "OTG state: %s\n\n", | 990 | "OTG state: %s\n\n", |
981 | otg_state_string(fsl_otg_dev->otg.state)); | 991 | otg_state_string(fsl_otg_dev->phy.state)); |
982 | size -= t; | 992 | size -= t; |
983 | next += t; | 993 | next += t; |
984 | 994 | ||
@@ -1124,12 +1134,13 @@ static int __devexit fsl_otg_remove(struct platform_device *pdev) | |||
1124 | { | 1134 | { |
1125 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; | 1135 | struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; |
1126 | 1136 | ||
1127 | otg_set_transceiver(NULL); | 1137 | usb_set_transceiver(NULL); |
1128 | free_irq(fsl_otg_dev->irq, fsl_otg_dev); | 1138 | free_irq(fsl_otg_dev->irq, fsl_otg_dev); |
1129 | 1139 | ||
1130 | iounmap((void *)usb_dr_regs); | 1140 | iounmap((void *)usb_dr_regs); |
1131 | 1141 | ||
1132 | fsl_otg_uninit_timers(); | 1142 | fsl_otg_uninit_timers(); |
1143 | kfree(fsl_otg_dev->phy.otg); | ||
1133 | kfree(fsl_otg_dev); | 1144 | kfree(fsl_otg_dev); |
1134 | 1145 | ||
1135 | device_remove_file(&pdev->dev, &dev_attr_fsl_usb2_otg_state); | 1146 | device_remove_file(&pdev->dev, &dev_attr_fsl_usb2_otg_state); |
diff --git a/drivers/usb/otg/fsl_otg.h b/drivers/usb/otg/fsl_otg.h index 3f8ef731aac..ca266280895 100644 --- a/drivers/usb/otg/fsl_otg.h +++ b/drivers/usb/otg/fsl_otg.h | |||
@@ -369,7 +369,7 @@ inline struct fsl_otg_timer *otg_timer_initializer | |||
369 | } | 369 | } |
370 | 370 | ||
371 | struct fsl_otg { | 371 | struct fsl_otg { |
372 | struct otg_transceiver otg; | 372 | struct usb_phy phy; |
373 | struct otg_fsm fsm; | 373 | struct otg_fsm fsm; |
374 | struct usb_dr_mmap *dr_mem_map; | 374 | struct usb_dr_mmap *dr_mem_map; |
375 | struct delayed_work otg_event; | 375 | struct delayed_work otg_event; |
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c index fb644c107de..3ece43a2e4c 100644 --- a/drivers/usb/otg/gpio_vbus.c +++ b/drivers/usb/otg/gpio_vbus.c | |||
@@ -32,7 +32,7 @@ | |||
32 | * Needs to be loaded before the UDC driver that will use it. | 32 | * Needs to be loaded before the UDC driver that will use it. |
33 | */ | 33 | */ |
34 | struct gpio_vbus_data { | 34 | struct gpio_vbus_data { |
35 | struct otg_transceiver otg; | 35 | struct usb_phy phy; |
36 | struct device *dev; | 36 | struct device *dev; |
37 | struct regulator *vbus_draw; | 37 | struct regulator *vbus_draw; |
38 | int vbus_draw_enabled; | 38 | int vbus_draw_enabled; |
@@ -98,7 +98,7 @@ static void gpio_vbus_work(struct work_struct *work) | |||
98 | struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; | 98 | struct gpio_vbus_mach_info *pdata = gpio_vbus->dev->platform_data; |
99 | int gpio; | 99 | int gpio; |
100 | 100 | ||
101 | if (!gpio_vbus->otg.gadget) | 101 | if (!gpio_vbus->phy.otg->gadget) |
102 | return; | 102 | return; |
103 | 103 | ||
104 | /* Peripheral controllers which manage the pullup themselves won't have | 104 | /* Peripheral controllers which manage the pullup themselves won't have |
@@ -108,8 +108,8 @@ static void gpio_vbus_work(struct work_struct *work) | |||
108 | */ | 108 | */ |
109 | gpio = pdata->gpio_pullup; | 109 | gpio = pdata->gpio_pullup; |
110 | if (is_vbus_powered(pdata)) { | 110 | if (is_vbus_powered(pdata)) { |
111 | gpio_vbus->otg.state = OTG_STATE_B_PERIPHERAL; | 111 | gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; |
112 | usb_gadget_vbus_connect(gpio_vbus->otg.gadget); | 112 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); |
113 | 113 | ||
114 | /* drawing a "unit load" is *always* OK, except for OTG */ | 114 | /* drawing a "unit load" is *always* OK, except for OTG */ |
115 | set_vbus_draw(gpio_vbus, 100); | 115 | set_vbus_draw(gpio_vbus, 100); |
@@ -124,8 +124,8 @@ static void gpio_vbus_work(struct work_struct *work) | |||
124 | 124 | ||
125 | set_vbus_draw(gpio_vbus, 0); | 125 | set_vbus_draw(gpio_vbus, 0); |
126 | 126 | ||
127 | usb_gadget_vbus_disconnect(gpio_vbus->otg.gadget); | 127 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); |
128 | gpio_vbus->otg.state = OTG_STATE_B_IDLE; | 128 | gpio_vbus->phy.state = OTG_STATE_B_IDLE; |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
@@ -135,12 +135,13 @@ static irqreturn_t gpio_vbus_irq(int irq, void *data) | |||
135 | struct platform_device *pdev = data; | 135 | struct platform_device *pdev = data; |
136 | struct gpio_vbus_mach_info *pdata = pdev->dev.platform_data; | 136 | struct gpio_vbus_mach_info *pdata = pdev->dev.platform_data; |
137 | struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev); | 137 | struct gpio_vbus_data *gpio_vbus = platform_get_drvdata(pdev); |
138 | struct usb_otg *otg = gpio_vbus->phy.otg; | ||
138 | 139 | ||
139 | dev_dbg(&pdev->dev, "VBUS %s (gadget: %s)\n", | 140 | dev_dbg(&pdev->dev, "VBUS %s (gadget: %s)\n", |
140 | is_vbus_powered(pdata) ? "supplied" : "inactive", | 141 | is_vbus_powered(pdata) ? "supplied" : "inactive", |
141 | gpio_vbus->otg.gadget ? gpio_vbus->otg.gadget->name : "none"); | 142 | otg->gadget ? otg->gadget->name : "none"); |
142 | 143 | ||
143 | if (gpio_vbus->otg.gadget) | 144 | if (otg->gadget) |
144 | schedule_work(&gpio_vbus->work); | 145 | schedule_work(&gpio_vbus->work); |
145 | 146 | ||
146 | return IRQ_HANDLED; | 147 | return IRQ_HANDLED; |
@@ -149,15 +150,15 @@ static irqreturn_t gpio_vbus_irq(int irq, void *data) | |||
149 | /* OTG transceiver interface */ | 150 | /* OTG transceiver interface */ |
150 | 151 | ||
151 | /* bind/unbind the peripheral controller */ | 152 | /* bind/unbind the peripheral controller */ |
152 | static int gpio_vbus_set_peripheral(struct otg_transceiver *otg, | 153 | static int gpio_vbus_set_peripheral(struct usb_otg *otg, |
153 | struct usb_gadget *gadget) | 154 | struct usb_gadget *gadget) |
154 | { | 155 | { |
155 | struct gpio_vbus_data *gpio_vbus; | 156 | struct gpio_vbus_data *gpio_vbus; |
156 | struct gpio_vbus_mach_info *pdata; | 157 | struct gpio_vbus_mach_info *pdata; |
157 | struct platform_device *pdev; | 158 | struct platform_device *pdev; |
158 | int gpio, irq; | 159 | int gpio, irq; |
159 | 160 | ||
160 | gpio_vbus = container_of(otg, struct gpio_vbus_data, otg); | 161 | gpio_vbus = container_of(otg->phy, struct gpio_vbus_data, phy); |
161 | pdev = to_platform_device(gpio_vbus->dev); | 162 | pdev = to_platform_device(gpio_vbus->dev); |
162 | pdata = gpio_vbus->dev->platform_data; | 163 | pdata = gpio_vbus->dev->platform_data; |
163 | irq = gpio_to_irq(pdata->gpio_vbus); | 164 | irq = gpio_to_irq(pdata->gpio_vbus); |
@@ -174,7 +175,7 @@ static int gpio_vbus_set_peripheral(struct otg_transceiver *otg, | |||
174 | set_vbus_draw(gpio_vbus, 0); | 175 | set_vbus_draw(gpio_vbus, 0); |
175 | 176 | ||
176 | usb_gadget_vbus_disconnect(otg->gadget); | 177 | usb_gadget_vbus_disconnect(otg->gadget); |
177 | otg->state = OTG_STATE_UNDEFINED; | 178 | otg->phy->state = OTG_STATE_UNDEFINED; |
178 | 179 | ||
179 | otg->gadget = NULL; | 180 | otg->gadget = NULL; |
180 | return 0; | 181 | return 0; |
@@ -189,23 +190,23 @@ static int gpio_vbus_set_peripheral(struct otg_transceiver *otg, | |||
189 | } | 190 | } |
190 | 191 | ||
191 | /* effective for B devices, ignored for A-peripheral */ | 192 | /* effective for B devices, ignored for A-peripheral */ |
192 | static int gpio_vbus_set_power(struct otg_transceiver *otg, unsigned mA) | 193 | static int gpio_vbus_set_power(struct usb_phy *phy, unsigned mA) |
193 | { | 194 | { |
194 | struct gpio_vbus_data *gpio_vbus; | 195 | struct gpio_vbus_data *gpio_vbus; |
195 | 196 | ||
196 | gpio_vbus = container_of(otg, struct gpio_vbus_data, otg); | 197 | gpio_vbus = container_of(phy, struct gpio_vbus_data, phy); |
197 | 198 | ||
198 | if (otg->state == OTG_STATE_B_PERIPHERAL) | 199 | if (phy->state == OTG_STATE_B_PERIPHERAL) |
199 | set_vbus_draw(gpio_vbus, mA); | 200 | set_vbus_draw(gpio_vbus, mA); |
200 | return 0; | 201 | return 0; |
201 | } | 202 | } |
202 | 203 | ||
203 | /* for non-OTG B devices: set/clear transceiver suspend mode */ | 204 | /* for non-OTG B devices: set/clear transceiver suspend mode */ |
204 | static int gpio_vbus_set_suspend(struct otg_transceiver *otg, int suspend) | 205 | static int gpio_vbus_set_suspend(struct usb_phy *phy, int suspend) |
205 | { | 206 | { |
206 | struct gpio_vbus_data *gpio_vbus; | 207 | struct gpio_vbus_data *gpio_vbus; |
207 | 208 | ||
208 | gpio_vbus = container_of(otg, struct gpio_vbus_data, otg); | 209 | gpio_vbus = container_of(phy, struct gpio_vbus_data, phy); |
209 | 210 | ||
210 | /* draw max 0 mA from vbus in suspend mode; or the previously | 211 | /* draw max 0 mA from vbus in suspend mode; or the previously |
211 | * recorded amount of current if not suspended | 212 | * recorded amount of current if not suspended |
@@ -213,7 +214,7 @@ static int gpio_vbus_set_suspend(struct otg_transceiver *otg, int suspend) | |||
213 | * NOTE: high powered configs (mA > 100) may draw up to 2.5 mA | 214 | * NOTE: high powered configs (mA > 100) may draw up to 2.5 mA |
214 | * if they're wake-enabled ... we don't handle that yet. | 215 | * if they're wake-enabled ... we don't handle that yet. |
215 | */ | 216 | */ |
216 | return gpio_vbus_set_power(otg, suspend ? 0 : gpio_vbus->mA); | 217 | return gpio_vbus_set_power(phy, suspend ? 0 : gpio_vbus->mA); |
217 | } | 218 | } |
218 | 219 | ||
219 | /* platform driver interface */ | 220 | /* platform driver interface */ |
@@ -233,13 +234,21 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) | |||
233 | if (!gpio_vbus) | 234 | if (!gpio_vbus) |
234 | return -ENOMEM; | 235 | return -ENOMEM; |
235 | 236 | ||
237 | gpio_vbus->phy.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL); | ||
238 | if (!gpio_vbus->phy.otg) { | ||
239 | kfree(gpio_vbus); | ||
240 | return -ENOMEM; | ||
241 | } | ||
242 | |||
236 | platform_set_drvdata(pdev, gpio_vbus); | 243 | platform_set_drvdata(pdev, gpio_vbus); |
237 | gpio_vbus->dev = &pdev->dev; | 244 | gpio_vbus->dev = &pdev->dev; |
238 | gpio_vbus->otg.label = "gpio-vbus"; | 245 | gpio_vbus->phy.label = "gpio-vbus"; |
239 | gpio_vbus->otg.state = OTG_STATE_UNDEFINED; | 246 | gpio_vbus->phy.set_power = gpio_vbus_set_power; |
240 | gpio_vbus->otg.set_peripheral = gpio_vbus_set_peripheral; | 247 | gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; |
241 | gpio_vbus->otg.set_power = gpio_vbus_set_power; | 248 | gpio_vbus->phy.state = OTG_STATE_UNDEFINED; |
242 | gpio_vbus->otg.set_suspend = gpio_vbus_set_suspend; | 249 | |
250 | gpio_vbus->phy.otg->phy = &gpio_vbus->phy; | ||
251 | gpio_vbus->phy.otg->set_peripheral = gpio_vbus_set_peripheral; | ||
243 | 252 | ||
244 | err = gpio_request(gpio, "vbus_detect"); | 253 | err = gpio_request(gpio, "vbus_detect"); |
245 | if (err) { | 254 | if (err) { |
@@ -288,7 +297,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev) | |||
288 | } | 297 | } |
289 | 298 | ||
290 | /* only active when a gadget is registered */ | 299 | /* only active when a gadget is registered */ |
291 | err = otg_set_transceiver(&gpio_vbus->otg); | 300 | err = usb_set_transceiver(&gpio_vbus->phy); |
292 | if (err) { | 301 | if (err) { |
293 | dev_err(&pdev->dev, "can't register transceiver, err: %d\n", | 302 | dev_err(&pdev->dev, "can't register transceiver, err: %d\n", |
294 | err); | 303 | err); |
@@ -304,6 +313,7 @@ err_irq: | |||
304 | gpio_free(pdata->gpio_vbus); | 313 | gpio_free(pdata->gpio_vbus); |
305 | err_gpio: | 314 | err_gpio: |
306 | platform_set_drvdata(pdev, NULL); | 315 | platform_set_drvdata(pdev, NULL); |
316 | kfree(gpio_vbus->phy.otg); | ||
307 | kfree(gpio_vbus); | 317 | kfree(gpio_vbus); |
308 | return err; | 318 | return err; |
309 | } | 319 | } |
@@ -316,13 +326,14 @@ static int __exit gpio_vbus_remove(struct platform_device *pdev) | |||
316 | 326 | ||
317 | regulator_put(gpio_vbus->vbus_draw); | 327 | regulator_put(gpio_vbus->vbus_draw); |
318 | 328 | ||
319 | otg_set_transceiver(NULL); | 329 | usb_set_transceiver(NULL); |
320 | 330 | ||
321 | free_irq(gpio_to_irq(gpio), &pdev->dev); | 331 | free_irq(gpio_to_irq(gpio), &pdev->dev); |
322 | if (gpio_is_valid(pdata->gpio_pullup)) | 332 | if (gpio_is_valid(pdata->gpio_pullup)) |
323 | gpio_free(pdata->gpio_pullup); | 333 | gpio_free(pdata->gpio_pullup); |
324 | gpio_free(gpio); | 334 | gpio_free(gpio); |
325 | platform_set_drvdata(pdev, NULL); | 335 | platform_set_drvdata(pdev, NULL); |
336 | kfree(gpio_vbus->phy.otg); | ||
326 | kfree(gpio_vbus); | 337 | kfree(gpio_vbus); |
327 | 338 | ||
328 | return 0; | 339 | return 0; |
diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c index 8c86787c2f0..70cf5d7bca4 100644 --- a/drivers/usb/otg/isp1301_omap.c +++ b/drivers/usb/otg/isp1301_omap.c | |||
@@ -52,7 +52,7 @@ MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver"); | |||
52 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
53 | 53 | ||
54 | struct isp1301 { | 54 | struct isp1301 { |
55 | struct otg_transceiver otg; | 55 | struct usb_phy phy; |
56 | struct i2c_client *client; | 56 | struct i2c_client *client; |
57 | void (*i2c_release)(struct device *dev); | 57 | void (*i2c_release)(struct device *dev); |
58 | 58 | ||
@@ -236,7 +236,7 @@ isp1301_clear_bits(struct isp1301 *isp, u8 reg, u8 bits) | |||
236 | 236 | ||
237 | static inline const char *state_name(struct isp1301 *isp) | 237 | static inline const char *state_name(struct isp1301 *isp) |
238 | { | 238 | { |
239 | return otg_state_string(isp->otg.state); | 239 | return otg_state_string(isp->phy.state); |
240 | } | 240 | } |
241 | 241 | ||
242 | /*-------------------------------------------------------------------------*/ | 242 | /*-------------------------------------------------------------------------*/ |
@@ -251,7 +251,7 @@ static inline const char *state_name(struct isp1301 *isp) | |||
251 | 251 | ||
252 | static void power_down(struct isp1301 *isp) | 252 | static void power_down(struct isp1301 *isp) |
253 | { | 253 | { |
254 | isp->otg.state = OTG_STATE_UNDEFINED; | 254 | isp->phy.state = OTG_STATE_UNDEFINED; |
255 | 255 | ||
256 | // isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); | 256 | // isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); |
257 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND); | 257 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND); |
@@ -280,13 +280,13 @@ static int host_suspend(struct isp1301 *isp) | |||
280 | #else | 280 | #else |
281 | struct device *dev; | 281 | struct device *dev; |
282 | 282 | ||
283 | if (!isp->otg.host) | 283 | if (!isp->phy.otg->host) |
284 | return -ENODEV; | 284 | return -ENODEV; |
285 | 285 | ||
286 | /* Currently ASSUMES only the OTG port matters; | 286 | /* Currently ASSUMES only the OTG port matters; |
287 | * other ports could be active... | 287 | * other ports could be active... |
288 | */ | 288 | */ |
289 | dev = isp->otg.host->controller; | 289 | dev = isp->phy.otg->host->controller; |
290 | return dev->driver->suspend(dev, 3, 0); | 290 | return dev->driver->suspend(dev, 3, 0); |
291 | #endif | 291 | #endif |
292 | } | 292 | } |
@@ -298,20 +298,20 @@ static int host_resume(struct isp1301 *isp) | |||
298 | #else | 298 | #else |
299 | struct device *dev; | 299 | struct device *dev; |
300 | 300 | ||
301 | if (!isp->otg.host) | 301 | if (!isp->phy.otg->host) |
302 | return -ENODEV; | 302 | return -ENODEV; |
303 | 303 | ||
304 | dev = isp->otg.host->controller; | 304 | dev = isp->phy.otg->host->controller; |
305 | return dev->driver->resume(dev, 0); | 305 | return dev->driver->resume(dev, 0); |
306 | #endif | 306 | #endif |
307 | } | 307 | } |
308 | 308 | ||
309 | static int gadget_suspend(struct isp1301 *isp) | 309 | static int gadget_suspend(struct isp1301 *isp) |
310 | { | 310 | { |
311 | isp->otg.gadget->b_hnp_enable = 0; | 311 | isp->phy.otg->gadget->b_hnp_enable = 0; |
312 | isp->otg.gadget->a_hnp_support = 0; | 312 | isp->phy.otg->gadget->a_hnp_support = 0; |
313 | isp->otg.gadget->a_alt_hnp_support = 0; | 313 | isp->phy.otg->gadget->a_alt_hnp_support = 0; |
314 | return usb_gadget_vbus_disconnect(isp->otg.gadget); | 314 | return usb_gadget_vbus_disconnect(isp->phy.otg->gadget); |
315 | } | 315 | } |
316 | 316 | ||
317 | /*-------------------------------------------------------------------------*/ | 317 | /*-------------------------------------------------------------------------*/ |
@@ -341,19 +341,19 @@ static void a_idle(struct isp1301 *isp, const char *tag) | |||
341 | { | 341 | { |
342 | u32 l; | 342 | u32 l; |
343 | 343 | ||
344 | if (isp->otg.state == OTG_STATE_A_IDLE) | 344 | if (isp->phy.state == OTG_STATE_A_IDLE) |
345 | return; | 345 | return; |
346 | 346 | ||
347 | isp->otg.default_a = 1; | 347 | isp->phy.otg->default_a = 1; |
348 | if (isp->otg.host) { | 348 | if (isp->phy.otg->host) { |
349 | isp->otg.host->is_b_host = 0; | 349 | isp->phy.otg->host->is_b_host = 0; |
350 | host_suspend(isp); | 350 | host_suspend(isp); |
351 | } | 351 | } |
352 | if (isp->otg.gadget) { | 352 | if (isp->phy.otg->gadget) { |
353 | isp->otg.gadget->is_a_peripheral = 1; | 353 | isp->phy.otg->gadget->is_a_peripheral = 1; |
354 | gadget_suspend(isp); | 354 | gadget_suspend(isp); |
355 | } | 355 | } |
356 | isp->otg.state = OTG_STATE_A_IDLE; | 356 | isp->phy.state = OTG_STATE_A_IDLE; |
357 | l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; | 357 | l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; |
358 | omap_writel(l, OTG_CTRL); | 358 | omap_writel(l, OTG_CTRL); |
359 | isp->last_otg_ctrl = l; | 359 | isp->last_otg_ctrl = l; |
@@ -365,19 +365,19 @@ static void b_idle(struct isp1301 *isp, const char *tag) | |||
365 | { | 365 | { |
366 | u32 l; | 366 | u32 l; |
367 | 367 | ||
368 | if (isp->otg.state == OTG_STATE_B_IDLE) | 368 | if (isp->phy.state == OTG_STATE_B_IDLE) |
369 | return; | 369 | return; |
370 | 370 | ||
371 | isp->otg.default_a = 0; | 371 | isp->phy.otg->default_a = 0; |
372 | if (isp->otg.host) { | 372 | if (isp->phy.otg->host) { |
373 | isp->otg.host->is_b_host = 1; | 373 | isp->phy.otg->host->is_b_host = 1; |
374 | host_suspend(isp); | 374 | host_suspend(isp); |
375 | } | 375 | } |
376 | if (isp->otg.gadget) { | 376 | if (isp->phy.otg->gadget) { |
377 | isp->otg.gadget->is_a_peripheral = 0; | 377 | isp->phy.otg->gadget->is_a_peripheral = 0; |
378 | gadget_suspend(isp); | 378 | gadget_suspend(isp); |
379 | } | 379 | } |
380 | isp->otg.state = OTG_STATE_B_IDLE; | 380 | isp->phy.state = OTG_STATE_B_IDLE; |
381 | l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; | 381 | l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; |
382 | omap_writel(l, OTG_CTRL); | 382 | omap_writel(l, OTG_CTRL); |
383 | isp->last_otg_ctrl = l; | 383 | isp->last_otg_ctrl = l; |
@@ -478,7 +478,7 @@ static void check_state(struct isp1301 *isp, const char *tag) | |||
478 | default: | 478 | default: |
479 | break; | 479 | break; |
480 | } | 480 | } |
481 | if (isp->otg.state == state && !extra) | 481 | if (isp->phy.state == state && !extra) |
482 | return; | 482 | return; |
483 | pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag, | 483 | pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag, |
484 | otg_state_string(state), fsm, state_name(isp), | 484 | otg_state_string(state), fsm, state_name(isp), |
@@ -502,22 +502,23 @@ static void update_otg1(struct isp1301 *isp, u8 int_src) | |||
502 | 502 | ||
503 | if (int_src & INTR_SESS_VLD) | 503 | if (int_src & INTR_SESS_VLD) |
504 | otg_ctrl |= OTG_ASESSVLD; | 504 | otg_ctrl |= OTG_ASESSVLD; |
505 | else if (isp->otg.state == OTG_STATE_A_WAIT_VFALL) { | 505 | else if (isp->phy.state == OTG_STATE_A_WAIT_VFALL) { |
506 | a_idle(isp, "vfall"); | 506 | a_idle(isp, "vfall"); |
507 | otg_ctrl &= ~OTG_CTRL_BITS; | 507 | otg_ctrl &= ~OTG_CTRL_BITS; |
508 | } | 508 | } |
509 | if (int_src & INTR_VBUS_VLD) | 509 | if (int_src & INTR_VBUS_VLD) |
510 | otg_ctrl |= OTG_VBUSVLD; | 510 | otg_ctrl |= OTG_VBUSVLD; |
511 | if (int_src & INTR_ID_GND) { /* default-A */ | 511 | if (int_src & INTR_ID_GND) { /* default-A */ |
512 | if (isp->otg.state == OTG_STATE_B_IDLE | 512 | if (isp->phy.state == OTG_STATE_B_IDLE |
513 | || isp->otg.state == OTG_STATE_UNDEFINED) { | 513 | || isp->phy.state |
514 | == OTG_STATE_UNDEFINED) { | ||
514 | a_idle(isp, "init"); | 515 | a_idle(isp, "init"); |
515 | return; | 516 | return; |
516 | } | 517 | } |
517 | } else { /* default-B */ | 518 | } else { /* default-B */ |
518 | otg_ctrl |= OTG_ID; | 519 | otg_ctrl |= OTG_ID; |
519 | if (isp->otg.state == OTG_STATE_A_IDLE | 520 | if (isp->phy.state == OTG_STATE_A_IDLE |
520 | || isp->otg.state == OTG_STATE_UNDEFINED) { | 521 | || isp->phy.state == OTG_STATE_UNDEFINED) { |
521 | b_idle(isp, "init"); | 522 | b_idle(isp, "init"); |
522 | return; | 523 | return; |
523 | } | 524 | } |
@@ -551,14 +552,14 @@ static void otg_update_isp(struct isp1301 *isp) | |||
551 | isp->last_otg_ctrl = otg_ctrl; | 552 | isp->last_otg_ctrl = otg_ctrl; |
552 | otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS; | 553 | otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS; |
553 | 554 | ||
554 | switch (isp->otg.state) { | 555 | switch (isp->phy.state) { |
555 | case OTG_STATE_B_IDLE: | 556 | case OTG_STATE_B_IDLE: |
556 | case OTG_STATE_B_PERIPHERAL: | 557 | case OTG_STATE_B_PERIPHERAL: |
557 | case OTG_STATE_B_SRP_INIT: | 558 | case OTG_STATE_B_SRP_INIT: |
558 | if (!(otg_ctrl & OTG_PULLUP)) { | 559 | if (!(otg_ctrl & OTG_PULLUP)) { |
559 | // if (otg_ctrl & OTG_B_HNPEN) { | 560 | // if (otg_ctrl & OTG_B_HNPEN) { |
560 | if (isp->otg.gadget->b_hnp_enable) { | 561 | if (isp->phy.otg->gadget->b_hnp_enable) { |
561 | isp->otg.state = OTG_STATE_B_WAIT_ACON; | 562 | isp->phy.state = OTG_STATE_B_WAIT_ACON; |
562 | pr_debug(" --> b_wait_acon\n"); | 563 | pr_debug(" --> b_wait_acon\n"); |
563 | } | 564 | } |
564 | goto pulldown; | 565 | goto pulldown; |
@@ -585,10 +586,10 @@ pulldown: | |||
585 | else clr |= ISP; \ | 586 | else clr |= ISP; \ |
586 | } while (0) | 587 | } while (0) |
587 | 588 | ||
588 | if (!(isp->otg.host)) | 589 | if (!(isp->phy.otg->host)) |
589 | otg_ctrl &= ~OTG_DRV_VBUS; | 590 | otg_ctrl &= ~OTG_DRV_VBUS; |
590 | 591 | ||
591 | switch (isp->otg.state) { | 592 | switch (isp->phy.state) { |
592 | case OTG_STATE_A_SUSPEND: | 593 | case OTG_STATE_A_SUSPEND: |
593 | if (otg_ctrl & OTG_DRV_VBUS) { | 594 | if (otg_ctrl & OTG_DRV_VBUS) { |
594 | set |= OTG1_VBUS_DRV; | 595 | set |= OTG1_VBUS_DRV; |
@@ -599,7 +600,7 @@ pulldown: | |||
599 | 600 | ||
600 | /* FALLTHROUGH */ | 601 | /* FALLTHROUGH */ |
601 | case OTG_STATE_A_VBUS_ERR: | 602 | case OTG_STATE_A_VBUS_ERR: |
602 | isp->otg.state = OTG_STATE_A_WAIT_VFALL; | 603 | isp->phy.state = OTG_STATE_A_WAIT_VFALL; |
603 | pr_debug(" --> a_wait_vfall\n"); | 604 | pr_debug(" --> a_wait_vfall\n"); |
604 | /* FALLTHROUGH */ | 605 | /* FALLTHROUGH */ |
605 | case OTG_STATE_A_WAIT_VFALL: | 606 | case OTG_STATE_A_WAIT_VFALL: |
@@ -608,7 +609,7 @@ pulldown: | |||
608 | break; | 609 | break; |
609 | case OTG_STATE_A_IDLE: | 610 | case OTG_STATE_A_IDLE: |
610 | if (otg_ctrl & OTG_DRV_VBUS) { | 611 | if (otg_ctrl & OTG_DRV_VBUS) { |
611 | isp->otg.state = OTG_STATE_A_WAIT_VRISE; | 612 | isp->phy.state = OTG_STATE_A_WAIT_VRISE; |
612 | pr_debug(" --> a_wait_vrise\n"); | 613 | pr_debug(" --> a_wait_vrise\n"); |
613 | } | 614 | } |
614 | /* FALLTHROUGH */ | 615 | /* FALLTHROUGH */ |
@@ -628,17 +629,17 @@ pulldown: | |||
628 | if (otg_change & OTG_PULLUP) { | 629 | if (otg_change & OTG_PULLUP) { |
629 | u32 l; | 630 | u32 l; |
630 | 631 | ||
631 | switch (isp->otg.state) { | 632 | switch (isp->phy.state) { |
632 | case OTG_STATE_B_IDLE: | 633 | case OTG_STATE_B_IDLE: |
633 | if (clr & OTG1_DP_PULLUP) | 634 | if (clr & OTG1_DP_PULLUP) |
634 | break; | 635 | break; |
635 | isp->otg.state = OTG_STATE_B_PERIPHERAL; | 636 | isp->phy.state = OTG_STATE_B_PERIPHERAL; |
636 | pr_debug(" --> b_peripheral\n"); | 637 | pr_debug(" --> b_peripheral\n"); |
637 | break; | 638 | break; |
638 | case OTG_STATE_A_SUSPEND: | 639 | case OTG_STATE_A_SUSPEND: |
639 | if (clr & OTG1_DP_PULLUP) | 640 | if (clr & OTG1_DP_PULLUP) |
640 | break; | 641 | break; |
641 | isp->otg.state = OTG_STATE_A_PERIPHERAL; | 642 | isp->phy.state = OTG_STATE_A_PERIPHERAL; |
642 | pr_debug(" --> a_peripheral\n"); | 643 | pr_debug(" --> a_peripheral\n"); |
643 | break; | 644 | break; |
644 | default: | 645 | default: |
@@ -659,6 +660,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
659 | u32 otg_ctrl; | 660 | u32 otg_ctrl; |
660 | int ret = IRQ_NONE; | 661 | int ret = IRQ_NONE; |
661 | struct isp1301 *isp = _isp; | 662 | struct isp1301 *isp = _isp; |
663 | struct usb_otg *otg = isp->phy.otg; | ||
662 | 664 | ||
663 | /* update ISP1301 transceiver from OTG controller */ | 665 | /* update ISP1301 transceiver from OTG controller */ |
664 | if (otg_irq & OPRT_CHG) { | 666 | if (otg_irq & OPRT_CHG) { |
@@ -675,7 +677,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
675 | * remote wakeup (SRP, normal) using their own timer | 677 | * remote wakeup (SRP, normal) using their own timer |
676 | * to give "check cable and A-device" messages. | 678 | * to give "check cable and A-device" messages. |
677 | */ | 679 | */ |
678 | if (isp->otg.state == OTG_STATE_B_SRP_INIT) | 680 | if (isp->phy.state == OTG_STATE_B_SRP_INIT) |
679 | b_idle(isp, "srp_timeout"); | 681 | b_idle(isp, "srp_timeout"); |
680 | 682 | ||
681 | omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC); | 683 | omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC); |
@@ -693,7 +695,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
693 | omap_writel(otg_ctrl, OTG_CTRL); | 695 | omap_writel(otg_ctrl, OTG_CTRL); |
694 | 696 | ||
695 | /* subset of b_peripheral()... */ | 697 | /* subset of b_peripheral()... */ |
696 | isp->otg.state = OTG_STATE_B_PERIPHERAL; | 698 | isp->phy.state = OTG_STATE_B_PERIPHERAL; |
697 | pr_debug(" --> b_peripheral\n"); | 699 | pr_debug(" --> b_peripheral\n"); |
698 | 700 | ||
699 | omap_writew(B_HNP_FAIL, OTG_IRQ_SRC); | 701 | omap_writew(B_HNP_FAIL, OTG_IRQ_SRC); |
@@ -705,9 +707,9 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
705 | state_name(isp), omap_readl(OTG_CTRL)); | 707 | state_name(isp), omap_readl(OTG_CTRL)); |
706 | 708 | ||
707 | isp1301_defer_work(isp, WORK_UPDATE_OTG); | 709 | isp1301_defer_work(isp, WORK_UPDATE_OTG); |
708 | switch (isp->otg.state) { | 710 | switch (isp->phy.state) { |
709 | case OTG_STATE_A_IDLE: | 711 | case OTG_STATE_A_IDLE: |
710 | if (!isp->otg.host) | 712 | if (!otg->host) |
711 | break; | 713 | break; |
712 | isp1301_defer_work(isp, WORK_HOST_RESUME); | 714 | isp1301_defer_work(isp, WORK_HOST_RESUME); |
713 | otg_ctrl = omap_readl(OTG_CTRL); | 715 | otg_ctrl = omap_readl(OTG_CTRL); |
@@ -736,7 +738,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
736 | otg_ctrl |= OTG_BUSDROP; | 738 | otg_ctrl |= OTG_BUSDROP; |
737 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; | 739 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; |
738 | omap_writel(otg_ctrl, OTG_CTRL); | 740 | omap_writel(otg_ctrl, OTG_CTRL); |
739 | isp->otg.state = OTG_STATE_A_WAIT_VFALL; | 741 | isp->phy.state = OTG_STATE_A_WAIT_VFALL; |
740 | 742 | ||
741 | omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC); | 743 | omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC); |
742 | ret = IRQ_HANDLED; | 744 | ret = IRQ_HANDLED; |
@@ -750,7 +752,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
750 | otg_ctrl |= OTG_BUSDROP; | 752 | otg_ctrl |= OTG_BUSDROP; |
751 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; | 753 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; |
752 | omap_writel(otg_ctrl, OTG_CTRL); | 754 | omap_writel(otg_ctrl, OTG_CTRL); |
753 | isp->otg.state = OTG_STATE_A_VBUS_ERR; | 755 | isp->phy.state = OTG_STATE_A_VBUS_ERR; |
754 | 756 | ||
755 | omap_writew(A_VBUS_ERR, OTG_IRQ_SRC); | 757 | omap_writew(A_VBUS_ERR, OTG_IRQ_SRC); |
756 | ret = IRQ_HANDLED; | 758 | ret = IRQ_HANDLED; |
@@ -771,7 +773,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
771 | 773 | ||
772 | /* role is peripheral */ | 774 | /* role is peripheral */ |
773 | if (otg_ctrl & OTG_DRIVER_SEL) { | 775 | if (otg_ctrl & OTG_DRIVER_SEL) { |
774 | switch (isp->otg.state) { | 776 | switch (isp->phy.state) { |
775 | case OTG_STATE_A_IDLE: | 777 | case OTG_STATE_A_IDLE: |
776 | b_idle(isp, __func__); | 778 | b_idle(isp, __func__); |
777 | break; | 779 | break; |
@@ -787,19 +789,19 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
787 | omap_writel(otg_ctrl | OTG_A_BUSREQ, OTG_CTRL); | 789 | omap_writel(otg_ctrl | OTG_A_BUSREQ, OTG_CTRL); |
788 | } | 790 | } |
789 | 791 | ||
790 | if (isp->otg.host) { | 792 | if (otg->host) { |
791 | switch (isp->otg.state) { | 793 | switch (isp->phy.state) { |
792 | case OTG_STATE_B_WAIT_ACON: | 794 | case OTG_STATE_B_WAIT_ACON: |
793 | isp->otg.state = OTG_STATE_B_HOST; | 795 | isp->phy.state = OTG_STATE_B_HOST; |
794 | pr_debug(" --> b_host\n"); | 796 | pr_debug(" --> b_host\n"); |
795 | kick = 1; | 797 | kick = 1; |
796 | break; | 798 | break; |
797 | case OTG_STATE_A_WAIT_BCON: | 799 | case OTG_STATE_A_WAIT_BCON: |
798 | isp->otg.state = OTG_STATE_A_HOST; | 800 | isp->phy.state = OTG_STATE_A_HOST; |
799 | pr_debug(" --> a_host\n"); | 801 | pr_debug(" --> a_host\n"); |
800 | break; | 802 | break; |
801 | case OTG_STATE_A_PERIPHERAL: | 803 | case OTG_STATE_A_PERIPHERAL: |
802 | isp->otg.state = OTG_STATE_A_WAIT_BCON; | 804 | isp->phy.state = OTG_STATE_A_WAIT_BCON; |
803 | pr_debug(" --> a_wait_bcon\n"); | 805 | pr_debug(" --> a_wait_bcon\n"); |
804 | break; | 806 | break; |
805 | default: | 807 | default: |
@@ -813,8 +815,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
813 | ret = IRQ_HANDLED; | 815 | ret = IRQ_HANDLED; |
814 | 816 | ||
815 | if (kick) | 817 | if (kick) |
816 | usb_bus_start_enum(isp->otg.host, | 818 | usb_bus_start_enum(otg->host, otg->host->otg_port); |
817 | isp->otg.host->otg_port); | ||
818 | } | 819 | } |
819 | 820 | ||
820 | check_state(isp, __func__); | 821 | check_state(isp, __func__); |
@@ -930,7 +931,7 @@ static void b_peripheral(struct isp1301 *isp) | |||
930 | l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; | 931 | l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; |
931 | omap_writel(l, OTG_CTRL); | 932 | omap_writel(l, OTG_CTRL); |
932 | 933 | ||
933 | usb_gadget_vbus_connect(isp->otg.gadget); | 934 | usb_gadget_vbus_connect(isp->phy.otg->gadget); |
934 | 935 | ||
935 | #ifdef CONFIG_USB_OTG | 936 | #ifdef CONFIG_USB_OTG |
936 | enable_vbus_draw(isp, 8); | 937 | enable_vbus_draw(isp, 8); |
@@ -940,7 +941,7 @@ static void b_peripheral(struct isp1301 *isp) | |||
940 | /* UDC driver just set OTG_BSESSVLD */ | 941 | /* UDC driver just set OTG_BSESSVLD */ |
941 | isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLUP); | 942 | isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLUP); |
942 | isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLDOWN); | 943 | isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLDOWN); |
943 | isp->otg.state = OTG_STATE_B_PERIPHERAL; | 944 | isp->phy.state = OTG_STATE_B_PERIPHERAL; |
944 | pr_debug(" --> b_peripheral\n"); | 945 | pr_debug(" --> b_peripheral\n"); |
945 | dump_regs(isp, "2periph"); | 946 | dump_regs(isp, "2periph"); |
946 | #endif | 947 | #endif |
@@ -948,8 +949,9 @@ static void b_peripheral(struct isp1301 *isp) | |||
948 | 949 | ||
949 | static void isp_update_otg(struct isp1301 *isp, u8 stat) | 950 | static void isp_update_otg(struct isp1301 *isp, u8 stat) |
950 | { | 951 | { |
952 | struct usb_otg *otg = isp->phy.otg; | ||
951 | u8 isp_stat, isp_bstat; | 953 | u8 isp_stat, isp_bstat; |
952 | enum usb_otg_state state = isp->otg.state; | 954 | enum usb_otg_state state = isp->phy.state; |
953 | 955 | ||
954 | if (stat & INTR_BDIS_ACON) | 956 | if (stat & INTR_BDIS_ACON) |
955 | pr_debug("OTG: BDIS_ACON, %s\n", state_name(isp)); | 957 | pr_debug("OTG: BDIS_ACON, %s\n", state_name(isp)); |
@@ -957,7 +959,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
957 | /* start certain state transitions right away */ | 959 | /* start certain state transitions right away */ |
958 | isp_stat = isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE); | 960 | isp_stat = isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE); |
959 | if (isp_stat & INTR_ID_GND) { | 961 | if (isp_stat & INTR_ID_GND) { |
960 | if (isp->otg.default_a) { | 962 | if (otg->default_a) { |
961 | switch (state) { | 963 | switch (state) { |
962 | case OTG_STATE_B_IDLE: | 964 | case OTG_STATE_B_IDLE: |
963 | a_idle(isp, "idle"); | 965 | a_idle(isp, "idle"); |
@@ -972,7 +974,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
972 | * when HNP is used. | 974 | * when HNP is used. |
973 | */ | 975 | */ |
974 | if (isp_stat & INTR_VBUS_VLD) | 976 | if (isp_stat & INTR_VBUS_VLD) |
975 | isp->otg.state = OTG_STATE_A_HOST; | 977 | isp->phy.state = OTG_STATE_A_HOST; |
976 | break; | 978 | break; |
977 | case OTG_STATE_A_WAIT_VFALL: | 979 | case OTG_STATE_A_WAIT_VFALL: |
978 | if (!(isp_stat & INTR_SESS_VLD)) | 980 | if (!(isp_stat & INTR_SESS_VLD)) |
@@ -980,7 +982,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
980 | break; | 982 | break; |
981 | default: | 983 | default: |
982 | if (!(isp_stat & INTR_VBUS_VLD)) | 984 | if (!(isp_stat & INTR_VBUS_VLD)) |
983 | isp->otg.state = OTG_STATE_A_VBUS_ERR; | 985 | isp->phy.state = OTG_STATE_A_VBUS_ERR; |
984 | break; | 986 | break; |
985 | } | 987 | } |
986 | isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS); | 988 | isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS); |
@@ -989,14 +991,14 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
989 | case OTG_STATE_B_PERIPHERAL: | 991 | case OTG_STATE_B_PERIPHERAL: |
990 | case OTG_STATE_B_HOST: | 992 | case OTG_STATE_B_HOST: |
991 | case OTG_STATE_B_WAIT_ACON: | 993 | case OTG_STATE_B_WAIT_ACON: |
992 | usb_gadget_vbus_disconnect(isp->otg.gadget); | 994 | usb_gadget_vbus_disconnect(otg->gadget); |
993 | break; | 995 | break; |
994 | default: | 996 | default: |
995 | break; | 997 | break; |
996 | } | 998 | } |
997 | if (state != OTG_STATE_A_IDLE) | 999 | if (state != OTG_STATE_A_IDLE) |
998 | a_idle(isp, "id"); | 1000 | a_idle(isp, "id"); |
999 | if (isp->otg.host && state == OTG_STATE_A_IDLE) | 1001 | if (otg->host && state == OTG_STATE_A_IDLE) |
1000 | isp1301_defer_work(isp, WORK_HOST_RESUME); | 1002 | isp1301_defer_work(isp, WORK_HOST_RESUME); |
1001 | isp_bstat = 0; | 1003 | isp_bstat = 0; |
1002 | } | 1004 | } |
@@ -1006,10 +1008,10 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
1006 | /* if user unplugged mini-A end of cable, | 1008 | /* if user unplugged mini-A end of cable, |
1007 | * don't bypass A_WAIT_VFALL. | 1009 | * don't bypass A_WAIT_VFALL. |
1008 | */ | 1010 | */ |
1009 | if (isp->otg.default_a) { | 1011 | if (otg->default_a) { |
1010 | switch (state) { | 1012 | switch (state) { |
1011 | default: | 1013 | default: |
1012 | isp->otg.state = OTG_STATE_A_WAIT_VFALL; | 1014 | isp->phy.state = OTG_STATE_A_WAIT_VFALL; |
1013 | break; | 1015 | break; |
1014 | case OTG_STATE_A_WAIT_VFALL: | 1016 | case OTG_STATE_A_WAIT_VFALL: |
1015 | state = OTG_STATE_A_IDLE; | 1017 | state = OTG_STATE_A_IDLE; |
@@ -1022,7 +1024,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
1022 | host_suspend(isp); | 1024 | host_suspend(isp); |
1023 | isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, | 1025 | isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, |
1024 | MC1_BDIS_ACON_EN); | 1026 | MC1_BDIS_ACON_EN); |
1025 | isp->otg.state = OTG_STATE_B_IDLE; | 1027 | isp->phy.state = OTG_STATE_B_IDLE; |
1026 | l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; | 1028 | l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; |
1027 | l &= ~OTG_CTRL_BITS; | 1029 | l &= ~OTG_CTRL_BITS; |
1028 | omap_writel(l, OTG_CTRL); | 1030 | omap_writel(l, OTG_CTRL); |
@@ -1033,7 +1035,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
1033 | } | 1035 | } |
1034 | isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS); | 1036 | isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS); |
1035 | 1037 | ||
1036 | switch (isp->otg.state) { | 1038 | switch (isp->phy.state) { |
1037 | case OTG_STATE_B_PERIPHERAL: | 1039 | case OTG_STATE_B_PERIPHERAL: |
1038 | case OTG_STATE_B_WAIT_ACON: | 1040 | case OTG_STATE_B_WAIT_ACON: |
1039 | case OTG_STATE_B_HOST: | 1041 | case OTG_STATE_B_HOST: |
@@ -1055,7 +1057,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
1055 | omap_writel(l, OTG_CTRL); | 1057 | omap_writel(l, OTG_CTRL); |
1056 | /* FALLTHROUGH */ | 1058 | /* FALLTHROUGH */ |
1057 | case OTG_STATE_B_IDLE: | 1059 | case OTG_STATE_B_IDLE: |
1058 | if (isp->otg.gadget && (isp_bstat & OTG_B_SESS_VLD)) { | 1060 | if (otg->gadget && (isp_bstat & OTG_B_SESS_VLD)) { |
1059 | #ifdef CONFIG_USB_OTG | 1061 | #ifdef CONFIG_USB_OTG |
1060 | update_otg1(isp, isp_stat); | 1062 | update_otg1(isp, isp_stat); |
1061 | update_otg2(isp, isp_bstat); | 1063 | update_otg2(isp, isp_bstat); |
@@ -1073,7 +1075,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
1073 | } | 1075 | } |
1074 | } | 1076 | } |
1075 | 1077 | ||
1076 | if (state != isp->otg.state) | 1078 | if (state != isp->phy.state) |
1077 | pr_debug(" isp, %s -> %s\n", | 1079 | pr_debug(" isp, %s -> %s\n", |
1078 | otg_state_string(state), state_name(isp)); | 1080 | otg_state_string(state), state_name(isp)); |
1079 | 1081 | ||
@@ -1131,10 +1133,10 @@ isp1301_work(struct work_struct *work) | |||
1131 | * skip A_WAIT_VRISE; hc transitions invisibly | 1133 | * skip A_WAIT_VRISE; hc transitions invisibly |
1132 | * skip A_WAIT_BCON; same. | 1134 | * skip A_WAIT_BCON; same. |
1133 | */ | 1135 | */ |
1134 | switch (isp->otg.state) { | 1136 | switch (isp->phy.state) { |
1135 | case OTG_STATE_A_WAIT_BCON: | 1137 | case OTG_STATE_A_WAIT_BCON: |
1136 | case OTG_STATE_A_WAIT_VRISE: | 1138 | case OTG_STATE_A_WAIT_VRISE: |
1137 | isp->otg.state = OTG_STATE_A_HOST; | 1139 | isp->phy.state = OTG_STATE_A_HOST; |
1138 | pr_debug(" --> a_host\n"); | 1140 | pr_debug(" --> a_host\n"); |
1139 | otg_ctrl = omap_readl(OTG_CTRL); | 1141 | otg_ctrl = omap_readl(OTG_CTRL); |
1140 | otg_ctrl |= OTG_A_BUSREQ; | 1142 | otg_ctrl |= OTG_A_BUSREQ; |
@@ -1143,7 +1145,7 @@ isp1301_work(struct work_struct *work) | |||
1143 | omap_writel(otg_ctrl, OTG_CTRL); | 1145 | omap_writel(otg_ctrl, OTG_CTRL); |
1144 | break; | 1146 | break; |
1145 | case OTG_STATE_B_WAIT_ACON: | 1147 | case OTG_STATE_B_WAIT_ACON: |
1146 | isp->otg.state = OTG_STATE_B_HOST; | 1148 | isp->phy.state = OTG_STATE_B_HOST; |
1147 | pr_debug(" --> b_host (acon)\n"); | 1149 | pr_debug(" --> b_host (acon)\n"); |
1148 | break; | 1150 | break; |
1149 | case OTG_STATE_B_HOST: | 1151 | case OTG_STATE_B_HOST: |
@@ -1204,6 +1206,7 @@ static void isp1301_release(struct device *dev) | |||
1204 | /* ugly -- i2c hijacks our memory hook to wait_for_completion() */ | 1206 | /* ugly -- i2c hijacks our memory hook to wait_for_completion() */ |
1205 | if (isp->i2c_release) | 1207 | if (isp->i2c_release) |
1206 | isp->i2c_release(dev); | 1208 | isp->i2c_release(dev); |
1209 | kfree(isp->phy.otg); | ||
1207 | kfree (isp); | 1210 | kfree (isp); |
1208 | } | 1211 | } |
1209 | 1212 | ||
@@ -1274,9 +1277,9 @@ static int isp1301_otg_enable(struct isp1301 *isp) | |||
1274 | 1277 | ||
1275 | /* add or disable the host device+driver */ | 1278 | /* add or disable the host device+driver */ |
1276 | static int | 1279 | static int |
1277 | isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host) | 1280 | isp1301_set_host(struct usb_otg *otg, struct usb_bus *host) |
1278 | { | 1281 | { |
1279 | struct isp1301 *isp = container_of(otg, struct isp1301, otg); | 1282 | struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); |
1280 | 1283 | ||
1281 | if (!otg || isp != the_transceiver) | 1284 | if (!otg || isp != the_transceiver) |
1282 | return -ENODEV; | 1285 | return -ENODEV; |
@@ -1284,21 +1287,21 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
1284 | if (!host) { | 1287 | if (!host) { |
1285 | omap_writew(0, OTG_IRQ_EN); | 1288 | omap_writew(0, OTG_IRQ_EN); |
1286 | power_down(isp); | 1289 | power_down(isp); |
1287 | isp->otg.host = NULL; | 1290 | otg->host = NULL; |
1288 | return 0; | 1291 | return 0; |
1289 | } | 1292 | } |
1290 | 1293 | ||
1291 | #ifdef CONFIG_USB_OTG | 1294 | #ifdef CONFIG_USB_OTG |
1292 | isp->otg.host = host; | 1295 | otg->host = host; |
1293 | dev_dbg(&isp->client->dev, "registered host\n"); | 1296 | dev_dbg(&isp->client->dev, "registered host\n"); |
1294 | host_suspend(isp); | 1297 | host_suspend(isp); |
1295 | if (isp->otg.gadget) | 1298 | if (otg->gadget) |
1296 | return isp1301_otg_enable(isp); | 1299 | return isp1301_otg_enable(isp); |
1297 | return 0; | 1300 | return 0; |
1298 | 1301 | ||
1299 | #elif !defined(CONFIG_USB_GADGET_OMAP) | 1302 | #elif !defined(CONFIG_USB_GADGET_OMAP) |
1300 | // FIXME update its refcount | 1303 | // FIXME update its refcount |
1301 | isp->otg.host = host; | 1304 | otg->host = host; |
1302 | 1305 | ||
1303 | power_up(isp); | 1306 | power_up(isp); |
1304 | 1307 | ||
@@ -1330,9 +1333,9 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
1330 | } | 1333 | } |
1331 | 1334 | ||
1332 | static int | 1335 | static int |
1333 | isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) | 1336 | isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) |
1334 | { | 1337 | { |
1335 | struct isp1301 *isp = container_of(otg, struct isp1301, otg); | 1338 | struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); |
1336 | #ifndef CONFIG_USB_OTG | 1339 | #ifndef CONFIG_USB_OTG |
1337 | u32 l; | 1340 | u32 l; |
1338 | #endif | 1341 | #endif |
@@ -1342,24 +1345,24 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) | |||
1342 | 1345 | ||
1343 | if (!gadget) { | 1346 | if (!gadget) { |
1344 | omap_writew(0, OTG_IRQ_EN); | 1347 | omap_writew(0, OTG_IRQ_EN); |
1345 | if (!isp->otg.default_a) | 1348 | if (!otg->default_a) |
1346 | enable_vbus_draw(isp, 0); | 1349 | enable_vbus_draw(isp, 0); |
1347 | usb_gadget_vbus_disconnect(isp->otg.gadget); | 1350 | usb_gadget_vbus_disconnect(otg->gadget); |
1348 | isp->otg.gadget = NULL; | 1351 | otg->gadget = NULL; |
1349 | power_down(isp); | 1352 | power_down(isp); |
1350 | return 0; | 1353 | return 0; |
1351 | } | 1354 | } |
1352 | 1355 | ||
1353 | #ifdef CONFIG_USB_OTG | 1356 | #ifdef CONFIG_USB_OTG |
1354 | isp->otg.gadget = gadget; | 1357 | otg->gadget = gadget; |
1355 | dev_dbg(&isp->client->dev, "registered gadget\n"); | 1358 | dev_dbg(&isp->client->dev, "registered gadget\n"); |
1356 | /* gadget driver may be suspended until vbus_connect () */ | 1359 | /* gadget driver may be suspended until vbus_connect () */ |
1357 | if (isp->otg.host) | 1360 | if (otg->host) |
1358 | return isp1301_otg_enable(isp); | 1361 | return isp1301_otg_enable(isp); |
1359 | return 0; | 1362 | return 0; |
1360 | 1363 | ||
1361 | #elif !defined(CONFIG_USB_OHCI_HCD) && !defined(CONFIG_USB_OHCI_HCD_MODULE) | 1364 | #elif !defined(CONFIG_USB_OHCI_HCD) && !defined(CONFIG_USB_OHCI_HCD_MODULE) |
1362 | isp->otg.gadget = gadget; | 1365 | otg->gadget = gadget; |
1363 | // FIXME update its refcount | 1366 | // FIXME update its refcount |
1364 | 1367 | ||
1365 | l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; | 1368 | l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; |
@@ -1368,7 +1371,7 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) | |||
1368 | omap_writel(l, OTG_CTRL); | 1371 | omap_writel(l, OTG_CTRL); |
1369 | 1372 | ||
1370 | power_up(isp); | 1373 | power_up(isp); |
1371 | isp->otg.state = OTG_STATE_B_IDLE; | 1374 | isp->phy.state = OTG_STATE_B_IDLE; |
1372 | 1375 | ||
1373 | if (machine_is_omap_h2() || machine_is_omap_h3()) | 1376 | if (machine_is_omap_h2() || machine_is_omap_h3()) |
1374 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); | 1377 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); |
@@ -1399,7 +1402,7 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget) | |||
1399 | /*-------------------------------------------------------------------------*/ | 1402 | /*-------------------------------------------------------------------------*/ |
1400 | 1403 | ||
1401 | static int | 1404 | static int |
1402 | isp1301_set_power(struct otg_transceiver *dev, unsigned mA) | 1405 | isp1301_set_power(struct usb_phy *dev, unsigned mA) |
1403 | { | 1406 | { |
1404 | if (!the_transceiver) | 1407 | if (!the_transceiver) |
1405 | return -ENODEV; | 1408 | return -ENODEV; |
@@ -1409,13 +1412,13 @@ isp1301_set_power(struct otg_transceiver *dev, unsigned mA) | |||
1409 | } | 1412 | } |
1410 | 1413 | ||
1411 | static int | 1414 | static int |
1412 | isp1301_start_srp(struct otg_transceiver *dev) | 1415 | isp1301_start_srp(struct usb_otg *otg) |
1413 | { | 1416 | { |
1414 | struct isp1301 *isp = container_of(dev, struct isp1301, otg); | 1417 | struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); |
1415 | u32 otg_ctrl; | 1418 | u32 otg_ctrl; |
1416 | 1419 | ||
1417 | if (!dev || isp != the_transceiver | 1420 | if (!otg || isp != the_transceiver |
1418 | || isp->otg.state != OTG_STATE_B_IDLE) | 1421 | || isp->phy.state != OTG_STATE_B_IDLE) |
1419 | return -ENODEV; | 1422 | return -ENODEV; |
1420 | 1423 | ||
1421 | otg_ctrl = omap_readl(OTG_CTRL); | 1424 | otg_ctrl = omap_readl(OTG_CTRL); |
@@ -1425,7 +1428,7 @@ isp1301_start_srp(struct otg_transceiver *dev) | |||
1425 | otg_ctrl |= OTG_B_BUSREQ; | 1428 | otg_ctrl |= OTG_B_BUSREQ; |
1426 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK; | 1429 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK; |
1427 | omap_writel(otg_ctrl, OTG_CTRL); | 1430 | omap_writel(otg_ctrl, OTG_CTRL); |
1428 | isp->otg.state = OTG_STATE_B_SRP_INIT; | 1431 | isp->phy.state = OTG_STATE_B_SRP_INIT; |
1429 | 1432 | ||
1430 | pr_debug("otg: SRP, %s ... %06x\n", state_name(isp), | 1433 | pr_debug("otg: SRP, %s ... %06x\n", state_name(isp), |
1431 | omap_readl(OTG_CTRL)); | 1434 | omap_readl(OTG_CTRL)); |
@@ -1436,27 +1439,26 @@ isp1301_start_srp(struct otg_transceiver *dev) | |||
1436 | } | 1439 | } |
1437 | 1440 | ||
1438 | static int | 1441 | static int |
1439 | isp1301_start_hnp(struct otg_transceiver *dev) | 1442 | isp1301_start_hnp(struct usb_otg *otg) |
1440 | { | 1443 | { |
1441 | #ifdef CONFIG_USB_OTG | 1444 | #ifdef CONFIG_USB_OTG |
1442 | struct isp1301 *isp = container_of(dev, struct isp1301, otg); | 1445 | struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); |
1443 | u32 l; | 1446 | u32 l; |
1444 | 1447 | ||
1445 | if (!dev || isp != the_transceiver) | 1448 | if (!otg || isp != the_transceiver) |
1446 | return -ENODEV; | 1449 | return -ENODEV; |
1447 | if (isp->otg.default_a && (isp->otg.host == NULL | 1450 | if (otg->default_a && (otg->host == NULL || !otg->host->b_hnp_enable)) |
1448 | || !isp->otg.host->b_hnp_enable)) | ||
1449 | return -ENOTCONN; | 1451 | return -ENOTCONN; |
1450 | if (!isp->otg.default_a && (isp->otg.gadget == NULL | 1452 | if (!otg->default_a && (otg->gadget == NULL |
1451 | || !isp->otg.gadget->b_hnp_enable)) | 1453 | || !otg->gadget->b_hnp_enable)) |
1452 | return -ENOTCONN; | 1454 | return -ENOTCONN; |
1453 | 1455 | ||
1454 | /* We want hardware to manage most HNP protocol timings. | 1456 | /* We want hardware to manage most HNP protocol timings. |
1455 | * So do this part as early as possible... | 1457 | * So do this part as early as possible... |
1456 | */ | 1458 | */ |
1457 | switch (isp->otg.state) { | 1459 | switch (isp->phy.state) { |
1458 | case OTG_STATE_B_HOST: | 1460 | case OTG_STATE_B_HOST: |
1459 | isp->otg.state = OTG_STATE_B_PERIPHERAL; | 1461 | isp->phy.state = OTG_STATE_B_PERIPHERAL; |
1460 | /* caller will suspend next */ | 1462 | /* caller will suspend next */ |
1461 | break; | 1463 | break; |
1462 | case OTG_STATE_A_HOST: | 1464 | case OTG_STATE_A_HOST: |
@@ -1466,7 +1468,7 @@ isp1301_start_hnp(struct otg_transceiver *dev) | |||
1466 | MC1_BDIS_ACON_EN); | 1468 | MC1_BDIS_ACON_EN); |
1467 | #endif | 1469 | #endif |
1468 | /* caller must suspend then clear A_BUSREQ */ | 1470 | /* caller must suspend then clear A_BUSREQ */ |
1469 | usb_gadget_vbus_connect(isp->otg.gadget); | 1471 | usb_gadget_vbus_connect(otg->gadget); |
1470 | l = omap_readl(OTG_CTRL); | 1472 | l = omap_readl(OTG_CTRL); |
1471 | l |= OTG_A_SETB_HNPEN; | 1473 | l |= OTG_A_SETB_HNPEN; |
1472 | omap_writel(l, OTG_CTRL); | 1474 | omap_writel(l, OTG_CTRL); |
@@ -1503,6 +1505,12 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id) | |||
1503 | if (!isp) | 1505 | if (!isp) |
1504 | return 0; | 1506 | return 0; |
1505 | 1507 | ||
1508 | isp->phy.otg = kzalloc(sizeof *isp->phy.otg, GFP_KERNEL); | ||
1509 | if (!isp->phy.otg) { | ||
1510 | kfree(isp); | ||
1511 | return 0; | ||
1512 | } | ||
1513 | |||
1506 | INIT_WORK(&isp->work, isp1301_work); | 1514 | INIT_WORK(&isp->work, isp1301_work); |
1507 | init_timer(&isp->timer); | 1515 | init_timer(&isp->timer); |
1508 | isp->timer.function = isp1301_timer; | 1516 | isp->timer.function = isp1301_timer; |
@@ -1576,14 +1584,15 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id) | |||
1576 | goto fail; | 1584 | goto fail; |
1577 | } | 1585 | } |
1578 | 1586 | ||
1579 | isp->otg.dev = &i2c->dev; | 1587 | isp->phy.dev = &i2c->dev; |
1580 | isp->otg.label = DRIVER_NAME; | 1588 | isp->phy.label = DRIVER_NAME; |
1589 | isp->phy.set_power = isp1301_set_power, | ||
1581 | 1590 | ||
1582 | isp->otg.set_host = isp1301_set_host, | 1591 | isp->phy.otg->phy = &isp->phy; |
1583 | isp->otg.set_peripheral = isp1301_set_peripheral, | 1592 | isp->phy.otg->set_host = isp1301_set_host, |
1584 | isp->otg.set_power = isp1301_set_power, | 1593 | isp->phy.otg->set_peripheral = isp1301_set_peripheral, |
1585 | isp->otg.start_srp = isp1301_start_srp, | 1594 | isp->phy.otg->start_srp = isp1301_start_srp, |
1586 | isp->otg.start_hnp = isp1301_start_hnp, | 1595 | isp->phy.otg->start_hnp = isp1301_start_hnp, |
1587 | 1596 | ||
1588 | enable_vbus_draw(isp, 0); | 1597 | enable_vbus_draw(isp, 0); |
1589 | power_down(isp); | 1598 | power_down(isp); |
@@ -1601,7 +1610,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id) | |||
1601 | dev_dbg(&i2c->dev, "scheduled timer, %d min\n", TIMER_MINUTES); | 1610 | dev_dbg(&i2c->dev, "scheduled timer, %d min\n", TIMER_MINUTES); |
1602 | #endif | 1611 | #endif |
1603 | 1612 | ||
1604 | status = otg_set_transceiver(&isp->otg); | 1613 | status = usb_set_transceiver(&isp->phy); |
1605 | if (status < 0) | 1614 | if (status < 0) |
1606 | dev_err(&i2c->dev, "can't register transceiver, %d\n", | 1615 | dev_err(&i2c->dev, "can't register transceiver, %d\n", |
1607 | status); | 1616 | status); |
@@ -1609,6 +1618,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id) | |||
1609 | return 0; | 1618 | return 0; |
1610 | 1619 | ||
1611 | fail: | 1620 | fail: |
1621 | kfree(isp->phy.otg); | ||
1612 | kfree(isp); | 1622 | kfree(isp); |
1613 | return -ENODEV; | 1623 | return -ENODEV; |
1614 | } | 1624 | } |
@@ -1639,7 +1649,7 @@ subsys_initcall(isp_init); | |||
1639 | static void __exit isp_exit(void) | 1649 | static void __exit isp_exit(void) |
1640 | { | 1650 | { |
1641 | if (the_transceiver) | 1651 | if (the_transceiver) |
1642 | otg_set_transceiver(NULL); | 1652 | usb_set_transceiver(NULL); |
1643 | i2c_del_driver(&isp1301_driver); | 1653 | i2c_del_driver(&isp1301_driver); |
1644 | } | 1654 | } |
1645 | module_exit(isp_exit); | 1655 | module_exit(isp_exit); |
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c index b276f8fcdeb..1d0347c247d 100644 --- a/drivers/usb/otg/msm_otg.c +++ b/drivers/usb/otg/msm_otg.c | |||
@@ -69,9 +69,9 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init) | |||
69 | int ret = 0; | 69 | int ret = 0; |
70 | 70 | ||
71 | if (init) { | 71 | if (init) { |
72 | hsusb_vddcx = regulator_get(motg->otg.dev, "HSUSB_VDDCX"); | 72 | hsusb_vddcx = regulator_get(motg->phy.dev, "HSUSB_VDDCX"); |
73 | if (IS_ERR(hsusb_vddcx)) { | 73 | if (IS_ERR(hsusb_vddcx)) { |
74 | dev_err(motg->otg.dev, "unable to get hsusb vddcx\n"); | 74 | dev_err(motg->phy.dev, "unable to get hsusb vddcx\n"); |
75 | return PTR_ERR(hsusb_vddcx); | 75 | return PTR_ERR(hsusb_vddcx); |
76 | } | 76 | } |
77 | 77 | ||
@@ -79,7 +79,7 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init) | |||
79 | USB_PHY_VDD_DIG_VOL_MIN, | 79 | USB_PHY_VDD_DIG_VOL_MIN, |
80 | USB_PHY_VDD_DIG_VOL_MAX); | 80 | USB_PHY_VDD_DIG_VOL_MAX); |
81 | if (ret) { | 81 | if (ret) { |
82 | dev_err(motg->otg.dev, "unable to set the voltage " | 82 | dev_err(motg->phy.dev, "unable to set the voltage " |
83 | "for hsusb vddcx\n"); | 83 | "for hsusb vddcx\n"); |
84 | regulator_put(hsusb_vddcx); | 84 | regulator_put(hsusb_vddcx); |
85 | return ret; | 85 | return ret; |
@@ -87,18 +87,18 @@ static int msm_hsusb_init_vddcx(struct msm_otg *motg, int init) | |||
87 | 87 | ||
88 | ret = regulator_enable(hsusb_vddcx); | 88 | ret = regulator_enable(hsusb_vddcx); |
89 | if (ret) { | 89 | if (ret) { |
90 | dev_err(motg->otg.dev, "unable to enable hsusb vddcx\n"); | 90 | dev_err(motg->phy.dev, "unable to enable hsusb vddcx\n"); |
91 | regulator_put(hsusb_vddcx); | 91 | regulator_put(hsusb_vddcx); |
92 | } | 92 | } |
93 | } else { | 93 | } else { |
94 | ret = regulator_set_voltage(hsusb_vddcx, 0, | 94 | ret = regulator_set_voltage(hsusb_vddcx, 0, |
95 | USB_PHY_VDD_DIG_VOL_MAX); | 95 | USB_PHY_VDD_DIG_VOL_MAX); |
96 | if (ret) | 96 | if (ret) |
97 | dev_err(motg->otg.dev, "unable to set the voltage " | 97 | dev_err(motg->phy.dev, "unable to set the voltage " |
98 | "for hsusb vddcx\n"); | 98 | "for hsusb vddcx\n"); |
99 | ret = regulator_disable(hsusb_vddcx); | 99 | ret = regulator_disable(hsusb_vddcx); |
100 | if (ret) | 100 | if (ret) |
101 | dev_err(motg->otg.dev, "unable to disable hsusb vddcx\n"); | 101 | dev_err(motg->phy.dev, "unable to disable hsusb vddcx\n"); |
102 | 102 | ||
103 | regulator_put(hsusb_vddcx); | 103 | regulator_put(hsusb_vddcx); |
104 | } | 104 | } |
@@ -111,40 +111,40 @@ static int msm_hsusb_ldo_init(struct msm_otg *motg, int init) | |||
111 | int rc = 0; | 111 | int rc = 0; |
112 | 112 | ||
113 | if (init) { | 113 | if (init) { |
114 | hsusb_3p3 = regulator_get(motg->otg.dev, "HSUSB_3p3"); | 114 | hsusb_3p3 = regulator_get(motg->phy.dev, "HSUSB_3p3"); |
115 | if (IS_ERR(hsusb_3p3)) { | 115 | if (IS_ERR(hsusb_3p3)) { |
116 | dev_err(motg->otg.dev, "unable to get hsusb 3p3\n"); | 116 | dev_err(motg->phy.dev, "unable to get hsusb 3p3\n"); |
117 | return PTR_ERR(hsusb_3p3); | 117 | return PTR_ERR(hsusb_3p3); |
118 | } | 118 | } |
119 | 119 | ||
120 | rc = regulator_set_voltage(hsusb_3p3, USB_PHY_3P3_VOL_MIN, | 120 | rc = regulator_set_voltage(hsusb_3p3, USB_PHY_3P3_VOL_MIN, |
121 | USB_PHY_3P3_VOL_MAX); | 121 | USB_PHY_3P3_VOL_MAX); |
122 | if (rc) { | 122 | if (rc) { |
123 | dev_err(motg->otg.dev, "unable to set voltage level " | 123 | dev_err(motg->phy.dev, "unable to set voltage level " |
124 | "for hsusb 3p3\n"); | 124 | "for hsusb 3p3\n"); |
125 | goto put_3p3; | 125 | goto put_3p3; |
126 | } | 126 | } |
127 | rc = regulator_enable(hsusb_3p3); | 127 | rc = regulator_enable(hsusb_3p3); |
128 | if (rc) { | 128 | if (rc) { |
129 | dev_err(motg->otg.dev, "unable to enable the hsusb 3p3\n"); | 129 | dev_err(motg->phy.dev, "unable to enable the hsusb 3p3\n"); |
130 | goto put_3p3; | 130 | goto put_3p3; |
131 | } | 131 | } |
132 | hsusb_1p8 = regulator_get(motg->otg.dev, "HSUSB_1p8"); | 132 | hsusb_1p8 = regulator_get(motg->phy.dev, "HSUSB_1p8"); |
133 | if (IS_ERR(hsusb_1p8)) { | 133 | if (IS_ERR(hsusb_1p8)) { |
134 | dev_err(motg->otg.dev, "unable to get hsusb 1p8\n"); | 134 | dev_err(motg->phy.dev, "unable to get hsusb 1p8\n"); |
135 | rc = PTR_ERR(hsusb_1p8); | 135 | rc = PTR_ERR(hsusb_1p8); |
136 | goto disable_3p3; | 136 | goto disable_3p3; |
137 | } | 137 | } |
138 | rc = regulator_set_voltage(hsusb_1p8, USB_PHY_1P8_VOL_MIN, | 138 | rc = regulator_set_voltage(hsusb_1p8, USB_PHY_1P8_VOL_MIN, |
139 | USB_PHY_1P8_VOL_MAX); | 139 | USB_PHY_1P8_VOL_MAX); |
140 | if (rc) { | 140 | if (rc) { |
141 | dev_err(motg->otg.dev, "unable to set voltage level " | 141 | dev_err(motg->phy.dev, "unable to set voltage level " |
142 | "for hsusb 1p8\n"); | 142 | "for hsusb 1p8\n"); |
143 | goto put_1p8; | 143 | goto put_1p8; |
144 | } | 144 | } |
145 | rc = regulator_enable(hsusb_1p8); | 145 | rc = regulator_enable(hsusb_1p8); |
146 | if (rc) { | 146 | if (rc) { |
147 | dev_err(motg->otg.dev, "unable to enable the hsusb 1p8\n"); | 147 | dev_err(motg->phy.dev, "unable to enable the hsusb 1p8\n"); |
148 | goto put_1p8; | 148 | goto put_1p8; |
149 | } | 149 | } |
150 | 150 | ||
@@ -235,9 +235,9 @@ static int msm_hsusb_ldo_set_mode(int on) | |||
235 | return ret < 0 ? ret : 0; | 235 | return ret < 0 ? ret : 0; |
236 | } | 236 | } |
237 | 237 | ||
238 | static int ulpi_read(struct otg_transceiver *otg, u32 reg) | 238 | static int ulpi_read(struct usb_phy *phy, u32 reg) |
239 | { | 239 | { |
240 | struct msm_otg *motg = container_of(otg, struct msm_otg, otg); | 240 | struct msm_otg *motg = container_of(phy, struct msm_otg, phy); |
241 | int cnt = 0; | 241 | int cnt = 0; |
242 | 242 | ||
243 | /* initiate read operation */ | 243 | /* initiate read operation */ |
@@ -253,16 +253,16 @@ static int ulpi_read(struct otg_transceiver *otg, u32 reg) | |||
253 | } | 253 | } |
254 | 254 | ||
255 | if (cnt >= ULPI_IO_TIMEOUT_USEC) { | 255 | if (cnt >= ULPI_IO_TIMEOUT_USEC) { |
256 | dev_err(otg->dev, "ulpi_read: timeout %08x\n", | 256 | dev_err(phy->dev, "ulpi_read: timeout %08x\n", |
257 | readl(USB_ULPI_VIEWPORT)); | 257 | readl(USB_ULPI_VIEWPORT)); |
258 | return -ETIMEDOUT; | 258 | return -ETIMEDOUT; |
259 | } | 259 | } |
260 | return ULPI_DATA_READ(readl(USB_ULPI_VIEWPORT)); | 260 | return ULPI_DATA_READ(readl(USB_ULPI_VIEWPORT)); |
261 | } | 261 | } |
262 | 262 | ||
263 | static int ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg) | 263 | static int ulpi_write(struct usb_phy *phy, u32 val, u32 reg) |
264 | { | 264 | { |
265 | struct msm_otg *motg = container_of(otg, struct msm_otg, otg); | 265 | struct msm_otg *motg = container_of(phy, struct msm_otg, phy); |
266 | int cnt = 0; | 266 | int cnt = 0; |
267 | 267 | ||
268 | /* initiate write operation */ | 268 | /* initiate write operation */ |
@@ -279,13 +279,13 @@ static int ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg) | |||
279 | } | 279 | } |
280 | 280 | ||
281 | if (cnt >= ULPI_IO_TIMEOUT_USEC) { | 281 | if (cnt >= ULPI_IO_TIMEOUT_USEC) { |
282 | dev_err(otg->dev, "ulpi_write: timeout\n"); | 282 | dev_err(phy->dev, "ulpi_write: timeout\n"); |
283 | return -ETIMEDOUT; | 283 | return -ETIMEDOUT; |
284 | } | 284 | } |
285 | return 0; | 285 | return 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | static struct otg_io_access_ops msm_otg_io_ops = { | 288 | static struct usb_phy_io_ops msm_otg_io_ops = { |
289 | .read = ulpi_read, | 289 | .read = ulpi_read, |
290 | .write = ulpi_write, | 290 | .write = ulpi_write, |
291 | }; | 291 | }; |
@@ -299,9 +299,9 @@ static void ulpi_init(struct msm_otg *motg) | |||
299 | return; | 299 | return; |
300 | 300 | ||
301 | while (seq[0] >= 0) { | 301 | while (seq[0] >= 0) { |
302 | dev_vdbg(motg->otg.dev, "ulpi: write 0x%02x to 0x%02x\n", | 302 | dev_vdbg(motg->phy.dev, "ulpi: write 0x%02x to 0x%02x\n", |
303 | seq[0], seq[1]); | 303 | seq[0], seq[1]); |
304 | ulpi_write(&motg->otg, seq[0], seq[1]); | 304 | ulpi_write(&motg->phy, seq[0], seq[1]); |
305 | seq += 2; | 305 | seq += 2; |
306 | } | 306 | } |
307 | } | 307 | } |
@@ -313,11 +313,11 @@ static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert) | |||
313 | if (assert) { | 313 | if (assert) { |
314 | ret = clk_reset(motg->clk, CLK_RESET_ASSERT); | 314 | ret = clk_reset(motg->clk, CLK_RESET_ASSERT); |
315 | if (ret) | 315 | if (ret) |
316 | dev_err(motg->otg.dev, "usb hs_clk assert failed\n"); | 316 | dev_err(motg->phy.dev, "usb hs_clk assert failed\n"); |
317 | } else { | 317 | } else { |
318 | ret = clk_reset(motg->clk, CLK_RESET_DEASSERT); | 318 | ret = clk_reset(motg->clk, CLK_RESET_DEASSERT); |
319 | if (ret) | 319 | if (ret) |
320 | dev_err(motg->otg.dev, "usb hs_clk deassert failed\n"); | 320 | dev_err(motg->phy.dev, "usb hs_clk deassert failed\n"); |
321 | } | 321 | } |
322 | return ret; | 322 | return ret; |
323 | } | 323 | } |
@@ -328,13 +328,13 @@ static int msm_otg_phy_clk_reset(struct msm_otg *motg) | |||
328 | 328 | ||
329 | ret = clk_reset(motg->phy_reset_clk, CLK_RESET_ASSERT); | 329 | ret = clk_reset(motg->phy_reset_clk, CLK_RESET_ASSERT); |
330 | if (ret) { | 330 | if (ret) { |
331 | dev_err(motg->otg.dev, "usb phy clk assert failed\n"); | 331 | dev_err(motg->phy.dev, "usb phy clk assert failed\n"); |
332 | return ret; | 332 | return ret; |
333 | } | 333 | } |
334 | usleep_range(10000, 12000); | 334 | usleep_range(10000, 12000); |
335 | ret = clk_reset(motg->phy_reset_clk, CLK_RESET_DEASSERT); | 335 | ret = clk_reset(motg->phy_reset_clk, CLK_RESET_DEASSERT); |
336 | if (ret) | 336 | if (ret) |
337 | dev_err(motg->otg.dev, "usb phy clk deassert failed\n"); | 337 | dev_err(motg->phy.dev, "usb phy clk deassert failed\n"); |
338 | return ret; | 338 | return ret; |
339 | } | 339 | } |
340 | 340 | ||
@@ -358,7 +358,7 @@ static int msm_otg_phy_reset(struct msm_otg *motg) | |||
358 | writel(val | PORTSC_PTS_ULPI, USB_PORTSC); | 358 | writel(val | PORTSC_PTS_ULPI, USB_PORTSC); |
359 | 359 | ||
360 | for (retries = 3; retries > 0; retries--) { | 360 | for (retries = 3; retries > 0; retries--) { |
361 | ret = ulpi_write(&motg->otg, ULPI_FUNC_CTRL_SUSPENDM, | 361 | ret = ulpi_write(&motg->phy, ULPI_FUNC_CTRL_SUSPENDM, |
362 | ULPI_CLR(ULPI_FUNC_CTRL)); | 362 | ULPI_CLR(ULPI_FUNC_CTRL)); |
363 | if (!ret) | 363 | if (!ret) |
364 | break; | 364 | break; |
@@ -375,7 +375,7 @@ static int msm_otg_phy_reset(struct msm_otg *motg) | |||
375 | return ret; | 375 | return ret; |
376 | 376 | ||
377 | for (retries = 3; retries > 0; retries--) { | 377 | for (retries = 3; retries > 0; retries--) { |
378 | ret = ulpi_read(&motg->otg, ULPI_DEBUG); | 378 | ret = ulpi_read(&motg->phy, ULPI_DEBUG); |
379 | if (ret != -ETIMEDOUT) | 379 | if (ret != -ETIMEDOUT) |
380 | break; | 380 | break; |
381 | ret = msm_otg_phy_clk_reset(motg); | 381 | ret = msm_otg_phy_clk_reset(motg); |
@@ -385,14 +385,14 @@ static int msm_otg_phy_reset(struct msm_otg *motg) | |||
385 | if (!retries) | 385 | if (!retries) |
386 | return -ETIMEDOUT; | 386 | return -ETIMEDOUT; |
387 | 387 | ||
388 | dev_info(motg->otg.dev, "phy_reset: success\n"); | 388 | dev_info(motg->phy.dev, "phy_reset: success\n"); |
389 | return 0; | 389 | return 0; |
390 | } | 390 | } |
391 | 391 | ||
392 | #define LINK_RESET_TIMEOUT_USEC (250 * 1000) | 392 | #define LINK_RESET_TIMEOUT_USEC (250 * 1000) |
393 | static int msm_otg_reset(struct otg_transceiver *otg) | 393 | static int msm_otg_reset(struct usb_phy *phy) |
394 | { | 394 | { |
395 | struct msm_otg *motg = container_of(otg, struct msm_otg, otg); | 395 | struct msm_otg *motg = container_of(phy, struct msm_otg, phy); |
396 | struct msm_otg_platform_data *pdata = motg->pdata; | 396 | struct msm_otg_platform_data *pdata = motg->pdata; |
397 | int cnt = 0; | 397 | int cnt = 0; |
398 | int ret; | 398 | int ret; |
@@ -401,7 +401,7 @@ static int msm_otg_reset(struct otg_transceiver *otg) | |||
401 | 401 | ||
402 | ret = msm_otg_phy_reset(motg); | 402 | ret = msm_otg_phy_reset(motg); |
403 | if (ret) { | 403 | if (ret) { |
404 | dev_err(otg->dev, "phy_reset failed\n"); | 404 | dev_err(phy->dev, "phy_reset failed\n"); |
405 | return ret; | 405 | return ret; |
406 | } | 406 | } |
407 | 407 | ||
@@ -435,8 +435,8 @@ static int msm_otg_reset(struct otg_transceiver *otg) | |||
435 | val |= OTGSC_BSVIE; | 435 | val |= OTGSC_BSVIE; |
436 | } | 436 | } |
437 | writel(val, USB_OTGSC); | 437 | writel(val, USB_OTGSC); |
438 | ulpi_write(otg, ulpi_val, ULPI_USB_INT_EN_RISE); | 438 | ulpi_write(phy, ulpi_val, ULPI_USB_INT_EN_RISE); |
439 | ulpi_write(otg, ulpi_val, ULPI_USB_INT_EN_FALL); | 439 | ulpi_write(phy, ulpi_val, ULPI_USB_INT_EN_FALL); |
440 | } | 440 | } |
441 | 441 | ||
442 | return 0; | 442 | return 0; |
@@ -448,8 +448,8 @@ static int msm_otg_reset(struct otg_transceiver *otg) | |||
448 | #ifdef CONFIG_PM_SLEEP | 448 | #ifdef CONFIG_PM_SLEEP |
449 | static int msm_otg_suspend(struct msm_otg *motg) | 449 | static int msm_otg_suspend(struct msm_otg *motg) |
450 | { | 450 | { |
451 | struct otg_transceiver *otg = &motg->otg; | 451 | struct usb_phy *phy = &motg->phy; |
452 | struct usb_bus *bus = otg->host; | 452 | struct usb_bus *bus = phy->otg->host; |
453 | struct msm_otg_platform_data *pdata = motg->pdata; | 453 | struct msm_otg_platform_data *pdata = motg->pdata; |
454 | int cnt = 0; | 454 | int cnt = 0; |
455 | 455 | ||
@@ -475,10 +475,10 @@ static int msm_otg_suspend(struct msm_otg *motg) | |||
475 | */ | 475 | */ |
476 | 476 | ||
477 | if (motg->pdata->phy_type == CI_45NM_INTEGRATED_PHY) { | 477 | if (motg->pdata->phy_type == CI_45NM_INTEGRATED_PHY) { |
478 | ulpi_read(otg, 0x14); | 478 | ulpi_read(phy, 0x14); |
479 | if (pdata->otg_control == OTG_PHY_CONTROL) | 479 | if (pdata->otg_control == OTG_PHY_CONTROL) |
480 | ulpi_write(otg, 0x01, 0x30); | 480 | ulpi_write(phy, 0x01, 0x30); |
481 | ulpi_write(otg, 0x08, 0x09); | 481 | ulpi_write(phy, 0x08, 0x09); |
482 | } | 482 | } |
483 | 483 | ||
484 | /* | 484 | /* |
@@ -495,8 +495,8 @@ static int msm_otg_suspend(struct msm_otg *motg) | |||
495 | } | 495 | } |
496 | 496 | ||
497 | if (cnt >= PHY_SUSPEND_TIMEOUT_USEC) { | 497 | if (cnt >= PHY_SUSPEND_TIMEOUT_USEC) { |
498 | dev_err(otg->dev, "Unable to suspend PHY\n"); | 498 | dev_err(phy->dev, "Unable to suspend PHY\n"); |
499 | msm_otg_reset(otg); | 499 | msm_otg_reset(phy); |
500 | enable_irq(motg->irq); | 500 | enable_irq(motg->irq); |
501 | return -ETIMEDOUT; | 501 | return -ETIMEDOUT; |
502 | } | 502 | } |
@@ -528,7 +528,7 @@ static int msm_otg_suspend(struct msm_otg *motg) | |||
528 | msm_hsusb_config_vddcx(0); | 528 | msm_hsusb_config_vddcx(0); |
529 | } | 529 | } |
530 | 530 | ||
531 | if (device_may_wakeup(otg->dev)) | 531 | if (device_may_wakeup(phy->dev)) |
532 | enable_irq_wake(motg->irq); | 532 | enable_irq_wake(motg->irq); |
533 | if (bus) | 533 | if (bus) |
534 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &(bus_to_hcd(bus))->flags); | 534 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &(bus_to_hcd(bus))->flags); |
@@ -536,15 +536,15 @@ static int msm_otg_suspend(struct msm_otg *motg) | |||
536 | atomic_set(&motg->in_lpm, 1); | 536 | atomic_set(&motg->in_lpm, 1); |
537 | enable_irq(motg->irq); | 537 | enable_irq(motg->irq); |
538 | 538 | ||
539 | dev_info(otg->dev, "USB in low power mode\n"); | 539 | dev_info(phy->dev, "USB in low power mode\n"); |
540 | 540 | ||
541 | return 0; | 541 | return 0; |
542 | } | 542 | } |
543 | 543 | ||
544 | static int msm_otg_resume(struct msm_otg *motg) | 544 | static int msm_otg_resume(struct msm_otg *motg) |
545 | { | 545 | { |
546 | struct otg_transceiver *otg = &motg->otg; | 546 | struct usb_phy *phy = &motg->phy; |
547 | struct usb_bus *bus = otg->host; | 547 | struct usb_bus *bus = phy->otg->host; |
548 | int cnt = 0; | 548 | int cnt = 0; |
549 | unsigned temp; | 549 | unsigned temp; |
550 | 550 | ||
@@ -592,13 +592,13 @@ static int msm_otg_resume(struct msm_otg *motg) | |||
592 | * PHY. USB state can not be restored. Re-insertion | 592 | * PHY. USB state can not be restored. Re-insertion |
593 | * of USB cable is the only way to get USB working. | 593 | * of USB cable is the only way to get USB working. |
594 | */ | 594 | */ |
595 | dev_err(otg->dev, "Unable to resume USB." | 595 | dev_err(phy->dev, "Unable to resume USB." |
596 | "Re-plugin the cable\n"); | 596 | "Re-plugin the cable\n"); |
597 | msm_otg_reset(otg); | 597 | msm_otg_reset(phy); |
598 | } | 598 | } |
599 | 599 | ||
600 | skip_phy_resume: | 600 | skip_phy_resume: |
601 | if (device_may_wakeup(otg->dev)) | 601 | if (device_may_wakeup(phy->dev)) |
602 | disable_irq_wake(motg->irq); | 602 | disable_irq_wake(motg->irq); |
603 | if (bus) | 603 | if (bus) |
604 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &(bus_to_hcd(bus))->flags); | 604 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &(bus_to_hcd(bus))->flags); |
@@ -607,11 +607,11 @@ skip_phy_resume: | |||
607 | 607 | ||
608 | if (motg->async_int) { | 608 | if (motg->async_int) { |
609 | motg->async_int = 0; | 609 | motg->async_int = 0; |
610 | pm_runtime_put(otg->dev); | 610 | pm_runtime_put(phy->dev); |
611 | enable_irq(motg->irq); | 611 | enable_irq(motg->irq); |
612 | } | 612 | } |
613 | 613 | ||
614 | dev_info(otg->dev, "USB exited from low power mode\n"); | 614 | dev_info(phy->dev, "USB exited from low power mode\n"); |
615 | 615 | ||
616 | return 0; | 616 | return 0; |
617 | } | 617 | } |
@@ -623,13 +623,13 @@ static void msm_otg_notify_charger(struct msm_otg *motg, unsigned mA) | |||
623 | return; | 623 | return; |
624 | 624 | ||
625 | /* TODO: Notify PMIC about available current */ | 625 | /* TODO: Notify PMIC about available current */ |
626 | dev_info(motg->otg.dev, "Avail curr from USB = %u\n", mA); | 626 | dev_info(motg->phy.dev, "Avail curr from USB = %u\n", mA); |
627 | motg->cur_power = mA; | 627 | motg->cur_power = mA; |
628 | } | 628 | } |
629 | 629 | ||
630 | static int msm_otg_set_power(struct otg_transceiver *otg, unsigned mA) | 630 | static int msm_otg_set_power(struct usb_phy *phy, unsigned mA) |
631 | { | 631 | { |
632 | struct msm_otg *motg = container_of(otg, struct msm_otg, otg); | 632 | struct msm_otg *motg = container_of(phy, struct msm_otg, phy); |
633 | 633 | ||
634 | /* | 634 | /* |
635 | * Gadget driver uses set_power method to notify about the | 635 | * Gadget driver uses set_power method to notify about the |
@@ -644,19 +644,19 @@ static int msm_otg_set_power(struct otg_transceiver *otg, unsigned mA) | |||
644 | return 0; | 644 | return 0; |
645 | } | 645 | } |
646 | 646 | ||
647 | static void msm_otg_start_host(struct otg_transceiver *otg, int on) | 647 | static void msm_otg_start_host(struct usb_phy *phy, int on) |
648 | { | 648 | { |
649 | struct msm_otg *motg = container_of(otg, struct msm_otg, otg); | 649 | struct msm_otg *motg = container_of(phy, struct msm_otg, phy); |
650 | struct msm_otg_platform_data *pdata = motg->pdata; | 650 | struct msm_otg_platform_data *pdata = motg->pdata; |
651 | struct usb_hcd *hcd; | 651 | struct usb_hcd *hcd; |
652 | 652 | ||
653 | if (!otg->host) | 653 | if (!phy->otg->host) |
654 | return; | 654 | return; |
655 | 655 | ||
656 | hcd = bus_to_hcd(otg->host); | 656 | hcd = bus_to_hcd(phy->otg->host); |
657 | 657 | ||
658 | if (on) { | 658 | if (on) { |
659 | dev_dbg(otg->dev, "host on\n"); | 659 | dev_dbg(phy->dev, "host on\n"); |
660 | 660 | ||
661 | if (pdata->vbus_power) | 661 | if (pdata->vbus_power) |
662 | pdata->vbus_power(1); | 662 | pdata->vbus_power(1); |
@@ -671,7 +671,7 @@ static void msm_otg_start_host(struct otg_transceiver *otg, int on) | |||
671 | usb_add_hcd(hcd, hcd->irq, IRQF_SHARED); | 671 | usb_add_hcd(hcd, hcd->irq, IRQF_SHARED); |
672 | #endif | 672 | #endif |
673 | } else { | 673 | } else { |
674 | dev_dbg(otg->dev, "host off\n"); | 674 | dev_dbg(phy->dev, "host off\n"); |
675 | 675 | ||
676 | #ifdef CONFIG_USB | 676 | #ifdef CONFIG_USB |
677 | usb_remove_hcd(hcd); | 677 | usb_remove_hcd(hcd); |
@@ -683,9 +683,9 @@ static void msm_otg_start_host(struct otg_transceiver *otg, int on) | |||
683 | } | 683 | } |
684 | } | 684 | } |
685 | 685 | ||
686 | static int msm_otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) | 686 | static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host) |
687 | { | 687 | { |
688 | struct msm_otg *motg = container_of(otg, struct msm_otg, otg); | 688 | struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy); |
689 | struct usb_hcd *hcd; | 689 | struct usb_hcd *hcd; |
690 | 690 | ||
691 | /* | 691 | /* |
@@ -693,16 +693,16 @@ static int msm_otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
693 | * only peripheral configuration. | 693 | * only peripheral configuration. |
694 | */ | 694 | */ |
695 | if (motg->pdata->mode == USB_PERIPHERAL) { | 695 | if (motg->pdata->mode == USB_PERIPHERAL) { |
696 | dev_info(otg->dev, "Host mode is not supported\n"); | 696 | dev_info(otg->phy->dev, "Host mode is not supported\n"); |
697 | return -ENODEV; | 697 | return -ENODEV; |
698 | } | 698 | } |
699 | 699 | ||
700 | if (!host) { | 700 | if (!host) { |
701 | if (otg->state == OTG_STATE_A_HOST) { | 701 | if (otg->phy->state == OTG_STATE_A_HOST) { |
702 | pm_runtime_get_sync(otg->dev); | 702 | pm_runtime_get_sync(otg->phy->dev); |
703 | msm_otg_start_host(otg, 0); | 703 | msm_otg_start_host(otg->phy, 0); |
704 | otg->host = NULL; | 704 | otg->host = NULL; |
705 | otg->state = OTG_STATE_UNDEFINED; | 705 | otg->phy->state = OTG_STATE_UNDEFINED; |
706 | schedule_work(&motg->sm_work); | 706 | schedule_work(&motg->sm_work); |
707 | } else { | 707 | } else { |
708 | otg->host = NULL; | 708 | otg->host = NULL; |
@@ -715,30 +715,30 @@ static int msm_otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
715 | hcd->power_budget = motg->pdata->power_budget; | 715 | hcd->power_budget = motg->pdata->power_budget; |
716 | 716 | ||
717 | otg->host = host; | 717 | otg->host = host; |
718 | dev_dbg(otg->dev, "host driver registered w/ tranceiver\n"); | 718 | dev_dbg(otg->phy->dev, "host driver registered w/ tranceiver\n"); |
719 | 719 | ||
720 | /* | 720 | /* |
721 | * Kick the state machine work, if peripheral is not supported | 721 | * Kick the state machine work, if peripheral is not supported |
722 | * or peripheral is already registered with us. | 722 | * or peripheral is already registered with us. |
723 | */ | 723 | */ |
724 | if (motg->pdata->mode == USB_HOST || otg->gadget) { | 724 | if (motg->pdata->mode == USB_HOST || otg->gadget) { |
725 | pm_runtime_get_sync(otg->dev); | 725 | pm_runtime_get_sync(otg->phy->dev); |
726 | schedule_work(&motg->sm_work); | 726 | schedule_work(&motg->sm_work); |
727 | } | 727 | } |
728 | 728 | ||
729 | return 0; | 729 | return 0; |
730 | } | 730 | } |
731 | 731 | ||
732 | static void msm_otg_start_peripheral(struct otg_transceiver *otg, int on) | 732 | static void msm_otg_start_peripheral(struct usb_phy *phy, int on) |
733 | { | 733 | { |
734 | struct msm_otg *motg = container_of(otg, struct msm_otg, otg); | 734 | struct msm_otg *motg = container_of(phy, struct msm_otg, phy); |
735 | struct msm_otg_platform_data *pdata = motg->pdata; | 735 | struct msm_otg_platform_data *pdata = motg->pdata; |
736 | 736 | ||
737 | if (!otg->gadget) | 737 | if (!phy->otg->gadget) |
738 | return; | 738 | return; |
739 | 739 | ||
740 | if (on) { | 740 | if (on) { |
741 | dev_dbg(otg->dev, "gadget on\n"); | 741 | dev_dbg(phy->dev, "gadget on\n"); |
742 | /* | 742 | /* |
743 | * Some boards have a switch cotrolled by gpio | 743 | * Some boards have a switch cotrolled by gpio |
744 | * to enable/disable internal HUB. Disable internal | 744 | * to enable/disable internal HUB. Disable internal |
@@ -746,36 +746,36 @@ static void msm_otg_start_peripheral(struct otg_transceiver *otg, int on) | |||
746 | */ | 746 | */ |
747 | if (pdata->setup_gpio) | 747 | if (pdata->setup_gpio) |
748 | pdata->setup_gpio(OTG_STATE_B_PERIPHERAL); | 748 | pdata->setup_gpio(OTG_STATE_B_PERIPHERAL); |
749 | usb_gadget_vbus_connect(otg->gadget); | 749 | usb_gadget_vbus_connect(phy->otg->gadget); |
750 | } else { | 750 | } else { |
751 | dev_dbg(otg->dev, "gadget off\n"); | 751 | dev_dbg(phy->dev, "gadget off\n"); |
752 | usb_gadget_vbus_disconnect(otg->gadget); | 752 | usb_gadget_vbus_disconnect(phy->otg->gadget); |
753 | if (pdata->setup_gpio) | 753 | if (pdata->setup_gpio) |
754 | pdata->setup_gpio(OTG_STATE_UNDEFINED); | 754 | pdata->setup_gpio(OTG_STATE_UNDEFINED); |
755 | } | 755 | } |
756 | 756 | ||
757 | } | 757 | } |
758 | 758 | ||
759 | static int msm_otg_set_peripheral(struct otg_transceiver *otg, | 759 | static int msm_otg_set_peripheral(struct usb_otg *otg, |
760 | struct usb_gadget *gadget) | 760 | struct usb_gadget *gadget) |
761 | { | 761 | { |
762 | struct msm_otg *motg = container_of(otg, struct msm_otg, otg); | 762 | struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy); |
763 | 763 | ||
764 | /* | 764 | /* |
765 | * Fail peripheral registration if this board can support | 765 | * Fail peripheral registration if this board can support |
766 | * only host configuration. | 766 | * only host configuration. |
767 | */ | 767 | */ |
768 | if (motg->pdata->mode == USB_HOST) { | 768 | if (motg->pdata->mode == USB_HOST) { |
769 | dev_info(otg->dev, "Peripheral mode is not supported\n"); | 769 | dev_info(otg->phy->dev, "Peripheral mode is not supported\n"); |
770 | return -ENODEV; | 770 | return -ENODEV; |
771 | } | 771 | } |
772 | 772 | ||
773 | if (!gadget) { | 773 | if (!gadget) { |
774 | if (otg->state == OTG_STATE_B_PERIPHERAL) { | 774 | if (otg->phy->state == OTG_STATE_B_PERIPHERAL) { |
775 | pm_runtime_get_sync(otg->dev); | 775 | pm_runtime_get_sync(otg->phy->dev); |
776 | msm_otg_start_peripheral(otg, 0); | 776 | msm_otg_start_peripheral(otg->phy, 0); |
777 | otg->gadget = NULL; | 777 | otg->gadget = NULL; |
778 | otg->state = OTG_STATE_UNDEFINED; | 778 | otg->phy->state = OTG_STATE_UNDEFINED; |
779 | schedule_work(&motg->sm_work); | 779 | schedule_work(&motg->sm_work); |
780 | } else { | 780 | } else { |
781 | otg->gadget = NULL; | 781 | otg->gadget = NULL; |
@@ -784,14 +784,14 @@ static int msm_otg_set_peripheral(struct otg_transceiver *otg, | |||
784 | return 0; | 784 | return 0; |
785 | } | 785 | } |
786 | otg->gadget = gadget; | 786 | otg->gadget = gadget; |
787 | dev_dbg(otg->dev, "peripheral driver registered w/ tranceiver\n"); | 787 | dev_dbg(otg->phy->dev, "peripheral driver registered w/ tranceiver\n"); |
788 | 788 | ||
789 | /* | 789 | /* |
790 | * Kick the state machine work, if host is not supported | 790 | * Kick the state machine work, if host is not supported |
791 | * or host is already registered with us. | 791 | * or host is already registered with us. |
792 | */ | 792 | */ |
793 | if (motg->pdata->mode == USB_PERIPHERAL || otg->host) { | 793 | if (motg->pdata->mode == USB_PERIPHERAL || otg->host) { |
794 | pm_runtime_get_sync(otg->dev); | 794 | pm_runtime_get_sync(otg->phy->dev); |
795 | schedule_work(&motg->sm_work); | 795 | schedule_work(&motg->sm_work); |
796 | } | 796 | } |
797 | 797 | ||
@@ -800,17 +800,17 @@ static int msm_otg_set_peripheral(struct otg_transceiver *otg, | |||
800 | 800 | ||
801 | static bool msm_chg_check_secondary_det(struct msm_otg *motg) | 801 | static bool msm_chg_check_secondary_det(struct msm_otg *motg) |
802 | { | 802 | { |
803 | struct otg_transceiver *otg = &motg->otg; | 803 | struct usb_phy *phy = &motg->phy; |
804 | u32 chg_det; | 804 | u32 chg_det; |
805 | bool ret = false; | 805 | bool ret = false; |
806 | 806 | ||
807 | switch (motg->pdata->phy_type) { | 807 | switch (motg->pdata->phy_type) { |
808 | case CI_45NM_INTEGRATED_PHY: | 808 | case CI_45NM_INTEGRATED_PHY: |
809 | chg_det = ulpi_read(otg, 0x34); | 809 | chg_det = ulpi_read(phy, 0x34); |
810 | ret = chg_det & (1 << 4); | 810 | ret = chg_det & (1 << 4); |
811 | break; | 811 | break; |
812 | case SNPS_28NM_INTEGRATED_PHY: | 812 | case SNPS_28NM_INTEGRATED_PHY: |
813 | chg_det = ulpi_read(otg, 0x87); | 813 | chg_det = ulpi_read(phy, 0x87); |
814 | ret = chg_det & 1; | 814 | ret = chg_det & 1; |
815 | break; | 815 | break; |
816 | default: | 816 | default: |
@@ -821,38 +821,38 @@ static bool msm_chg_check_secondary_det(struct msm_otg *motg) | |||
821 | 821 | ||
822 | static void msm_chg_enable_secondary_det(struct msm_otg *motg) | 822 | static void msm_chg_enable_secondary_det(struct msm_otg *motg) |
823 | { | 823 | { |
824 | struct otg_transceiver *otg = &motg->otg; | 824 | struct usb_phy *phy = &motg->phy; |
825 | u32 chg_det; | 825 | u32 chg_det; |
826 | 826 | ||
827 | switch (motg->pdata->phy_type) { | 827 | switch (motg->pdata->phy_type) { |
828 | case CI_45NM_INTEGRATED_PHY: | 828 | case CI_45NM_INTEGRATED_PHY: |
829 | chg_det = ulpi_read(otg, 0x34); | 829 | chg_det = ulpi_read(phy, 0x34); |
830 | /* Turn off charger block */ | 830 | /* Turn off charger block */ |
831 | chg_det |= ~(1 << 1); | 831 | chg_det |= ~(1 << 1); |
832 | ulpi_write(otg, chg_det, 0x34); | 832 | ulpi_write(phy, chg_det, 0x34); |
833 | udelay(20); | 833 | udelay(20); |
834 | /* control chg block via ULPI */ | 834 | /* control chg block via ULPI */ |
835 | chg_det &= ~(1 << 3); | 835 | chg_det &= ~(1 << 3); |
836 | ulpi_write(otg, chg_det, 0x34); | 836 | ulpi_write(phy, chg_det, 0x34); |
837 | /* put it in host mode for enabling D- source */ | 837 | /* put it in host mode for enabling D- source */ |
838 | chg_det &= ~(1 << 2); | 838 | chg_det &= ~(1 << 2); |
839 | ulpi_write(otg, chg_det, 0x34); | 839 | ulpi_write(phy, chg_det, 0x34); |
840 | /* Turn on chg detect block */ | 840 | /* Turn on chg detect block */ |
841 | chg_det &= ~(1 << 1); | 841 | chg_det &= ~(1 << 1); |
842 | ulpi_write(otg, chg_det, 0x34); | 842 | ulpi_write(phy, chg_det, 0x34); |
843 | udelay(20); | 843 | udelay(20); |
844 | /* enable chg detection */ | 844 | /* enable chg detection */ |
845 | chg_det &= ~(1 << 0); | 845 | chg_det &= ~(1 << 0); |
846 | ulpi_write(otg, chg_det, 0x34); | 846 | ulpi_write(phy, chg_det, 0x34); |
847 | break; | 847 | break; |
848 | case SNPS_28NM_INTEGRATED_PHY: | 848 | case SNPS_28NM_INTEGRATED_PHY: |
849 | /* | 849 | /* |
850 | * Configure DM as current source, DP as current sink | 850 | * Configure DM as current source, DP as current sink |
851 | * and enable battery charging comparators. | 851 | * and enable battery charging comparators. |
852 | */ | 852 | */ |
853 | ulpi_write(otg, 0x8, 0x85); | 853 | ulpi_write(phy, 0x8, 0x85); |
854 | ulpi_write(otg, 0x2, 0x85); | 854 | ulpi_write(phy, 0x2, 0x85); |
855 | ulpi_write(otg, 0x1, 0x85); | 855 | ulpi_write(phy, 0x1, 0x85); |
856 | break; | 856 | break; |
857 | default: | 857 | default: |
858 | break; | 858 | break; |
@@ -861,17 +861,17 @@ static void msm_chg_enable_secondary_det(struct msm_otg *motg) | |||
861 | 861 | ||
862 | static bool msm_chg_check_primary_det(struct msm_otg *motg) | 862 | static bool msm_chg_check_primary_det(struct msm_otg *motg) |
863 | { | 863 | { |
864 | struct otg_transceiver *otg = &motg->otg; | 864 | struct usb_phy *phy = &motg->phy; |
865 | u32 chg_det; | 865 | u32 chg_det; |
866 | bool ret = false; | 866 | bool ret = false; |
867 | 867 | ||
868 | switch (motg->pdata->phy_type) { | 868 | switch (motg->pdata->phy_type) { |
869 | case CI_45NM_INTEGRATED_PHY: | 869 | case CI_45NM_INTEGRATED_PHY: |
870 | chg_det = ulpi_read(otg, 0x34); | 870 | chg_det = ulpi_read(phy, 0x34); |
871 | ret = chg_det & (1 << 4); | 871 | ret = chg_det & (1 << 4); |
872 | break; | 872 | break; |
873 | case SNPS_28NM_INTEGRATED_PHY: | 873 | case SNPS_28NM_INTEGRATED_PHY: |
874 | chg_det = ulpi_read(otg, 0x87); | 874 | chg_det = ulpi_read(phy, 0x87); |
875 | ret = chg_det & 1; | 875 | ret = chg_det & 1; |
876 | break; | 876 | break; |
877 | default: | 877 | default: |
@@ -882,23 +882,23 @@ static bool msm_chg_check_primary_det(struct msm_otg *motg) | |||
882 | 882 | ||
883 | static void msm_chg_enable_primary_det(struct msm_otg *motg) | 883 | static void msm_chg_enable_primary_det(struct msm_otg *motg) |
884 | { | 884 | { |
885 | struct otg_transceiver *otg = &motg->otg; | 885 | struct usb_phy *phy = &motg->phy; |
886 | u32 chg_det; | 886 | u32 chg_det; |
887 | 887 | ||
888 | switch (motg->pdata->phy_type) { | 888 | switch (motg->pdata->phy_type) { |
889 | case CI_45NM_INTEGRATED_PHY: | 889 | case CI_45NM_INTEGRATED_PHY: |
890 | chg_det = ulpi_read(otg, 0x34); | 890 | chg_det = ulpi_read(phy, 0x34); |
891 | /* enable chg detection */ | 891 | /* enable chg detection */ |
892 | chg_det &= ~(1 << 0); | 892 | chg_det &= ~(1 << 0); |
893 | ulpi_write(otg, chg_det, 0x34); | 893 | ulpi_write(phy, chg_det, 0x34); |
894 | break; | 894 | break; |
895 | case SNPS_28NM_INTEGRATED_PHY: | 895 | case SNPS_28NM_INTEGRATED_PHY: |
896 | /* | 896 | /* |
897 | * Configure DP as current source, DM as current sink | 897 | * Configure DP as current source, DM as current sink |
898 | * and enable battery charging comparators. | 898 | * and enable battery charging comparators. |
899 | */ | 899 | */ |
900 | ulpi_write(otg, 0x2, 0x85); | 900 | ulpi_write(phy, 0x2, 0x85); |
901 | ulpi_write(otg, 0x1, 0x85); | 901 | ulpi_write(phy, 0x1, 0x85); |
902 | break; | 902 | break; |
903 | default: | 903 | default: |
904 | break; | 904 | break; |
@@ -907,17 +907,17 @@ static void msm_chg_enable_primary_det(struct msm_otg *motg) | |||
907 | 907 | ||
908 | static bool msm_chg_check_dcd(struct msm_otg *motg) | 908 | static bool msm_chg_check_dcd(struct msm_otg *motg) |
909 | { | 909 | { |
910 | struct otg_transceiver *otg = &motg->otg; | 910 | struct usb_phy *phy = &motg->phy; |
911 | u32 line_state; | 911 | u32 line_state; |
912 | bool ret = false; | 912 | bool ret = false; |
913 | 913 | ||
914 | switch (motg->pdata->phy_type) { | 914 | switch (motg->pdata->phy_type) { |
915 | case CI_45NM_INTEGRATED_PHY: | 915 | case CI_45NM_INTEGRATED_PHY: |
916 | line_state = ulpi_read(otg, 0x15); | 916 | line_state = ulpi_read(phy, 0x15); |
917 | ret = !(line_state & 1); | 917 | ret = !(line_state & 1); |
918 | break; | 918 | break; |
919 | case SNPS_28NM_INTEGRATED_PHY: | 919 | case SNPS_28NM_INTEGRATED_PHY: |
920 | line_state = ulpi_read(otg, 0x87); | 920 | line_state = ulpi_read(phy, 0x87); |
921 | ret = line_state & 2; | 921 | ret = line_state & 2; |
922 | break; | 922 | break; |
923 | default: | 923 | default: |
@@ -928,17 +928,17 @@ static bool msm_chg_check_dcd(struct msm_otg *motg) | |||
928 | 928 | ||
929 | static void msm_chg_disable_dcd(struct msm_otg *motg) | 929 | static void msm_chg_disable_dcd(struct msm_otg *motg) |
930 | { | 930 | { |
931 | struct otg_transceiver *otg = &motg->otg; | 931 | struct usb_phy *phy = &motg->phy; |
932 | u32 chg_det; | 932 | u32 chg_det; |
933 | 933 | ||
934 | switch (motg->pdata->phy_type) { | 934 | switch (motg->pdata->phy_type) { |
935 | case CI_45NM_INTEGRATED_PHY: | 935 | case CI_45NM_INTEGRATED_PHY: |
936 | chg_det = ulpi_read(otg, 0x34); | 936 | chg_det = ulpi_read(phy, 0x34); |
937 | chg_det &= ~(1 << 5); | 937 | chg_det &= ~(1 << 5); |
938 | ulpi_write(otg, chg_det, 0x34); | 938 | ulpi_write(phy, chg_det, 0x34); |
939 | break; | 939 | break; |
940 | case SNPS_28NM_INTEGRATED_PHY: | 940 | case SNPS_28NM_INTEGRATED_PHY: |
941 | ulpi_write(otg, 0x10, 0x86); | 941 | ulpi_write(phy, 0x10, 0x86); |
942 | break; | 942 | break; |
943 | default: | 943 | default: |
944 | break; | 944 | break; |
@@ -947,19 +947,19 @@ static void msm_chg_disable_dcd(struct msm_otg *motg) | |||
947 | 947 | ||
948 | static void msm_chg_enable_dcd(struct msm_otg *motg) | 948 | static void msm_chg_enable_dcd(struct msm_otg *motg) |
949 | { | 949 | { |
950 | struct otg_transceiver *otg = &motg->otg; | 950 | struct usb_phy *phy = &motg->phy; |
951 | u32 chg_det; | 951 | u32 chg_det; |
952 | 952 | ||
953 | switch (motg->pdata->phy_type) { | 953 | switch (motg->pdata->phy_type) { |
954 | case CI_45NM_INTEGRATED_PHY: | 954 | case CI_45NM_INTEGRATED_PHY: |
955 | chg_det = ulpi_read(otg, 0x34); | 955 | chg_det = ulpi_read(phy, 0x34); |
956 | /* Turn on D+ current source */ | 956 | /* Turn on D+ current source */ |
957 | chg_det |= (1 << 5); | 957 | chg_det |= (1 << 5); |
958 | ulpi_write(otg, chg_det, 0x34); | 958 | ulpi_write(phy, chg_det, 0x34); |
959 | break; | 959 | break; |
960 | case SNPS_28NM_INTEGRATED_PHY: | 960 | case SNPS_28NM_INTEGRATED_PHY: |
961 | /* Data contact detection enable */ | 961 | /* Data contact detection enable */ |
962 | ulpi_write(otg, 0x10, 0x85); | 962 | ulpi_write(phy, 0x10, 0x85); |
963 | break; | 963 | break; |
964 | default: | 964 | default: |
965 | break; | 965 | break; |
@@ -968,32 +968,32 @@ static void msm_chg_enable_dcd(struct msm_otg *motg) | |||
968 | 968 | ||
969 | static void msm_chg_block_on(struct msm_otg *motg) | 969 | static void msm_chg_block_on(struct msm_otg *motg) |
970 | { | 970 | { |
971 | struct otg_transceiver *otg = &motg->otg; | 971 | struct usb_phy *phy = &motg->phy; |
972 | u32 func_ctrl, chg_det; | 972 | u32 func_ctrl, chg_det; |
973 | 973 | ||
974 | /* put the controller in non-driving mode */ | 974 | /* put the controller in non-driving mode */ |
975 | func_ctrl = ulpi_read(otg, ULPI_FUNC_CTRL); | 975 | func_ctrl = ulpi_read(phy, ULPI_FUNC_CTRL); |
976 | func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK; | 976 | func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK; |
977 | func_ctrl |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; | 977 | func_ctrl |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; |
978 | ulpi_write(otg, func_ctrl, ULPI_FUNC_CTRL); | 978 | ulpi_write(phy, func_ctrl, ULPI_FUNC_CTRL); |
979 | 979 | ||
980 | switch (motg->pdata->phy_type) { | 980 | switch (motg->pdata->phy_type) { |
981 | case CI_45NM_INTEGRATED_PHY: | 981 | case CI_45NM_INTEGRATED_PHY: |
982 | chg_det = ulpi_read(otg, 0x34); | 982 | chg_det = ulpi_read(phy, 0x34); |
983 | /* control chg block via ULPI */ | 983 | /* control chg block via ULPI */ |
984 | chg_det &= ~(1 << 3); | 984 | chg_det &= ~(1 << 3); |
985 | ulpi_write(otg, chg_det, 0x34); | 985 | ulpi_write(phy, chg_det, 0x34); |
986 | /* Turn on chg detect block */ | 986 | /* Turn on chg detect block */ |
987 | chg_det &= ~(1 << 1); | 987 | chg_det &= ~(1 << 1); |
988 | ulpi_write(otg, chg_det, 0x34); | 988 | ulpi_write(phy, chg_det, 0x34); |
989 | udelay(20); | 989 | udelay(20); |
990 | break; | 990 | break; |
991 | case SNPS_28NM_INTEGRATED_PHY: | 991 | case SNPS_28NM_INTEGRATED_PHY: |
992 | /* Clear charger detecting control bits */ | 992 | /* Clear charger detecting control bits */ |
993 | ulpi_write(otg, 0x3F, 0x86); | 993 | ulpi_write(phy, 0x3F, 0x86); |
994 | /* Clear alt interrupt latch and enable bits */ | 994 | /* Clear alt interrupt latch and enable bits */ |
995 | ulpi_write(otg, 0x1F, 0x92); | 995 | ulpi_write(phy, 0x1F, 0x92); |
996 | ulpi_write(otg, 0x1F, 0x95); | 996 | ulpi_write(phy, 0x1F, 0x95); |
997 | udelay(100); | 997 | udelay(100); |
998 | break; | 998 | break; |
999 | default: | 999 | default: |
@@ -1003,32 +1003,32 @@ static void msm_chg_block_on(struct msm_otg *motg) | |||
1003 | 1003 | ||
1004 | static void msm_chg_block_off(struct msm_otg *motg) | 1004 | static void msm_chg_block_off(struct msm_otg *motg) |
1005 | { | 1005 | { |
1006 | struct otg_transceiver *otg = &motg->otg; | 1006 | struct usb_phy *phy = &motg->phy; |
1007 | u32 func_ctrl, chg_det; | 1007 | u32 func_ctrl, chg_det; |
1008 | 1008 | ||
1009 | switch (motg->pdata->phy_type) { | 1009 | switch (motg->pdata->phy_type) { |
1010 | case CI_45NM_INTEGRATED_PHY: | 1010 | case CI_45NM_INTEGRATED_PHY: |
1011 | chg_det = ulpi_read(otg, 0x34); | 1011 | chg_det = ulpi_read(phy, 0x34); |
1012 | /* Turn off charger block */ | 1012 | /* Turn off charger block */ |
1013 | chg_det |= ~(1 << 1); | 1013 | chg_det |= ~(1 << 1); |
1014 | ulpi_write(otg, chg_det, 0x34); | 1014 | ulpi_write(phy, chg_det, 0x34); |
1015 | break; | 1015 | break; |
1016 | case SNPS_28NM_INTEGRATED_PHY: | 1016 | case SNPS_28NM_INTEGRATED_PHY: |
1017 | /* Clear charger detecting control bits */ | 1017 | /* Clear charger detecting control bits */ |
1018 | ulpi_write(otg, 0x3F, 0x86); | 1018 | ulpi_write(phy, 0x3F, 0x86); |
1019 | /* Clear alt interrupt latch and enable bits */ | 1019 | /* Clear alt interrupt latch and enable bits */ |
1020 | ulpi_write(otg, 0x1F, 0x92); | 1020 | ulpi_write(phy, 0x1F, 0x92); |
1021 | ulpi_write(otg, 0x1F, 0x95); | 1021 | ulpi_write(phy, 0x1F, 0x95); |
1022 | break; | 1022 | break; |
1023 | default: | 1023 | default: |
1024 | break; | 1024 | break; |
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | /* put the controller in normal mode */ | 1027 | /* put the controller in normal mode */ |
1028 | func_ctrl = ulpi_read(otg, ULPI_FUNC_CTRL); | 1028 | func_ctrl = ulpi_read(phy, ULPI_FUNC_CTRL); |
1029 | func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK; | 1029 | func_ctrl &= ~ULPI_FUNC_CTRL_OPMODE_MASK; |
1030 | func_ctrl |= ULPI_FUNC_CTRL_OPMODE_NORMAL; | 1030 | func_ctrl |= ULPI_FUNC_CTRL_OPMODE_NORMAL; |
1031 | ulpi_write(otg, func_ctrl, ULPI_FUNC_CTRL); | 1031 | ulpi_write(phy, func_ctrl, ULPI_FUNC_CTRL); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | #define MSM_CHG_DCD_POLL_TIME (100 * HZ/1000) /* 100 msec */ | 1034 | #define MSM_CHG_DCD_POLL_TIME (100 * HZ/1000) /* 100 msec */ |
@@ -1038,14 +1038,14 @@ static void msm_chg_block_off(struct msm_otg *motg) | |||
1038 | static void msm_chg_detect_work(struct work_struct *w) | 1038 | static void msm_chg_detect_work(struct work_struct *w) |
1039 | { | 1039 | { |
1040 | struct msm_otg *motg = container_of(w, struct msm_otg, chg_work.work); | 1040 | struct msm_otg *motg = container_of(w, struct msm_otg, chg_work.work); |
1041 | struct otg_transceiver *otg = &motg->otg; | 1041 | struct usb_phy *phy = &motg->phy; |
1042 | bool is_dcd, tmout, vout; | 1042 | bool is_dcd, tmout, vout; |
1043 | unsigned long delay; | 1043 | unsigned long delay; |
1044 | 1044 | ||
1045 | dev_dbg(otg->dev, "chg detection work\n"); | 1045 | dev_dbg(phy->dev, "chg detection work\n"); |
1046 | switch (motg->chg_state) { | 1046 | switch (motg->chg_state) { |
1047 | case USB_CHG_STATE_UNDEFINED: | 1047 | case USB_CHG_STATE_UNDEFINED: |
1048 | pm_runtime_get_sync(otg->dev); | 1048 | pm_runtime_get_sync(phy->dev); |
1049 | msm_chg_block_on(motg); | 1049 | msm_chg_block_on(motg); |
1050 | msm_chg_enable_dcd(motg); | 1050 | msm_chg_enable_dcd(motg); |
1051 | motg->chg_state = USB_CHG_STATE_WAIT_FOR_DCD; | 1051 | motg->chg_state = USB_CHG_STATE_WAIT_FOR_DCD; |
@@ -1088,7 +1088,7 @@ static void msm_chg_detect_work(struct work_struct *w) | |||
1088 | motg->chg_state = USB_CHG_STATE_DETECTED; | 1088 | motg->chg_state = USB_CHG_STATE_DETECTED; |
1089 | case USB_CHG_STATE_DETECTED: | 1089 | case USB_CHG_STATE_DETECTED: |
1090 | msm_chg_block_off(motg); | 1090 | msm_chg_block_off(motg); |
1091 | dev_dbg(otg->dev, "charger = %d\n", motg->chg_type); | 1091 | dev_dbg(phy->dev, "charger = %d\n", motg->chg_type); |
1092 | schedule_work(&motg->sm_work); | 1092 | schedule_work(&motg->sm_work); |
1093 | return; | 1093 | return; |
1094 | default: | 1094 | default: |
@@ -1152,22 +1152,22 @@ static void msm_otg_init_sm(struct msm_otg *motg) | |||
1152 | static void msm_otg_sm_work(struct work_struct *w) | 1152 | static void msm_otg_sm_work(struct work_struct *w) |
1153 | { | 1153 | { |
1154 | struct msm_otg *motg = container_of(w, struct msm_otg, sm_work); | 1154 | struct msm_otg *motg = container_of(w, struct msm_otg, sm_work); |
1155 | struct otg_transceiver *otg = &motg->otg; | 1155 | struct usb_otg *otg = motg->phy.otg; |
1156 | 1156 | ||
1157 | switch (otg->state) { | 1157 | switch (otg->phy->state) { |
1158 | case OTG_STATE_UNDEFINED: | 1158 | case OTG_STATE_UNDEFINED: |
1159 | dev_dbg(otg->dev, "OTG_STATE_UNDEFINED state\n"); | 1159 | dev_dbg(otg->phy->dev, "OTG_STATE_UNDEFINED state\n"); |
1160 | msm_otg_reset(otg); | 1160 | msm_otg_reset(otg->phy); |
1161 | msm_otg_init_sm(motg); | 1161 | msm_otg_init_sm(motg); |
1162 | otg->state = OTG_STATE_B_IDLE; | 1162 | otg->phy->state = OTG_STATE_B_IDLE; |
1163 | /* FALL THROUGH */ | 1163 | /* FALL THROUGH */ |
1164 | case OTG_STATE_B_IDLE: | 1164 | case OTG_STATE_B_IDLE: |
1165 | dev_dbg(otg->dev, "OTG_STATE_B_IDLE state\n"); | 1165 | dev_dbg(otg->phy->dev, "OTG_STATE_B_IDLE state\n"); |
1166 | if (!test_bit(ID, &motg->inputs) && otg->host) { | 1166 | if (!test_bit(ID, &motg->inputs) && otg->host) { |
1167 | /* disable BSV bit */ | 1167 | /* disable BSV bit */ |
1168 | writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC); | 1168 | writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC); |
1169 | msm_otg_start_host(otg, 1); | 1169 | msm_otg_start_host(otg->phy, 1); |
1170 | otg->state = OTG_STATE_A_HOST; | 1170 | otg->phy->state = OTG_STATE_A_HOST; |
1171 | } else if (test_bit(B_SESS_VLD, &motg->inputs)) { | 1171 | } else if (test_bit(B_SESS_VLD, &motg->inputs)) { |
1172 | switch (motg->chg_state) { | 1172 | switch (motg->chg_state) { |
1173 | case USB_CHG_STATE_UNDEFINED: | 1173 | case USB_CHG_STATE_UNDEFINED: |
@@ -1182,13 +1182,15 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1182 | case USB_CDP_CHARGER: | 1182 | case USB_CDP_CHARGER: |
1183 | msm_otg_notify_charger(motg, | 1183 | msm_otg_notify_charger(motg, |
1184 | IDEV_CHG_MAX); | 1184 | IDEV_CHG_MAX); |
1185 | msm_otg_start_peripheral(otg, 1); | 1185 | msm_otg_start_peripheral(otg->phy, 1); |
1186 | otg->state = OTG_STATE_B_PERIPHERAL; | 1186 | otg->phy->state |
1187 | = OTG_STATE_B_PERIPHERAL; | ||
1187 | break; | 1188 | break; |
1188 | case USB_SDP_CHARGER: | 1189 | case USB_SDP_CHARGER: |
1189 | msm_otg_notify_charger(motg, IUNIT); | 1190 | msm_otg_notify_charger(motg, IUNIT); |
1190 | msm_otg_start_peripheral(otg, 1); | 1191 | msm_otg_start_peripheral(otg->phy, 1); |
1191 | otg->state = OTG_STATE_B_PERIPHERAL; | 1192 | otg->phy->state |
1193 | = OTG_STATE_B_PERIPHERAL; | ||
1192 | break; | 1194 | break; |
1193 | default: | 1195 | default: |
1194 | break; | 1196 | break; |
@@ -1204,34 +1206,34 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1204 | * is incremented in charger detection work. | 1206 | * is incremented in charger detection work. |
1205 | */ | 1207 | */ |
1206 | if (cancel_delayed_work_sync(&motg->chg_work)) { | 1208 | if (cancel_delayed_work_sync(&motg->chg_work)) { |
1207 | pm_runtime_put_sync(otg->dev); | 1209 | pm_runtime_put_sync(otg->phy->dev); |
1208 | msm_otg_reset(otg); | 1210 | msm_otg_reset(otg->phy); |
1209 | } | 1211 | } |
1210 | msm_otg_notify_charger(motg, 0); | 1212 | msm_otg_notify_charger(motg, 0); |
1211 | motg->chg_state = USB_CHG_STATE_UNDEFINED; | 1213 | motg->chg_state = USB_CHG_STATE_UNDEFINED; |
1212 | motg->chg_type = USB_INVALID_CHARGER; | 1214 | motg->chg_type = USB_INVALID_CHARGER; |
1213 | } | 1215 | } |
1214 | pm_runtime_put_sync(otg->dev); | 1216 | pm_runtime_put_sync(otg->phy->dev); |
1215 | break; | 1217 | break; |
1216 | case OTG_STATE_B_PERIPHERAL: | 1218 | case OTG_STATE_B_PERIPHERAL: |
1217 | dev_dbg(otg->dev, "OTG_STATE_B_PERIPHERAL state\n"); | 1219 | dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); |
1218 | if (!test_bit(B_SESS_VLD, &motg->inputs) || | 1220 | if (!test_bit(B_SESS_VLD, &motg->inputs) || |
1219 | !test_bit(ID, &motg->inputs)) { | 1221 | !test_bit(ID, &motg->inputs)) { |
1220 | msm_otg_notify_charger(motg, 0); | 1222 | msm_otg_notify_charger(motg, 0); |
1221 | msm_otg_start_peripheral(otg, 0); | 1223 | msm_otg_start_peripheral(otg->phy, 0); |
1222 | motg->chg_state = USB_CHG_STATE_UNDEFINED; | 1224 | motg->chg_state = USB_CHG_STATE_UNDEFINED; |
1223 | motg->chg_type = USB_INVALID_CHARGER; | 1225 | motg->chg_type = USB_INVALID_CHARGER; |
1224 | otg->state = OTG_STATE_B_IDLE; | 1226 | otg->phy->state = OTG_STATE_B_IDLE; |
1225 | msm_otg_reset(otg); | 1227 | msm_otg_reset(otg->phy); |
1226 | schedule_work(w); | 1228 | schedule_work(w); |
1227 | } | 1229 | } |
1228 | break; | 1230 | break; |
1229 | case OTG_STATE_A_HOST: | 1231 | case OTG_STATE_A_HOST: |
1230 | dev_dbg(otg->dev, "OTG_STATE_A_HOST state\n"); | 1232 | dev_dbg(otg->phy->dev, "OTG_STATE_A_HOST state\n"); |
1231 | if (test_bit(ID, &motg->inputs)) { | 1233 | if (test_bit(ID, &motg->inputs)) { |
1232 | msm_otg_start_host(otg, 0); | 1234 | msm_otg_start_host(otg->phy, 0); |
1233 | otg->state = OTG_STATE_B_IDLE; | 1235 | otg->phy->state = OTG_STATE_B_IDLE; |
1234 | msm_otg_reset(otg); | 1236 | msm_otg_reset(otg->phy); |
1235 | schedule_work(w); | 1237 | schedule_work(w); |
1236 | } | 1238 | } |
1237 | break; | 1239 | break; |
@@ -1243,13 +1245,13 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1243 | static irqreturn_t msm_otg_irq(int irq, void *data) | 1245 | static irqreturn_t msm_otg_irq(int irq, void *data) |
1244 | { | 1246 | { |
1245 | struct msm_otg *motg = data; | 1247 | struct msm_otg *motg = data; |
1246 | struct otg_transceiver *otg = &motg->otg; | 1248 | struct usb_phy *phy = &motg->phy; |
1247 | u32 otgsc = 0; | 1249 | u32 otgsc = 0; |
1248 | 1250 | ||
1249 | if (atomic_read(&motg->in_lpm)) { | 1251 | if (atomic_read(&motg->in_lpm)) { |
1250 | disable_irq_nosync(irq); | 1252 | disable_irq_nosync(irq); |
1251 | motg->async_int = 1; | 1253 | motg->async_int = 1; |
1252 | pm_runtime_get(otg->dev); | 1254 | pm_runtime_get(phy->dev); |
1253 | return IRQ_HANDLED; | 1255 | return IRQ_HANDLED; |
1254 | } | 1256 | } |
1255 | 1257 | ||
@@ -1262,15 +1264,15 @@ static irqreturn_t msm_otg_irq(int irq, void *data) | |||
1262 | set_bit(ID, &motg->inputs); | 1264 | set_bit(ID, &motg->inputs); |
1263 | else | 1265 | else |
1264 | clear_bit(ID, &motg->inputs); | 1266 | clear_bit(ID, &motg->inputs); |
1265 | dev_dbg(otg->dev, "ID set/clear\n"); | 1267 | dev_dbg(phy->dev, "ID set/clear\n"); |
1266 | pm_runtime_get_noresume(otg->dev); | 1268 | pm_runtime_get_noresume(phy->dev); |
1267 | } else if ((otgsc & OTGSC_BSVIS) && (otgsc & OTGSC_BSVIE)) { | 1269 | } else if ((otgsc & OTGSC_BSVIS) && (otgsc & OTGSC_BSVIE)) { |
1268 | if (otgsc & OTGSC_BSV) | 1270 | if (otgsc & OTGSC_BSV) |
1269 | set_bit(B_SESS_VLD, &motg->inputs); | 1271 | set_bit(B_SESS_VLD, &motg->inputs); |
1270 | else | 1272 | else |
1271 | clear_bit(B_SESS_VLD, &motg->inputs); | 1273 | clear_bit(B_SESS_VLD, &motg->inputs); |
1272 | dev_dbg(otg->dev, "BSV set/clear\n"); | 1274 | dev_dbg(phy->dev, "BSV set/clear\n"); |
1273 | pm_runtime_get_noresume(otg->dev); | 1275 | pm_runtime_get_noresume(phy->dev); |
1274 | } | 1276 | } |
1275 | 1277 | ||
1276 | writel(otgsc, USB_OTGSC); | 1278 | writel(otgsc, USB_OTGSC); |
@@ -1281,9 +1283,9 @@ static irqreturn_t msm_otg_irq(int irq, void *data) | |||
1281 | static int msm_otg_mode_show(struct seq_file *s, void *unused) | 1283 | static int msm_otg_mode_show(struct seq_file *s, void *unused) |
1282 | { | 1284 | { |
1283 | struct msm_otg *motg = s->private; | 1285 | struct msm_otg *motg = s->private; |
1284 | struct otg_transceiver *otg = &motg->otg; | 1286 | struct usb_otg *otg = motg->phy.otg; |
1285 | 1287 | ||
1286 | switch (otg->state) { | 1288 | switch (otg->phy->state) { |
1287 | case OTG_STATE_A_HOST: | 1289 | case OTG_STATE_A_HOST: |
1288 | seq_printf(s, "host\n"); | 1290 | seq_printf(s, "host\n"); |
1289 | break; | 1291 | break; |
@@ -1309,7 +1311,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf, | |||
1309 | struct seq_file *s = file->private_data; | 1311 | struct seq_file *s = file->private_data; |
1310 | struct msm_otg *motg = s->private; | 1312 | struct msm_otg *motg = s->private; |
1311 | char buf[16]; | 1313 | char buf[16]; |
1312 | struct otg_transceiver *otg = &motg->otg; | 1314 | struct usb_otg *otg = motg->phy.otg; |
1313 | int status = count; | 1315 | int status = count; |
1314 | enum usb_mode_type req_mode; | 1316 | enum usb_mode_type req_mode; |
1315 | 1317 | ||
@@ -1333,7 +1335,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf, | |||
1333 | 1335 | ||
1334 | switch (req_mode) { | 1336 | switch (req_mode) { |
1335 | case USB_NONE: | 1337 | case USB_NONE: |
1336 | switch (otg->state) { | 1338 | switch (otg->phy->state) { |
1337 | case OTG_STATE_A_HOST: | 1339 | case OTG_STATE_A_HOST: |
1338 | case OTG_STATE_B_PERIPHERAL: | 1340 | case OTG_STATE_B_PERIPHERAL: |
1339 | set_bit(ID, &motg->inputs); | 1341 | set_bit(ID, &motg->inputs); |
@@ -1344,7 +1346,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf, | |||
1344 | } | 1346 | } |
1345 | break; | 1347 | break; |
1346 | case USB_PERIPHERAL: | 1348 | case USB_PERIPHERAL: |
1347 | switch (otg->state) { | 1349 | switch (otg->phy->state) { |
1348 | case OTG_STATE_B_IDLE: | 1350 | case OTG_STATE_B_IDLE: |
1349 | case OTG_STATE_A_HOST: | 1351 | case OTG_STATE_A_HOST: |
1350 | set_bit(ID, &motg->inputs); | 1352 | set_bit(ID, &motg->inputs); |
@@ -1355,7 +1357,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf, | |||
1355 | } | 1357 | } |
1356 | break; | 1358 | break; |
1357 | case USB_HOST: | 1359 | case USB_HOST: |
1358 | switch (otg->state) { | 1360 | switch (otg->phy->state) { |
1359 | case OTG_STATE_B_IDLE: | 1361 | case OTG_STATE_B_IDLE: |
1360 | case OTG_STATE_B_PERIPHERAL: | 1362 | case OTG_STATE_B_PERIPHERAL: |
1361 | clear_bit(ID, &motg->inputs); | 1363 | clear_bit(ID, &motg->inputs); |
@@ -1368,7 +1370,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf, | |||
1368 | goto out; | 1370 | goto out; |
1369 | } | 1371 | } |
1370 | 1372 | ||
1371 | pm_runtime_get_sync(otg->dev); | 1373 | pm_runtime_get_sync(otg->phy->dev); |
1372 | schedule_work(&motg->sm_work); | 1374 | schedule_work(&motg->sm_work); |
1373 | out: | 1375 | out: |
1374 | return status; | 1376 | return status; |
@@ -1414,7 +1416,7 @@ static int __init msm_otg_probe(struct platform_device *pdev) | |||
1414 | int ret = 0; | 1416 | int ret = 0; |
1415 | struct resource *res; | 1417 | struct resource *res; |
1416 | struct msm_otg *motg; | 1418 | struct msm_otg *motg; |
1417 | struct otg_transceiver *otg; | 1419 | struct usb_phy *phy; |
1418 | 1420 | ||
1419 | dev_info(&pdev->dev, "msm_otg probe\n"); | 1421 | dev_info(&pdev->dev, "msm_otg probe\n"); |
1420 | if (!pdev->dev.platform_data) { | 1422 | if (!pdev->dev.platform_data) { |
@@ -1428,9 +1430,15 @@ static int __init msm_otg_probe(struct platform_device *pdev) | |||
1428 | return -ENOMEM; | 1430 | return -ENOMEM; |
1429 | } | 1431 | } |
1430 | 1432 | ||
1433 | motg->phy.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL); | ||
1434 | if (!motg->phy.otg) { | ||
1435 | dev_err(&pdev->dev, "unable to allocate msm_otg\n"); | ||
1436 | return -ENOMEM; | ||
1437 | } | ||
1438 | |||
1431 | motg->pdata = pdev->dev.platform_data; | 1439 | motg->pdata = pdev->dev.platform_data; |
1432 | otg = &motg->otg; | 1440 | phy = &motg->phy; |
1433 | otg->dev = &pdev->dev; | 1441 | phy->dev = &pdev->dev; |
1434 | 1442 | ||
1435 | motg->phy_reset_clk = clk_get(&pdev->dev, "usb_phy_clk"); | 1443 | motg->phy_reset_clk = clk_get(&pdev->dev, "usb_phy_clk"); |
1436 | if (IS_ERR(motg->phy_reset_clk)) { | 1444 | if (IS_ERR(motg->phy_reset_clk)) { |
@@ -1538,16 +1546,18 @@ static int __init msm_otg_probe(struct platform_device *pdev) | |||
1538 | goto disable_clks; | 1546 | goto disable_clks; |
1539 | } | 1547 | } |
1540 | 1548 | ||
1541 | otg->init = msm_otg_reset; | 1549 | phy->init = msm_otg_reset; |
1542 | otg->set_host = msm_otg_set_host; | 1550 | phy->set_power = msm_otg_set_power; |
1543 | otg->set_peripheral = msm_otg_set_peripheral; | 1551 | |
1544 | otg->set_power = msm_otg_set_power; | 1552 | phy->io_ops = &msm_otg_io_ops; |
1545 | 1553 | ||
1546 | otg->io_ops = &msm_otg_io_ops; | 1554 | phy->otg->phy = &motg->phy; |
1555 | phy->otg->set_host = msm_otg_set_host; | ||
1556 | phy->otg->set_peripheral = msm_otg_set_peripheral; | ||
1547 | 1557 | ||
1548 | ret = otg_set_transceiver(&motg->otg); | 1558 | ret = usb_set_transceiver(&motg->phy); |
1549 | if (ret) { | 1559 | if (ret) { |
1550 | dev_err(&pdev->dev, "otg_set_transceiver failed\n"); | 1560 | dev_err(&pdev->dev, "usb_set_transceiver failed\n"); |
1551 | goto free_irq; | 1561 | goto free_irq; |
1552 | } | 1562 | } |
1553 | 1563 | ||
@@ -1591,6 +1601,7 @@ put_clk: | |||
1591 | put_phy_reset_clk: | 1601 | put_phy_reset_clk: |
1592 | clk_put(motg->phy_reset_clk); | 1602 | clk_put(motg->phy_reset_clk); |
1593 | free_motg: | 1603 | free_motg: |
1604 | kfree(motg->phy.otg); | ||
1594 | kfree(motg); | 1605 | kfree(motg); |
1595 | return ret; | 1606 | return ret; |
1596 | } | 1607 | } |
@@ -1598,10 +1609,10 @@ free_motg: | |||
1598 | static int __devexit msm_otg_remove(struct platform_device *pdev) | 1609 | static int __devexit msm_otg_remove(struct platform_device *pdev) |
1599 | { | 1610 | { |
1600 | struct msm_otg *motg = platform_get_drvdata(pdev); | 1611 | struct msm_otg *motg = platform_get_drvdata(pdev); |
1601 | struct otg_transceiver *otg = &motg->otg; | 1612 | struct usb_phy *phy = &motg->phy; |
1602 | int cnt = 0; | 1613 | int cnt = 0; |
1603 | 1614 | ||
1604 | if (otg->host || otg->gadget) | 1615 | if (phy->otg->host || phy->otg->gadget) |
1605 | return -EBUSY; | 1616 | return -EBUSY; |
1606 | 1617 | ||
1607 | msm_otg_debugfs_cleanup(); | 1618 | msm_otg_debugfs_cleanup(); |
@@ -1613,14 +1624,14 @@ static int __devexit msm_otg_remove(struct platform_device *pdev) | |||
1613 | device_init_wakeup(&pdev->dev, 0); | 1624 | device_init_wakeup(&pdev->dev, 0); |
1614 | pm_runtime_disable(&pdev->dev); | 1625 | pm_runtime_disable(&pdev->dev); |
1615 | 1626 | ||
1616 | otg_set_transceiver(NULL); | 1627 | usb_set_transceiver(NULL); |
1617 | free_irq(motg->irq, motg); | 1628 | free_irq(motg->irq, motg); |
1618 | 1629 | ||
1619 | /* | 1630 | /* |
1620 | * Put PHY in low power mode. | 1631 | * Put PHY in low power mode. |
1621 | */ | 1632 | */ |
1622 | ulpi_read(otg, 0x14); | 1633 | ulpi_read(phy, 0x14); |
1623 | ulpi_write(otg, 0x08, 0x09); | 1634 | ulpi_write(phy, 0x08, 0x09); |
1624 | 1635 | ||
1625 | writel(readl(USB_PORTSC) | PORTSC_PHCD, USB_PORTSC); | 1636 | writel(readl(USB_PORTSC) | PORTSC_PHCD, USB_PORTSC); |
1626 | while (cnt < PHY_SUSPEND_TIMEOUT_USEC) { | 1637 | while (cnt < PHY_SUSPEND_TIMEOUT_USEC) { |
@@ -1630,7 +1641,7 @@ static int __devexit msm_otg_remove(struct platform_device *pdev) | |||
1630 | cnt++; | 1641 | cnt++; |
1631 | } | 1642 | } |
1632 | if (cnt >= PHY_SUSPEND_TIMEOUT_USEC) | 1643 | if (cnt >= PHY_SUSPEND_TIMEOUT_USEC) |
1633 | dev_err(otg->dev, "Unable to suspend PHY\n"); | 1644 | dev_err(phy->dev, "Unable to suspend PHY\n"); |
1634 | 1645 | ||
1635 | clk_disable(motg->pclk); | 1646 | clk_disable(motg->pclk); |
1636 | clk_disable(motg->clk); | 1647 | clk_disable(motg->clk); |
@@ -1651,6 +1662,7 @@ static int __devexit msm_otg_remove(struct platform_device *pdev) | |||
1651 | if (motg->core_clk) | 1662 | if (motg->core_clk) |
1652 | clk_put(motg->core_clk); | 1663 | clk_put(motg->core_clk); |
1653 | 1664 | ||
1665 | kfree(motg->phy.otg); | ||
1654 | kfree(motg); | 1666 | kfree(motg); |
1655 | 1667 | ||
1656 | return 0; | 1668 | return 0; |
@@ -1660,7 +1672,7 @@ static int __devexit msm_otg_remove(struct platform_device *pdev) | |||
1660 | static int msm_otg_runtime_idle(struct device *dev) | 1672 | static int msm_otg_runtime_idle(struct device *dev) |
1661 | { | 1673 | { |
1662 | struct msm_otg *motg = dev_get_drvdata(dev); | 1674 | struct msm_otg *motg = dev_get_drvdata(dev); |
1663 | struct otg_transceiver *otg = &motg->otg; | 1675 | struct usb_otg *otg = motg->phy.otg; |
1664 | 1676 | ||
1665 | dev_dbg(dev, "OTG runtime idle\n"); | 1677 | dev_dbg(dev, "OTG runtime idle\n"); |
1666 | 1678 | ||
@@ -1670,7 +1682,7 @@ static int msm_otg_runtime_idle(struct device *dev) | |||
1670 | * This 1 sec delay also prevents entering into LPM immediately | 1682 | * This 1 sec delay also prevents entering into LPM immediately |
1671 | * after asynchronous interrupt. | 1683 | * after asynchronous interrupt. |
1672 | */ | 1684 | */ |
1673 | if (otg->state != OTG_STATE_UNDEFINED) | 1685 | if (otg->phy->state != OTG_STATE_UNDEFINED) |
1674 | pm_schedule_suspend(dev, 1000); | 1686 | pm_schedule_suspend(dev, 1000); |
1675 | 1687 | ||
1676 | return -EAGAIN; | 1688 | return -EAGAIN; |
diff --git a/drivers/usb/otg/mv_otg.c b/drivers/usb/otg/mv_otg.c index b5fbe1452ab..6cc6c3ffbb8 100644 --- a/drivers/usb/otg/mv_otg.c +++ b/drivers/usb/otg/mv_otg.c | |||
@@ -55,16 +55,16 @@ static char *state_string[] = { | |||
55 | "a_vbus_err" | 55 | "a_vbus_err" |
56 | }; | 56 | }; |
57 | 57 | ||
58 | static int mv_otg_set_vbus(struct otg_transceiver *otg, bool on) | 58 | static int mv_otg_set_vbus(struct usb_otg *otg, bool on) |
59 | { | 59 | { |
60 | struct mv_otg *mvotg = container_of(otg, struct mv_otg, otg); | 60 | struct mv_otg *mvotg = container_of(otg->phy, struct mv_otg, phy); |
61 | if (mvotg->pdata->set_vbus == NULL) | 61 | if (mvotg->pdata->set_vbus == NULL) |
62 | return -ENODEV; | 62 | return -ENODEV; |
63 | 63 | ||
64 | return mvotg->pdata->set_vbus(on); | 64 | return mvotg->pdata->set_vbus(on); |
65 | } | 65 | } |
66 | 66 | ||
67 | static int mv_otg_set_host(struct otg_transceiver *otg, | 67 | static int mv_otg_set_host(struct usb_otg *otg, |
68 | struct usb_bus *host) | 68 | struct usb_bus *host) |
69 | { | 69 | { |
70 | otg->host = host; | 70 | otg->host = host; |
@@ -72,7 +72,7 @@ static int mv_otg_set_host(struct otg_transceiver *otg, | |||
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | 74 | ||
75 | static int mv_otg_set_peripheral(struct otg_transceiver *otg, | 75 | static int mv_otg_set_peripheral(struct usb_otg *otg, |
76 | struct usb_gadget *gadget) | 76 | struct usb_gadget *gadget) |
77 | { | 77 | { |
78 | otg->gadget = gadget; | 78 | otg->gadget = gadget; |
@@ -203,7 +203,7 @@ static void mv_otg_init_irq(struct mv_otg *mvotg) | |||
203 | static void mv_otg_start_host(struct mv_otg *mvotg, int on) | 203 | static void mv_otg_start_host(struct mv_otg *mvotg, int on) |
204 | { | 204 | { |
205 | #ifdef CONFIG_USB | 205 | #ifdef CONFIG_USB |
206 | struct otg_transceiver *otg = &mvotg->otg; | 206 | struct usb_otg *otg = mvotg->phy.otg; |
207 | struct usb_hcd *hcd; | 207 | struct usb_hcd *hcd; |
208 | 208 | ||
209 | if (!otg->host) | 209 | if (!otg->host) |
@@ -222,12 +222,12 @@ static void mv_otg_start_host(struct mv_otg *mvotg, int on) | |||
222 | 222 | ||
223 | static void mv_otg_start_periphrals(struct mv_otg *mvotg, int on) | 223 | static void mv_otg_start_periphrals(struct mv_otg *mvotg, int on) |
224 | { | 224 | { |
225 | struct otg_transceiver *otg = &mvotg->otg; | 225 | struct usb_otg *otg = mvotg->phy.otg; |
226 | 226 | ||
227 | if (!otg->gadget) | 227 | if (!otg->gadget) |
228 | return; | 228 | return; |
229 | 229 | ||
230 | dev_info(otg->dev, "gadget %s\n", on ? "on" : "off"); | 230 | dev_info(mvotg->phy.dev, "gadget %s\n", on ? "on" : "off"); |
231 | 231 | ||
232 | if (on) | 232 | if (on) |
233 | usb_gadget_vbus_connect(otg->gadget); | 233 | usb_gadget_vbus_connect(otg->gadget); |
@@ -343,69 +343,69 @@ static void mv_otg_update_inputs(struct mv_otg *mvotg) | |||
343 | static void mv_otg_update_state(struct mv_otg *mvotg) | 343 | static void mv_otg_update_state(struct mv_otg *mvotg) |
344 | { | 344 | { |
345 | struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; | 345 | struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; |
346 | struct otg_transceiver *otg = &mvotg->otg; | 346 | struct usb_phy *phy = &mvotg->phy; |
347 | int old_state = otg->state; | 347 | int old_state = phy->state; |
348 | 348 | ||
349 | switch (old_state) { | 349 | switch (old_state) { |
350 | case OTG_STATE_UNDEFINED: | 350 | case OTG_STATE_UNDEFINED: |
351 | otg->state = OTG_STATE_B_IDLE; | 351 | phy->state = OTG_STATE_B_IDLE; |
352 | /* FALL THROUGH */ | 352 | /* FALL THROUGH */ |
353 | case OTG_STATE_B_IDLE: | 353 | case OTG_STATE_B_IDLE: |
354 | if (otg_ctrl->id == 0) | 354 | if (otg_ctrl->id == 0) |
355 | otg->state = OTG_STATE_A_IDLE; | 355 | phy->state = OTG_STATE_A_IDLE; |
356 | else if (otg_ctrl->b_sess_vld) | 356 | else if (otg_ctrl->b_sess_vld) |
357 | otg->state = OTG_STATE_B_PERIPHERAL; | 357 | phy->state = OTG_STATE_B_PERIPHERAL; |
358 | break; | 358 | break; |
359 | case OTG_STATE_B_PERIPHERAL: | 359 | case OTG_STATE_B_PERIPHERAL: |
360 | if (!otg_ctrl->b_sess_vld || otg_ctrl->id == 0) | 360 | if (!otg_ctrl->b_sess_vld || otg_ctrl->id == 0) |
361 | otg->state = OTG_STATE_B_IDLE; | 361 | phy->state = OTG_STATE_B_IDLE; |
362 | break; | 362 | break; |
363 | case OTG_STATE_A_IDLE: | 363 | case OTG_STATE_A_IDLE: |
364 | if (otg_ctrl->id) | 364 | if (otg_ctrl->id) |
365 | otg->state = OTG_STATE_B_IDLE; | 365 | phy->state = OTG_STATE_B_IDLE; |
366 | else if (!(otg_ctrl->a_bus_drop) && | 366 | else if (!(otg_ctrl->a_bus_drop) && |
367 | (otg_ctrl->a_bus_req || otg_ctrl->a_srp_det)) | 367 | (otg_ctrl->a_bus_req || otg_ctrl->a_srp_det)) |
368 | otg->state = OTG_STATE_A_WAIT_VRISE; | 368 | phy->state = OTG_STATE_A_WAIT_VRISE; |
369 | break; | 369 | break; |
370 | case OTG_STATE_A_WAIT_VRISE: | 370 | case OTG_STATE_A_WAIT_VRISE: |
371 | if (otg_ctrl->a_vbus_vld) | 371 | if (otg_ctrl->a_vbus_vld) |
372 | otg->state = OTG_STATE_A_WAIT_BCON; | 372 | phy->state = OTG_STATE_A_WAIT_BCON; |
373 | break; | 373 | break; |
374 | case OTG_STATE_A_WAIT_BCON: | 374 | case OTG_STATE_A_WAIT_BCON: |
375 | if (otg_ctrl->id || otg_ctrl->a_bus_drop | 375 | if (otg_ctrl->id || otg_ctrl->a_bus_drop |
376 | || otg_ctrl->a_wait_bcon_timeout) { | 376 | || otg_ctrl->a_wait_bcon_timeout) { |
377 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); | 377 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); |
378 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; | 378 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; |
379 | otg->state = OTG_STATE_A_WAIT_VFALL; | 379 | phy->state = OTG_STATE_A_WAIT_VFALL; |
380 | otg_ctrl->a_bus_req = 0; | 380 | otg_ctrl->a_bus_req = 0; |
381 | } else if (!otg_ctrl->a_vbus_vld) { | 381 | } else if (!otg_ctrl->a_vbus_vld) { |
382 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); | 382 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); |
383 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; | 383 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; |
384 | otg->state = OTG_STATE_A_VBUS_ERR; | 384 | phy->state = OTG_STATE_A_VBUS_ERR; |
385 | } else if (otg_ctrl->b_conn) { | 385 | } else if (otg_ctrl->b_conn) { |
386 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); | 386 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); |
387 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; | 387 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; |
388 | otg->state = OTG_STATE_A_HOST; | 388 | phy->state = OTG_STATE_A_HOST; |
389 | } | 389 | } |
390 | break; | 390 | break; |
391 | case OTG_STATE_A_HOST: | 391 | case OTG_STATE_A_HOST: |
392 | if (otg_ctrl->id || !otg_ctrl->b_conn | 392 | if (otg_ctrl->id || !otg_ctrl->b_conn |
393 | || otg_ctrl->a_bus_drop) | 393 | || otg_ctrl->a_bus_drop) |
394 | otg->state = OTG_STATE_A_WAIT_BCON; | 394 | phy->state = OTG_STATE_A_WAIT_BCON; |
395 | else if (!otg_ctrl->a_vbus_vld) | 395 | else if (!otg_ctrl->a_vbus_vld) |
396 | otg->state = OTG_STATE_A_VBUS_ERR; | 396 | phy->state = OTG_STATE_A_VBUS_ERR; |
397 | break; | 397 | break; |
398 | case OTG_STATE_A_WAIT_VFALL: | 398 | case OTG_STATE_A_WAIT_VFALL: |
399 | if (otg_ctrl->id | 399 | if (otg_ctrl->id |
400 | || (!otg_ctrl->b_conn && otg_ctrl->a_sess_vld) | 400 | || (!otg_ctrl->b_conn && otg_ctrl->a_sess_vld) |
401 | || otg_ctrl->a_bus_req) | 401 | || otg_ctrl->a_bus_req) |
402 | otg->state = OTG_STATE_A_IDLE; | 402 | phy->state = OTG_STATE_A_IDLE; |
403 | break; | 403 | break; |
404 | case OTG_STATE_A_VBUS_ERR: | 404 | case OTG_STATE_A_VBUS_ERR: |
405 | if (otg_ctrl->id || otg_ctrl->a_clr_err | 405 | if (otg_ctrl->id || otg_ctrl->a_clr_err |
406 | || otg_ctrl->a_bus_drop) { | 406 | || otg_ctrl->a_bus_drop) { |
407 | otg_ctrl->a_clr_err = 0; | 407 | otg_ctrl->a_clr_err = 0; |
408 | otg->state = OTG_STATE_A_WAIT_VFALL; | 408 | phy->state = OTG_STATE_A_WAIT_VFALL; |
409 | } | 409 | } |
410 | break; | 410 | break; |
411 | default: | 411 | default: |
@@ -416,15 +416,17 @@ static void mv_otg_update_state(struct mv_otg *mvotg) | |||
416 | static void mv_otg_work(struct work_struct *work) | 416 | static void mv_otg_work(struct work_struct *work) |
417 | { | 417 | { |
418 | struct mv_otg *mvotg; | 418 | struct mv_otg *mvotg; |
419 | struct otg_transceiver *otg; | 419 | struct usb_phy *phy; |
420 | struct usb_otg *otg; | ||
420 | int old_state; | 421 | int old_state; |
421 | 422 | ||
422 | mvotg = container_of((struct delayed_work *)work, struct mv_otg, work); | 423 | mvotg = container_of((struct delayed_work *)work, struct mv_otg, work); |
423 | 424 | ||
424 | run: | 425 | run: |
425 | /* work queue is single thread, or we need spin_lock to protect */ | 426 | /* work queue is single thread, or we need spin_lock to protect */ |
426 | otg = &mvotg->otg; | 427 | phy = &mvotg->phy; |
427 | old_state = otg->state; | 428 | otg = phy->otg; |
429 | old_state = phy->state; | ||
428 | 430 | ||
429 | if (!mvotg->active) | 431 | if (!mvotg->active) |
430 | return; | 432 | return; |
@@ -432,14 +434,14 @@ run: | |||
432 | mv_otg_update_inputs(mvotg); | 434 | mv_otg_update_inputs(mvotg); |
433 | mv_otg_update_state(mvotg); | 435 | mv_otg_update_state(mvotg); |
434 | 436 | ||
435 | if (old_state != otg->state) { | 437 | if (old_state != phy->state) { |
436 | dev_info(&mvotg->pdev->dev, "change from state %s to %s\n", | 438 | dev_info(&mvotg->pdev->dev, "change from state %s to %s\n", |
437 | state_string[old_state], | 439 | state_string[old_state], |
438 | state_string[otg->state]); | 440 | state_string[phy->state]); |
439 | 441 | ||
440 | switch (otg->state) { | 442 | switch (phy->state) { |
441 | case OTG_STATE_B_IDLE: | 443 | case OTG_STATE_B_IDLE: |
442 | mvotg->otg.default_a = 0; | 444 | otg->default_a = 0; |
443 | if (old_state == OTG_STATE_B_PERIPHERAL) | 445 | if (old_state == OTG_STATE_B_PERIPHERAL) |
444 | mv_otg_start_periphrals(mvotg, 0); | 446 | mv_otg_start_periphrals(mvotg, 0); |
445 | mv_otg_reset(mvotg); | 447 | mv_otg_reset(mvotg); |
@@ -450,14 +452,14 @@ run: | |||
450 | mv_otg_start_periphrals(mvotg, 1); | 452 | mv_otg_start_periphrals(mvotg, 1); |
451 | break; | 453 | break; |
452 | case OTG_STATE_A_IDLE: | 454 | case OTG_STATE_A_IDLE: |
453 | mvotg->otg.default_a = 1; | 455 | otg->default_a = 1; |
454 | mv_otg_enable(mvotg); | 456 | mv_otg_enable(mvotg); |
455 | if (old_state == OTG_STATE_A_WAIT_VFALL) | 457 | if (old_state == OTG_STATE_A_WAIT_VFALL) |
456 | mv_otg_start_host(mvotg, 0); | 458 | mv_otg_start_host(mvotg, 0); |
457 | mv_otg_reset(mvotg); | 459 | mv_otg_reset(mvotg); |
458 | break; | 460 | break; |
459 | case OTG_STATE_A_WAIT_VRISE: | 461 | case OTG_STATE_A_WAIT_VRISE: |
460 | mv_otg_set_vbus(&mvotg->otg, 1); | 462 | mv_otg_set_vbus(otg, 1); |
461 | break; | 463 | break; |
462 | case OTG_STATE_A_WAIT_BCON: | 464 | case OTG_STATE_A_WAIT_BCON: |
463 | if (old_state != OTG_STATE_A_HOST) | 465 | if (old_state != OTG_STATE_A_HOST) |
@@ -479,7 +481,7 @@ run: | |||
479 | * here. In fact, it need host driver to notify us. | 481 | * here. In fact, it need host driver to notify us. |
480 | */ | 482 | */ |
481 | mvotg->otg_ctrl.b_conn = 0; | 483 | mvotg->otg_ctrl.b_conn = 0; |
482 | mv_otg_set_vbus(&mvotg->otg, 0); | 484 | mv_otg_set_vbus(otg, 0); |
483 | break; | 485 | break; |
484 | case OTG_STATE_A_VBUS_ERR: | 486 | case OTG_STATE_A_VBUS_ERR: |
485 | break; | 487 | break; |
@@ -548,8 +550,8 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr, | |||
548 | return -1; | 550 | return -1; |
549 | 551 | ||
550 | /* We will use this interface to change to A device */ | 552 | /* We will use this interface to change to A device */ |
551 | if (mvotg->otg.state != OTG_STATE_B_IDLE | 553 | if (mvotg->phy.state != OTG_STATE_B_IDLE |
552 | && mvotg->otg.state != OTG_STATE_A_IDLE) | 554 | && mvotg->phy.state != OTG_STATE_A_IDLE) |
553 | return -1; | 555 | return -1; |
554 | 556 | ||
555 | /* The clock may disabled and we need to set irq for ID detected */ | 557 | /* The clock may disabled and we need to set irq for ID detected */ |
@@ -579,7 +581,7 @@ set_a_clr_err(struct device *dev, struct device_attribute *attr, | |||
579 | const char *buf, size_t count) | 581 | const char *buf, size_t count) |
580 | { | 582 | { |
581 | struct mv_otg *mvotg = dev_get_drvdata(dev); | 583 | struct mv_otg *mvotg = dev_get_drvdata(dev); |
582 | if (!mvotg->otg.default_a) | 584 | if (!mvotg->phy.otg->default_a) |
583 | return -1; | 585 | return -1; |
584 | 586 | ||
585 | if (count > 2) | 587 | if (count > 2) |
@@ -615,7 +617,7 @@ set_a_bus_drop(struct device *dev, struct device_attribute *attr, | |||
615 | const char *buf, size_t count) | 617 | const char *buf, size_t count) |
616 | { | 618 | { |
617 | struct mv_otg *mvotg = dev_get_drvdata(dev); | 619 | struct mv_otg *mvotg = dev_get_drvdata(dev); |
618 | if (!mvotg->otg.default_a) | 620 | if (!mvotg->phy.otg->default_a) |
619 | return -1; | 621 | return -1; |
620 | 622 | ||
621 | if (count > 2) | 623 | if (count > 2) |
@@ -688,9 +690,10 @@ int mv_otg_remove(struct platform_device *pdev) | |||
688 | for (clk_i = 0; clk_i <= mvotg->clknum; clk_i++) | 690 | for (clk_i = 0; clk_i <= mvotg->clknum; clk_i++) |
689 | clk_put(mvotg->clk[clk_i]); | 691 | clk_put(mvotg->clk[clk_i]); |
690 | 692 | ||
691 | otg_set_transceiver(NULL); | 693 | usb_set_transceiver(NULL); |
692 | platform_set_drvdata(pdev, NULL); | 694 | platform_set_drvdata(pdev, NULL); |
693 | 695 | ||
696 | kfree(mvotg->phy.otg); | ||
694 | kfree(mvotg); | 697 | kfree(mvotg); |
695 | 698 | ||
696 | return 0; | 699 | return 0; |
@@ -700,6 +703,7 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
700 | { | 703 | { |
701 | struct mv_usb_platform_data *pdata = pdev->dev.platform_data; | 704 | struct mv_usb_platform_data *pdata = pdev->dev.platform_data; |
702 | struct mv_otg *mvotg; | 705 | struct mv_otg *mvotg; |
706 | struct usb_otg *otg; | ||
703 | struct resource *r; | 707 | struct resource *r; |
704 | int retval = 0, clk_i, i; | 708 | int retval = 0, clk_i, i; |
705 | size_t size; | 709 | size_t size; |
@@ -716,6 +720,12 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
716 | return -ENOMEM; | 720 | return -ENOMEM; |
717 | } | 721 | } |
718 | 722 | ||
723 | otg = kzalloc(sizeof *otg, GFP_KERNEL); | ||
724 | if (!otg) { | ||
725 | kfree(mvotg); | ||
726 | return -ENOMEM; | ||
727 | } | ||
728 | |||
719 | platform_set_drvdata(pdev, mvotg); | 729 | platform_set_drvdata(pdev, mvotg); |
720 | 730 | ||
721 | mvotg->pdev = pdev; | 731 | mvotg->pdev = pdev; |
@@ -741,12 +751,15 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
741 | 751 | ||
742 | /* OTG common part */ | 752 | /* OTG common part */ |
743 | mvotg->pdev = pdev; | 753 | mvotg->pdev = pdev; |
744 | mvotg->otg.dev = &pdev->dev; | 754 | mvotg->phy.dev = &pdev->dev; |
745 | mvotg->otg.label = driver_name; | 755 | mvotg->phy.otg = otg; |
746 | mvotg->otg.set_host = mv_otg_set_host; | 756 | mvotg->phy.label = driver_name; |
747 | mvotg->otg.set_peripheral = mv_otg_set_peripheral; | 757 | mvotg->phy.state = OTG_STATE_UNDEFINED; |
748 | mvotg->otg.set_vbus = mv_otg_set_vbus; | 758 | |
749 | mvotg->otg.state = OTG_STATE_UNDEFINED; | 759 | otg->phy = &mvotg->phy; |
760 | otg->set_host = mv_otg_set_host; | ||
761 | otg->set_peripheral = mv_otg_set_peripheral; | ||
762 | otg->set_vbus = mv_otg_set_vbus; | ||
750 | 763 | ||
751 | for (i = 0; i < OTG_TIMER_NUM; i++) | 764 | for (i = 0; i < OTG_TIMER_NUM; i++) |
752 | init_timer(&mvotg->otg_ctrl.timer[i]); | 765 | init_timer(&mvotg->otg_ctrl.timer[i]); |
@@ -840,7 +853,7 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
840 | goto err_disable_clk; | 853 | goto err_disable_clk; |
841 | } | 854 | } |
842 | 855 | ||
843 | retval = otg_set_transceiver(&mvotg->otg); | 856 | retval = usb_set_transceiver(&mvotg->phy); |
844 | if (retval < 0) { | 857 | if (retval < 0) { |
845 | dev_err(&pdev->dev, "can't register transceiver, %d\n", | 858 | dev_err(&pdev->dev, "can't register transceiver, %d\n", |
846 | retval); | 859 | retval); |
@@ -867,7 +880,7 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
867 | return 0; | 880 | return 0; |
868 | 881 | ||
869 | err_set_transceiver: | 882 | err_set_transceiver: |
870 | otg_set_transceiver(NULL); | 883 | usb_set_transceiver(NULL); |
871 | err_free_irq: | 884 | err_free_irq: |
872 | free_irq(mvotg->irq, mvotg); | 885 | free_irq(mvotg->irq, mvotg); |
873 | err_disable_clk: | 886 | err_disable_clk: |
@@ -888,6 +901,7 @@ err_put_clk: | |||
888 | clk_put(mvotg->clk[clk_i]); | 901 | clk_put(mvotg->clk[clk_i]); |
889 | 902 | ||
890 | platform_set_drvdata(pdev, NULL); | 903 | platform_set_drvdata(pdev, NULL); |
904 | kfree(otg); | ||
891 | kfree(mvotg); | 905 | kfree(mvotg); |
892 | 906 | ||
893 | return retval; | 907 | return retval; |
@@ -898,10 +912,10 @@ static int mv_otg_suspend(struct platform_device *pdev, pm_message_t state) | |||
898 | { | 912 | { |
899 | struct mv_otg *mvotg = platform_get_drvdata(pdev); | 913 | struct mv_otg *mvotg = platform_get_drvdata(pdev); |
900 | 914 | ||
901 | if (mvotg->otg.state != OTG_STATE_B_IDLE) { | 915 | if (mvotg->phy.state != OTG_STATE_B_IDLE) { |
902 | dev_info(&pdev->dev, | 916 | dev_info(&pdev->dev, |
903 | "OTG state is not B_IDLE, it is %d!\n", | 917 | "OTG state is not B_IDLE, it is %d!\n", |
904 | mvotg->otg.state); | 918 | mvotg->phy.state); |
905 | return -EAGAIN; | 919 | return -EAGAIN; |
906 | } | 920 | } |
907 | 921 | ||
diff --git a/drivers/usb/otg/mv_otg.h b/drivers/usb/otg/mv_otg.h index be6ca143764..8a9e351b36b 100644 --- a/drivers/usb/otg/mv_otg.h +++ b/drivers/usb/otg/mv_otg.h | |||
@@ -136,7 +136,7 @@ struct mv_otg_regs { | |||
136 | }; | 136 | }; |
137 | 137 | ||
138 | struct mv_otg { | 138 | struct mv_otg { |
139 | struct otg_transceiver otg; | 139 | struct usb_phy phy; |
140 | struct mv_otg_ctrl otg_ctrl; | 140 | struct mv_otg_ctrl otg_ctrl; |
141 | 141 | ||
142 | /* base address */ | 142 | /* base address */ |
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index c1e36004643..58b26df6afd 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | 34 | ||
35 | struct nop_usb_xceiv { | 35 | struct nop_usb_xceiv { |
36 | struct otg_transceiver otg; | 36 | struct usb_phy phy; |
37 | struct device *dev; | 37 | struct device *dev; |
38 | }; | 38 | }; |
39 | 39 | ||
@@ -58,51 +58,37 @@ void usb_nop_xceiv_unregister(void) | |||
58 | } | 58 | } |
59 | EXPORT_SYMBOL(usb_nop_xceiv_unregister); | 59 | EXPORT_SYMBOL(usb_nop_xceiv_unregister); |
60 | 60 | ||
61 | static inline struct nop_usb_xceiv *xceiv_to_nop(struct otg_transceiver *x) | 61 | static int nop_set_suspend(struct usb_phy *x, int suspend) |
62 | { | ||
63 | return container_of(x, struct nop_usb_xceiv, otg); | ||
64 | } | ||
65 | |||
66 | static int nop_set_suspend(struct otg_transceiver *x, int suspend) | ||
67 | { | 62 | { |
68 | return 0; | 63 | return 0; |
69 | } | 64 | } |
70 | 65 | ||
71 | static int nop_set_peripheral(struct otg_transceiver *x, | 66 | static int nop_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) |
72 | struct usb_gadget *gadget) | ||
73 | { | 67 | { |
74 | struct nop_usb_xceiv *nop; | 68 | if (!otg) |
75 | |||
76 | if (!x) | ||
77 | return -ENODEV; | 69 | return -ENODEV; |
78 | 70 | ||
79 | nop = xceiv_to_nop(x); | ||
80 | |||
81 | if (!gadget) { | 71 | if (!gadget) { |
82 | nop->otg.gadget = NULL; | 72 | otg->gadget = NULL; |
83 | return -ENODEV; | 73 | return -ENODEV; |
84 | } | 74 | } |
85 | 75 | ||
86 | nop->otg.gadget = gadget; | 76 | otg->gadget = gadget; |
87 | nop->otg.state = OTG_STATE_B_IDLE; | 77 | otg->phy->state = OTG_STATE_B_IDLE; |
88 | return 0; | 78 | return 0; |
89 | } | 79 | } |
90 | 80 | ||
91 | static int nop_set_host(struct otg_transceiver *x, struct usb_bus *host) | 81 | static int nop_set_host(struct usb_otg *otg, struct usb_bus *host) |
92 | { | 82 | { |
93 | struct nop_usb_xceiv *nop; | 83 | if (!otg) |
94 | |||
95 | if (!x) | ||
96 | return -ENODEV; | 84 | return -ENODEV; |
97 | 85 | ||
98 | nop = xceiv_to_nop(x); | ||
99 | |||
100 | if (!host) { | 86 | if (!host) { |
101 | nop->otg.host = NULL; | 87 | otg->host = NULL; |
102 | return -ENODEV; | 88 | return -ENODEV; |
103 | } | 89 | } |
104 | 90 | ||
105 | nop->otg.host = host; | 91 | otg->host = host; |
106 | return 0; | 92 | return 0; |
107 | } | 93 | } |
108 | 94 | ||
@@ -115,15 +101,23 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) | |||
115 | if (!nop) | 101 | if (!nop) |
116 | return -ENOMEM; | 102 | return -ENOMEM; |
117 | 103 | ||
104 | nop->phy.otg = kzalloc(sizeof *nop->phy.otg, GFP_KERNEL); | ||
105 | if (!nop->phy.otg) { | ||
106 | kfree(nop); | ||
107 | return -ENOMEM; | ||
108 | } | ||
109 | |||
118 | nop->dev = &pdev->dev; | 110 | nop->dev = &pdev->dev; |
119 | nop->otg.dev = nop->dev; | 111 | nop->phy.dev = nop->dev; |
120 | nop->otg.label = "nop-xceiv"; | 112 | nop->phy.label = "nop-xceiv"; |
121 | nop->otg.state = OTG_STATE_UNDEFINED; | 113 | nop->phy.set_suspend = nop_set_suspend; |
122 | nop->otg.set_host = nop_set_host; | 114 | nop->phy.state = OTG_STATE_UNDEFINED; |
123 | nop->otg.set_peripheral = nop_set_peripheral; | 115 | |
124 | nop->otg.set_suspend = nop_set_suspend; | 116 | nop->phy.otg->phy = &nop->phy; |
125 | 117 | nop->phy.otg->set_host = nop_set_host; | |
126 | err = otg_set_transceiver(&nop->otg); | 118 | nop->phy.otg->set_peripheral = nop_set_peripheral; |
119 | |||
120 | err = usb_set_transceiver(&nop->phy); | ||
127 | if (err) { | 121 | if (err) { |
128 | dev_err(&pdev->dev, "can't register transceiver, err: %d\n", | 122 | dev_err(&pdev->dev, "can't register transceiver, err: %d\n", |
129 | err); | 123 | err); |
@@ -132,10 +126,11 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) | |||
132 | 126 | ||
133 | platform_set_drvdata(pdev, nop); | 127 | platform_set_drvdata(pdev, nop); |
134 | 128 | ||
135 | ATOMIC_INIT_NOTIFIER_HEAD(&nop->otg.notifier); | 129 | ATOMIC_INIT_NOTIFIER_HEAD(&nop->phy.notifier); |
136 | 130 | ||
137 | return 0; | 131 | return 0; |
138 | exit: | 132 | exit: |
133 | kfree(nop->phy.otg); | ||
139 | kfree(nop); | 134 | kfree(nop); |
140 | return err; | 135 | return err; |
141 | } | 136 | } |
@@ -144,9 +139,10 @@ static int __devexit nop_usb_xceiv_remove(struct platform_device *pdev) | |||
144 | { | 139 | { |
145 | struct nop_usb_xceiv *nop = platform_get_drvdata(pdev); | 140 | struct nop_usb_xceiv *nop = platform_get_drvdata(pdev); |
146 | 141 | ||
147 | otg_set_transceiver(NULL); | 142 | usb_set_transceiver(NULL); |
148 | 143 | ||
149 | platform_set_drvdata(pdev, NULL); | 144 | platform_set_drvdata(pdev, NULL); |
145 | kfree(nop->phy.otg); | ||
150 | kfree(nop); | 146 | kfree(nop); |
151 | 147 | ||
152 | return 0; | 148 | return 0; |
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c index 307c27bc51e..801e597a154 100644 --- a/drivers/usb/otg/otg.c +++ b/drivers/usb/otg/otg.c | |||
@@ -15,56 +15,56 @@ | |||
15 | 15 | ||
16 | #include <linux/usb/otg.h> | 16 | #include <linux/usb/otg.h> |
17 | 17 | ||
18 | static struct otg_transceiver *xceiv; | 18 | static struct usb_phy *phy; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * otg_get_transceiver - find the (single) OTG transceiver | 21 | * usb_get_transceiver - find the (single) USB transceiver |
22 | * | 22 | * |
23 | * Returns the transceiver driver, after getting a refcount to it; or | 23 | * Returns the transceiver driver, after getting a refcount to it; or |
24 | * null if there is no such transceiver. The caller is responsible for | 24 | * null if there is no such transceiver. The caller is responsible for |
25 | * calling otg_put_transceiver() to release that count. | 25 | * calling usb_put_transceiver() to release that count. |
26 | * | 26 | * |
27 | * For use by USB host and peripheral drivers. | 27 | * For use by USB host and peripheral drivers. |
28 | */ | 28 | */ |
29 | struct otg_transceiver *otg_get_transceiver(void) | 29 | struct usb_phy *usb_get_transceiver(void) |
30 | { | 30 | { |
31 | if (xceiv) | 31 | if (phy) |
32 | get_device(xceiv->dev); | 32 | get_device(phy->dev); |
33 | return xceiv; | 33 | return phy; |
34 | } | 34 | } |
35 | EXPORT_SYMBOL(otg_get_transceiver); | 35 | EXPORT_SYMBOL(usb_get_transceiver); |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * otg_put_transceiver - release the (single) OTG transceiver | 38 | * usb_put_transceiver - release the (single) USB transceiver |
39 | * @x: the transceiver returned by otg_get_transceiver() | 39 | * @x: the transceiver returned by usb_get_transceiver() |
40 | * | 40 | * |
41 | * Releases a refcount the caller received from otg_get_transceiver(). | 41 | * Releases a refcount the caller received from usb_get_transceiver(). |
42 | * | 42 | * |
43 | * For use by USB host and peripheral drivers. | 43 | * For use by USB host and peripheral drivers. |
44 | */ | 44 | */ |
45 | void otg_put_transceiver(struct otg_transceiver *x) | 45 | void usb_put_transceiver(struct usb_phy *x) |
46 | { | 46 | { |
47 | if (x) | 47 | if (x) |
48 | put_device(x->dev); | 48 | put_device(x->dev); |
49 | } | 49 | } |
50 | EXPORT_SYMBOL(otg_put_transceiver); | 50 | EXPORT_SYMBOL(usb_put_transceiver); |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * otg_set_transceiver - declare the (single) OTG transceiver | 53 | * usb_set_transceiver - declare the (single) USB transceiver |
54 | * @x: the USB OTG transceiver to be used; or NULL | 54 | * @x: the USB transceiver to be used; or NULL |
55 | * | 55 | * |
56 | * This call is exclusively for use by transceiver drivers, which | 56 | * This call is exclusively for use by transceiver drivers, which |
57 | * coordinate the activities of drivers for host and peripheral | 57 | * coordinate the activities of drivers for host and peripheral |
58 | * controllers, and in some cases for VBUS current regulation. | 58 | * controllers, and in some cases for VBUS current regulation. |
59 | */ | 59 | */ |
60 | int otg_set_transceiver(struct otg_transceiver *x) | 60 | int usb_set_transceiver(struct usb_phy *x) |
61 | { | 61 | { |
62 | if (xceiv && x) | 62 | if (phy && x) |
63 | return -EBUSY; | 63 | return -EBUSY; |
64 | xceiv = x; | 64 | phy = x; |
65 | return 0; | 65 | return 0; |
66 | } | 66 | } |
67 | EXPORT_SYMBOL(otg_set_transceiver); | 67 | EXPORT_SYMBOL(usb_set_transceiver); |
68 | 68 | ||
69 | const char *otg_state_string(enum usb_otg_state state) | 69 | const char *otg_state_string(enum usb_otg_state state) |
70 | { | 70 | { |
diff --git a/drivers/usb/otg/otg_fsm.c b/drivers/usb/otg/otg_fsm.c index 09117387d2a..ade131a8ae5 100644 --- a/drivers/usb/otg/otg_fsm.c +++ b/drivers/usb/otg/otg_fsm.c | |||
@@ -117,10 +117,10 @@ void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) | |||
117 | int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) | 117 | int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) |
118 | { | 118 | { |
119 | state_changed = 1; | 119 | state_changed = 1; |
120 | if (fsm->transceiver->state == new_state) | 120 | if (fsm->otg->phy->state == new_state) |
121 | return 0; | 121 | return 0; |
122 | VDBG("Set state: %s\n", otg_state_string(new_state)); | 122 | VDBG("Set state: %s\n", otg_state_string(new_state)); |
123 | otg_leave_state(fsm, fsm->transceiver->state); | 123 | otg_leave_state(fsm, fsm->otg->phy->state); |
124 | switch (new_state) { | 124 | switch (new_state) { |
125 | case OTG_STATE_B_IDLE: | 125 | case OTG_STATE_B_IDLE: |
126 | otg_drv_vbus(fsm, 0); | 126 | otg_drv_vbus(fsm, 0); |
@@ -155,8 +155,8 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) | |||
155 | otg_loc_conn(fsm, 0); | 155 | otg_loc_conn(fsm, 0); |
156 | otg_loc_sof(fsm, 1); | 156 | otg_loc_sof(fsm, 1); |
157 | otg_set_protocol(fsm, PROTO_HOST); | 157 | otg_set_protocol(fsm, PROTO_HOST); |
158 | usb_bus_start_enum(fsm->transceiver->host, | 158 | usb_bus_start_enum(fsm->otg->host, |
159 | fsm->transceiver->host->otg_port); | 159 | fsm->otg->host->otg_port); |
160 | break; | 160 | break; |
161 | case OTG_STATE_A_IDLE: | 161 | case OTG_STATE_A_IDLE: |
162 | otg_drv_vbus(fsm, 0); | 162 | otg_drv_vbus(fsm, 0); |
@@ -221,7 +221,7 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) | |||
221 | break; | 221 | break; |
222 | } | 222 | } |
223 | 223 | ||
224 | fsm->transceiver->state = new_state; | 224 | fsm->otg->phy->state = new_state; |
225 | return 0; | 225 | return 0; |
226 | } | 226 | } |
227 | 227 | ||
@@ -233,7 +233,7 @@ int otg_statemachine(struct otg_fsm *fsm) | |||
233 | 233 | ||
234 | spin_lock_irqsave(&fsm->lock, flags); | 234 | spin_lock_irqsave(&fsm->lock, flags); |
235 | 235 | ||
236 | state = fsm->transceiver->state; | 236 | state = fsm->otg->phy->state; |
237 | state_changed = 0; | 237 | state_changed = 0; |
238 | /* State machine state change judgement */ | 238 | /* State machine state change judgement */ |
239 | 239 | ||
@@ -248,7 +248,7 @@ int otg_statemachine(struct otg_fsm *fsm) | |||
248 | case OTG_STATE_B_IDLE: | 248 | case OTG_STATE_B_IDLE: |
249 | if (!fsm->id) | 249 | if (!fsm->id) |
250 | otg_set_state(fsm, OTG_STATE_A_IDLE); | 250 | otg_set_state(fsm, OTG_STATE_A_IDLE); |
251 | else if (fsm->b_sess_vld && fsm->transceiver->gadget) | 251 | else if (fsm->b_sess_vld && fsm->otg->gadget) |
252 | otg_set_state(fsm, OTG_STATE_B_PERIPHERAL); | 252 | otg_set_state(fsm, OTG_STATE_B_PERIPHERAL); |
253 | else if (fsm->b_bus_req && fsm->b_sess_end && fsm->b_se0_srp) | 253 | else if (fsm->b_bus_req && fsm->b_sess_end && fsm->b_se0_srp) |
254 | otg_set_state(fsm, OTG_STATE_B_SRP_INIT); | 254 | otg_set_state(fsm, OTG_STATE_B_SRP_INIT); |
@@ -260,7 +260,7 @@ int otg_statemachine(struct otg_fsm *fsm) | |||
260 | case OTG_STATE_B_PERIPHERAL: | 260 | case OTG_STATE_B_PERIPHERAL: |
261 | if (!fsm->id || !fsm->b_sess_vld) | 261 | if (!fsm->id || !fsm->b_sess_vld) |
262 | otg_set_state(fsm, OTG_STATE_B_IDLE); | 262 | otg_set_state(fsm, OTG_STATE_B_IDLE); |
263 | else if (fsm->b_bus_req && fsm->transceiver-> | 263 | else if (fsm->b_bus_req && fsm->otg-> |
264 | gadget->b_hnp_enable && fsm->a_bus_suspend) | 264 | gadget->b_hnp_enable && fsm->a_bus_suspend) |
265 | otg_set_state(fsm, OTG_STATE_B_WAIT_ACON); | 265 | otg_set_state(fsm, OTG_STATE_B_WAIT_ACON); |
266 | break; | 266 | break; |
@@ -302,7 +302,7 @@ int otg_statemachine(struct otg_fsm *fsm) | |||
302 | break; | 302 | break; |
303 | case OTG_STATE_A_HOST: | 303 | case OTG_STATE_A_HOST: |
304 | if ((!fsm->a_bus_req || fsm->a_suspend_req) && | 304 | if ((!fsm->a_bus_req || fsm->a_suspend_req) && |
305 | fsm->transceiver->host->b_hnp_enable) | 305 | fsm->otg->host->b_hnp_enable) |
306 | otg_set_state(fsm, OTG_STATE_A_SUSPEND); | 306 | otg_set_state(fsm, OTG_STATE_A_SUSPEND); |
307 | else if (fsm->id || !fsm->b_conn || fsm->a_bus_drop) | 307 | else if (fsm->id || !fsm->b_conn || fsm->a_bus_drop) |
308 | otg_set_state(fsm, OTG_STATE_A_WAIT_BCON); | 308 | otg_set_state(fsm, OTG_STATE_A_WAIT_BCON); |
@@ -310,9 +310,9 @@ int otg_statemachine(struct otg_fsm *fsm) | |||
310 | otg_set_state(fsm, OTG_STATE_A_VBUS_ERR); | 310 | otg_set_state(fsm, OTG_STATE_A_VBUS_ERR); |
311 | break; | 311 | break; |
312 | case OTG_STATE_A_SUSPEND: | 312 | case OTG_STATE_A_SUSPEND: |
313 | if (!fsm->b_conn && fsm->transceiver->host->b_hnp_enable) | 313 | if (!fsm->b_conn && fsm->otg->host->b_hnp_enable) |
314 | otg_set_state(fsm, OTG_STATE_A_PERIPHERAL); | 314 | otg_set_state(fsm, OTG_STATE_A_PERIPHERAL); |
315 | else if (!fsm->b_conn && !fsm->transceiver->host->b_hnp_enable) | 315 | else if (!fsm->b_conn && !fsm->otg->host->b_hnp_enable) |
316 | otg_set_state(fsm, OTG_STATE_A_WAIT_BCON); | 316 | otg_set_state(fsm, OTG_STATE_A_WAIT_BCON); |
317 | else if (fsm->a_bus_req || fsm->b_bus_resume) | 317 | else if (fsm->a_bus_req || fsm->b_bus_resume) |
318 | otg_set_state(fsm, OTG_STATE_A_HOST); | 318 | otg_set_state(fsm, OTG_STATE_A_HOST); |
diff --git a/drivers/usb/otg/otg_fsm.h b/drivers/usb/otg/otg_fsm.h index 0cecf1d593a..c30a2e1d9e4 100644 --- a/drivers/usb/otg/otg_fsm.h +++ b/drivers/usb/otg/otg_fsm.h | |||
@@ -82,7 +82,7 @@ struct otg_fsm { | |||
82 | int loc_sof; | 82 | int loc_sof; |
83 | 83 | ||
84 | struct otg_fsm_ops *ops; | 84 | struct otg_fsm_ops *ops; |
85 | struct otg_transceiver *transceiver; | 85 | struct usb_otg *otg; |
86 | 86 | ||
87 | /* Current usb protocol used: 0:undefine; 1:host; 2:client */ | 87 | /* Current usb protocol used: 0:undefine; 1:host; 2:client */ |
88 | int protocol; | 88 | int protocol; |
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c index 14f66c35862..c4a86da858e 100644 --- a/drivers/usb/otg/twl4030-usb.c +++ b/drivers/usb/otg/twl4030-usb.c | |||
@@ -144,7 +144,7 @@ | |||
144 | #define GPIO_USB_4PIN_ULPI_2430C (3 << 0) | 144 | #define GPIO_USB_4PIN_ULPI_2430C (3 << 0) |
145 | 145 | ||
146 | struct twl4030_usb { | 146 | struct twl4030_usb { |
147 | struct otg_transceiver otg; | 147 | struct usb_phy phy; |
148 | struct device *dev; | 148 | struct device *dev; |
149 | 149 | ||
150 | /* TWL4030 internal USB regulator supplies */ | 150 | /* TWL4030 internal USB regulator supplies */ |
@@ -166,7 +166,7 @@ struct twl4030_usb { | |||
166 | }; | 166 | }; |
167 | 167 | ||
168 | /* internal define on top of container_of */ | 168 | /* internal define on top of container_of */ |
169 | #define xceiv_to_twl(x) container_of((x), struct twl4030_usb, otg) | 169 | #define phy_to_twl(x) container_of((x), struct twl4030_usb, phy) |
170 | 170 | ||
171 | /*-------------------------------------------------------------------------*/ | 171 | /*-------------------------------------------------------------------------*/ |
172 | 172 | ||
@@ -246,10 +246,11 @@ twl4030_usb_clear_bits(struct twl4030_usb *twl, u8 reg, u8 bits) | |||
246 | 246 | ||
247 | /*-------------------------------------------------------------------------*/ | 247 | /*-------------------------------------------------------------------------*/ |
248 | 248 | ||
249 | static enum usb_xceiv_events twl4030_usb_linkstat(struct twl4030_usb *twl) | 249 | static enum usb_phy_events twl4030_usb_linkstat(struct twl4030_usb *twl) |
250 | { | 250 | { |
251 | int status; | 251 | int status; |
252 | int linkstat = USB_EVENT_NONE; | 252 | int linkstat = USB_EVENT_NONE; |
253 | struct usb_otg *otg = twl->phy.otg; | ||
253 | 254 | ||
254 | twl->vbus_supplied = false; | 255 | twl->vbus_supplied = false; |
255 | 256 | ||
@@ -281,7 +282,7 @@ static enum usb_xceiv_events twl4030_usb_linkstat(struct twl4030_usb *twl) | |||
281 | dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n", | 282 | dev_dbg(twl->dev, "HW_CONDITIONS 0x%02x/%d; link %d\n", |
282 | status, status, linkstat); | 283 | status, status, linkstat); |
283 | 284 | ||
284 | twl->otg.last_event = linkstat; | 285 | twl->phy.last_event = linkstat; |
285 | 286 | ||
286 | /* REVISIT this assumes host and peripheral controllers | 287 | /* REVISIT this assumes host and peripheral controllers |
287 | * are registered, and that both are active... | 288 | * are registered, and that both are active... |
@@ -290,11 +291,11 @@ static enum usb_xceiv_events twl4030_usb_linkstat(struct twl4030_usb *twl) | |||
290 | spin_lock_irq(&twl->lock); | 291 | spin_lock_irq(&twl->lock); |
291 | twl->linkstat = linkstat; | 292 | twl->linkstat = linkstat; |
292 | if (linkstat == USB_EVENT_ID) { | 293 | if (linkstat == USB_EVENT_ID) { |
293 | twl->otg.default_a = true; | 294 | otg->default_a = true; |
294 | twl->otg.state = OTG_STATE_A_IDLE; | 295 | twl->phy.state = OTG_STATE_A_IDLE; |
295 | } else { | 296 | } else { |
296 | twl->otg.default_a = false; | 297 | otg->default_a = false; |
297 | twl->otg.state = OTG_STATE_B_IDLE; | 298 | twl->phy.state = OTG_STATE_B_IDLE; |
298 | } | 299 | } |
299 | spin_unlock_irq(&twl->lock); | 300 | spin_unlock_irq(&twl->lock); |
300 | 301 | ||
@@ -520,8 +521,8 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
520 | else | 521 | else |
521 | twl4030_phy_resume(twl); | 522 | twl4030_phy_resume(twl); |
522 | 523 | ||
523 | atomic_notifier_call_chain(&twl->otg.notifier, status, | 524 | atomic_notifier_call_chain(&twl->phy.notifier, status, |
524 | twl->otg.gadget); | 525 | twl->phy.otg->gadget); |
525 | } | 526 | } |
526 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | 527 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); |
527 | 528 | ||
@@ -542,15 +543,15 @@ static void twl4030_usb_phy_init(struct twl4030_usb *twl) | |||
542 | twl->asleep = 0; | 543 | twl->asleep = 0; |
543 | } | 544 | } |
544 | 545 | ||
545 | atomic_notifier_call_chain(&twl->otg.notifier, status, | 546 | atomic_notifier_call_chain(&twl->phy.notifier, status, |
546 | twl->otg.gadget); | 547 | twl->phy.otg->gadget); |
547 | } | 548 | } |
548 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | 549 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); |
549 | } | 550 | } |
550 | 551 | ||
551 | static int twl4030_set_suspend(struct otg_transceiver *x, int suspend) | 552 | static int twl4030_set_suspend(struct usb_phy *x, int suspend) |
552 | { | 553 | { |
553 | struct twl4030_usb *twl = xceiv_to_twl(x); | 554 | struct twl4030_usb *twl = phy_to_twl(x); |
554 | 555 | ||
555 | if (suspend) | 556 | if (suspend) |
556 | twl4030_phy_suspend(twl, 1); | 557 | twl4030_phy_suspend(twl, 1); |
@@ -560,33 +561,27 @@ static int twl4030_set_suspend(struct otg_transceiver *x, int suspend) | |||
560 | return 0; | 561 | return 0; |
561 | } | 562 | } |
562 | 563 | ||
563 | static int twl4030_set_peripheral(struct otg_transceiver *x, | 564 | static int twl4030_set_peripheral(struct usb_otg *otg, |
564 | struct usb_gadget *gadget) | 565 | struct usb_gadget *gadget) |
565 | { | 566 | { |
566 | struct twl4030_usb *twl; | 567 | if (!otg) |
567 | |||
568 | if (!x) | ||
569 | return -ENODEV; | 568 | return -ENODEV; |
570 | 569 | ||
571 | twl = xceiv_to_twl(x); | 570 | otg->gadget = gadget; |
572 | twl->otg.gadget = gadget; | ||
573 | if (!gadget) | 571 | if (!gadget) |
574 | twl->otg.state = OTG_STATE_UNDEFINED; | 572 | otg->phy->state = OTG_STATE_UNDEFINED; |
575 | 573 | ||
576 | return 0; | 574 | return 0; |
577 | } | 575 | } |
578 | 576 | ||
579 | static int twl4030_set_host(struct otg_transceiver *x, struct usb_bus *host) | 577 | static int twl4030_set_host(struct usb_otg *otg, struct usb_bus *host) |
580 | { | 578 | { |
581 | struct twl4030_usb *twl; | 579 | if (!otg) |
582 | |||
583 | if (!x) | ||
584 | return -ENODEV; | 580 | return -ENODEV; |
585 | 581 | ||
586 | twl = xceiv_to_twl(x); | 582 | otg->host = host; |
587 | twl->otg.host = host; | ||
588 | if (!host) | 583 | if (!host) |
589 | twl->otg.state = OTG_STATE_UNDEFINED; | 584 | otg->phy->state = OTG_STATE_UNDEFINED; |
590 | 585 | ||
591 | return 0; | 586 | return 0; |
592 | } | 587 | } |
@@ -596,6 +591,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev) | |||
596 | struct twl4030_usb_data *pdata = pdev->dev.platform_data; | 591 | struct twl4030_usb_data *pdata = pdev->dev.platform_data; |
597 | struct twl4030_usb *twl; | 592 | struct twl4030_usb *twl; |
598 | int status, err; | 593 | int status, err; |
594 | struct usb_otg *otg; | ||
599 | 595 | ||
600 | if (!pdata) { | 596 | if (!pdata) { |
601 | dev_dbg(&pdev->dev, "platform_data not available\n"); | 597 | dev_dbg(&pdev->dev, "platform_data not available\n"); |
@@ -606,16 +602,26 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev) | |||
606 | if (!twl) | 602 | if (!twl) |
607 | return -ENOMEM; | 603 | return -ENOMEM; |
608 | 604 | ||
605 | otg = kzalloc(sizeof *otg, GFP_KERNEL); | ||
606 | if (!otg) { | ||
607 | kfree(twl); | ||
608 | return -ENOMEM; | ||
609 | } | ||
610 | |||
609 | twl->dev = &pdev->dev; | 611 | twl->dev = &pdev->dev; |
610 | twl->irq = platform_get_irq(pdev, 0); | 612 | twl->irq = platform_get_irq(pdev, 0); |
611 | twl->otg.dev = twl->dev; | ||
612 | twl->otg.label = "twl4030"; | ||
613 | twl->otg.set_host = twl4030_set_host; | ||
614 | twl->otg.set_peripheral = twl4030_set_peripheral; | ||
615 | twl->otg.set_suspend = twl4030_set_suspend; | ||
616 | twl->usb_mode = pdata->usb_mode; | 613 | twl->usb_mode = pdata->usb_mode; |
617 | twl->vbus_supplied = false; | 614 | twl->vbus_supplied = false; |
618 | twl->asleep = 1; | 615 | twl->asleep = 1; |
616 | |||
617 | twl->phy.dev = twl->dev; | ||
618 | twl->phy.label = "twl4030"; | ||
619 | twl->phy.otg = otg; | ||
620 | twl->phy.set_suspend = twl4030_set_suspend; | ||
621 | |||
622 | otg->phy = &twl->phy; | ||
623 | otg->set_host = twl4030_set_host; | ||
624 | otg->set_peripheral = twl4030_set_peripheral; | ||
619 | 625 | ||
620 | /* init spinlock for workqueue */ | 626 | /* init spinlock for workqueue */ |
621 | spin_lock_init(&twl->lock); | 627 | spin_lock_init(&twl->lock); |
@@ -623,16 +629,17 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev) | |||
623 | err = twl4030_usb_ldo_init(twl); | 629 | err = twl4030_usb_ldo_init(twl); |
624 | if (err) { | 630 | if (err) { |
625 | dev_err(&pdev->dev, "ldo init failed\n"); | 631 | dev_err(&pdev->dev, "ldo init failed\n"); |
632 | kfree(otg); | ||
626 | kfree(twl); | 633 | kfree(twl); |
627 | return err; | 634 | return err; |
628 | } | 635 | } |
629 | otg_set_transceiver(&twl->otg); | 636 | usb_set_transceiver(&twl->phy); |
630 | 637 | ||
631 | platform_set_drvdata(pdev, twl); | 638 | platform_set_drvdata(pdev, twl); |
632 | if (device_create_file(&pdev->dev, &dev_attr_vbus)) | 639 | if (device_create_file(&pdev->dev, &dev_attr_vbus)) |
633 | dev_warn(&pdev->dev, "could not create sysfs file\n"); | 640 | dev_warn(&pdev->dev, "could not create sysfs file\n"); |
634 | 641 | ||
635 | ATOMIC_INIT_NOTIFIER_HEAD(&twl->otg.notifier); | 642 | ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier); |
636 | 643 | ||
637 | /* Our job is to use irqs and status from the power module | 644 | /* Our job is to use irqs and status from the power module |
638 | * to keep the transceiver disabled when nothing's connected. | 645 | * to keep the transceiver disabled when nothing's connected. |
@@ -649,6 +656,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev) | |||
649 | if (status < 0) { | 656 | if (status < 0) { |
650 | dev_dbg(&pdev->dev, "can't get IRQ %d, err %d\n", | 657 | dev_dbg(&pdev->dev, "can't get IRQ %d, err %d\n", |
651 | twl->irq, status); | 658 | twl->irq, status); |
659 | kfree(otg); | ||
652 | kfree(twl); | 660 | kfree(twl); |
653 | return status; | 661 | return status; |
654 | } | 662 | } |
@@ -693,6 +701,7 @@ static int __exit twl4030_usb_remove(struct platform_device *pdev) | |||
693 | regulator_put(twl->usb1v8); | 701 | regulator_put(twl->usb1v8); |
694 | regulator_put(twl->usb3v1); | 702 | regulator_put(twl->usb3v1); |
695 | 703 | ||
704 | kfree(twl->phy.otg); | ||
696 | kfree(twl); | 705 | kfree(twl); |
697 | 706 | ||
698 | return 0; | 707 | return 0; |
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c index ed2b26cfe81..e3fa387ca81 100644 --- a/drivers/usb/otg/twl6030-usb.c +++ b/drivers/usb/otg/twl6030-usb.c | |||
@@ -87,7 +87,7 @@ | |||
87 | #define VBUS_DET BIT(2) | 87 | #define VBUS_DET BIT(2) |
88 | 88 | ||
89 | struct twl6030_usb { | 89 | struct twl6030_usb { |
90 | struct otg_transceiver otg; | 90 | struct usb_phy phy; |
91 | struct device *dev; | 91 | struct device *dev; |
92 | 92 | ||
93 | /* for vbus reporting with irqs disabled */ | 93 | /* for vbus reporting with irqs disabled */ |
@@ -107,7 +107,7 @@ struct twl6030_usb { | |||
107 | unsigned long features; | 107 | unsigned long features; |
108 | }; | 108 | }; |
109 | 109 | ||
110 | #define xceiv_to_twl(x) container_of((x), struct twl6030_usb, otg) | 110 | #define phy_to_twl(x) container_of((x), struct twl6030_usb, phy) |
111 | 111 | ||
112 | /*-------------------------------------------------------------------------*/ | 112 | /*-------------------------------------------------------------------------*/ |
113 | 113 | ||
@@ -137,13 +137,13 @@ static inline u8 twl6030_readb(struct twl6030_usb *twl, u8 module, u8 address) | |||
137 | return ret; | 137 | return ret; |
138 | } | 138 | } |
139 | 139 | ||
140 | static int twl6030_phy_init(struct otg_transceiver *x) | 140 | static int twl6030_phy_init(struct usb_phy *x) |
141 | { | 141 | { |
142 | struct twl6030_usb *twl; | 142 | struct twl6030_usb *twl; |
143 | struct device *dev; | 143 | struct device *dev; |
144 | struct twl4030_usb_data *pdata; | 144 | struct twl4030_usb_data *pdata; |
145 | 145 | ||
146 | twl = xceiv_to_twl(x); | 146 | twl = phy_to_twl(x); |
147 | dev = twl->dev; | 147 | dev = twl->dev; |
148 | pdata = dev->platform_data; | 148 | pdata = dev->platform_data; |
149 | 149 | ||
@@ -155,21 +155,21 @@ static int twl6030_phy_init(struct otg_transceiver *x) | |||
155 | return 0; | 155 | return 0; |
156 | } | 156 | } |
157 | 157 | ||
158 | static void twl6030_phy_shutdown(struct otg_transceiver *x) | 158 | static void twl6030_phy_shutdown(struct usb_phy *x) |
159 | { | 159 | { |
160 | struct twl6030_usb *twl; | 160 | struct twl6030_usb *twl; |
161 | struct device *dev; | 161 | struct device *dev; |
162 | struct twl4030_usb_data *pdata; | 162 | struct twl4030_usb_data *pdata; |
163 | 163 | ||
164 | twl = xceiv_to_twl(x); | 164 | twl = phy_to_twl(x); |
165 | dev = twl->dev; | 165 | dev = twl->dev; |
166 | pdata = dev->platform_data; | 166 | pdata = dev->platform_data; |
167 | pdata->phy_power(twl->dev, 0, 0); | 167 | pdata->phy_power(twl->dev, 0, 0); |
168 | } | 168 | } |
169 | 169 | ||
170 | static int twl6030_phy_suspend(struct otg_transceiver *x, int suspend) | 170 | static int twl6030_phy_suspend(struct usb_phy *x, int suspend) |
171 | { | 171 | { |
172 | struct twl6030_usb *twl = xceiv_to_twl(x); | 172 | struct twl6030_usb *twl = phy_to_twl(x); |
173 | struct device *dev = twl->dev; | 173 | struct device *dev = twl->dev; |
174 | struct twl4030_usb_data *pdata = dev->platform_data; | 174 | struct twl4030_usb_data *pdata = dev->platform_data; |
175 | 175 | ||
@@ -178,9 +178,9 @@ static int twl6030_phy_suspend(struct otg_transceiver *x, int suspend) | |||
178 | return 0; | 178 | return 0; |
179 | } | 179 | } |
180 | 180 | ||
181 | static int twl6030_start_srp(struct otg_transceiver *x) | 181 | static int twl6030_start_srp(struct usb_otg *otg) |
182 | { | 182 | { |
183 | struct twl6030_usb *twl = xceiv_to_twl(x); | 183 | struct twl6030_usb *twl = phy_to_twl(otg->phy); |
184 | 184 | ||
185 | twl6030_writeb(twl, TWL_MODULE_USB, 0x24, USB_VBUS_CTRL_SET); | 185 | twl6030_writeb(twl, TWL_MODULE_USB, 0x24, USB_VBUS_CTRL_SET); |
186 | twl6030_writeb(twl, TWL_MODULE_USB, 0x84, USB_VBUS_CTRL_SET); | 186 | twl6030_writeb(twl, TWL_MODULE_USB, 0x84, USB_VBUS_CTRL_SET); |
@@ -256,6 +256,7 @@ static DEVICE_ATTR(vbus, 0444, twl6030_usb_vbus_show, NULL); | |||
256 | static irqreturn_t twl6030_usb_irq(int irq, void *_twl) | 256 | static irqreturn_t twl6030_usb_irq(int irq, void *_twl) |
257 | { | 257 | { |
258 | struct twl6030_usb *twl = _twl; | 258 | struct twl6030_usb *twl = _twl; |
259 | struct usb_otg *otg = twl->phy.otg; | ||
259 | int status; | 260 | int status; |
260 | u8 vbus_state, hw_state; | 261 | u8 vbus_state, hw_state; |
261 | 262 | ||
@@ -268,18 +269,18 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl) | |||
268 | regulator_enable(twl->usb3v3); | 269 | regulator_enable(twl->usb3v3); |
269 | twl->asleep = 1; | 270 | twl->asleep = 1; |
270 | status = USB_EVENT_VBUS; | 271 | status = USB_EVENT_VBUS; |
271 | twl->otg.default_a = false; | 272 | otg->default_a = false; |
272 | twl->otg.state = OTG_STATE_B_IDLE; | 273 | twl->phy.state = OTG_STATE_B_IDLE; |
273 | twl->linkstat = status; | 274 | twl->linkstat = status; |
274 | twl->otg.last_event = status; | 275 | twl->phy.last_event = status; |
275 | atomic_notifier_call_chain(&twl->otg.notifier, | 276 | atomic_notifier_call_chain(&twl->phy.notifier, |
276 | status, twl->otg.gadget); | 277 | status, otg->gadget); |
277 | } else { | 278 | } else { |
278 | status = USB_EVENT_NONE; | 279 | status = USB_EVENT_NONE; |
279 | twl->linkstat = status; | 280 | twl->linkstat = status; |
280 | twl->otg.last_event = status; | 281 | twl->phy.last_event = status; |
281 | atomic_notifier_call_chain(&twl->otg.notifier, | 282 | atomic_notifier_call_chain(&twl->phy.notifier, |
282 | status, twl->otg.gadget); | 283 | status, otg->gadget); |
283 | if (twl->asleep) { | 284 | if (twl->asleep) { |
284 | regulator_disable(twl->usb3v3); | 285 | regulator_disable(twl->usb3v3); |
285 | twl->asleep = 0; | 286 | twl->asleep = 0; |
@@ -294,6 +295,7 @@ static irqreturn_t twl6030_usb_irq(int irq, void *_twl) | |||
294 | static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | 295 | static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) |
295 | { | 296 | { |
296 | struct twl6030_usb *twl = _twl; | 297 | struct twl6030_usb *twl = _twl; |
298 | struct usb_otg *otg = twl->phy.otg; | ||
297 | int status = USB_EVENT_NONE; | 299 | int status = USB_EVENT_NONE; |
298 | u8 hw_state; | 300 | u8 hw_state; |
299 | 301 | ||
@@ -307,12 +309,12 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | |||
307 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, | 309 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, |
308 | 0x10); | 310 | 0x10); |
309 | status = USB_EVENT_ID; | 311 | status = USB_EVENT_ID; |
310 | twl->otg.default_a = true; | 312 | otg->default_a = true; |
311 | twl->otg.state = OTG_STATE_A_IDLE; | 313 | twl->phy.state = OTG_STATE_A_IDLE; |
312 | twl->linkstat = status; | 314 | twl->linkstat = status; |
313 | twl->otg.last_event = status; | 315 | twl->phy.last_event = status; |
314 | atomic_notifier_call_chain(&twl->otg.notifier, status, | 316 | atomic_notifier_call_chain(&twl->phy.notifier, status, |
315 | twl->otg.gadget); | 317 | otg->gadget); |
316 | } else { | 318 | } else { |
317 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, | 319 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_CLR, |
318 | 0x10); | 320 | 0x10); |
@@ -324,25 +326,22 @@ static irqreturn_t twl6030_usbotg_irq(int irq, void *_twl) | |||
324 | return IRQ_HANDLED; | 326 | return IRQ_HANDLED; |
325 | } | 327 | } |
326 | 328 | ||
327 | static int twl6030_set_peripheral(struct otg_transceiver *x, | 329 | static int twl6030_set_peripheral(struct usb_otg *otg, |
328 | struct usb_gadget *gadget) | 330 | struct usb_gadget *gadget) |
329 | { | 331 | { |
330 | struct twl6030_usb *twl; | 332 | if (!otg) |
331 | |||
332 | if (!x) | ||
333 | return -ENODEV; | 333 | return -ENODEV; |
334 | 334 | ||
335 | twl = xceiv_to_twl(x); | 335 | otg->gadget = gadget; |
336 | twl->otg.gadget = gadget; | ||
337 | if (!gadget) | 336 | if (!gadget) |
338 | twl->otg.state = OTG_STATE_UNDEFINED; | 337 | otg->phy->state = OTG_STATE_UNDEFINED; |
339 | 338 | ||
340 | return 0; | 339 | return 0; |
341 | } | 340 | } |
342 | 341 | ||
343 | static int twl6030_enable_irq(struct otg_transceiver *x) | 342 | static int twl6030_enable_irq(struct usb_phy *x) |
344 | { | 343 | { |
345 | struct twl6030_usb *twl = xceiv_to_twl(x); | 344 | struct twl6030_usb *twl = phy_to_twl(x); |
346 | 345 | ||
347 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, 0x1); | 346 | twl6030_writeb(twl, TWL_MODULE_USB, USB_ID_INT_EN_HI_SET, 0x1); |
348 | twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C); | 347 | twl6030_interrupt_unmask(0x05, REG_INT_MSK_LINE_C); |
@@ -376,9 +375,9 @@ static void otg_set_vbus_work(struct work_struct *data) | |||
376 | CHARGERUSB_CTRL1); | 375 | CHARGERUSB_CTRL1); |
377 | } | 376 | } |
378 | 377 | ||
379 | static int twl6030_set_vbus(struct otg_transceiver *x, bool enabled) | 378 | static int twl6030_set_vbus(struct usb_otg *otg, bool enabled) |
380 | { | 379 | { |
381 | struct twl6030_usb *twl = xceiv_to_twl(x); | 380 | struct twl6030_usb *twl = phy_to_twl(otg->phy); |
382 | 381 | ||
383 | twl->vbus_enable = enabled; | 382 | twl->vbus_enable = enabled; |
384 | schedule_work(&twl->set_vbus_work); | 383 | schedule_work(&twl->set_vbus_work); |
@@ -386,17 +385,14 @@ static int twl6030_set_vbus(struct otg_transceiver *x, bool enabled) | |||
386 | return 0; | 385 | return 0; |
387 | } | 386 | } |
388 | 387 | ||
389 | static int twl6030_set_host(struct otg_transceiver *x, struct usb_bus *host) | 388 | static int twl6030_set_host(struct usb_otg *otg, struct usb_bus *host) |
390 | { | 389 | { |
391 | struct twl6030_usb *twl; | 390 | if (!otg) |
392 | |||
393 | if (!x) | ||
394 | return -ENODEV; | 391 | return -ENODEV; |
395 | 392 | ||
396 | twl = xceiv_to_twl(x); | 393 | otg->host = host; |
397 | twl->otg.host = host; | ||
398 | if (!host) | 394 | if (!host) |
399 | twl->otg.state = OTG_STATE_UNDEFINED; | 395 | otg->phy->state = OTG_STATE_UNDEFINED; |
400 | return 0; | 396 | return 0; |
401 | } | 397 | } |
402 | 398 | ||
@@ -405,6 +401,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) | |||
405 | struct twl6030_usb *twl; | 401 | struct twl6030_usb *twl; |
406 | int status, err; | 402 | int status, err; |
407 | struct twl4030_usb_data *pdata; | 403 | struct twl4030_usb_data *pdata; |
404 | struct usb_otg *otg; | ||
408 | struct device *dev = &pdev->dev; | 405 | struct device *dev = &pdev->dev; |
409 | pdata = dev->platform_data; | 406 | pdata = dev->platform_data; |
410 | 407 | ||
@@ -412,19 +409,29 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) | |||
412 | if (!twl) | 409 | if (!twl) |
413 | return -ENOMEM; | 410 | return -ENOMEM; |
414 | 411 | ||
412 | otg = kzalloc(sizeof *otg, GFP_KERNEL); | ||
413 | if (!otg) { | ||
414 | kfree(twl); | ||
415 | return -ENOMEM; | ||
416 | } | ||
417 | |||
415 | twl->dev = &pdev->dev; | 418 | twl->dev = &pdev->dev; |
416 | twl->irq1 = platform_get_irq(pdev, 0); | 419 | twl->irq1 = platform_get_irq(pdev, 0); |
417 | twl->irq2 = platform_get_irq(pdev, 1); | 420 | twl->irq2 = platform_get_irq(pdev, 1); |
418 | twl->features = pdata->features; | 421 | twl->features = pdata->features; |
419 | twl->otg.dev = twl->dev; | 422 | |
420 | twl->otg.label = "twl6030"; | 423 | twl->phy.dev = twl->dev; |
421 | twl->otg.set_host = twl6030_set_host; | 424 | twl->phy.label = "twl6030"; |
422 | twl->otg.set_peripheral = twl6030_set_peripheral; | 425 | twl->phy.otg = otg; |
423 | twl->otg.set_vbus = twl6030_set_vbus; | 426 | twl->phy.init = twl6030_phy_init; |
424 | twl->otg.init = twl6030_phy_init; | 427 | twl->phy.shutdown = twl6030_phy_shutdown; |
425 | twl->otg.shutdown = twl6030_phy_shutdown; | 428 | twl->phy.set_suspend = twl6030_phy_suspend; |
426 | twl->otg.set_suspend = twl6030_phy_suspend; | 429 | |
427 | twl->otg.start_srp = twl6030_start_srp; | 430 | otg->phy = &twl->phy; |
431 | otg->set_host = twl6030_set_host; | ||
432 | otg->set_peripheral = twl6030_set_peripheral; | ||
433 | otg->set_vbus = twl6030_set_vbus; | ||
434 | otg->start_srp = twl6030_start_srp; | ||
428 | 435 | ||
429 | /* init spinlock for workqueue */ | 436 | /* init spinlock for workqueue */ |
430 | spin_lock_init(&twl->lock); | 437 | spin_lock_init(&twl->lock); |
@@ -432,16 +439,17 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) | |||
432 | err = twl6030_usb_ldo_init(twl); | 439 | err = twl6030_usb_ldo_init(twl); |
433 | if (err) { | 440 | if (err) { |
434 | dev_err(&pdev->dev, "ldo init failed\n"); | 441 | dev_err(&pdev->dev, "ldo init failed\n"); |
442 | kfree(otg); | ||
435 | kfree(twl); | 443 | kfree(twl); |
436 | return err; | 444 | return err; |
437 | } | 445 | } |
438 | otg_set_transceiver(&twl->otg); | 446 | usb_set_transceiver(&twl->phy); |
439 | 447 | ||
440 | platform_set_drvdata(pdev, twl); | 448 | platform_set_drvdata(pdev, twl); |
441 | if (device_create_file(&pdev->dev, &dev_attr_vbus)) | 449 | if (device_create_file(&pdev->dev, &dev_attr_vbus)) |
442 | dev_warn(&pdev->dev, "could not create sysfs file\n"); | 450 | dev_warn(&pdev->dev, "could not create sysfs file\n"); |
443 | 451 | ||
444 | ATOMIC_INIT_NOTIFIER_HEAD(&twl->otg.notifier); | 452 | ATOMIC_INIT_NOTIFIER_HEAD(&twl->phy.notifier); |
445 | 453 | ||
446 | INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work); | 454 | INIT_WORK(&twl->set_vbus_work, otg_set_vbus_work); |
447 | 455 | ||
@@ -453,6 +461,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) | |||
453 | dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", | 461 | dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", |
454 | twl->irq1, status); | 462 | twl->irq1, status); |
455 | device_remove_file(twl->dev, &dev_attr_vbus); | 463 | device_remove_file(twl->dev, &dev_attr_vbus); |
464 | kfree(otg); | ||
456 | kfree(twl); | 465 | kfree(twl); |
457 | return status; | 466 | return status; |
458 | } | 467 | } |
@@ -465,14 +474,15 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev) | |||
465 | twl->irq2, status); | 474 | twl->irq2, status); |
466 | free_irq(twl->irq1, twl); | 475 | free_irq(twl->irq1, twl); |
467 | device_remove_file(twl->dev, &dev_attr_vbus); | 476 | device_remove_file(twl->dev, &dev_attr_vbus); |
477 | kfree(otg); | ||
468 | kfree(twl); | 478 | kfree(twl); |
469 | return status; | 479 | return status; |
470 | } | 480 | } |
471 | 481 | ||
472 | twl->asleep = 0; | 482 | twl->asleep = 0; |
473 | pdata->phy_init(dev); | 483 | pdata->phy_init(dev); |
474 | twl6030_phy_suspend(&twl->otg, 0); | 484 | twl6030_phy_suspend(&twl->phy, 0); |
475 | twl6030_enable_irq(&twl->otg); | 485 | twl6030_enable_irq(&twl->phy); |
476 | dev_info(&pdev->dev, "Initialized TWL6030 USB module\n"); | 486 | dev_info(&pdev->dev, "Initialized TWL6030 USB module\n"); |
477 | 487 | ||
478 | return 0; | 488 | return 0; |
@@ -496,6 +506,7 @@ static int __exit twl6030_usb_remove(struct platform_device *pdev) | |||
496 | pdata->phy_exit(twl->dev); | 506 | pdata->phy_exit(twl->dev); |
497 | device_remove_file(twl->dev, &dev_attr_vbus); | 507 | device_remove_file(twl->dev, &dev_attr_vbus); |
498 | cancel_work_sync(&twl->set_vbus_work); | 508 | cancel_work_sync(&twl->set_vbus_work); |
509 | kfree(twl->phy.otg); | ||
499 | kfree(twl); | 510 | kfree(twl); |
500 | 511 | ||
501 | return 0; | 512 | return 0; |
diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c index 0b0466728fd..217339dd7a9 100644 --- a/drivers/usb/otg/ulpi.c +++ b/drivers/usb/otg/ulpi.c | |||
@@ -49,31 +49,31 @@ static struct ulpi_info ulpi_ids[] = { | |||
49 | ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"), | 49 | ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"), |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static int ulpi_set_otg_flags(struct otg_transceiver *otg) | 52 | static int ulpi_set_otg_flags(struct usb_phy *phy) |
53 | { | 53 | { |
54 | unsigned int flags = ULPI_OTG_CTRL_DP_PULLDOWN | | 54 | unsigned int flags = ULPI_OTG_CTRL_DP_PULLDOWN | |
55 | ULPI_OTG_CTRL_DM_PULLDOWN; | 55 | ULPI_OTG_CTRL_DM_PULLDOWN; |
56 | 56 | ||
57 | if (otg->flags & ULPI_OTG_ID_PULLUP) | 57 | if (phy->flags & ULPI_OTG_ID_PULLUP) |
58 | flags |= ULPI_OTG_CTRL_ID_PULLUP; | 58 | flags |= ULPI_OTG_CTRL_ID_PULLUP; |
59 | 59 | ||
60 | /* | 60 | /* |
61 | * ULPI Specification rev.1.1 default | 61 | * ULPI Specification rev.1.1 default |
62 | * for Dp/DmPulldown is enabled. | 62 | * for Dp/DmPulldown is enabled. |
63 | */ | 63 | */ |
64 | if (otg->flags & ULPI_OTG_DP_PULLDOWN_DIS) | 64 | if (phy->flags & ULPI_OTG_DP_PULLDOWN_DIS) |
65 | flags &= ~ULPI_OTG_CTRL_DP_PULLDOWN; | 65 | flags &= ~ULPI_OTG_CTRL_DP_PULLDOWN; |
66 | 66 | ||
67 | if (otg->flags & ULPI_OTG_DM_PULLDOWN_DIS) | 67 | if (phy->flags & ULPI_OTG_DM_PULLDOWN_DIS) |
68 | flags &= ~ULPI_OTG_CTRL_DM_PULLDOWN; | 68 | flags &= ~ULPI_OTG_CTRL_DM_PULLDOWN; |
69 | 69 | ||
70 | if (otg->flags & ULPI_OTG_EXTVBUSIND) | 70 | if (phy->flags & ULPI_OTG_EXTVBUSIND) |
71 | flags |= ULPI_OTG_CTRL_EXTVBUSIND; | 71 | flags |= ULPI_OTG_CTRL_EXTVBUSIND; |
72 | 72 | ||
73 | return otg_io_write(otg, flags, ULPI_OTG_CTRL); | 73 | return usb_phy_io_write(phy, flags, ULPI_OTG_CTRL); |
74 | } | 74 | } |
75 | 75 | ||
76 | static int ulpi_set_fc_flags(struct otg_transceiver *otg) | 76 | static int ulpi_set_fc_flags(struct usb_phy *phy) |
77 | { | 77 | { |
78 | unsigned int flags = 0; | 78 | unsigned int flags = 0; |
79 | 79 | ||
@@ -81,27 +81,27 @@ static int ulpi_set_fc_flags(struct otg_transceiver *otg) | |||
81 | * ULPI Specification rev.1.1 default | 81 | * ULPI Specification rev.1.1 default |
82 | * for XcvrSelect is Full Speed. | 82 | * for XcvrSelect is Full Speed. |
83 | */ | 83 | */ |
84 | if (otg->flags & ULPI_FC_HS) | 84 | if (phy->flags & ULPI_FC_HS) |
85 | flags |= ULPI_FUNC_CTRL_HIGH_SPEED; | 85 | flags |= ULPI_FUNC_CTRL_HIGH_SPEED; |
86 | else if (otg->flags & ULPI_FC_LS) | 86 | else if (phy->flags & ULPI_FC_LS) |
87 | flags |= ULPI_FUNC_CTRL_LOW_SPEED; | 87 | flags |= ULPI_FUNC_CTRL_LOW_SPEED; |
88 | else if (otg->flags & ULPI_FC_FS4LS) | 88 | else if (phy->flags & ULPI_FC_FS4LS) |
89 | flags |= ULPI_FUNC_CTRL_FS4LS; | 89 | flags |= ULPI_FUNC_CTRL_FS4LS; |
90 | else | 90 | else |
91 | flags |= ULPI_FUNC_CTRL_FULL_SPEED; | 91 | flags |= ULPI_FUNC_CTRL_FULL_SPEED; |
92 | 92 | ||
93 | if (otg->flags & ULPI_FC_TERMSEL) | 93 | if (phy->flags & ULPI_FC_TERMSEL) |
94 | flags |= ULPI_FUNC_CTRL_TERMSELECT; | 94 | flags |= ULPI_FUNC_CTRL_TERMSELECT; |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * ULPI Specification rev.1.1 default | 97 | * ULPI Specification rev.1.1 default |
98 | * for OpMode is Normal Operation. | 98 | * for OpMode is Normal Operation. |
99 | */ | 99 | */ |
100 | if (otg->flags & ULPI_FC_OP_NODRV) | 100 | if (phy->flags & ULPI_FC_OP_NODRV) |
101 | flags |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; | 101 | flags |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; |
102 | else if (otg->flags & ULPI_FC_OP_DIS_NRZI) | 102 | else if (phy->flags & ULPI_FC_OP_DIS_NRZI) |
103 | flags |= ULPI_FUNC_CTRL_OPMODE_DISABLE_NRZI; | 103 | flags |= ULPI_FUNC_CTRL_OPMODE_DISABLE_NRZI; |
104 | else if (otg->flags & ULPI_FC_OP_NSYNC_NEOP) | 104 | else if (phy->flags & ULPI_FC_OP_NSYNC_NEOP) |
105 | flags |= ULPI_FUNC_CTRL_OPMODE_NOSYNC_NOEOP; | 105 | flags |= ULPI_FUNC_CTRL_OPMODE_NOSYNC_NOEOP; |
106 | else | 106 | else |
107 | flags |= ULPI_FUNC_CTRL_OPMODE_NORMAL; | 107 | flags |= ULPI_FUNC_CTRL_OPMODE_NORMAL; |
@@ -112,54 +112,54 @@ static int ulpi_set_fc_flags(struct otg_transceiver *otg) | |||
112 | */ | 112 | */ |
113 | flags |= ULPI_FUNC_CTRL_SUSPENDM; | 113 | flags |= ULPI_FUNC_CTRL_SUSPENDM; |
114 | 114 | ||
115 | return otg_io_write(otg, flags, ULPI_FUNC_CTRL); | 115 | return usb_phy_io_write(phy, flags, ULPI_FUNC_CTRL); |
116 | } | 116 | } |
117 | 117 | ||
118 | static int ulpi_set_ic_flags(struct otg_transceiver *otg) | 118 | static int ulpi_set_ic_flags(struct usb_phy *phy) |
119 | { | 119 | { |
120 | unsigned int flags = 0; | 120 | unsigned int flags = 0; |
121 | 121 | ||
122 | if (otg->flags & ULPI_IC_AUTORESUME) | 122 | if (phy->flags & ULPI_IC_AUTORESUME) |
123 | flags |= ULPI_IFC_CTRL_AUTORESUME; | 123 | flags |= ULPI_IFC_CTRL_AUTORESUME; |
124 | 124 | ||
125 | if (otg->flags & ULPI_IC_EXTVBUS_INDINV) | 125 | if (phy->flags & ULPI_IC_EXTVBUS_INDINV) |
126 | flags |= ULPI_IFC_CTRL_EXTERNAL_VBUS; | 126 | flags |= ULPI_IFC_CTRL_EXTERNAL_VBUS; |
127 | 127 | ||
128 | if (otg->flags & ULPI_IC_IND_PASSTHRU) | 128 | if (phy->flags & ULPI_IC_IND_PASSTHRU) |
129 | flags |= ULPI_IFC_CTRL_PASSTHRU; | 129 | flags |= ULPI_IFC_CTRL_PASSTHRU; |
130 | 130 | ||
131 | if (otg->flags & ULPI_IC_PROTECT_DIS) | 131 | if (phy->flags & ULPI_IC_PROTECT_DIS) |
132 | flags |= ULPI_IFC_CTRL_PROTECT_IFC_DISABLE; | 132 | flags |= ULPI_IFC_CTRL_PROTECT_IFC_DISABLE; |
133 | 133 | ||
134 | return otg_io_write(otg, flags, ULPI_IFC_CTRL); | 134 | return usb_phy_io_write(phy, flags, ULPI_IFC_CTRL); |
135 | } | 135 | } |
136 | 136 | ||
137 | static int ulpi_set_flags(struct otg_transceiver *otg) | 137 | static int ulpi_set_flags(struct usb_phy *phy) |
138 | { | 138 | { |
139 | int ret; | 139 | int ret; |
140 | 140 | ||
141 | ret = ulpi_set_otg_flags(otg); | 141 | ret = ulpi_set_otg_flags(phy); |
142 | if (ret) | 142 | if (ret) |
143 | return ret; | 143 | return ret; |
144 | 144 | ||
145 | ret = ulpi_set_ic_flags(otg); | 145 | ret = ulpi_set_ic_flags(phy); |
146 | if (ret) | 146 | if (ret) |
147 | return ret; | 147 | return ret; |
148 | 148 | ||
149 | return ulpi_set_fc_flags(otg); | 149 | return ulpi_set_fc_flags(phy); |
150 | } | 150 | } |
151 | 151 | ||
152 | static int ulpi_check_integrity(struct otg_transceiver *otg) | 152 | static int ulpi_check_integrity(struct usb_phy *phy) |
153 | { | 153 | { |
154 | int ret, i; | 154 | int ret, i; |
155 | unsigned int val = 0x55; | 155 | unsigned int val = 0x55; |
156 | 156 | ||
157 | for (i = 0; i < 2; i++) { | 157 | for (i = 0; i < 2; i++) { |
158 | ret = otg_io_write(otg, val, ULPI_SCRATCH); | 158 | ret = usb_phy_io_write(phy, val, ULPI_SCRATCH); |
159 | if (ret < 0) | 159 | if (ret < 0) |
160 | return ret; | 160 | return ret; |
161 | 161 | ||
162 | ret = otg_io_read(otg, ULPI_SCRATCH); | 162 | ret = usb_phy_io_read(phy, ULPI_SCRATCH); |
163 | if (ret < 0) | 163 | if (ret < 0) |
164 | return ret; | 164 | return ret; |
165 | 165 | ||
@@ -175,13 +175,13 @@ static int ulpi_check_integrity(struct otg_transceiver *otg) | |||
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
177 | 177 | ||
178 | static int ulpi_init(struct otg_transceiver *otg) | 178 | static int ulpi_init(struct usb_phy *phy) |
179 | { | 179 | { |
180 | int i, vid, pid, ret; | 180 | int i, vid, pid, ret; |
181 | u32 ulpi_id = 0; | 181 | u32 ulpi_id = 0; |
182 | 182 | ||
183 | for (i = 0; i < 4; i++) { | 183 | for (i = 0; i < 4; i++) { |
184 | ret = otg_io_read(otg, ULPI_PRODUCT_ID_HIGH - i); | 184 | ret = usb_phy_io_read(phy, ULPI_PRODUCT_ID_HIGH - i); |
185 | if (ret < 0) | 185 | if (ret < 0) |
186 | return ret; | 186 | return ret; |
187 | ulpi_id = (ulpi_id << 8) | ret; | 187 | ulpi_id = (ulpi_id << 8) | ret; |
@@ -199,16 +199,17 @@ static int ulpi_init(struct otg_transceiver *otg) | |||
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | ret = ulpi_check_integrity(otg); | 202 | ret = ulpi_check_integrity(phy); |
203 | if (ret) | 203 | if (ret) |
204 | return ret; | 204 | return ret; |
205 | 205 | ||
206 | return ulpi_set_flags(otg); | 206 | return ulpi_set_flags(phy); |
207 | } | 207 | } |
208 | 208 | ||
209 | static int ulpi_set_host(struct otg_transceiver *otg, struct usb_bus *host) | 209 | static int ulpi_set_host(struct usb_otg *otg, struct usb_bus *host) |
210 | { | 210 | { |
211 | unsigned int flags = otg_io_read(otg, ULPI_IFC_CTRL); | 211 | struct usb_phy *phy = otg->phy; |
212 | unsigned int flags = usb_phy_io_read(phy, ULPI_IFC_CTRL); | ||
212 | 213 | ||
213 | if (!host) { | 214 | if (!host) { |
214 | otg->host = NULL; | 215 | otg->host = NULL; |
@@ -221,51 +222,62 @@ static int ulpi_set_host(struct otg_transceiver *otg, struct usb_bus *host) | |||
221 | ULPI_IFC_CTRL_3_PIN_SERIAL_MODE | | 222 | ULPI_IFC_CTRL_3_PIN_SERIAL_MODE | |
222 | ULPI_IFC_CTRL_CARKITMODE); | 223 | ULPI_IFC_CTRL_CARKITMODE); |
223 | 224 | ||
224 | if (otg->flags & ULPI_IC_6PIN_SERIAL) | 225 | if (phy->flags & ULPI_IC_6PIN_SERIAL) |
225 | flags |= ULPI_IFC_CTRL_6_PIN_SERIAL_MODE; | 226 | flags |= ULPI_IFC_CTRL_6_PIN_SERIAL_MODE; |
226 | else if (otg->flags & ULPI_IC_3PIN_SERIAL) | 227 | else if (phy->flags & ULPI_IC_3PIN_SERIAL) |
227 | flags |= ULPI_IFC_CTRL_3_PIN_SERIAL_MODE; | 228 | flags |= ULPI_IFC_CTRL_3_PIN_SERIAL_MODE; |
228 | else if (otg->flags & ULPI_IC_CARKIT) | 229 | else if (phy->flags & ULPI_IC_CARKIT) |
229 | flags |= ULPI_IFC_CTRL_CARKITMODE; | 230 | flags |= ULPI_IFC_CTRL_CARKITMODE; |
230 | 231 | ||
231 | return otg_io_write(otg, flags, ULPI_IFC_CTRL); | 232 | return usb_phy_io_write(phy, flags, ULPI_IFC_CTRL); |
232 | } | 233 | } |
233 | 234 | ||
234 | static int ulpi_set_vbus(struct otg_transceiver *otg, bool on) | 235 | static int ulpi_set_vbus(struct usb_otg *otg, bool on) |
235 | { | 236 | { |
236 | unsigned int flags = otg_io_read(otg, ULPI_OTG_CTRL); | 237 | struct usb_phy *phy = otg->phy; |
238 | unsigned int flags = usb_phy_io_read(phy, ULPI_OTG_CTRL); | ||
237 | 239 | ||
238 | flags &= ~(ULPI_OTG_CTRL_DRVVBUS | ULPI_OTG_CTRL_DRVVBUS_EXT); | 240 | flags &= ~(ULPI_OTG_CTRL_DRVVBUS | ULPI_OTG_CTRL_DRVVBUS_EXT); |
239 | 241 | ||
240 | if (on) { | 242 | if (on) { |
241 | if (otg->flags & ULPI_OTG_DRVVBUS) | 243 | if (phy->flags & ULPI_OTG_DRVVBUS) |
242 | flags |= ULPI_OTG_CTRL_DRVVBUS; | 244 | flags |= ULPI_OTG_CTRL_DRVVBUS; |
243 | 245 | ||
244 | if (otg->flags & ULPI_OTG_DRVVBUS_EXT) | 246 | if (phy->flags & ULPI_OTG_DRVVBUS_EXT) |
245 | flags |= ULPI_OTG_CTRL_DRVVBUS_EXT; | 247 | flags |= ULPI_OTG_CTRL_DRVVBUS_EXT; |
246 | } | 248 | } |
247 | 249 | ||
248 | return otg_io_write(otg, flags, ULPI_OTG_CTRL); | 250 | return usb_phy_io_write(phy, flags, ULPI_OTG_CTRL); |
249 | } | 251 | } |
250 | 252 | ||
251 | struct otg_transceiver * | 253 | struct usb_phy * |
252 | otg_ulpi_create(struct otg_io_access_ops *ops, | 254 | otg_ulpi_create(struct usb_phy_io_ops *ops, |
253 | unsigned int flags) | 255 | unsigned int flags) |
254 | { | 256 | { |
255 | struct otg_transceiver *otg; | 257 | struct usb_phy *phy; |
258 | struct usb_otg *otg; | ||
259 | |||
260 | phy = kzalloc(sizeof(*phy), GFP_KERNEL); | ||
261 | if (!phy) | ||
262 | return NULL; | ||
256 | 263 | ||
257 | otg = kzalloc(sizeof(*otg), GFP_KERNEL); | 264 | otg = kzalloc(sizeof(*otg), GFP_KERNEL); |
258 | if (!otg) | 265 | if (!otg) { |
266 | kfree(phy); | ||
259 | return NULL; | 267 | return NULL; |
268 | } | ||
269 | |||
270 | phy->label = "ULPI"; | ||
271 | phy->flags = flags; | ||
272 | phy->io_ops = ops; | ||
273 | phy->otg = otg; | ||
274 | phy->init = ulpi_init; | ||
260 | 275 | ||
261 | otg->label = "ULPI"; | 276 | otg->phy = phy; |
262 | otg->flags = flags; | ||
263 | otg->io_ops = ops; | ||
264 | otg->init = ulpi_init; | ||
265 | otg->set_host = ulpi_set_host; | 277 | otg->set_host = ulpi_set_host; |
266 | otg->set_vbus = ulpi_set_vbus; | 278 | otg->set_vbus = ulpi_set_vbus; |
267 | 279 | ||
268 | return otg; | 280 | return phy; |
269 | } | 281 | } |
270 | EXPORT_SYMBOL_GPL(otg_ulpi_create); | 282 | EXPORT_SYMBOL_GPL(otg_ulpi_create); |
271 | 283 | ||
diff --git a/drivers/usb/otg/ulpi_viewport.c b/drivers/usb/otg/ulpi_viewport.c index e9a37f90994..c5ba7e5423f 100644 --- a/drivers/usb/otg/ulpi_viewport.c +++ b/drivers/usb/otg/ulpi_viewport.c | |||
@@ -40,7 +40,7 @@ static int ulpi_viewport_wait(void __iomem *view, u32 mask) | |||
40 | return -ETIMEDOUT; | 40 | return -ETIMEDOUT; |
41 | } | 41 | } |
42 | 42 | ||
43 | static int ulpi_viewport_read(struct otg_transceiver *otg, u32 reg) | 43 | static int ulpi_viewport_read(struct usb_phy *otg, u32 reg) |
44 | { | 44 | { |
45 | int ret; | 45 | int ret; |
46 | void __iomem *view = otg->io_priv; | 46 | void __iomem *view = otg->io_priv; |
@@ -58,7 +58,7 @@ static int ulpi_viewport_read(struct otg_transceiver *otg, u32 reg) | |||
58 | return ULPI_VIEW_DATA_READ(readl(view)); | 58 | return ULPI_VIEW_DATA_READ(readl(view)); |
59 | } | 59 | } |
60 | 60 | ||
61 | static int ulpi_viewport_write(struct otg_transceiver *otg, u32 val, u32 reg) | 61 | static int ulpi_viewport_write(struct usb_phy *otg, u32 val, u32 reg) |
62 | { | 62 | { |
63 | int ret; | 63 | int ret; |
64 | void __iomem *view = otg->io_priv; | 64 | void __iomem *view = otg->io_priv; |
@@ -74,7 +74,7 @@ static int ulpi_viewport_write(struct otg_transceiver *otg, u32 val, u32 reg) | |||
74 | return ulpi_viewport_wait(view, ULPI_VIEW_RUN); | 74 | return ulpi_viewport_wait(view, ULPI_VIEW_RUN); |
75 | } | 75 | } |
76 | 76 | ||
77 | struct otg_io_access_ops ulpi_viewport_access_ops = { | 77 | struct usb_phy_io_ops ulpi_viewport_access_ops = { |
78 | .read = ulpi_viewport_read, | 78 | .read = ulpi_viewport_read, |
79 | .write = ulpi_viewport_write, | 79 | .write = ulpi_viewport_write, |
80 | }; | 80 | }; |
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h index a0ccf795f36..756cf5543ff 100644 --- a/include/linux/usb/intel_mid_otg.h +++ b/include/linux/usb/intel_mid_otg.h | |||
@@ -104,11 +104,11 @@ struct iotg_ulpi_access_ops { | |||
104 | /* | 104 | /* |
105 | * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact | 105 | * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact |
106 | * with device and host drivers to implement the USB OTG related feature. More | 106 | * with device and host drivers to implement the USB OTG related feature. More |
107 | * function members are added based on otg_transceiver data structure for this | 107 | * function members are added based on usb_phy data structure for this |
108 | * purpose. | 108 | * purpose. |
109 | */ | 109 | */ |
110 | struct intel_mid_otg_xceiv { | 110 | struct intel_mid_otg_xceiv { |
111 | struct otg_transceiver otg; | 111 | struct usb_phy otg; |
112 | struct otg_hsm hsm; | 112 | struct otg_hsm hsm; |
113 | 113 | ||
114 | /* base address */ | 114 | /* base address */ |
@@ -147,7 +147,7 @@ struct intel_mid_otg_xceiv { | |||
147 | 147 | ||
148 | }; | 148 | }; |
149 | static inline | 149 | static inline |
150 | struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct otg_transceiver *otg) | 150 | struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg) |
151 | { | 151 | { |
152 | return container_of(otg, struct intel_mid_otg_xceiv, otg); | 152 | return container_of(otg, struct intel_mid_otg_xceiv, otg); |
153 | } | 153 | } |
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 00311fe9d0d..22a396c13f3 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h | |||
@@ -160,7 +160,7 @@ struct msm_otg_platform_data { | |||
160 | * detection process. | 160 | * detection process. |
161 | */ | 161 | */ |
162 | struct msm_otg { | 162 | struct msm_otg { |
163 | struct otg_transceiver otg; | 163 | struct usb_phy phy; |
164 | struct msm_otg_platform_data *pdata; | 164 | struct msm_otg_platform_data *pdata; |
165 | int irq; | 165 | int irq; |
166 | struct clk *clk; | 166 | struct clk *clk; |
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index d87f44f5b04..f67810f8f21 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -35,7 +35,7 @@ enum usb_otg_state { | |||
35 | OTG_STATE_A_VBUS_ERR, | 35 | OTG_STATE_A_VBUS_ERR, |
36 | }; | 36 | }; |
37 | 37 | ||
38 | enum usb_xceiv_events { | 38 | enum usb_phy_events { |
39 | USB_EVENT_NONE, /* no events or cable disconnected */ | 39 | USB_EVENT_NONE, /* no events or cable disconnected */ |
40 | USB_EVENT_VBUS, /* vbus valid event */ | 40 | USB_EVENT_VBUS, /* vbus valid event */ |
41 | USB_EVENT_ID, /* id was grounded */ | 41 | USB_EVENT_ID, /* id was grounded */ |
@@ -43,14 +43,39 @@ enum usb_xceiv_events { | |||
43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ | 43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ |
44 | }; | 44 | }; |
45 | 45 | ||
46 | struct otg_transceiver; | 46 | struct usb_phy; |
47 | 47 | ||
48 | /* for transceivers connected thru an ULPI interface, the user must | 48 | /* for transceivers connected thru an ULPI interface, the user must |
49 | * provide access ops | 49 | * provide access ops |
50 | */ | 50 | */ |
51 | struct otg_io_access_ops { | 51 | struct usb_phy_io_ops { |
52 | int (*read)(struct otg_transceiver *otg, u32 reg); | 52 | int (*read)(struct usb_phy *x, u32 reg); |
53 | int (*write)(struct otg_transceiver *otg, u32 val, u32 reg); | 53 | int (*write)(struct usb_phy *x, u32 val, u32 reg); |
54 | }; | ||
55 | |||
56 | struct usb_otg { | ||
57 | u8 default_a; | ||
58 | |||
59 | struct usb_phy *phy; | ||
60 | struct usb_bus *host; | ||
61 | struct usb_gadget *gadget; | ||
62 | |||
63 | /* bind/unbind the host controller */ | ||
64 | int (*set_host)(struct usb_otg *otg, struct usb_bus *host); | ||
65 | |||
66 | /* bind/unbind the peripheral controller */ | ||
67 | int (*set_peripheral)(struct usb_otg *otg, | ||
68 | struct usb_gadget *gadget); | ||
69 | |||
70 | /* effective for A-peripheral, ignored for B devices */ | ||
71 | int (*set_vbus)(struct usb_otg *otg, bool enabled); | ||
72 | |||
73 | /* for B devices only: start session with A-Host */ | ||
74 | int (*start_srp)(struct usb_otg *otg); | ||
75 | |||
76 | /* start or continue HNP role switch */ | ||
77 | int (*start_hnp)(struct usb_otg *otg); | ||
78 | |||
54 | }; | 79 | }; |
55 | 80 | ||
56 | /* | 81 | /* |
@@ -59,22 +84,20 @@ struct otg_io_access_ops { | |||
59 | * moment, using the transceiver, ID signal, HNP and sometimes static | 84 | * moment, using the transceiver, ID signal, HNP and sometimes static |
60 | * configuration information (including "board isn't wired for otg"). | 85 | * configuration information (including "board isn't wired for otg"). |
61 | */ | 86 | */ |
62 | struct otg_transceiver { | 87 | struct usb_phy { |
63 | struct device *dev; | 88 | struct device *dev; |
64 | const char *label; | 89 | const char *label; |
65 | unsigned int flags; | 90 | unsigned int flags; |
66 | 91 | ||
67 | u8 default_a; | ||
68 | enum usb_otg_state state; | 92 | enum usb_otg_state state; |
69 | enum usb_xceiv_events last_event; | 93 | enum usb_phy_events last_event; |
70 | 94 | ||
71 | struct usb_bus *host; | 95 | struct usb_otg *otg; |
72 | struct usb_gadget *gadget; | ||
73 | 96 | ||
74 | struct otg_io_access_ops *io_ops; | 97 | struct usb_phy_io_ops *io_ops; |
75 | void __iomem *io_priv; | 98 | void __iomem *io_priv; |
76 | 99 | ||
77 | /* for notification of usb_xceiv_events */ | 100 | /* for notification of usb_phy_events */ |
78 | struct atomic_notifier_head notifier; | 101 | struct atomic_notifier_head notifier; |
79 | 102 | ||
80 | /* to pass extra port status to the root hub */ | 103 | /* to pass extra port status to the root hub */ |
@@ -82,40 +105,22 @@ struct otg_transceiver { | |||
82 | u16 port_change; | 105 | u16 port_change; |
83 | 106 | ||
84 | /* initialize/shutdown the OTG controller */ | 107 | /* initialize/shutdown the OTG controller */ |
85 | int (*init)(struct otg_transceiver *otg); | 108 | int (*init)(struct usb_phy *x); |
86 | void (*shutdown)(struct otg_transceiver *otg); | 109 | void (*shutdown)(struct usb_phy *x); |
87 | |||
88 | /* bind/unbind the host controller */ | ||
89 | int (*set_host)(struct otg_transceiver *otg, | ||
90 | struct usb_bus *host); | ||
91 | |||
92 | /* bind/unbind the peripheral controller */ | ||
93 | int (*set_peripheral)(struct otg_transceiver *otg, | ||
94 | struct usb_gadget *gadget); | ||
95 | 110 | ||
96 | /* effective for B devices, ignored for A-peripheral */ | 111 | /* effective for B devices, ignored for A-peripheral */ |
97 | int (*set_power)(struct otg_transceiver *otg, | 112 | int (*set_power)(struct usb_phy *x, |
98 | unsigned mA); | 113 | unsigned mA); |
99 | 114 | ||
100 | /* effective for A-peripheral, ignored for B devices */ | ||
101 | int (*set_vbus)(struct otg_transceiver *otg, | ||
102 | bool enabled); | ||
103 | |||
104 | /* for non-OTG B devices: set transceiver into suspend mode */ | 115 | /* for non-OTG B devices: set transceiver into suspend mode */ |
105 | int (*set_suspend)(struct otg_transceiver *otg, | 116 | int (*set_suspend)(struct usb_phy *x, |
106 | int suspend); | 117 | int suspend); |
107 | 118 | ||
108 | /* for B devices only: start session with A-Host */ | ||
109 | int (*start_srp)(struct otg_transceiver *otg); | ||
110 | |||
111 | /* start or continue HNP role switch */ | ||
112 | int (*start_hnp)(struct otg_transceiver *otg); | ||
113 | |||
114 | }; | 119 | }; |
115 | 120 | ||
116 | 121 | ||
117 | /* for board-specific init logic */ | 122 | /* for board-specific init logic */ |
118 | extern int otg_set_transceiver(struct otg_transceiver *); | 123 | extern int usb_set_transceiver(struct usb_phy *); |
119 | 124 | ||
120 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) | 125 | #if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) |
121 | /* sometimes transceivers are accessed only through e.g. ULPI */ | 126 | /* sometimes transceivers are accessed only through e.g. ULPI */ |
@@ -132,50 +137,50 @@ static inline void usb_nop_xceiv_unregister(void) | |||
132 | #endif | 137 | #endif |
133 | 138 | ||
134 | /* helpers for direct access thru low-level io interface */ | 139 | /* helpers for direct access thru low-level io interface */ |
135 | static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) | 140 | static inline int usb_phy_io_read(struct usb_phy *x, u32 reg) |
136 | { | 141 | { |
137 | if (otg->io_ops && otg->io_ops->read) | 142 | if (x->io_ops && x->io_ops->read) |
138 | return otg->io_ops->read(otg, reg); | 143 | return x->io_ops->read(x, reg); |
139 | 144 | ||
140 | return -EINVAL; | 145 | return -EINVAL; |
141 | } | 146 | } |
142 | 147 | ||
143 | static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg) | 148 | static inline int usb_phy_io_write(struct usb_phy *x, u32 val, u32 reg) |
144 | { | 149 | { |
145 | if (otg->io_ops && otg->io_ops->write) | 150 | if (x->io_ops && x->io_ops->write) |
146 | return otg->io_ops->write(otg, val, reg); | 151 | return x->io_ops->write(x, val, reg); |
147 | 152 | ||
148 | return -EINVAL; | 153 | return -EINVAL; |
149 | } | 154 | } |
150 | 155 | ||
151 | static inline int | 156 | static inline int |
152 | otg_init(struct otg_transceiver *otg) | 157 | usb_phy_init(struct usb_phy *x) |
153 | { | 158 | { |
154 | if (otg->init) | 159 | if (x->init) |
155 | return otg->init(otg); | 160 | return x->init(x); |
156 | 161 | ||
157 | return 0; | 162 | return 0; |
158 | } | 163 | } |
159 | 164 | ||
160 | static inline void | 165 | static inline void |
161 | otg_shutdown(struct otg_transceiver *otg) | 166 | usb_phy_shutdown(struct usb_phy *x) |
162 | { | 167 | { |
163 | if (otg->shutdown) | 168 | if (x->shutdown) |
164 | otg->shutdown(otg); | 169 | x->shutdown(x); |
165 | } | 170 | } |
166 | 171 | ||
167 | /* for usb host and peripheral controller drivers */ | 172 | /* for usb host and peripheral controller drivers */ |
168 | #ifdef CONFIG_USB_OTG_UTILS | 173 | #ifdef CONFIG_USB_OTG_UTILS |
169 | extern struct otg_transceiver *otg_get_transceiver(void); | 174 | extern struct usb_phy *usb_get_transceiver(void); |
170 | extern void otg_put_transceiver(struct otg_transceiver *); | 175 | extern void usb_put_transceiver(struct usb_phy *); |
171 | extern const char *otg_state_string(enum usb_otg_state state); | 176 | extern const char *otg_state_string(enum usb_otg_state state); |
172 | #else | 177 | #else |
173 | static inline struct otg_transceiver *otg_get_transceiver(void) | 178 | static inline struct usb_phy *usb_get_transceiver(void) |
174 | { | 179 | { |
175 | return NULL; | 180 | return NULL; |
176 | } | 181 | } |
177 | 182 | ||
178 | static inline void otg_put_transceiver(struct otg_transceiver *x) | 183 | static inline void usb_put_transceiver(struct usb_phy *x) |
179 | { | 184 | { |
180 | } | 185 | } |
181 | 186 | ||
@@ -187,67 +192,84 @@ static inline const char *otg_state_string(enum usb_otg_state state) | |||
187 | 192 | ||
188 | /* Context: can sleep */ | 193 | /* Context: can sleep */ |
189 | static inline int | 194 | static inline int |
190 | otg_start_hnp(struct otg_transceiver *otg) | 195 | otg_start_hnp(struct usb_otg *otg) |
191 | { | 196 | { |
192 | return otg->start_hnp(otg); | 197 | if (otg && otg->start_hnp) |
198 | return otg->start_hnp(otg); | ||
199 | |||
200 | return -ENOTSUPP; | ||
193 | } | 201 | } |
194 | 202 | ||
195 | /* Context: can sleep */ | 203 | /* Context: can sleep */ |
196 | static inline int | 204 | static inline int |
197 | otg_set_vbus(struct otg_transceiver *otg, bool enabled) | 205 | otg_set_vbus(struct usb_otg *otg, bool enabled) |
198 | { | 206 | { |
199 | return otg->set_vbus(otg, enabled); | 207 | if (otg && otg->set_vbus) |
208 | return otg->set_vbus(otg, enabled); | ||
209 | |||
210 | return -ENOTSUPP; | ||
200 | } | 211 | } |
201 | 212 | ||
202 | /* for HCDs */ | 213 | /* for HCDs */ |
203 | static inline int | 214 | static inline int |
204 | otg_set_host(struct otg_transceiver *otg, struct usb_bus *host) | 215 | otg_set_host(struct usb_otg *otg, struct usb_bus *host) |
205 | { | 216 | { |
206 | return otg->set_host(otg, host); | 217 | if (otg && otg->set_host) |
218 | return otg->set_host(otg, host); | ||
219 | |||
220 | return -ENOTSUPP; | ||
207 | } | 221 | } |
208 | 222 | ||
209 | /* for usb peripheral controller drivers */ | 223 | /* for usb peripheral controller drivers */ |
210 | 224 | ||
211 | /* Context: can sleep */ | 225 | /* Context: can sleep */ |
212 | static inline int | 226 | static inline int |
213 | otg_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *periph) | 227 | otg_set_peripheral(struct usb_otg *otg, struct usb_gadget *periph) |
214 | { | 228 | { |
215 | return otg->set_peripheral(otg, periph); | 229 | if (otg && otg->set_peripheral) |
230 | return otg->set_peripheral(otg, periph); | ||
231 | |||
232 | return -ENOTSUPP; | ||
216 | } | 233 | } |
217 | 234 | ||
218 | static inline int | 235 | static inline int |
219 | otg_set_power(struct otg_transceiver *otg, unsigned mA) | 236 | usb_phy_set_power(struct usb_phy *x, unsigned mA) |
220 | { | 237 | { |
221 | return otg->set_power(otg, mA); | 238 | if (x && x->set_power) |
239 | return x->set_power(x, mA); | ||
240 | return 0; | ||
222 | } | 241 | } |
223 | 242 | ||
224 | /* Context: can sleep */ | 243 | /* Context: can sleep */ |
225 | static inline int | 244 | static inline int |
226 | otg_set_suspend(struct otg_transceiver *otg, int suspend) | 245 | usb_phy_set_suspend(struct usb_phy *x, int suspend) |
227 | { | 246 | { |
228 | if (otg->set_suspend != NULL) | 247 | if (x->set_suspend != NULL) |
229 | return otg->set_suspend(otg, suspend); | 248 | return x->set_suspend(x, suspend); |
230 | else | 249 | else |
231 | return 0; | 250 | return 0; |
232 | } | 251 | } |
233 | 252 | ||
234 | static inline int | 253 | static inline int |
235 | otg_start_srp(struct otg_transceiver *otg) | 254 | otg_start_srp(struct usb_otg *otg) |
236 | { | 255 | { |
237 | return otg->start_srp(otg); | 256 | if (otg && otg->start_srp) |
257 | return otg->start_srp(otg); | ||
258 | |||
259 | return -ENOTSUPP; | ||
238 | } | 260 | } |
239 | 261 | ||
240 | /* notifiers */ | 262 | /* notifiers */ |
241 | static inline int | 263 | static inline int |
242 | otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | 264 | usb_register_notifier(struct usb_phy *x, struct notifier_block *nb) |
243 | { | 265 | { |
244 | return atomic_notifier_chain_register(&otg->notifier, nb); | 266 | return atomic_notifier_chain_register(&x->notifier, nb); |
245 | } | 267 | } |
246 | 268 | ||
247 | static inline void | 269 | static inline void |
248 | otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | 270 | usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb) |
249 | { | 271 | { |
250 | atomic_notifier_chain_unregister(&otg->notifier, nb); | 272 | atomic_notifier_chain_unregister(&x->notifier, nb); |
251 | } | 273 | } |
252 | 274 | ||
253 | /* for OTG controller drivers (and maybe other stuff) */ | 275 | /* for OTG controller drivers (and maybe other stuff) */ |
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h index 9595796d62e..6f033a415ec 100644 --- a/include/linux/usb/ulpi.h +++ b/include/linux/usb/ulpi.h | |||
@@ -181,12 +181,12 @@ | |||
181 | 181 | ||
182 | /*-------------------------------------------------------------------------*/ | 182 | /*-------------------------------------------------------------------------*/ |
183 | 183 | ||
184 | struct otg_transceiver *otg_ulpi_create(struct otg_io_access_ops *ops, | 184 | struct usb_phy *otg_ulpi_create(struct usb_phy_io_ops *ops, |
185 | unsigned int flags); | 185 | unsigned int flags); |
186 | 186 | ||
187 | #ifdef CONFIG_USB_ULPI_VIEWPORT | 187 | #ifdef CONFIG_USB_ULPI_VIEWPORT |
188 | /* access ops for controllers with a viewport register */ | 188 | /* access ops for controllers with a viewport register */ |
189 | extern struct otg_io_access_ops ulpi_viewport_access_ops; | 189 | extern struct usb_phy_io_ops ulpi_viewport_access_ops; |
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | #endif /* __LINUX_USB_ULPI_H */ | 192 | #endif /* __LINUX_USB_ULPI_H */ |