USB: dwc_otg_310: hcd: modify reboot or shutdown painc
authorFeng Mingli <fml@rock-chips.com>
Wed, 29 Jul 2015 06:11:42 +0000 (14:11 +0800)
committerYunzhi Li <lyz@rock-chips.com>
Tue, 1 Sep 2015 07:35:25 +0000 (15:35 +0800)
When reboot or shutdown, hcd clean urbs and disable host interrupts. But
there may pending interrupts, so clean them.

Change-Id: Ide34aab5857a790a0912fb56ebe18d43ba228cf0
Signed-off-by: Feng Mingli <fml@rock-chips.com>
Signed-off-by: Yunzhi Li <lyz@rock-chips.com>
drivers/usb/dwc_otg_310/dwc_otg_cil.c
drivers/usb/dwc_otg_310/dwc_otg_hcd.c

index dae6550634c1c2f1c52ccb967dcebf537e141b11..411064697d37779d5e04584bd90594e7915c6d65 100755 (executable)
@@ -2395,6 +2395,8 @@ void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t *core_if)
        intr_mask.b.nptxfempty = 1;
 
        DWC_MODIFY_REG32(&global_regs->gintmsk, intr_mask.d32, 0);
+       /* Clear pending interrupts */
+       DWC_WRITE_REG32(&global_regs->gintsts, intr_mask.d32);
 }
 
 /**
index 09881639192bd3c0206fe494a346d1a199fbd14c..9df43cd1aba17ef10f45f45d01d03a8b790633f2 100755 (executable)
@@ -480,9 +480,6 @@ void dwc_otg_hcd_stop(dwc_otg_hcd_t *hcd)
        pldata = hcd->core_if->otg_dev->pldata;
        DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD STOP\n");
 
-       /* Turn off all host-specific interrupts. */
-       dwc_otg_disable_host_interrupts(hcd->core_if);
-
        /*
         * Set status flags for the hub driver.
         */
@@ -495,6 +492,9 @@ void dwc_otg_hcd_stop(dwc_otg_hcd_t *hcd)
         * and the QH lists (via ..._hcd_endpoint_disable).
         */
        DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags);
+       /* Turn off all host-specific interrupts. */
+       dwc_otg_disable_host_interrupts(hcd->core_if);
+
        kill_all_urbs(hcd);
        DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags);