aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/davinci.c
diff options
context:
space:
mode:
authorAntoine Tenart <antoine.tenart@free-electrons.com>2014-10-30 13:41:13 -0400
committerFelipe Balbi <balbi@ti.com>2014-11-03 11:01:25 -0500
commite47d92545c2972bcf3711e7db80f481e402163c7 (patch)
treea84db324fbd565aaa371bc0ef5677456541877e3 /drivers/usb/musb/davinci.c
parenta2655e4a8edb66d21b0967940172e83a51d30ef3 (diff)
usb: move the OTG state from the USB PHY to the OTG structure
Before using the PHY framework instead of the USB PHY one, we need to move the OTG state into another place, since it won't be available when USB PHY isn't used. This patch moves the OTG state into the OTG structure, and makes all the needed modifications in the drivers using the OTG state. [ balbi@ti.com : fix build regressions with phy-tahvo.c, musb_dsps.c, phy-isp1301-omap, and chipidea's debug.c ] Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/davinci.c')
-rw-r--r--drivers/usb/musb/davinci.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 04de3aca938d..3c1d9b211b51 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -214,10 +214,10 @@ static void otg_timer(unsigned long _musb)
214 */ 214 */
215 devctl = musb_readb(mregs, MUSB_DEVCTL); 215 devctl = musb_readb(mregs, MUSB_DEVCTL);
216 dev_dbg(musb->controller, "poll devctl %02x (%s)\n", devctl, 216 dev_dbg(musb->controller, "poll devctl %02x (%s)\n", devctl,
217 usb_otg_state_string(musb->xceiv->state)); 217 usb_otg_state_string(musb->xceiv->otg->state));
218 218
219 spin_lock_irqsave(&musb->lock, flags); 219 spin_lock_irqsave(&musb->lock, flags);
220 switch (musb->xceiv->state) { 220 switch (musb->xceiv->otg->state) {
221 case OTG_STATE_A_WAIT_VFALL: 221 case OTG_STATE_A_WAIT_VFALL:
222 /* Wait till VBUS falls below SessionEnd (~0.2V); the 1.3 RTL 222 /* Wait till VBUS falls below SessionEnd (~0.2V); the 1.3 RTL
223 * seems to mis-handle session "start" otherwise (or in our 223 * seems to mis-handle session "start" otherwise (or in our
@@ -228,7 +228,7 @@ static void otg_timer(unsigned long _musb)
228 mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); 228 mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
229 break; 229 break;
230 } 230 }
231 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; 231 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
232 musb_writel(musb->ctrl_base, DAVINCI_USB_INT_SET_REG, 232 musb_writel(musb->ctrl_base, DAVINCI_USB_INT_SET_REG,
233 MUSB_INTR_VBUSERROR << DAVINCI_USB_USBINT_SHIFT); 233 MUSB_INTR_VBUSERROR << DAVINCI_USB_USBINT_SHIFT);
234 break; 234 break;
@@ -251,7 +251,7 @@ static void otg_timer(unsigned long _musb)
251 if (devctl & MUSB_DEVCTL_BDEVICE) 251 if (devctl & MUSB_DEVCTL_BDEVICE)
252 mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); 252 mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
253 else 253 else
254 musb->xceiv->state = OTG_STATE_A_IDLE; 254 musb->xceiv->otg->state = OTG_STATE_A_IDLE;
255 break; 255 break;
256 default: 256 default:
257 break; 257 break;
@@ -325,20 +325,20 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
325 * to stop registering in devctl. 325 * to stop registering in devctl.
326 */ 326 */
327 musb->int_usb &= ~MUSB_INTR_VBUSERROR; 327 musb->int_usb &= ~MUSB_INTR_VBUSERROR;
328 musb->xceiv->state = OTG_STATE_A_WAIT_VFALL; 328 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL;
329 mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); 329 mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
330 WARNING("VBUS error workaround (delay coming)\n"); 330 WARNING("VBUS error workaround (delay coming)\n");
331 } else if (drvvbus) { 331 } else if (drvvbus) {
332 MUSB_HST_MODE(musb); 332 MUSB_HST_MODE(musb);
333 otg->default_a = 1; 333 otg->default_a = 1;
334 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; 334 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
335 portstate(musb->port1_status |= USB_PORT_STAT_POWER); 335 portstate(musb->port1_status |= USB_PORT_STAT_POWER);
336 del_timer(&otg_workaround); 336 del_timer(&otg_workaround);
337 } else { 337 } else {
338 musb->is_active = 0; 338 musb->is_active = 0;
339 MUSB_DEV_MODE(musb); 339 MUSB_DEV_MODE(musb);
340 otg->default_a = 0; 340 otg->default_a = 0;
341 musb->xceiv->state = OTG_STATE_B_IDLE; 341 musb->xceiv->otg->state = OTG_STATE_B_IDLE;
342 portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); 342 portstate(musb->port1_status &= ~USB_PORT_STAT_POWER);
343 } 343 }
344 344
@@ -348,7 +348,7 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
348 davinci_musb_source_power(musb, drvvbus, 0); 348 davinci_musb_source_power(musb, drvvbus, 0);
349 dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", 349 dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n",
350 drvvbus ? "on" : "off", 350 drvvbus ? "on" : "off",
351 usb_otg_state_string(musb->xceiv->state), 351 usb_otg_state_string(musb->xceiv->otg->state),
352 err ? " ERROR" : "", 352 err ? " ERROR" : "",
353 devctl); 353 devctl);
354 retval = IRQ_HANDLED; 354 retval = IRQ_HANDLED;
@@ -361,7 +361,7 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci)
361 musb_writel(tibase, DAVINCI_USB_EOI_REG, 0); 361 musb_writel(tibase, DAVINCI_USB_EOI_REG, 0);
362 362
363 /* poll for ID change */ 363 /* poll for ID change */
364 if (musb->xceiv->state == OTG_STATE_B_IDLE) 364 if (musb->xceiv->otg->state == OTG_STATE_B_IDLE)
365 mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); 365 mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
366 366
367 spin_unlock_irqrestore(&musb->lock, flags); 367 spin_unlock_irqrestore(&musb->lock, flags);