dwc3: flush the buffers before using it
In the linux kernel, non cacheable buffers are used. However in uboot
since there are no APIs to allocate non cacheable memory, all
the buffers should be flushed before using it.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
diff --git a/drivers/usb/dwc3/io.h b/drivers/usb/dwc3/io.h
index b6da135..5042a24 100644
--- a/drivers/usb/dwc3/io.h
+++ b/drivers/usb/dwc3/io.h
@@ -20,6 +20,7 @@
#include <asm/io.h>
+#define CACHELINE_SIZE CONFIG_SYS_CACHELINE_SIZE
static inline u32 dwc3_readl(void __iomem *base, u32 offset)
{
u32 offs = offset - DWC3_GLOBALS_REGS_START;
@@ -47,4 +48,8 @@
writel(value, base + offs);
}
+static inline void dwc3_flush_cache(int addr, int length)
+{
+ flush_dcache_range(addr, addr + ROUND(length, CACHELINE_SIZE));
+}
#endif /* __DRIVERS_USB_DWC3_IO_H */