aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2012-02-13 06:24:15 -0500
committerFelipe Balbi <balbi@ti.com>2012-02-13 06:52:54 -0500
commitd445b6da8da491e025eb60576ce959f6a3a56a4f (patch)
tree06bf3afc86c3c6248a9c2d980cf359bdb008447e /drivers/usb/musb
parent76eb57ec1bf3201d2f417cafa5c974e7c0b6aaf9 (diff)
usb: musb: Start using struct usb_otg
Use struct usb_otg members with OTG specific functions instead of usb_phy members. [ balbi@ti.com: added a missing change on musb_gadget.c to avoid a compile error on a later patch ] Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/am35x.c5
-rw-r--r--drivers/usb/musb/da8xx.c5
-rw-r--r--drivers/usb/musb/davinci.c7
-rw-r--r--drivers/usb/musb/musb_core.c11
-rw-r--r--drivers/usb/musb/musb_gadget.c3
-rw-r--r--drivers/usb/musb/musb_virthub.c9
-rw-r--r--drivers/usb/musb/omap2430.c5
-rw-r--r--drivers/usb/musb/tusb6010.c14
8 files changed, 35 insertions, 24 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index e233d2b7d33..cb942b6cfe2 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 }
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index 2613bfdb09b..f0cb7767fa6 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 }
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 7c569f51212..f2a63dd0dfc 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 }
@@ -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
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 7b7ecf6c65b..f9ecd5ebf26 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -414,6 +414,7 @@ void musb_hnp_stop(struct musb *musb)
414static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, 414static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
415 u8 devctl, u8 power) 415 u8 devctl, u8 power)
416{ 416{
417 struct usb_otg *otg = musb->xceiv->otg;
417 irqreturn_t handled = IRQ_NONE; 418 irqreturn_t handled = IRQ_NONE;
418 419
419 dev_dbg(musb->controller, "<== Power=%02x, DevCtl=%02x, int_usb=0x%x\n", power, devctl, 420 dev_dbg(musb->controller, "<== Power=%02x, DevCtl=%02x, int_usb=0x%x\n", power, devctl,
@@ -626,7 +627,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
626 case OTG_STATE_B_PERIPHERAL: 627 case OTG_STATE_B_PERIPHERAL:
627 musb_g_suspend(musb); 628 musb_g_suspend(musb);
628 musb->is_active = is_otg_enabled(musb) 629 musb->is_active = is_otg_enabled(musb)
629 && musb->xceiv->gadget->b_hnp_enable; 630 && otg->gadget->b_hnp_enable;
630 if (musb->is_active) { 631 if (musb->is_active) {
631 musb->xceiv->state = OTG_STATE_B_WAIT_ACON; 632 musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
632 dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n"); 633 dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n");
@@ -643,7 +644,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
643 case OTG_STATE_A_HOST: 644 case OTG_STATE_A_HOST:
644 musb->xceiv->state = OTG_STATE_A_SUSPEND; 645 musb->xceiv->state = OTG_STATE_A_SUSPEND;
645 musb->is_active = is_otg_enabled(musb) 646 musb->is_active = is_otg_enabled(musb)
646 && musb->xceiv->host->b_hnp_enable; 647 && otg->host->b_hnp_enable;
647 break; 648 break;
648 case OTG_STATE_B_HOST: 649 case OTG_STATE_B_HOST:
649 /* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */ 650 /* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */
@@ -1965,7 +1966,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1965 1966
1966 if (is_otg_enabled(musb)) 1967 if (is_otg_enabled(musb))
1967 hcd->self.otg_port = 1; 1968 hcd->self.otg_port = 1;
1968 musb->xceiv->host = &hcd->self; 1969 musb->xceiv->otg->host = &hcd->self;
1969 hcd->power_budget = 2 * (plat->power ? : 250); 1970 hcd->power_budget = 2 * (plat->power ? : 250);
1970 1971
1971 /* program PHY to use external vBus if required */ 1972 /* program PHY to use external vBus if required */
@@ -1984,7 +1985,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1984 struct usb_hcd *hcd = musb_to_hcd(musb); 1985 struct usb_hcd *hcd = musb_to_hcd(musb);
1985 1986
1986 MUSB_HST_MODE(musb); 1987 MUSB_HST_MODE(musb);
1987 musb->xceiv->default_a = 1; 1988 musb->xceiv->otg->default_a = 1;
1988 musb->xceiv->state = OTG_STATE_A_IDLE; 1989 musb->xceiv->state = OTG_STATE_A_IDLE;
1989 1990
1990 status = usb_add_hcd(musb_to_hcd(musb), -1, 0); 1991 status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
@@ -1999,7 +2000,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1999 2000
2000 } else /* peripheral is enabled */ { 2001 } else /* peripheral is enabled */ {
2001 MUSB_DEV_MODE(musb); 2002 MUSB_DEV_MODE(musb);
2002 musb->xceiv->default_a = 0; 2003 musb->xceiv->otg->default_a = 0;
2003 musb->xceiv->state = OTG_STATE_B_IDLE; 2004 musb->xceiv->state = OTG_STATE_B_IDLE;
2004 2005
2005 status = musb_gadget_setup(musb); 2006 status = musb_gadget_setup(musb);
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index ac3d2eec20f..0524a34be3c 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -1898,6 +1898,7 @@ static int musb_gadget_start(struct usb_gadget *g,
1898 struct usb_gadget_driver *driver) 1898 struct usb_gadget_driver *driver)
1899{ 1899{
1900 struct musb *musb = gadget_to_musb(g); 1900 struct musb *musb = gadget_to_musb(g);
1901 struct usb_otg *otg = musb->xceiv->otg;
1901 unsigned long flags; 1902 unsigned long flags;
1902 int retval = -EINVAL; 1903 int retval = -EINVAL;
1903 1904
@@ -1945,7 +1946,7 @@ static int musb_gadget_start(struct usb_gadget *g,
1945 } 1946 }
1946 1947
1947 if ((musb->xceiv->last_event == USB_EVENT_ID) 1948 if ((musb->xceiv->last_event == USB_EVENT_ID)
1948 && musb->xceiv->set_vbus) 1949 && otg->set_vbus)
1949 otg_set_vbus(musb->xceiv, 1); 1950 otg_set_vbus(musb->xceiv, 1);
1950 1951
1951 hcd->self.uses_pio_for_control = 1; 1952 hcd->self.uses_pio_for_control = 1;
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
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 df719eae3b0..a427fcb1343 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;
@@ -167,7 +168,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
167 otg_set_vbus(musb->xceiv, 1); 168 otg_set_vbus(musb->xceiv, 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
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 5ce01bdb195..0665c14cc54 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -293,7 +293,7 @@ static int tusb_draw_power(struct usb_phy *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 &=