usb: dwc_otg_310: do not clear nak when prepare for setup packet

When prepare setup packet, don't clear nak before call
ep0_out_start(), because clear nak will make the usb
core to handle OUT transaction immediately without
NAK response, this may cause OUT transaction fail.

We can reproduce this issue in the following two case:
 - Configure usb device as rndis, connect to Windows PC;
 - Configure usb device as uvc, connect to Windows PC,
   and take still image;

Use the usb analyzer to capture data in case2,we can
easily to find the problem.

Without this patch, the Class request OUT transfer is:
 - SETUP transaction
 - OUT transaction
   - OUT packet
   - DATA1 packet
   - ACK pakcet
 - IN transactions
   - IN packet
   - NAK packet (response NAK forever)

With this patch, the Class request OUT transfer is:
 - SETUP transaction
 - OUT transaction
   - OUT packet
   - DATA1 packet
   - NAK packet
 - PING transactions
 - OUT transaction
   - OUT packet
   - DATA1 packet
   - ACK pakcet
 - IN transaction
   - IN packet
   - DATA1 packet
   - ACK pakcet

Change-Id: I5ea915bc425ffa2f2a06a1a830f6f88725c94b03
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2017-11-28 18:18:52 +08:00
committed by Tao Huang
parent 6e1353425b
commit 23f0e17a96

View File

@@ -4606,27 +4606,9 @@ retry:
ep->dwc_ep.stp_rollover = 0;
/* Prepare for more setup packets */
if (pcd->ep0state == EP0_IN_STATUS_PHASE || pcd->ep0state == EP0_IN_DATA_PHASE) {
depctl_data_t
depctl
= {
.d32 = 0};
depctl.b.cnak
=
1;
ep0_out_start
(core_if,
pcd);
/* Core not updating setup packet count
* in case of PET testing - @TODO vahrama
* to check with HW team further */
if (!core_if->otg_ver) {
DWC_MODIFY_REG32
(&core_if->dev_if->
out_ep_regs
[0]->doepctl,
0,
depctl.d32);
}
}
goto exit_xfercompl;
} else {
@@ -4796,27 +4778,9 @@ retry:
(pcd);
/* Prepare for setup packets if ep0in was enabled */
if (pcd->ep0state == EP0_IN_STATUS_PHASE) {
depctl_data_t
depctl
= {
.d32 = 0};
depctl.b.cnak
=
1;
ep0_out_start
(core_if,
pcd);
/* Core not updating setup packet count
* in case of PET testing - @TODO vahrama
* to check with HW team further */
if (!core_if->otg_ver) {
DWC_MODIFY_REG32
(&core_if->dev_if->
out_ep_regs
[0]->doepctl,
0,
depctl.d32);
}
}
goto exit_xfercompl;
} else {