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 1YM1Wz-0000N2-VK for barebox@lists.infradead.org; Thu, 12 Feb 2015 21:42:43 +0000 Received: from tellur.intern.lynxeye.de (p57B5FBCA.dip0.t-ipconnect.de [87.181.251.202]) by lynxeye.de (Postfix) with ESMTPA id F007926C2014 for ; Thu, 12 Feb 2015 22:40:14 +0100 (CET) From: Lucas Stach Date: Thu, 12 Feb 2015 22:39:55 +0100 Message-Id: <1423777200-22965-20-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 19/24] net: xgmac: convert to streaming DMA ops To: barebox@lists.infradead.org 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..3369a64 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, , 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