mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: mvneta: convert to streaming DMA ops
@ 2015-03-13 20:23 Lucas Stach
  2015-03-16  4:30 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2015-03-13 20:23 UTC (permalink / raw)
  To: barebox

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 <dev@lynxeye.de>
---
I don't know why I missed this one driver in the big conversion
series, but the randconfig builder just came around and reminded
to get my act together.

Please apply to master.
---
 drivers/net/mvneta.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index f2948e4ed7f1..d4c8a2c68dd2 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -393,7 +393,7 @@ static int mvneta_send(struct eth_device *edev, void *data, int len)
 	int ret, error, last_desc;
 
 	/* Flush transmit data */
-	dma_flush_range((unsigned long)data, (unsigned long)data+len);
+	dma_sync_single_for_device((unsigned long)data, len, DMA_TO_DEVICE);
 
 	/* Fill the Tx descriptor */
 	txdesc->cmd_sts |= MVNETA_TX_L4_CSUM_NOT | MVNETA_TXD_FLZ_DESC;
@@ -409,6 +409,7 @@ static int mvneta_send(struct eth_device *edev, void *data, int len)
 	 * the Tx port status register (PTXS).
 	 */
 	ret = wait_on_timeout(TRANSFER_TIMEOUT, !mvneta_pending_tx(priv));
+	dma_sync_single_for_cpu((unsigned long)data, len, DMA_TO_DEVICE);
 	if (ret) {
 		dev_err(&edev->dev, "transmit timeout\n");
 		return ret;
@@ -459,15 +460,17 @@ static int mvneta_recv(struct eth_device *edev)
 	}
 
 	/* invalidate current receive buffer */
-	dma_inv_range((unsigned long)rxdesc->buf_phys_addr,
-		      (unsigned long)rxdesc->buf_phys_addr +
-		      ALIGN(PKTSIZE, 8));
+	dma_sync_single_for_cpu((unsigned long)rxdesc->buf_phys_addr,
+				ALIGN(PKTSIZE, 8), DMA_FROM_DEVICE);
 
 	/* received packet is padded with two null bytes (Marvell header) */
 	net_receive(edev, (void *)(rxdesc->buf_phys_addr + MVNETA_MH_SIZE),
 			  rxdesc->data_size - MVNETA_MH_SIZE);
 	ret = 0;
 
+	dma_sync_single_for_device((unsigned long)rxdesc->buf_phys_addr,
+				   ALIGN(PKTSIZE, 8), DMA_FROM_DEVICE);
+
 recv_err:
 	/* reset this and get next rx descriptor*/
 	rxdesc->data_size = 0;
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-16  4:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 20:23 [PATCH] net: mvneta: convert to streaming DMA ops Lucas Stach
2015-03-16  4:30 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox