MLK-9897-2 usb: otg-fsm: check B-device state before sending polling request
authorLi Jun <jun.li@freescale.com>
Tue, 25 Nov 2014 04:08:48 +0000 (12:08 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:47:15 +0000 (14:47 -0500)
While system resume, the connected udev as B-device may not has been resumed,
if HNP polling request is sent to it, HNP polling may fail, this patch adds
check of the udev state to make sure it finished resume and to be configured
state before sending host request message, otherwise try next HNP polling
request.

Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Li Jun <jun.li@freescale.com>
(cherry picked from commit 2cff5eb7bd4feb70cd28ac4655e7433e57a17938)
(cherry picked from commit b6eea060a3760bdb24d1514a5130a346daba81c9)

drivers/usb/common/usb-otg-fsm.c

index 1530bac..23009e3 100644 (file)
@@ -150,6 +150,13 @@ static void otg_hnp_polling_work(struct work_struct *work)
                return;
        }
 
+       if (udev->state != USB_STATE_CONFIGURED) {
+               dev_dbg(&udev->dev, "the B dev is not resumed!\n");
+               schedule_delayed_work(&fsm->hnp_polling_work,
+                                     msecs_to_jiffies(T_HOST_REQ_POLL));
+               return;
+       }
+
        /*
         * Legacy otg test device does not support HNP polling,
         * start HNP directly for legacy otg test device.