Re: [PATCH] USB: musb_gadget: fix ZLP sending in musb_g_tx(v1)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tom.leiming@xxxxxxxxx wrote:
From: Ming Lei <tom.leiming@xxxxxxxxx>

This patch fixes the problem reported by Sergei:

how come? we need to send ZLP before giving back the request.
Well, look at the code ionce again. We need to send ZLP *after*
request->actual == request->length, but as the check is inserted
after the ZLP send, ZLP *may* be sent once the first DMA completes,
not the last.

The patch also has been discussed on the link below:

	http://marc.info/?t=128454814900001&r=1&w=2

Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
Reported-by:   Sergei Shtylyov <sshtylyov@xxxxxxxxxx>
Cc: Felipe Balbi <balbi@xxxxxx>
Cc: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
Cc: Anand Gadiyar <gadiyar@xxxxxx>
Cc: Mike Frysinger <vapier@xxxxxxxxxx>
Cc: Sergei Shtylyov <sshtylyov@xxxxxxxxxxxxx>
---
v1: we need to set TXPKTRDY manually for each packet in dma mode0,
	which is pointed out by Sergei.
---
 drivers/usb/musb/musb_gadget.c |   61 +++++++++++++++++++--------------------
 1 files changed, 30 insertions(+), 31 deletions(-)

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 46cf94a..fff2455 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -477,40 +477,39 @@ void musb_g_tx(struct musb *musb, u8 epnum)
 				epnum, csr, musb_ep->dma->actual_len, request);
 		}
- if (is_dma || request->actual == request->length) {
-			/*
-			 * First, maybe a terminating short packet. Some DMA
-			 * engines might handle this by themselves.
-			 */
-			if ((request->zero && request->length
-				&& request->length % musb_ep->packet_sz == 0)
+		/*
+		 * First, maybe a terminating short packet. Some DMA
+		 * engines might handle this by themselves.
+		 */
+		if ((request->zero && request->length
+			&& (request->length % musb_ep->packet_sz == 0)

   There were no parens here, and they are not necessary.

+			&& (request->actual == request->length))

   Same here.

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux