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 1YM1WB-0008Jz-IT for barebox@lists.infradead.org; Thu, 12 Feb 2015 21:41:55 +0000 Received: from tellur.intern.lynxeye.de (p57B5FBCA.dip0.t-ipconnect.de [87.181.251.202]) by lynxeye.de (Postfix) with ESMTPA id A6C8F26C2011 for ; Thu, 12 Feb 2015 22:40:13 +0100 (CET) From: Lucas Stach Date: Thu, 12 Feb 2015 22:39:52 +0100 Message-Id: <1423777200-22965-17-git-send-email-dev@lynxeye.de> In-Reply-To: <1423777200-22965-1-git-send-email-dev@lynxeye.de> References: <1423777200-22965-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 RFT 16/24] net: macb: convert to streaming DMA ops To: barebox@lists.infradead.org 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