[PATCH 1/2 v2] macb: add timeout on send

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Mon Mar 5 13:00:34 EST 2012


This will ensure that we send an other packet only when the first one is send.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
 drivers/net/macb.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index ab0d1af..ea8ae82 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -120,6 +120,11 @@ static int macb_send(struct eth_device *edev, void *packet,
 	barrier();
 	writel(MACB_BIT(TE) | MACB_BIT(RE) | MACB_BIT(TSTART), macb->regs + MACB_NCR);
 
+	wait_on_timeout(100 * MSECOND,
+		!(macb->tx_ring[0].ctrl & TXBUF_USED));
+
+	ctrl = macb->tx_ring[0].ctrl;
+
 	if (ctrl & TXBUF_UNDERRUN)
 		printf("TX underrun\n");
 	if (ctrl & TXBUF_EXHAUSTED)
-- 
1.7.7




More information about the barebox mailing list