Skip to contentSkip to conversation

net: mvneta: convert to streaming DMA ops

PATCH In review Lucas Stach 2 participants 2 messages Mar 13, 2015 – Mar 16, 2015 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: mvneta: convert to streaming DMA ops

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.

---
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(-)
drivers/net/mvneta.c +7 -4
index f2948e4ed7f1..d4c8a2c68dd2 100644
@@ -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;
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 11 lines · Lucas Stach

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.

---
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.

Did that, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox