[U-Boot] [PATCH 2/2] u-boot/drivers/net/designware with cache support.

Frank Dols frank.dols at synopsys.com
Tue Jan 22 15:10:21 CET 2013


Signed-off-by: Frank Dols <frank.dols at synopsys.com>
---
 drivers/net/designware.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 2f235d5..8e0508e 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -32,6 +32,9 @@
 #include <linux/err.h>
 #include <asm/io.h>
 #include "designware.h"
+#ifdef CONFIG_SYS_DCACHE_ON
+#include <asm/cache.h>
+#endif
 
 static int configure_phy(struct eth_device *dev);
 
@@ -227,6 +230,10 @@ static int dw_eth_send(struct eth_device *dev, void *packet, int length)
 
 	memcpy((void *)readl(&desc_p->dmamac_addr), packet, length);
 
+#ifdef CONFIG_SYS_DCACHE_ON
+	flush_dcache_range((void *)readl(&desc_p->dmamac_addr), length);
+#endif
+
 #if defined(CONFIG_DW_ALTDESCRIPTOR)
 	writel(readl(&desc_p->txrx_status) | DESC_TXSTS_TXFIRST |
 		DESC_TXSTS_TXLAST, &desc_p->txrx_status);
@@ -277,8 +284,17 @@ static int dw_eth_recv(struct eth_device *dev)
 		length = (status & DESC_RXSTS_FRMLENMSK) >>
 			 DESC_RXSTS_FRMLENSHFT;
 
+#ifdef CONFIG_SYS_DCACHE_ON
+		invalidate_dcache_range((void *)readl(&desc_p->dmamac_addr),
+			length);
+#endif
+
 		NetReceive(readl(&desc_p->dmamac_addr), length);
 
+#ifdef CONFIG_SYS_DCACHE_ON
+		flush_dcache_range((void *)readl(&desc_p->dmamac_addr), length);
+#endif
+
 		/*
 		 * Make the current descriptor valid again and go to
 		 * the next one
@@ -584,6 +600,10 @@ int designware_initialize(u32 id, ulong base_addr, u32 phy_addr, u32 interface)
 	dev->halt = dw_eth_halt;
 	dev->write_hwaddr = dw_write_hwaddr;
 
+#ifdef CONFIG_SYS_DCACHE_ON
+	flush_dcache_range(priv, sizeof(struct dw_eth_dev));
+#endif
+
 	eth_register(dev);
 
 #if defined(CONFIG_MII)
-- 
1.7.0.4



More information about the U-Boot mailing list