[PATCH 5/5] macb: add timeout on send

Sascha Hauer s.hauer at pengutronix.de
Tue Mar 6 03:29:30 EST 2012


On Fri, Mar 02, 2012 at 07:20:10PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> 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 9b54afa..3835dba 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -121,6 +121,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));

If you care for adding a timeout loop then you should also check
the return value.

Sascha

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



More information about the barebox mailing list