[PATCH 11/24] net: cpsw: convert to streaming DMA ops
Jan Weitzel
J.Weitzel at phytec.de
Mon Mar 2 00:37:53 PST 2015
On Sun, Mar 01, 2015 at 02:17:09PM +0100, Lucas Stach wrote:
> 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.
Tested-by: Jan Weitzel <j.weitzel at phytec.de>
>
> Signed-off-by: Lucas Stach <dev at lynxeye.de>
> ---
> drivers/net/cpsw.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
> index 799fac8..3f8ffa0 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,8 +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_sync_single_for_device((unsigned long)buffer, len,
> + DMA_FROM_DEVICE);
> cpdma_submit(priv, &priv->rx_chan, buffer, PKTSIZE);
> }
>
> --
> 2.1.0
>
>
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
More information about the barebox
mailing list