Patchwork [U-Boot,V5,12/18] usb: gadget: mv_udc: flush item before head

login
register
mail settings
Submitter Troy Kisky
Date Sept. 26, 2013, 1:41 a.m.
Message ID <1380159678-26416-13-git-send-email-troy.kisky@boundarydevices.com>
Download mbox | patch
Permalink /patch/278062/
State Awaiting Upstream
Delegated to: Marek Vasut
Headers show

Comments

Troy Kisky - Sept. 26, 2013, 1:41 a.m.
Make sure the transfer descriptor is flushed
before the queue is updated so that the controller
will not see old information.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>

---
v4: no change
v5: no change
---
 drivers/usb/gadget/mv_udc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Marek Vasut - Sept. 27, 2013, 6:01 p.m.
Dear Troy Kisky,

> Make sure the transfer descriptor is flushed
> before the queue is updated so that the controller
> will not see old information.
> 
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> 
Picking for -next, thanks
Best regards,
Marek Vasut

Patch

diff --git a/drivers/usb/gadget/mv_udc.c b/drivers/usb/gadget/mv_udc.c
index a2cbe67..3509aa8 100644
--- a/drivers/usb/gadget/mv_udc.c
+++ b/drivers/usb/gadget/mv_udc.c
@@ -347,21 +347,20 @@  static int mv_ep_queue(struct usb_ep *ep,
 	item->info = INFO_BYTES(len) | INFO_IOC | INFO_ACTIVE;
 	item->page0 = (uint32_t)mv_ep->b_buf;
 	item->page1 = ((uint32_t)mv_ep->b_buf & 0xfffff000) + 0x1000;
+	mv_flush_qtd(num);
 
 	head->next = (unsigned) item;
 	head->info = 0;
 
 	DBG("ept%d %s queue len %x, buffer %p\n",
 	    num, in ? "in" : "out", len, mv_ep->b_buf);
+	mv_flush_qh(num);
 
 	if (in)
 		bit = EPT_TX(num);
 	else
 		bit = EPT_RX(num);
 
-	mv_flush_qh(num);
-	mv_flush_qtd(num);
-
 	writel(bit, &udc->epprime);
 
 	return 0;