]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
add timeout to polling loop for FEC_TBD_READY
authorLothar Waßmann <LW@KARO-electronics.de>
Tue, 6 Mar 2012 15:28:22 +0000 (16:28 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 6 Mar 2012 15:28:22 +0000 (16:28 +0100)
drivers/net/fec_mxc.c

index 06ed7e5089a6c529b829054f4286a33519c99cc7..a8943f58bdf0a997247e705fe488d9d01b850787 100644 (file)
@@ -589,6 +589,7 @@ static void fec_halt(struct eth_device *dev)
 static int fec_send(struct eth_device *dev, volatile void *packet, int length)
 {
        unsigned int status;
+       int timeout = 1000;
 
        /*
         * This routine transmits one frame.  This routine only accepts
@@ -636,6 +637,8 @@ static int fec_send(struct eth_device *dev, volatile void *packet, int length)
         * wait until frame is sent .
         */
        while (readw(&fec->tbd_base[fec->tbd_index].status) & FEC_TBD_READY) {
+               if (--timeout < 0)
+                       return -ETIMEDOUT;
                udelay(1);
        }
        debug("fec_send: status 0x%x index %d\n",