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 1YS3m5-0007jE-9A for barebox@lists.infradead.org; Sun, 01 Mar 2015 13:19:17 +0000 Received: from tellur.intern.lynxeye.de (p57B5E414.dip0.t-ipconnect.de [87.181.228.20]) by lynxeye.de (Postfix) with ESMTPA id F006326C2014 for ; Sun, 1 Mar 2015 14:17:31 +0100 (CET) From: Lucas Stach Date: Sun, 1 Mar 2015 14:17:17 +0100 Message-Id: <1425215842-6982-20-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 19/24] net: xgmac: 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/xgmac.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/xgmac.c b/drivers/net/xgmac.c index c1e4da8..f39dc4c 100644 --- a/drivers/net/xgmac.c +++ b/drivers/net/xgmac.c @@ -25,7 +25,6 @@ #include #include #include -#include #define TX_NUM_DESC 1 #define RX_NUM_DESC 32 @@ -587,7 +586,7 @@ static int xgmac_send(struct eth_device *edev, void *packet, int length) struct xgmac_dma_desc *txdesc = &priv->tx_chain[currdesc]; int ret; - dma_flush_range((ulong) packet, (ulong)packet + length); + dma_sync_single_for_device((unsigned long)packet, length, DMA_TO_DEVICE); desc_set_buf_addr_and_size(txdesc, packet, length); desc_set_tx_owner(txdesc, TXDESC_FIRST_SEG | TXDESC_LAST_SEG | TXDESC_CRC_EN_APPEND); @@ -596,6 +595,7 @@ static int xgmac_send(struct eth_device *edev, void *packet, int length) writel(1, priv->base + XGMAC_DMA_TX_POLL); ret = wait_on_timeout(1 * SECOND, !desc_get_owner(txdesc)); + dma_sync_single_for_cpu((unsigned long)packet, length, DMA_TO_DEVICE); if (ret) { dev_err(priv->dev, "TX timeout\n"); return ret; @@ -611,14 +611,19 @@ static int xgmac_recv(struct eth_device *edev) u32 currdesc = priv->rx_currdesc; struct xgmac_dma_desc *rxdesc = &priv->rx_chain[currdesc]; int length = 0; + void *buf_addr; /* check if the host has the desc */ if (desc_get_owner(rxdesc)) return -1; /* something bad happened */ length = desc_get_rx_frame_len(rxdesc); + buf_addr = desc_get_buf_addr(rxdesc); - net_receive(edev, desc_get_buf_addr(rxdesc), length); + dma_sync_single_for_cpu((unsigned long)buf_addr, length, DMA_FROM_DEVICE); + net_receive(edev, buf_addr, length); + dma_sync_single_for_device((unsigned long)buf_addr, length, + DMA_FROM_DEVICE); /* set descriptor back to owned by XGMAC */ desc_set_rx_owner(rxdesc); -- 2.1.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox