]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: dwc2: Align size of invalidating dcache before starting DMA
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 31 Jul 2017 09:08:10 +0000 (18:08 +0900)
committerMarek Vasut <marek.vasut+renesas@gmail.com>
Wed, 27 Sep 2017 10:12:23 +0000 (12:12 +0200)
During using dwc2 usb gadget, if usb message size is too small,
following cache misaligned warning is shown:

   CACHE: Misaligned operation at range [bfdbcb00bfdbcb04]

Align size of invalidating dcache before starting DMA to remove the
warning.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c

index 0d6d2fba8a0f3f22c8f69be5531a4f9282814be9..b6164afa9245a6c78775c65a7b90e4a76bf5000d 100644 (file)
@@ -111,7 +111,8 @@ static int setdma_rx(struct dwc2_ep *ep, struct dwc2_request *req)
        ctrl =  readl(&reg->out_endp[ep_num].doepctl);
 
        invalidate_dcache_range((unsigned long) ep->dma_buf,
-                               (unsigned long) ep->dma_buf + ep->len);
+                               (unsigned long) ep->dma_buf +
+                               ROUND(ep->len, CONFIG_SYS_CACHELINE_SIZE));
 
        writel((unsigned int) ep->dma_buf, &reg->out_endp[ep_num].doepdma);
        writel(DOEPT_SIZ_PKT_CNT(pktcnt) | DOEPT_SIZ_XFER_SIZE(length),