Skip to contentSkip to conversation

usb: dwc2: Align size of invalidating dcache before starting DMA

PATCH New Seung-Woo Kim 3 participants 4 messages Jul 31, 2017 – Aug 31, 2017 1 message not in the archive USB

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20170731090805epcas1p2d8374538b622a1d1b4c6ee62ab871a85@epcas1p2.samsung.com

#1 lore raw

PATCH 1/1 usb: dwc2: Align size of invalidating dcache before starting DMA

During using dwc2 usb gadget, if usb message size is too small, following cache misaligned warning is shown:

CACHE: Misaligned operation at range [bfdbcb00, bfdbcb04]

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

---
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +2 -1
index 0d6d2fb..b6164af 100644
@@ -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),
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 1/1 usb: dwc2: Align size of invalidating dcache before starting DMA

Hi Seung-Woo,

Quoted 19 lines

During using dwc2 usb gadget, if usb message size is too small, following cache misaligned warning is shown:

CACHE: Misaligned operation at range [bfdbcb00, bfdbcb04]

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

---
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +0 -0
index 0d6d2fb..b6164af 100644

drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c static int setdma_rx(struct dwc2_ep *ep, struct dwc2_request *req) · line 118

Quoted 9 lines
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +2 -1
@@ -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),
Signature · 9 lines
Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
#3 lore raw

PATCH 1/1 usb: dwc2: Align size of invalidating dcache before starting DMA

Quoted 27 lines · Łukasz Majewski

Hi Seung-Woo,

Quoted 25 lines

During using dwc2 usb gadget, if usb message size is too small, following cache misaligned warning is shown:

CACHE: Misaligned operation at range [bfdbcb00, bfdbcb04]

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

---
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +2 -1
index 0d6d2fb..b6164af 100644
@@ -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));
 
Quoted 5 lines

drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c static int setdma_rx(struct dwc2_ep *ep, struct dwc2_request *req) · line 118

Quoted 3 lines
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +0 -0
     writel((unsigned int) ep->dma_buf, &reg->out_endp[ep_num].doepdma);
     writel(DOEPT_SIZ_PKT_CNT(pktcnt) | DOEPT_SIZ_XFER_SIZE(length),

Best Regards,
Jaehoon Chung

Quoted 1 line
#4 lore raw

PATCH 1/1 usb: dwc2: Align size of invalidating dcache before starting DMA

In reply to Seung-Woo Kim

Hello,

This patch was tested with Exynos4412 Odroid-U3 board for THOR usb gadget driver.

Best Regards,
- Seung-Woo Kim

Quoted 36 lines

-----Original Message-----
From: Seung-Woo Kim [mailto:sw0312.kim at samsung.com]
Sent: Monday, July 31, 2017 6:08 PM
To: u-boot at lists.denx.de; lukma at denx.de; marex at denx.de
Cc: sw0312.kim at samsung.com; xzy.xu at rock-chips.com; jh80.chung at samsung.com
Subject: [PATCH] usb: dwc2: Align size of invalidating dcache before starting DMA

During using dwc2 usb gadget, if usb message size is too small, following cache misaligned warning is shown:

CACHE: Misaligned operation at range [bfdbcb00, bfdbcb04]

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

---
 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c +2 -2
index 0d6d2fb..b6164af 100644
@@ -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),
--

1.7.9.5