From aaca81b9f56959aa07ace421bed6a6506a602f9f Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Thu, 5 Mar 2015 22:50:12 +0100 Subject: [PATCH] net: fec: 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 Signed-off-by: Sascha Hauer --- drivers/net/fec_imx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index 266357e55..875905a1b 100644 --- a/drivers/net/fec_imx.c +++ b/drivers/net/fec_imx.c @@ -31,8 +31,6 @@ #include #include -#include - #include "fec_imx.h" struct fec_frame { @@ -479,8 +477,9 @@ static int fec_send(struct eth_device *dev, void *eth_data, int data_length) writew(data_length, &fec->tbd_base[fec->tbd_index].data_length); writel((uint32_t)(eth_data), &fec->tbd_base[fec->tbd_index].data_pointer); - dma_flush_range((unsigned long)eth_data, - (unsigned long)(eth_data + data_length)); + + dma_sync_single_for_device((unsigned long)eth_data, data_length, + DMA_TO_DEVICE); /* * update BD's status now * This block: @@ -503,6 +502,8 @@ static int fec_send(struct eth_device *dev, void *eth_data, int data_length) break; } } + dma_sync_single_for_cpu((unsigned long)eth_data, data_length, + DMA_TO_DEVICE); /* for next transmission use the other buffer */ if (fec->tbd_index) @@ -576,7 +577,11 @@ static int fec_recv(struct eth_device *dev) */ frame = phys_to_virt(readl(&rbd->data_pointer)); frame_length = readw(&rbd->data_length) - 4; + dma_sync_single_for_cpu((unsigned long)frame->data, + frame_length, DMA_FROM_DEVICE); net_receive(dev, frame->data, frame_length); + dma_sync_single_for_device((unsigned long)frame->data, + frame_length, DMA_FROM_DEVICE); len = frame_length; } else { if (bd_status & FEC_RBD_ERR) {