summaryrefslogtreecommitdiffstats
path: root/drivers/net/cpsw.c
diff options
context:
space:
mode:
authorLucas Stach <dev@lynxeye.de>2015-03-05 22:50:08 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-03-06 07:53:47 +0100
commitd8967a857c274ebe18b69baa0bc93dca7774799a (patch)
tree783574fb1e9d085ac0531d0a989277cf5066e35f /drivers/net/cpsw.c
parent2addec7bc328937cf64ef9fa33401eaebbbf6a62 (diff)
downloadbarebox-d8967a857c274ebe18b69baa0bc93dca7774799a.tar.gz
barebox-d8967a857c274ebe18b69baa0bc93dca7774799a.tar.xz
net: cpsw: convert to streaming DMA ops
Move to the common streaming DMA ops in order to get rid of the direct usage of the ARM MMU functions for the cache maintenance. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/cpsw.c')
-rw-r--r--drivers/net/cpsw.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 301b8a9dfd..76872546fd 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -21,6 +21,7 @@
#include <init.h>
#include <command.h>
+#include <dma.h>
#include <net.h>
#include <malloc.h>
#include <net.h>
@@ -32,7 +33,6 @@
#include <of_net.h>
#include <of_address.h>
#include <xfuncs.h>
-#include <asm/mmu.h>
#include <asm/system.h>
#include <linux/err.h>
@@ -871,9 +871,9 @@ static int cpsw_send(struct eth_device *edev, void *packet, int length)
dev_dbg(&slave->dev, "%s: %i bytes @ 0x%p\n", __func__, length, packet);
- dma_flush_range((ulong) packet, (ulong)packet + length);
-
+ dma_sync_single_for_device((unsigned long)packet, length, DMA_TO_DEVICE);
ret = cpdma_submit(priv, &priv->tx_chan, packet, length);
+ dma_sync_single_for_cpu((unsigned long)packet, length, DMA_TO_DEVICE);
return ret;
}
@@ -886,9 +886,11 @@ static int cpsw_recv(struct eth_device *edev)
int len;
while (cpdma_process(priv, &priv->rx_chan, &buffer, &len) >= 0) {
- dma_inv_range((ulong)buffer, (ulong)buffer + len);
+ dma_sync_single_for_cpu((unsigned long)buffer, len,
+ DMA_FROM_DEVICE);
net_receive(edev, buffer, len);
- dma_inv_range((ulong)buffer, (ulong)buffer + len);
+ dma_sync_single_for_device((unsigned long)buffer, len,
+ DMA_FROM_DEVICE);
cpdma_submit(priv, &priv->rx_chan, buffer, PKTSIZE);
}