RE: [RFC] [PATCH] usb: gadget: fix dtd dma confusion

From
Chen Peter-B29397 <hidden>
Date
2012-05-14 01:11:17
Reply to
Christoph Fritz, 2012-05-13
=20


=20
quoted
See here:
daec765da767e4a6a30e1298862b28f2cae9a73f
usb: gadget: mv_udc: fix dtd dma confusion

So hereby I'm CC-ing all *udc.c maintainers to point out that this
issue maybe affects you too.


---
Subject: [PATCH] usb: gadget: fsl_udc: fix dtd dma confusion

The controller will hang when doing testings with g_ether and iperf
(tool for measuring maximum TCP and UDP bandwidth).  This patch adds a
delay to wait for controller to release dtd dma before freeing it.

Signed-off-by: Christoph Fritz <redacted>
---
 drivers/usb/gadget/fsl_udc_core.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/drivers/usb/gadget/fsl_udc_core.c
b/drivers/usb/gadget/fsl_udc_core.c
quoted
index 55abfb6..fc86108 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -1638,6 +1638,15 @@ static int process_ep_req(struct fsl_udc *udc,
int pipe,
quoted
 			status =3D REQ_UNCOMPLETE;
 			return status;
 		} else if (remaining_length) {
+			/* wait controller release dtd dma */
+			while ((curr_qh->curr_dtd_ptr =3D=3D curr_td->td_dma)) {
+				if (curr_td->next_td_ptr =3D=3D
+						EP_QUEUE_HEAD_NEXT_TERMINATE) {
+					udelay(100);
+					break;
+				}
+				udelay(1);
+			}
 			if (direction) {
 				VDBG("Transmit dTD remaining length not zero");
 				status =3D -EPROTO;
--
1.7.2.5
=20
 ping  -  what about this patch? Will it be applied?
=20
Christoph, it is better use errata suggests workaround (postpone free dtd m=
emory),
and you can find related code at:=20

http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/
drivers/usb/gadget/arcotg_udc.c?h=3Dimx_3.0.15

The code is defined with POSTPONE_FREE_LAST_DTD
Thanks,
 -- Christoph
=20
Thread (42 messages) 42 messages, 7 authors, last reply 2012-10-22
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help