diff options
author | Lucas Stach <dev@lynxeye.de> | 2015-03-05 22:50:09 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-03-06 07:53:48 +0100 |
commit | 575c78c2672d65979ffdfbc9d2f1e4e93e820459 (patch) | |
tree | de94f354160e8b7fb238f53ec8dca50a4bb48187 | |
parent | d8967a857c274ebe18b69baa0bc93dca7774799a (diff) | |
download | barebox-575c78c2672d65979ffdfbc9d2f1e4e93e820459.tar.gz barebox-575c78c2672d65979ffdfbc9d2f1e4e93e820459.tar.xz |
net: at91_ether: 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>
-rw-r--r-- | drivers/net/at91_ether.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/at91_ether.c b/drivers/net/at91_ether.c index 9597639b44..5a74837f65 100644 --- a/drivers/net/at91_ether.c +++ b/drivers/net/at91_ether.c @@ -35,7 +35,6 @@ #include <linux/clk.h> #include <linux/mii.h> #include <errno.h> -#include <asm/mmu.h> #include <linux/phy.h> #include "at91_ether.h" @@ -200,7 +199,8 @@ static int at91_ether_send(struct eth_device *edev, void *packet, int length) { while (!(at91_emac_read(AT91_EMAC_TSR) & AT91_EMAC_TSR_BNQ)); - dma_flush_range((ulong) packet, (ulong)packet + length); + dma_sync_single_for_device((unsigned long)packet, length, DMA_TO_DEVICE); + /* Set address of the data in the Transmit Address register */ at91_emac_write(AT91_EMAC_TAR, (unsigned long) packet); /* Set length of the packet in the Transmit Control register */ @@ -211,6 +211,8 @@ static int at91_ether_send(struct eth_device *edev, void *packet, int length) at91_emac_write(AT91_EMAC_TSR, at91_emac_read(AT91_EMAC_TSR) | AT91_EMAC_TSR_COMP); + dma_sync_single_for_cpu((unsigned long)packet, length, DMA_TO_DEVICE); + return 0; } @@ -225,7 +227,11 @@ static int at91_ether_rx(struct eth_device *edev) size = rbfp->size & RBF_SIZE; + dma_sync_single_for_cpu((unsigned long)rbfp->addr, size, + DMA_FROM_DEVICE); net_receive(edev, (unsigned char *)(rbfp->addr & RBF_ADDR), size); + dma_sync_single_for_device((unsigned long)rbfp->addr, size, + DMA_FROM_DEVICE); rbfp->addr &= ~RBF_OWNER; if (rbfp->addr & RBF_WRAP) |