aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-01 11:45:33 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-01 11:45:33 -0500
commit8062d94a545457a83d5291bd62c3bfd14200bba0 (patch)
treea6a7aaaea5dff00f7415a93189720a1164ae30dd /drivers/usb/musb
parent15e68a803573974409972e761d8f08f03fce5bdb (diff)
parent6e13c6505cdff9766d5268ffb8c972c1a2f996e6 (diff)
Merge tag 'xceiv-for-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
USB: transceiver changes for 3.4 Here we have a big rework done by Heikki Krogerus (thanks) which splits OTG functionality away from transceivers. We have known for quite a long time that struct otg_transceiver was a bad name for the structure, considering transceiver is far from being OTG-specific (see 4e67185).
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/am35x.c9
-rw-r--r--drivers/usb/musb/blackfin.c6
-rw-r--r--drivers/usb/musb/da8xx.c9
-rw-r--r--drivers/usb/musb/davinci.c13
-rw-r--r--drivers/usb/musb/musb_core.c24
-rw-r--r--drivers/usb/musb/musb_core.h2
-rw-r--r--drivers/usb/musb/musb_gadget.c13
-rw-r--r--drivers/usb/musb/musb_virthub.c9
-rw-r--r--drivers/usb/musb/omap2430.c35
-rw-r--r--drivers/usb/musb/tusb6010.c22
-rw-r--r--drivers/usb/musb/ux500.c8
11 files changed, 80 insertions, 70 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 5285bda1dc4e..9f3eda91ea4d 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 261af3487b5e..a087ed6c3be9 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
320static int bfin_musb_set_power(struct otg_transceiver *x, unsigned mA) 320static 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 01c8f2ece084..8bd9566f3fbb 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 0ba3e75285cf..97ab975fa442 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
444fail: 445fail:
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 3746fff628b2..b527e9e6dbac 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
134static int musb_ulpi_read(struct otg_transceiver *otg, u32 offset) 134static 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
168static int musb_ulpi_write(struct otg_transceiver *otg, 168static 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
203static struct otg_io_access_ops musb_ulpi_access = { 202static 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)
414static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, 413static 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 3d28fb8a2dc9..93de517a32a0 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 957d9ca3d06d..a495a3079c07 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
1727static int musb_gadget_pullup(struct usb_gadget *gadget, int is_on) 1727static 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 e9f80adc45a4..22ec3e379980 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -47,6 +47,7 @@
47 47
48static void musb_port_suspend(struct musb *musb, bool do_suspend) 48static 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
180void musb_root_disconnect(struct musb *musb) 181void 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 da430c31ebef..2ae0bb309994 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
133static void omap2430_musb_set_vbus(struct musb *musb, int is_on) 133static 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)
379static void omap2430_musb_disable(struct musb *musb) 380static 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
385static int omap2430_musb_exit(struct musb *musb) 386static 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 b387f12d05b8..de1355946a83 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 */
280static int tusb_draw_power(struct otg_transceiver *x, unsigned mA) 280static 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 bcfc48f4854a..aa09dd417b94 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 = 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
49static int ux500_musb_exit(struct musb *musb) 49static 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}