diff mbox

[2.6.29] MUSB: Use Mode 1 for TX if transfer size equals maxpacket

Message ID 5A47E75E594F054BAF48C5E4FC4B92AB02FB0861EF@dbde02.ent.ti.com (mailing list archive)
State Awaiting Upstream, archived
Delegated to: Felipe Balbi
Headers show

Commit Message

Anand Gadiyar April 1, 2009, 12:13 p.m. UTC
From: Anand Gadiyar <gadiyar@ti.com>

MUSB: Use Mode 1 for TX if transfer size equals maxpacket

Without this change, musb will not correctly send out a ZLP if the
last transfer is exactly equal to the maxpacket size and request->zero
is set. 

CC: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
---
(Resending with [PATCH] tag, and linux-omap CC'ed)

Currently we use Mode 0 if transfer size is less-than-or-equal-to maxpacket.
This requires that we explicitly set TxPktRdy for that transfer.

However the musb_g_rx code will not set TxPktRdy twice if the last transfer
is exactly equal to maxpacket, even if request->zero is set. Using Mode 1
will solve this, but maybe a better fix might be in musb_g_rx()

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index c7ebd08..2807988 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -304,7 +304,7 @@  static void txstate(struct musb *musb, struct musb_request *req)
 			/* setup DMA, then program endpoint CSR */
 			request_size = min(request->length,
 						musb_ep->dma->max_len);
-			if (request_size <= musb_ep->packet_sz)
+			if (request_size < musb_ep->packet_sz)
 				musb_ep->dma->desired_mode = 0;
 			else
 				musb_ep->dma->desired_mode = 1;