]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00154704 usb-gadget: wmb is needed after dtd pointer is updated for armv7
authorPeter Chen <peter.chen@freescale.com>
Thu, 11 Aug 2011 02:51:45 +0000 (10:51 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:33:06 +0000 (08:33 +0200)
At armv7 SoC, the dma_alloc_coherent returns non-cachable, but
bufferable region, so the driver needs to drain write buffer by
itself, if the controller needs to visit dma buffer immediately
after cpu writes

There is a discussion for this armv7 change:
http://marc.info/?t=127918539100004&r=1&w=2

For this issue, the next dtd pointer is invalid sometimes, the reason
is the region which is used to store dtd is dma buffer, so the data may
not be written to memory when the controller visit this data.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
drivers/usb/gadget/arcotg_udc.c

index 95dd31ec793603f3edd5b34e965e0ad218156fbe..f33ba52f288ef2e3e9f6d8dbce254df985d9a845 100755 (executable)
@@ -879,6 +879,9 @@ static int fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
                        lastreq->tail->next_td_ptr =
                            cpu_to_hc32(req->head->td_dma & DTD_ADDR_MASK);
                }
+       #ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
+               wmb();
+       #endif
                /* Read prime bit, if 1 goto done */
                if (fsl_readl(&dr_regs->endpointprime) & bitmask)
                        goto out;