From b08c16fba036c8ba7a8710e88874de5b14676d91 Mon Sep 17 00:00:00 2001 From: lyz Date: Fri, 6 Sep 2013 16:55:22 +0800 Subject: [PATCH] usb: fix bug: ep0 64Byte IN Packet Error --- drivers/usb/dwc_otg/dwc_otg_pcd.c | 3 ++- drivers/usb/dwc_otg/dwc_otg_pcd_intr.c | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc_otg/dwc_otg_pcd.c b/drivers/usb/dwc_otg/dwc_otg_pcd.c index a9b05d6ebea6..16222daa83b9 100755 --- a/drivers/usb/dwc_otg/dwc_otg_pcd.c +++ b/drivers/usb/dwc_otg/dwc_otg_pcd.c @@ -652,6 +652,8 @@ static int dwc_otg_pcd_ep_queue(struct usb_ep *_ep, DWC_DEBUGPL(DBG_PCD, "%s ep0: EP0_IN_DATA_PHASE\n", __func__); + if((_req->length % MAX_EP0_SIZE) == 0) + ep->dwc_ep.sent_zlp = 1; break; case EP0_OUT_DATA_PHASE: @@ -684,7 +686,6 @@ static int dwc_otg_pcd_ep_queue(struct usb_ep *_ep, ep->dwc_ep.xfer_buff = _req->buf; ep->dwc_ep.xfer_len = _req->length; ep->dwc_ep.xfer_count = 0; - ep->dwc_ep.sent_zlp = 0; ep->dwc_ep.total_len = ep->dwc_ep.xfer_len; dwc_otg_ep0_start_transfer( GET_CORE_IF(pcd), &ep->dwc_ep ); diff --git a/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c index 7f207908d145..cdc9a2066251 100755 --- a/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c +++ b/drivers/usb/dwc_otg/dwc_otg_pcd_intr.c @@ -1847,6 +1847,10 @@ static void handle_ep0( dwc_otg_pcd_t *_pcd ) { dwc_otg_ep0_continue_transfer ( GET_CORE_IF(_pcd), &ep0->dwc_ep ); DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER\n"); + }else if (ep0->dwc_ep.sent_zlp) { + dwc_otg_ep0_continue_transfer(GET_CORE_IF(_pcd), &ep0->dwc_ep); + ep0->dwc_ep.sent_zlp = 0; + DWC_DEBUGPL(DBG_PCD, "CONTINUE TRANSFER sent zlp\n"); } else { -- 2.34.1