From: Feng Mingli Date: Tue, 23 May 2017 05:51:48 +0000 (+0800) Subject: USB: dwc_otg_310: pcd: don't set cnak when setup stage X-Git-Tag: release-20171130_firefly~4^2~525 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e3c52e0bbf72e977fc947e7ae5e4aa53342e4827;p=firefly-linux-kernel-4.4.55.git USB: dwc_otg_310: pcd: don't set cnak when setup stage Refer dwc2 databook and programming, the controller automatic receive SETUP packet to the receive FIFO and respond to Host ACK whether ep enabled or not. The core internally set the IN NAK and OUT NAK bits when SETUP packet was received in order to software process SETUP packet and transition to the next stage. If software has not enabled ep before the Host send the SETUP packet, set enable ep and cnak at the same time the Host send DATA OUT packet. Then dwc2 controller write the setup data to the memory and disable ep, respond ACK to the Host DATA OUT packet. The Host transition to the status stage, but we lost the DATA OUT packet. So don't set cnak when setup stage, the dwc2 controller respond NAK to the Host DATA OUT packet, the Host resend ping packet and DATA OUT packet. TEST=set gadget work as usb audio and connect to ubuntu(rk3036) Change-Id: Id791c44baf3d363a975ceaeb7d1c879c9703ce1d Signed-off-by: Feng Mingli Signed-off-by: William Wu --- diff --git a/drivers/usb/dwc_otg_310/dwc_otg_pcd_intr.c b/drivers/usb/dwc_otg_310/dwc_otg_pcd_intr.c index 5d7d1178ca19..29c054e2b879 100755 --- a/drivers/usb/dwc_otg_310/dwc_otg_pcd_intr.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_pcd_intr.c @@ -792,13 +792,8 @@ static inline void ep0_out_start(dwc_otg_core_if_t *core_if, /** DOEPCTL0 Register write cnak will be set after setup interrupt */ doepctl.d32 = 0; doepctl.b.epena = 1; - if (core_if->snpsid <= OTG_CORE_REV_2_94a) { - doepctl.b.cnak = 1; - DWC_WRITE_REG32(&dev_if->out_ep_regs[0]->doepctl, doepctl.d32); - } else { - DWC_MODIFY_REG32(&dev_if->out_ep_regs[0]->doepctl, 0, - doepctl.d32); - } + DWC_MODIFY_REG32(&dev_if->out_ep_regs[0]->doepctl, 0, + doepctl.d32); #ifdef VERBOSE DWC_DEBUGPL(DBG_PCDV, "doepctl0=%0x\n",