]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/usb/chipidea/udc.c
MLK-10243 usb: chipidea: udc: enable and disable BSV irq only for ID change
[karo-tx-linux.git] / drivers / usb / chipidea / udc.c
index 68fe3bf356a52f223322f79c03e9d201a027089a..21c7903a3256b138a569b21de3f10dade93a83da 100644 (file)
@@ -1941,9 +1941,12 @@ static int udc_id_switch_for_device(struct ci_hdrc *ci)
        if (!ci->is_otg)
                return 0;
 
-       /* Clear and enable BSV irq for peripheral or OTG B-device */
+       /*
+        * Clear and enable BSV irq for A-device switch to B-device
+        * (in otg fsm mode, means A_IDLE->B_DILE) due to ID change.
+        */
        if (!ci_otg_is_fsm_mode(ci) ||
-                       ci->fsm.otg->state <= OTG_STATE_B_HOST)
+                       ci->fsm.otg->state == OTG_STATE_A_IDLE)
                hw_write_otgsc(ci, OTGSC_BSVIS | OTGSC_BSVIE,
                                        OTGSC_BSVIS | OTGSC_BSVIE);
 
@@ -1954,12 +1957,13 @@ static void udc_id_switch_for_host(struct ci_hdrc *ci)
 {
        if (!ci->is_otg)
                return;
+
        /*
-        * Host or OTG A-device doesn't care B_SESSION_VALID event
-        * so clear and disbale BSV irq
+        * Clear and disbale BSV irq for B-device switch to A-device
+        * (in otg fsm mode, means B_IDLE->A_IDLE) due to ID change.
         */
        if (!ci_otg_is_fsm_mode(ci) ||
-                       ci->fsm.otg->state > OTG_STATE_B_HOST)
+                       ci->fsm.otg->state == OTG_STATE_B_IDLE)
                hw_write_otgsc(ci, OTGSC_BSVIE | OTGSC_BSVIS, OTGSC_BSVIS);
 }