From 23f0e17a9629971ebab8cccb6c8d5aa1bf013152 Mon Sep 17 00:00:00 2001 From: William Wu Date: Tue, 28 Nov 2017 18:18:52 +0800 Subject: [PATCH] usb: dwc_otg_310: do not clear nak when prepare for setup packet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- drivers/usb/dwc_otg_310/dwc_otg_pcd_intr.c | 36 ---------------------- 1 file changed, 36 deletions(-) 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 760cd96f60e4..96b0ff9085b4 100644 --- a/drivers/usb/dwc_otg_310/dwc_otg_pcd_intr.c +++ b/drivers/usb/dwc_otg_310/dwc_otg_pcd_intr.c @@ -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 {