usb: chipidea: operate on otgsc register in a general way
[firefly-linux-kernel-4.4.55.git] / drivers / usb / chipidea / udc.c
index 7739c64ef2590a1dbdd0daf8e631b90cf99af628..798943b6ef7b5371988e124c83e127906a19caea 100644 (file)
@@ -1843,21 +1843,22 @@ void ci_hdrc_gadget_destroy(struct ci_hdrc *ci)
 
 static int udc_id_switch_for_device(struct ci_hdrc *ci)
 {
-       if (ci->is_otg) {
-               ci_clear_otg_interrupt(ci, OTGSC_BSVIS);
-               ci_enable_otg_interrupt(ci, OTGSC_BSVIE);
-       }
+       if (ci->is_otg)
+               /* Clear and enable BSV irq */
+               hw_write_otgsc(ci, OTGSC_BSVIS | OTGSC_BSVIE,
+                                       OTGSC_BSVIS | OTGSC_BSVIE);
 
        return 0;
 }
 
 static void udc_id_switch_for_host(struct ci_hdrc *ci)
 {
-       if (ci->is_otg) {
-               /* host doesn't care B_SESSION_VALID event */
-               ci_clear_otg_interrupt(ci, OTGSC_BSVIS);
-               ci_disable_otg_interrupt(ci, OTGSC_BSVIE);
-       }
+       /*
+        * host doesn't care B_SESSION_VALID event
+        * so clear and disbale BSV irq
+        */
+       if (ci->is_otg)
+               hw_write_otgsc(ci, OTGSC_BSVIE | OTGSC_BSVIS, OTGSC_BSVIS);
 }
 
 /**