Commit 58e45f3e authored by Tony Lindgren's avatar Tony Lindgren

musb_hdrc: Fixes for OPT HS A tests

If RESUME is cleared too soon, OPT HS A 6.8 tests will fail.

This patch removes the check for RESUME bit before SUSPEND
is set, and makes virthub sleep until RESUME has been held
for 20 ms. Additionally virthub waits after clearing RESUME
to allow musb to start generating SOFs before RESET.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent fc51c39a
...@@ -386,26 +386,27 @@ static irqreturn_t musb_stage0_irq(struct musb * pThis, u8 bIntrUSB, ...@@ -386,26 +386,27 @@ static irqreturn_t musb_stage0_irq(struct musb * pThis, u8 bIntrUSB,
/* remote wakeup? later, GetPortStatus /* remote wakeup? later, GetPortStatus
* will stop RESUME signaling * will stop RESUME signaling
*/ */
if (power & MGC_M_POWER_RESUME) {
power &= ~MGC_M_POWER_SUSPENDM; if (power & MGC_M_POWER_SUSPENDM) {
musb_writeb(pBase, MGC_O_HDRC_POWER, /* spurious */
pThis->int_usb &= ~MGC_M_INTR_SUSPEND;
DBG(2, "Spurious SUSPENDM\n");
break;
}
power &= ~MGC_M_POWER_SUSPENDM;
musb_writeb(pBase, MGC_O_HDRC_POWER,
power | MGC_M_POWER_RESUME); power | MGC_M_POWER_RESUME);
pThis->port1_status |= pThis->port1_status |=
(USB_PORT_STAT_C_SUSPEND << 16) (USB_PORT_STAT_C_SUSPEND << 16)
| MUSB_PORT_STAT_RESUME; | MUSB_PORT_STAT_RESUME;
pThis->rh_timer = jiffies pThis->rh_timer = jiffies
+ msecs_to_jiffies(20); + msecs_to_jiffies(20);
pThis->xceiv.state = OTG_STATE_A_HOST; pThis->xceiv.state = OTG_STATE_A_HOST;
pThis->is_active = 1; pThis->is_active = 1;
usb_hcd_resume_root_hub( usb_hcd_resume_root_hub(musb_to_hcd(pThis));
musb_to_hcd(pThis));
} else if (power & MGC_M_POWER_SUSPENDM) {
/* spurious */
pThis->int_usb &= ~MGC_M_INTR_SUSPEND;
}
break; break;
case OTG_STATE_B_WAIT_ACON: case OTG_STATE_B_WAIT_ACON:
pThis->xceiv.state = OTG_STATE_B_PERIPHERAL; pThis->xceiv.state = OTG_STATE_B_PERIPHERAL;
......
...@@ -129,6 +129,22 @@ static void musb_port_reset(struct musb *musb, u8 bReset) ...@@ -129,6 +129,22 @@ static void musb_port_reset(struct musb *musb, u8 bReset)
*/ */
power = musb_readb(pBase, MGC_O_HDRC_POWER); power = musb_readb(pBase, MGC_O_HDRC_POWER);
if (bReset) { if (bReset) {
/*
* If RESUME is set, we must make sure it stays minimum 20 ms.
* Then we must clear RESUME and wait a bit to let musb start
* generating SOFs. If we don't do this, OPT HS A 6.8 tests
* fail with "Error! Did not receive an SOF before suspend
* detected".
*/
if (power & MGC_M_POWER_RESUME) {
while (time_before(jiffies, musb->rh_timer))
msleep(1);
musb_writeb(pBase, MGC_O_HDRC_POWER,
power & ~MGC_M_POWER_RESUME);
msleep(1);
}
musb->bIgnoreDisconnect = TRUE; musb->bIgnoreDisconnect = TRUE;
power &= 0xf0; power &= 0xf0;
musb_writeb(pBase, MGC_O_HDRC_POWER, musb_writeb(pBase, MGC_O_HDRC_POWER,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment