9
0
Fork 0

macb: add timeout on send

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

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-03-05 19:00:34 +01:00 committed by Sascha Hauer
parent beb36c510b
commit f4b9f8a9af
1 changed files with 5 additions and 0 deletions

View File

@ -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)