aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/power/ab8500_charger.c2
-rw-r--r--drivers/power/isp1704_charger.c2
-rw-r--r--drivers/power/pda_power.c2
-rw-r--r--drivers/power/twl4030_charger.c2
-rw-r--r--drivers/usb/chipidea/udc.c2
-rw-r--r--drivers/usb/gadget/fsl_udc_core.c2
-rw-r--r--drivers/usb/gadget/mv_udc_core.c2
-rw-r--r--drivers/usb/gadget/omap_udc.c2
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c2
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c2
-rw-r--r--drivers/usb/gadget/s3c-hsudc.c2
-rw-r--r--drivers/usb/host/ehci-fsl.c2
-rw-r--r--drivers/usb/host/ehci-msm.c2
-rw-r--r--drivers/usb/host/ehci-mv.c2
-rw-r--r--drivers/usb/host/ehci-tegra.c2
-rw-r--r--drivers/usb/host/ohci-omap.c2
-rw-r--r--drivers/usb/musb/am35x.c2
-rw-r--r--drivers/usb/musb/blackfin.c2
-rw-r--r--drivers/usb/musb/da8xx.c2
-rw-r--r--drivers/usb/musb/davinci.c2
-rw-r--r--drivers/usb/musb/musb_dsps.c2
-rw-r--r--drivers/usb/musb/omap2430.c2
-rw-r--r--drivers/usb/musb/tusb6010.c2
-rw-r--r--drivers/usb/musb/ux500.c2
-rw-r--r--drivers/usb/otg/ab8500-usb.c4
-rw-r--r--drivers/usb/otg/fsl_otg.c6
-rw-r--r--drivers/usb/otg/gpio_vbus.c4
-rw-r--r--drivers/usb/otg/isp1301_omap.c4
-rw-r--r--drivers/usb/otg/msm_otg.c4
-rw-r--r--drivers/usb/otg/mv_otg.c6
-rw-r--r--drivers/usb/otg/nop-usb-xceiv.c4
-rw-r--r--drivers/usb/otg/otg.c96
-rw-r--r--drivers/usb/otg/twl4030-usb.c2
-rw-r--r--drivers/usb/otg/twl6030-usb.c2
-rw-r--r--include/linux/usb/otg.h29
35 files changed, 152 insertions, 57 deletions
diff --git a/drivers/power/ab8500_charger.c b/drivers/power/ab8500_charger.c
index cf5ffc4d1048..6bd6f1c41967 100644
--- a/drivers/power/ab8500_charger.c
+++ b/drivers/power/ab8500_charger.c
@@ -2688,7 +2688,7 @@ static int __devinit ab8500_charger_probe(struct platform_device *pdev)
2688 goto free_ac; 2688 goto free_ac;
2689 } 2689 }
2690 2690
2691 di->usb_phy = usb_get_phy(); 2691 di->usb_phy = usb_get_phy(USB_PHY_TYPE_USB2);
2692 if (!di->usb_phy) { 2692 if (!di->usb_phy) {
2693 dev_err(di->dev, "failed to get usb transceiver\n"); 2693 dev_err(di->dev, "failed to get usb transceiver\n");
2694 ret = -EINVAL; 2694 ret = -EINVAL;
diff --git a/drivers/power/isp1704_charger.c b/drivers/power/isp1704_charger.c
index 50773ae6f72e..090e5f9e72c9 100644
--- a/drivers/power/isp1704_charger.c
+++ b/drivers/power/isp1704_charger.c
@@ -415,7 +415,7 @@ static int __devinit isp1704_charger_probe(struct platform_device *pdev)
415 if (!isp) 415 if (!isp)
416 return -ENOMEM; 416 return -ENOMEM;
417 417
418 isp->phy = usb_get_phy(); 418 isp->phy = usb_get_phy(USB_PHY_TYPE_USB2);
419 if (!isp->phy) 419 if (!isp->phy)
420 goto fail0; 420 goto fail0;
421 421
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index e0f206b0775b..7602d49e4d81 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -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 = usb_get_phy(); 324 transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
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 }
diff --git a/drivers/power/twl4030_charger.c b/drivers/power/twl4030_charger.c
index fcddd115cc08..13f9db2e8538 100644
--- a/drivers/power/twl4030_charger.c
+++ b/drivers/power/twl4030_charger.c
@@ -479,7 +479,7 @@ 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 = usb_get_phy(); 482 bci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
483 if (bci->transceiver != NULL) { 483 if (bci->transceiver != NULL) {
484 bci->usb_nb.notifier_call = twl4030_bci_usb_ncb; 484 bci->usb_nb.notifier_call = twl4030_bci_usb_ncb;
485 usb_register_notifier(bci->transceiver, &bci->usb_nb); 485 usb_register_notifier(bci->transceiver, &bci->usb_nb);
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 4468f2c2dddd..a06d28b119f5 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1687,7 +1687,7 @@ static int udc_start(struct ci13xxx *udc)
1687 1687
1688 udc->gadget.ep0 = &udc->ep0in->ep; 1688 udc->gadget.ep0 = &udc->ep0in->ep;
1689 1689
1690 udc->transceiver = usb_get_phy(); 1690 udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
1691 1691
1692 if (udc->udc_driver->flags & CI13XXX_REQUIRE_TRANSCEIVER) { 1692 if (udc->udc_driver->flags & CI13XXX_REQUIRE_TRANSCEIVER) {
1693 if (udc->transceiver == NULL) { 1693 if (udc->transceiver == NULL) {
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index d7038509b956..0808820ba495 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2455,7 +2455,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
2455 2455
2456#ifdef CONFIG_USB_OTG 2456#ifdef CONFIG_USB_OTG
2457 if (pdata->operating_mode == FSL_USB2_DR_OTG) { 2457 if (pdata->operating_mode == FSL_USB2_DR_OTG) {
2458 udc_controller->transceiver = usb_get_phy(); 2458 udc_controller->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
2459 if (!udc_controller->transceiver) { 2459 if (!udc_controller->transceiver) {
2460 ERR("Can't find OTG driver!\n"); 2460 ERR("Can't find OTG driver!\n");
2461 ret = -ENODEV; 2461 ret = -ENODEV;
diff --git a/drivers/usb/gadget/mv_udc_core.c b/drivers/usb/gadget/mv_udc_core.c
index 5d779955d5a6..75ff41a5c959 100644
--- a/drivers/usb/gadget/mv_udc_core.c
+++ b/drivers/usb/gadget/mv_udc_core.c
@@ -2180,7 +2180,7 @@ static int __devinit mv_udc_probe(struct platform_device *dev)
2180 2180
2181#ifdef CONFIG_USB_OTG_UTILS 2181#ifdef CONFIG_USB_OTG_UTILS
2182 if (pdata->mode == MV_USB_MODE_OTG) 2182 if (pdata->mode == MV_USB_MODE_OTG)
2183 udc->transceiver = usb_get_phy(); 2183 udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
2184#endif 2184#endif
2185 2185
2186 udc->clknum = pdata->clknum; 2186 udc->clknum = pdata->clknum;
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 74b9bb8099e7..cf8bf26f12ed 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2865,7 +2865,7 @@ static int __init omap_udc_probe(struct platform_device *pdev)
2865 * use it. Except for OTG, we don't _need_ to talk to one; 2865 * use it. Except for OTG, we don't _need_ to talk to one;
2866 * but not having one probably means no VBUS detection. 2866 * but not having one probably means no VBUS detection.
2867 */ 2867 */
2868 xceiv = usb_get_phy(); 2868 xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
2869 if (xceiv) 2869 if (xceiv)
2870 type = xceiv->label; 2870 type = xceiv->label;
2871 else if (config->otg) { 2871 else if (config->otg) {
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index a658e446caba..cc0b1e63dcab 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -2159,7 +2159,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev)
2159 dev->dev = &pdev->dev; 2159 dev->dev = &pdev->dev;
2160 dev->mach = pdev->dev.platform_data; 2160 dev->mach = pdev->dev.platform_data;
2161 2161
2162 dev->transceiver = usb_get_phy(); 2162 dev->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
2163 2163
2164 if (gpio_is_valid(dev->mach->gpio_pullup)) { 2164 if (gpio_is_valid(dev->mach->gpio_pullup)) {
2165 if ((retval = gpio_request(dev->mach->gpio_pullup, 2165 if ((retval = gpio_request(dev->mach->gpio_pullup,
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index b982304a49c1..8f744aab9628 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -2464,7 +2464,7 @@ static int __init pxa_udc_probe(struct platform_device *pdev)
2464 2464
2465 udc->dev = &pdev->dev; 2465 udc->dev = &pdev->dev;
2466 udc->mach = pdev->dev.platform_data; 2466 udc->mach = pdev->dev.platform_data;
2467 udc->transceiver = usb_get_phy(); 2467 udc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
2468 2468
2469 gpio = udc->mach->gpio_pullup; 2469 gpio = udc->mach->gpio_pullup;
2470 if (gpio_is_valid(gpio)) { 2470 if (gpio_is_valid(gpio)) {
diff --git a/drivers/usb/gadget/s3c-hsudc.c b/drivers/usb/gadget/s3c-hsudc.c
index 9ad33395f564..22326f274466 100644
--- a/drivers/usb/gadget/s3c-hsudc.c
+++ b/drivers/usb/gadget/s3c-hsudc.c
@@ -1282,7 +1282,7 @@ static int __devinit s3c_hsudc_probe(struct platform_device *pdev)
1282 hsudc->dev = dev; 1282 hsudc->dev = dev;
1283 hsudc->pd = pdev->dev.platform_data; 1283 hsudc->pd = pdev->dev.platform_data;
1284 1284
1285 hsudc->transceiver = usb_get_phy(); 1285 hsudc->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
1286 1286
1287 for (i = 0; i < ARRAY_SIZE(hsudc->supplies); i++) 1287 for (i = 0; i < ARRAY_SIZE(hsudc->supplies); i++)
1288 hsudc->supplies[i].supply = s3c_hsudc_supply_names[i]; 1288 hsudc->supplies[i].supply = s3c_hsudc_supply_names[i];
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 0e8976a0ed51..ba290589d858 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -142,7 +142,7 @@ 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 = usb_get_phy(); 145 ehci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
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
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 7badd5db398c..c7615fb93dbb 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -145,7 +145,7 @@ 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 phy = usb_get_phy(); 148 phy = usb_get_phy(USB_PHY_TYPE_USB2);
149 if (!phy) { 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;
diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c
index 24f838fe25ac..ef7aa0df40a6 100644
--- a/drivers/usb/host/ehci-mv.c
+++ b/drivers/usb/host/ehci-mv.c
@@ -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 = usb_get_phy(); 256 ehci_mv->otg = usb_get_phy(USB_PHY_TYPE_USB2);
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");
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index ee17d19b1b82..14df2f5cf6ae 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -749,7 +749,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
749 749
750#ifdef CONFIG_USB_OTG_UTILS 750#ifdef CONFIG_USB_OTG_UTILS
751 if (pdata->operating_mode == TEGRA_USB_OTG) { 751 if (pdata->operating_mode == TEGRA_USB_OTG) {
752 tegra->transceiver = usb_get_phy(); 752 tegra->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
753 if (tegra->transceiver) 753 if (tegra->transceiver)
754 otg_set_host(tegra->transceiver->otg, &hcd->self); 754 otg_set_host(tegra->transceiver->otg, &hcd->self);
755 } 755 }
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index c2c1f55889a4..92a77dfd1930 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -211,7 +211,7 @@ static int ohci_omap_init(struct usb_hcd *hcd)
211 211
212#ifdef CONFIG_USB_OTG 212#ifdef CONFIG_USB_OTG
213 if (need_transceiver) { 213 if (need_transceiver) {
214 ohci->transceiver = usb_get_phy(); 214 ohci->transceiver = usb_get_phy(USB_PHY_TYPE_USB2);
215 if (ohci->transceiver) { 215 if (ohci->transceiver) {
216 int status = otg_set_host(ohci->transceiver->otg, 216 int status = otg_set_host(ohci->transceiver->otg,
217 &ohci_to_hcd(ohci)->self); 217 &ohci_to_hcd(ohci)->self);
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index a75989bbb3d4..4a8cbf0e8d51 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -364,7 +364,7 @@ static int am35x_musb_init(struct musb *musb)
364 return -ENODEV; 364 return -ENODEV;
365 365
366 usb_nop_xceiv_register(); 366 usb_nop_xceiv_register();
367 musb->xceiv = usb_get_phy(); 367 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
368 if (!musb->xceiv) 368 if (!musb->xceiv)
369 return -ENODEV; 369 return -ENODEV;
370 370
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 522a4a263df8..452940986d6d 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -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 = usb_get_phy(); 418 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
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;
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 61868d604b28..d731c80c4fef 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -425,7 +425,7 @@ static int da8xx_musb_init(struct musb *musb)
425 goto fail; 425 goto fail;
426 426
427 usb_nop_xceiv_register(); 427 usb_nop_xceiv_register();
428 musb->xceiv = usb_get_phy(); 428 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
429 if (!musb->xceiv) 429 if (!musb->xceiv)
430 goto fail; 430 goto fail;
431 431
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 441f776366f3..582268de3fa2 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -384,7 +384,7 @@ static int davinci_musb_init(struct musb *musb)
384 u32 revision; 384 u32 revision;
385 385
386 usb_nop_xceiv_register(); 386 usb_nop_xceiv_register();
387 musb->xceiv = usb_get_phy(); 387 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
388 if (!musb->xceiv) 388 if (!musb->xceiv)
389 goto unregister; 389 goto unregister;
390 390
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 716c113608f4..92603e498e61 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -376,7 +376,7 @@ static int dsps_musb_init(struct musb *musb)
376 376
377 /* NOP driver needs change if supporting dual instance */ 377 /* NOP driver needs change if supporting dual instance */
378 usb_nop_xceiv_register(); 378 usb_nop_xceiv_register();
379 musb->xceiv = usb_get_phy(); 379 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
380 if (!musb->xceiv) 380 if (!musb->xceiv)
381 return -ENODEV; 381 return -ENODEV;
382 382
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index e16dbbf7f305..e279cf32772e 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -292,7 +292,7 @@ static int omap2430_musb_init(struct musb *musb)
292 * up through ULPI. TWL4030-family PMICs include one, 292 * up through ULPI. TWL4030-family PMICs include one,
293 * which needs a driver, drivers aren't always needed. 293 * which needs a driver, drivers aren't always needed.
294 */ 294 */
295 musb->xceiv = usb_get_phy(); 295 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
296 if (!musb->xceiv) { 296 if (!musb->xceiv) {
297 pr_err("HS USB OTG: no transceiver configured\n"); 297 pr_err("HS USB OTG: no transceiver configured\n");
298 return -ENODEV; 298 return -ENODEV;
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index a004736186f1..8ddf3d5f7cdc 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1078,7 +1078,7 @@ static int tusb_musb_init(struct musb *musb)
1078 int ret; 1078 int ret;
1079 1079
1080 usb_nop_xceiv_register(); 1080 usb_nop_xceiv_register();
1081 musb->xceiv = usb_get_phy(); 1081 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
1082 if (!musb->xceiv) 1082 if (!musb->xceiv)
1083 return -ENODEV; 1083 return -ENODEV;
1084 1084
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index 53006b113b12..46cf80a8cacd 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -37,7 +37,7 @@ struct ux500_glue {
37 37
38static int ux500_musb_init(struct musb *musb) 38static int ux500_musb_init(struct musb *musb)
39{ 39{
40 musb->xceiv = usb_get_phy(); 40 musb->xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
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;
diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c
index 672e28c81437..ae8ad561f083 100644
--- a/drivers/usb/otg/ab8500-usb.c
+++ b/drivers/usb/otg/ab8500-usb.c
@@ -529,7 +529,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
529 if (err < 0) 529 if (err < 0)
530 goto fail0; 530 goto fail0;
531 531
532 err = usb_add_phy(&ab->phy); 532 err = usb_add_phy(&ab->phy, USB_PHY_TYPE_USB2);
533 if (err) { 533 if (err) {
534 dev_err(&pdev->dev, "Can't register transceiver\n"); 534 dev_err(&pdev->dev, "Can't register transceiver\n");
535 goto fail1; 535 goto fail1;
@@ -556,7 +556,7 @@ static int __devexit ab8500_usb_remove(struct platform_device *pdev)
556 556
557 cancel_work_sync(&ab->phy_dis_work); 557 cancel_work_sync(&ab->phy_dis_work);
558 558
559 usb_add_phy(NULL); 559 usb_remove_phy(&ab->phy);
560 560
561 ab8500_usb_host_phy_dis(ab); 561 ab8500_usb_host_phy_dis(ab);
562 ab8500_usb_peri_phy_dis(ab); 562 ab8500_usb_peri_phy_dis(ab);
diff --git a/drivers/usb/otg/fsl_otg.c b/drivers/usb/otg/fsl_otg.c
index 73561edd81de..23c798cb2d7f 100644
--- a/drivers/usb/otg/fsl_otg.c
+++ b/drivers/usb/otg/fsl_otg.c
@@ -806,7 +806,7 @@ static int fsl_otg_conf(struct platform_device *pdev)
806 fsl_otg_dev = fsl_otg_tc; 806 fsl_otg_dev = fsl_otg_tc;
807 807
808 /* Store the otg transceiver */ 808 /* Store the otg transceiver */
809 status = usb_add_phy(&fsl_otg_tc->phy); 809 status = usb_add_phy(&fsl_otg_tc->phy, USB_PHY_TYPE_USB2);
810 if (status) { 810 if (status) {
811 pr_warn(FSL_OTG_NAME ": unable to register OTG transceiver.\n"); 811 pr_warn(FSL_OTG_NAME ": unable to register OTG transceiver.\n");
812 goto err; 812 goto err;
@@ -824,7 +824,7 @@ err:
824int usb_otg_start(struct platform_device *pdev) 824int usb_otg_start(struct platform_device *pdev)
825{ 825{
826 struct fsl_otg *p_otg; 826 struct fsl_otg *p_otg;
827 struct usb_phy *otg_trans = usb_get_phy(); 827 struct usb_phy *otg_trans = usb_get_phy(USB_PHY_TYPE_USB2);
828 struct otg_fsm *fsm; 828 struct otg_fsm *fsm;
829 int status; 829 int status;
830 struct resource *res; 830 struct resource *res;
@@ -1134,7 +1134,7 @@ static int __devexit fsl_otg_remove(struct platform_device *pdev)
1134{ 1134{
1135 struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data; 1135 struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
1136 1136
1137 usb_add_phy(NULL); 1137 usb_remove_phy(&fsl_otg_dev->phy);
1138 free_irq(fsl_otg_dev->irq, fsl_otg_dev); 1138 free_irq(fsl_otg_dev->irq, fsl_otg_dev);
1139 1139
1140 iounmap((void *)usb_dr_regs); 1140 iounmap((void *)usb_dr_regs);
diff --git a/drivers/usb/otg/gpio_vbus.c b/drivers/usb/otg/gpio_vbus.c
index 9b3c264cdb56..a67ffe22179a 100644
--- a/drivers/usb/otg/gpio_vbus.c
+++ b/drivers/usb/otg/gpio_vbus.c
@@ -320,7 +320,7 @@ static int __init gpio_vbus_probe(struct platform_device *pdev)
320 } 320 }
321 321
322 /* only active when a gadget is registered */ 322 /* only active when a gadget is registered */
323 err = usb_add_phy(&gpio_vbus->phy); 323 err = usb_add_phy(&gpio_vbus->phy, USB_PHY_TYPE_USB2);
324 if (err) { 324 if (err) {
325 dev_err(&pdev->dev, "can't register transceiver, err: %d\n", 325 dev_err(&pdev->dev, "can't register transceiver, err: %d\n",
326 err); 326 err);
@@ -354,7 +354,7 @@ static int __exit gpio_vbus_remove(struct platform_device *pdev)
354 cancel_delayed_work_sync(&gpio_vbus->work); 354 cancel_delayed_work_sync(&gpio_vbus->work);
355 regulator_put(gpio_vbus->vbus_draw); 355 regulator_put(gpio_vbus->vbus_draw);
356 356
357 usb_add_phy(NULL); 357 usb_remove_phy(&gpio_vbus->phy);
358 358
359 free_irq(gpio_vbus->irq, pdev); 359 free_irq(gpio_vbus->irq, pdev);
360 if (gpio_is_valid(pdata->gpio_pullup)) 360 if (gpio_is_valid(pdata->gpio_pullup))
diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index b74df3fec56f..75cea4ab0985 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -1611,7 +1611,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
1611 dev_dbg(&i2c->dev, "scheduled timer, %d min\n", TIMER_MINUTES); 1611 dev_dbg(&i2c->dev, "scheduled timer, %d min\n", TIMER_MINUTES);
1612#endif 1612#endif
1613 1613
1614 status = usb_add_phy(&isp->phy); 1614 status = usb_add_phy(&isp->phy, USB_PHY_TYPE_USB2);
1615 if (status < 0) 1615 if (status < 0)
1616 dev_err(&i2c->dev, "can't register transceiver, %d\n", 1616 dev_err(&i2c->dev, "can't register transceiver, %d\n",
1617 status); 1617 status);
@@ -1650,7 +1650,7 @@ subsys_initcall(isp_init);
1650static void __exit isp_exit(void) 1650static void __exit isp_exit(void)
1651{ 1651{
1652 if (the_transceiver) 1652 if (the_transceiver)
1653 usb_add_phy(NULL); 1653 usb_remove_phy(&the_transceiver->phy);
1654 i2c_del_driver(&isp1301_driver); 1654 i2c_del_driver(&isp1301_driver);
1655} 1655}
1656module_exit(isp_exit); 1656module_exit(isp_exit);
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index dd606c010035..9f5fc906041a 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -1555,7 +1555,7 @@ static int __init msm_otg_probe(struct platform_device *pdev)
1555 phy->otg->set_host = msm_otg_set_host; 1555 phy->otg->set_host = msm_otg_set_host;
1556 phy->otg->set_peripheral = msm_otg_set_peripheral; 1556 phy->otg->set_peripheral = msm_otg_set_peripheral;
1557 1557
1558 ret = usb_add_phy(&motg->phy); 1558 ret = usb_add_phy(&motg->phy, USB_PHY_TYPE_USB2);
1559 if (ret) { 1559 if (ret) {
1560 dev_err(&pdev->dev, "usb_add_phy failed\n"); 1560 dev_err(&pdev->dev, "usb_add_phy failed\n");
1561 goto free_irq; 1561 goto free_irq;
@@ -1624,7 +1624,7 @@ static int __devexit msm_otg_remove(struct platform_device *pdev)
1624 device_init_wakeup(&pdev->dev, 0); 1624 device_init_wakeup(&pdev->dev, 0);
1625 pm_runtime_disable(&pdev->dev); 1625 pm_runtime_disable(&pdev->dev);
1626 1626
1627 usb_add_phy(NULL); 1627 usb_remove_phy(phy);
1628 free_irq(motg->irq, motg); 1628 free_irq(motg->irq, motg);
1629 1629
1630 /* 1630 /*
diff --git a/drivers/usb/otg/mv_otg.c b/drivers/usb/otg/mv_otg.c
index 18e90fe1fbd1..3f124e8f5792 100644
--- a/drivers/usb/otg/mv_otg.c
+++ b/drivers/usb/otg/mv_otg.c
@@ -690,7 +690,7 @@ int mv_otg_remove(struct platform_device *pdev)
690 for (clk_i = 0; clk_i <= mvotg->clknum; clk_i++) 690 for (clk_i = 0; clk_i <= mvotg->clknum; clk_i++)
691 clk_put(mvotg->clk[clk_i]); 691 clk_put(mvotg->clk[clk_i]);
692 692
693 usb_add_phy(NULL); 693 usb_remove_phy(&mvotg->phy);
694 platform_set_drvdata(pdev, NULL); 694 platform_set_drvdata(pdev, NULL);
695 695
696 kfree(mvotg->phy.otg); 696 kfree(mvotg->phy.otg);
@@ -853,7 +853,7 @@ static int mv_otg_probe(struct platform_device *pdev)
853 goto err_disable_clk; 853 goto err_disable_clk;
854 } 854 }
855 855
856 retval = usb_add_phy(&mvotg->phy); 856 retval = usb_add_phy(&mvotg->phy, USB_PHY_TYPE_USB2);
857 if (retval < 0) { 857 if (retval < 0) {
858 dev_err(&pdev->dev, "can't register transceiver, %d\n", 858 dev_err(&pdev->dev, "can't register transceiver, %d\n",
859 retval); 859 retval);
@@ -880,7 +880,7 @@ static int mv_otg_probe(struct platform_device *pdev)
880 return 0; 880 return 0;
881 881
882err_set_transceiver: 882err_set_transceiver:
883 usb_add_phy(NULL); 883 usb_remove_phy(&mvotg->phy);
884err_free_irq: 884err_free_irq:
885 free_irq(mvotg->irq, mvotg); 885 free_irq(mvotg->irq, mvotg);
886err_disable_clk: 886err_disable_clk:
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 33000dae7200..803f958f4133 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -117,7 +117,7 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev)
117 nop->phy.otg->set_host = nop_set_host; 117 nop->phy.otg->set_host = nop_set_host;
118 nop->phy.otg->set_peripheral = nop_set_peripheral; 118 nop->phy.otg->set_peripheral = nop_set_peripheral;
119 119
120 err = usb_add_phy(&nop->phy); 120 err = usb_add_phy(&nop->phy, USB_PHY_TYPE_USB2);
121 if (err) { 121 if (err) {
122 dev_err(&pdev->dev, "can't register transceiver, err: %d\n", 122 dev_err(&pdev->dev, "can't register transceiver, err: %d\n",
123 err); 123 err);
@@ -139,7 +139,7 @@ static int __devexit nop_usb_xceiv_remove(struct platform_device *pdev)
139{ 139{
140 struct nop_usb_xceiv *nop = platform_get_drvdata(pdev); 140 struct nop_usb_xceiv *nop = platform_get_drvdata(pdev);
141 141
142 usb_add_phy(NULL); 142 usb_remove_phy(&nop->phy);
143 143
144 platform_set_drvdata(pdev, NULL); 144 platform_set_drvdata(pdev, NULL);
145 kfree(nop->phy.otg); 145 kfree(nop->phy.otg);
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
index 300a995cfdbe..a23065820ead 100644
--- a/drivers/usb/otg/otg.c
+++ b/drivers/usb/otg/otg.c
@@ -11,14 +11,32 @@
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/export.h> 13#include <linux/export.h>
14#include <linux/err.h>
14#include <linux/device.h> 15#include <linux/device.h>
15 16
16#include <linux/usb/otg.h> 17#include <linux/usb/otg.h>
17 18
18static struct usb_phy *phy; 19static LIST_HEAD(phy_list);
20static DEFINE_SPINLOCK(phy_lock);
21
22static struct usb_phy *__usb_find_phy(struct list_head *list,
23 enum usb_phy_type type)
24{
25 struct usb_phy *phy = NULL;
26
27 list_for_each_entry(phy, list, head) {
28 if (phy->type != type)
29 continue;
30
31 return phy;
32 }
33
34 return ERR_PTR(-ENODEV);
35}
19 36
20/** 37/**
21 * usb_get_phy - find the (single) USB PHY 38 * usb_get_phy - find the USB PHY
39 * @type - the type of the phy the controller requires
22 * 40 *
23 * Returns the phy driver, after getting a refcount to it; or 41 * Returns the phy driver, after getting a refcount to it; or
24 * null if there is no such phy. The caller is responsible for 42 * null if there is no such phy. The caller is responsible for
@@ -26,16 +44,30 @@ static struct usb_phy *phy;
26 * 44 *
27 * For use by USB host and peripheral drivers. 45 * For use by USB host and peripheral drivers.
28 */ 46 */
29struct usb_phy *usb_get_phy(void) 47struct usb_phy *usb_get_phy(enum usb_phy_type type)
30{ 48{
31 if (phy) 49 struct usb_phy *phy = NULL;
32 get_device(phy->dev); 50 unsigned long flags;
51
52 spin_lock_irqsave(&phy_lock, flags);
53
54 phy = __usb_find_phy(&phy_list, type);
55 if (IS_ERR(phy)) {
56 pr_err("unable to find transceiver of type %s\n",
57 usb_phy_type_string(type));
58 return phy;
59 }
60
61 get_device(phy->dev);
62
63 spin_unlock_irqrestore(&phy_lock, flags);
64
33 return phy; 65 return phy;
34} 66}
35EXPORT_SYMBOL(usb_get_phy); 67EXPORT_SYMBOL(usb_get_phy);
36 68
37/** 69/**
38 * usb_put_phy - release the (single) USB PHY 70 * usb_put_phy - release the USB PHY
39 * @x: the phy returned by usb_get_phy() 71 * @x: the phy returned by usb_get_phy()
40 * 72 *
41 * Releases a refcount the caller received from usb_get_phy(). 73 * Releases a refcount the caller received from usb_get_phy().
@@ -50,22 +82,62 @@ void usb_put_phy(struct usb_phy *x)
50EXPORT_SYMBOL(usb_put_phy); 82EXPORT_SYMBOL(usb_put_phy);
51 83
52/** 84/**
53 * usb_add_phy - declare the (single) USB PHY 85 * usb_add_phy - declare the USB PHY
54 * @x: the USB phy to be used; or NULL 86 * @x: the USB phy to be used; or NULL
87 * @type - the type of this PHY
55 * 88 *
56 * This call is exclusively for use by phy drivers, which 89 * This call is exclusively for use by phy drivers, which
57 * coordinate the activities of drivers for host and peripheral 90 * coordinate the activities of drivers for host and peripheral
58 * controllers, and in some cases for VBUS current regulation. 91 * controllers, and in some cases for VBUS current regulation.
59 */ 92 */
60int usb_add_phy(struct usb_phy *x) 93int usb_add_phy(struct usb_phy *x, enum usb_phy_type type)
61{ 94{
62 if (phy && x) 95 int ret = 0;
63 return -EBUSY; 96 unsigned long flags;
64 phy = x; 97 struct usb_phy *phy;
65 return 0; 98
99 if (x && x->type != USB_PHY_TYPE_UNDEFINED) {
100 dev_err(x->dev, "not accepting initialized PHY %s\n", x->label);
101 return -EINVAL;
102 }
103
104 spin_lock_irqsave(&phy_lock, flags);
105
106 list_for_each_entry(phy, &phy_list, head) {
107 if (phy->type == type) {
108 ret = -EBUSY;
109 dev_err(x->dev, "transceiver type %s already exists\n",
110 usb_phy_type_string(type));
111 goto out;
112 }
113 }
114
115 x->type = type;
116 list_add_tail(&x->head, &phy_list);
117
118out:
119 spin_unlock_irqrestore(&phy_lock, flags);
120 return ret;
66} 121}
67EXPORT_SYMBOL(usb_add_phy); 122EXPORT_SYMBOL(usb_add_phy);
68 123
124/**
125 * usb_remove_phy - remove the OTG PHY
126 * @x: the USB OTG PHY to be removed;
127 *
128 * This reverts the effects of usb_add_phy
129 */
130void usb_remove_phy(struct usb_phy *x)
131{
132 unsigned long flags;
133
134 spin_lock_irqsave(&phy_lock, flags);
135 if (x)
136 list_del(&x->head);
137 spin_unlock_irqrestore(&phy_lock, flags);
138}
139EXPORT_SYMBOL(usb_remove_phy);
140
69const char *otg_state_string(enum usb_otg_state state) 141const char *otg_state_string(enum usb_otg_state state)
70{ 142{
71 switch (state) { 143 switch (state) {
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 01022c891e26..25a09fabbe35 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -633,7 +633,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev)
633 kfree(twl); 633 kfree(twl);
634 return err; 634 return err;
635 } 635 }
636 usb_add_phy(&twl->phy); 636 usb_add_phy(&twl->phy, USB_PHY_TYPE_USB2);
637 637
638 platform_set_drvdata(pdev, twl); 638 platform_set_drvdata(pdev, twl);
639 if (device_create_file(&pdev->dev, &dev_attr_vbus)) 639 if (device_create_file(&pdev->dev, &dev_attr_vbus))
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index a8be20878eb9..dbee00aea755 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -443,7 +443,7 @@ static int __devinit twl6030_usb_probe(struct platform_device *pdev)
443 kfree(twl); 443 kfree(twl);
444 return err; 444 return err;
445 } 445 }
446 usb_add_phy(&twl->phy); 446 usb_add_phy(&twl->phy, USB_PHY_TYPE_USB2);
447 447
448 platform_set_drvdata(pdev, twl); 448 platform_set_drvdata(pdev, twl);
449 if (device_create_file(&pdev->dev, &dev_attr_vbus)) 449 if (device_create_file(&pdev->dev, &dev_attr_vbus))
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 0e739c810525..1def65fb57d0 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -43,6 +43,13 @@ enum usb_phy_events {
43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */ 43 USB_EVENT_ENUMERATED, /* gadget driver enumerated */
44}; 44};
45 45
46/* associate a type with PHY */
47enum usb_phy_type {
48 USB_PHY_TYPE_UNDEFINED,
49 USB_PHY_TYPE_USB2,
50 USB_PHY_TYPE_USB3,
51};
52
46struct usb_phy; 53struct usb_phy;
47 54
48/* for transceivers connected thru an ULPI interface, the user must 55/* for transceivers connected thru an ULPI interface, the user must
@@ -89,6 +96,7 @@ struct usb_phy {
89 const char *label; 96 const char *label;
90 unsigned int flags; 97 unsigned int flags;
91 98
99 enum usb_phy_type type;
92 enum usb_otg_state state; 100 enum usb_otg_state state;
93 enum usb_phy_events last_event; 101 enum usb_phy_events last_event;
94 102
@@ -105,6 +113,9 @@ struct usb_phy {
105 u16 port_status; 113 u16 port_status;
106 u16 port_change; 114 u16 port_change;
107 115
116 /* to support controllers that have multiple transceivers */
117 struct list_head head;
118
108 /* initialize/shutdown the OTG controller */ 119 /* initialize/shutdown the OTG controller */
109 int (*init)(struct usb_phy *x); 120 int (*init)(struct usb_phy *x);
110 void (*shutdown)(struct usb_phy *x); 121 void (*shutdown)(struct usb_phy *x);
@@ -121,7 +132,8 @@ struct usb_phy {
121 132
122 133
123/* for board-specific init logic */ 134/* for board-specific init logic */
124extern int usb_add_phy(struct usb_phy *); 135extern int usb_add_phy(struct usb_phy *, enum usb_phy_type type);
136extern void usb_remove_phy(struct usb_phy *);
125 137
126#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 138#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
127/* sometimes transceivers are accessed only through e.g. ULPI */ 139/* sometimes transceivers are accessed only through e.g. ULPI */
@@ -172,11 +184,11 @@ usb_phy_shutdown(struct usb_phy *x)
172 184
173/* for usb host and peripheral controller drivers */ 185/* for usb host and peripheral controller drivers */
174#ifdef CONFIG_USB_OTG_UTILS 186#ifdef CONFIG_USB_OTG_UTILS
175extern struct usb_phy *usb_get_phy(void); 187extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
176extern void usb_put_phy(struct usb_phy *); 188extern void usb_put_phy(struct usb_phy *);
177extern const char *otg_state_string(enum usb_otg_state state); 189extern const char *otg_state_string(enum usb_otg_state state);
178#else 190#else
179static inline struct usb_phy *usb_get_phy(void) 191static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
180{ 192{
181 return NULL; 193 return NULL;
182} 194}
@@ -276,4 +288,15 @@ usb_unregister_notifier(struct usb_phy *x, struct notifier_block *nb)
276/* for OTG controller drivers (and maybe other stuff) */ 288/* for OTG controller drivers (and maybe other stuff) */
277extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); 289extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num);
278 290
291static inline const char *usb_phy_type_string(enum usb_phy_type type)
292{
293 switch (type) {
294 case USB_PHY_TYPE_USB2:
295 return "USB2 PHY";
296 case USB_PHY_TYPE_USB3:
297 return "USB3 PHY";
298 default:
299 return "UNKNOWN PHY TYPE";
300 }
301}
279#endif /* __LINUX_USB_OTG_H */ 302#endif /* __LINUX_USB_OTG_H */