USB: PCD: fix setup packet count issue
authorqi duan <qi.duan@amlogic.com>
Tue, 6 Mar 2018 10:06:15 +0000 (18:06 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Fri, 9 Mar 2018 08:38:20 +0000 (00:38 -0800)
PD#161573: USB: PCD: fix setup packet count issue.
           merge from dwc_otg version3.30a

Change-Id: I636129dfadc0b28e04d09df771aa062ee73670fa
Signed-off-by: qi duan <qi.duan@amlogic.com>
drivers/amlogic/usb/dwc_otg/310/dwc_otg_pcd_intr.c

index 092bc83..264749b 100644 (file)
@@ -1815,12 +1815,16 @@ static inline void pcd_setup(dwc_otg_pcd_t *pcd)
                    ("\n\n-----------    CANNOT handle > 1 setup packet in DMA mode\n\n");
 
        if ((core_if->snpsid >= OTG_CORE_REV_3_00a)
-           && (core_if->dma_enable == 1) && (core_if->dma_desc_enable == 0))
+           && (core_if->dma_enable == 1) && (core_if->dma_desc_enable == 0)) {
+               if (doeptsize0.b.supcnt == 3 && ep0->dwc_ep.stp_rollover == 0) {
+                       DWC_ERROR(" !!! Setup packet count\n");
+                       return;
+               }
                ctrl =
                    (pcd->setup_pkt +
                     (3 - doeptsize0.b.supcnt - 1 +
                      ep0->dwc_ep.stp_rollover))->req;
-
+       }
 #ifdef DEBUG_EP0
        DWC_DEBUGPL(DBG_PCD, "SETUP %02x.%02x v%04x i%04x l%04x\n",
                    ctrl.bmRequestType, ctrl.bRequest,