/* remote wakeup? later, GetPortStatus
* will stop RESUME signaling
*/
- if (power & MGC_M_POWER_RESUME) {
- power &= ~MGC_M_POWER_SUSPENDM;
- musb_writeb(pBase, MGC_O_HDRC_POWER,
+
+ if (power & MGC_M_POWER_SUSPENDM) {
+ /* 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);
- pThis->port1_status |=
+ pThis->port1_status |=
(USB_PORT_STAT_C_SUSPEND << 16)
| MUSB_PORT_STAT_RESUME;
- pThis->rh_timer = jiffies
+ pThis->rh_timer = jiffies
+ msecs_to_jiffies(20);
- pThis->xceiv.state = OTG_STATE_A_HOST;
- pThis->is_active = 1;
- usb_hcd_resume_root_hub(
- musb_to_hcd(pThis));
-
- } else if (power & MGC_M_POWER_SUSPENDM) {
- /* spurious */
- pThis->int_usb &= ~MGC_M_INTR_SUSPEND;
- }
+ pThis->xceiv.state = OTG_STATE_A_HOST;
+ pThis->is_active = 1;
+ usb_hcd_resume_root_hub(musb_to_hcd(pThis));
break;
case OTG_STATE_B_WAIT_ACON:
pThis->xceiv.state = OTG_STATE_B_PERIPHERAL;
*/
power = musb_readb(pBase, MGC_O_HDRC_POWER);
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;
power &= 0xf0;
musb_writeb(pBase, MGC_O_HDRC_POWER,