From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from ns.lynxeye.de ([87.118.118.114] helo=lynxeye.de) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YS3mt-0008GF-I7 for barebox@lists.infradead.org; Sun, 01 Mar 2015 13:20:05 +0000 Received: from tellur.intern.lynxeye.de (p57B5E414.dip0.t-ipconnect.de [87.181.228.20]) by lynxeye.de (Postfix) with ESMTPA id F007226C2011 for ; Sun, 1 Mar 2015 14:17:30 +0100 (CET) From: Lucas Stach Date: Sun, 1 Mar 2015 14:17:14 +0100 Message-Id: <1425215842-6982-17-git-send-email-dev@lynxeye.de> In-Reply-To: <1425215842-6982-1-git-send-email-dev@lynxeye.de> References: <1425215842-6982-1-git-send-email-dev@lynxeye.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 16/24] net: macb: convert to streaming DMA ops To: barebox@lists.infradead.org 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 --- drivers/net/macb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index b941c27..957e4a7 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -47,7 +47,6 @@ #include #include #include -#include #include #include "macb.h" @@ -122,7 +121,7 @@ static int macb_send(struct eth_device *edev, void *packet, macb->tx_ring[tx_head].ctrl = ctrl; macb->tx_ring[tx_head].addr = (ulong)packet; barrier(); - dma_flush_range((ulong) packet, (ulong)packet + length); + dma_sync_single_for_device((unsigned long)packet, length, DMA_TO_DEVICE); macb_writel(macb, NCR, MACB_BIT(TE) | MACB_BIT(RE) | MACB_BIT(TSTART)); start = get_time_ns(); @@ -135,6 +134,7 @@ static int macb_send(struct eth_device *edev, void *packet, break; } } while (!is_timeout(start, 100 * MSECOND)); + dma_sync_single_for_cpu((unsigned long)packet, length, DMA_TO_DEVICE); if (ctrl & MACB_BIT(TX_UNDERRUN)) dev_err(macb->dev, "TX underrun\n"); @@ -188,7 +188,11 @@ static int gem_recv(struct eth_device *edev) status = macb->rx_ring[macb->rx_tail].ctrl; length = MACB_BFEXT(RX_FRMLEN, status); buffer = macb->rx_buffer + macb->rx_buffer_size * macb->rx_tail; + dma_sync_single_for_cpu((unsigned long)buffer, length, + DMA_FROM_DEVICE); net_receive(edev, buffer, length); + dma_sync_single_for_device((unsigned long)buffer, length, + DMA_FROM_DEVICE); macb->rx_ring[macb->rx_tail].addr &= ~MACB_BIT(RX_USED); barrier(); -- 2.1.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox