diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-02-20 18:05:11 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-02-20 18:25:10 +0100 |
commit | 5392235bddf419390817092c00fe8fb8d388a0c7 (patch) | |
tree | 89149ff5adfc4b91a48df73d3896c35f9b8cc7b1 /drivers/net | |
parent | faa4c039c3f2d576dbc9fadc8e30cb454070f10d (diff) | |
download | barebox-5392235bddf419390817092c00fe8fb8d388a0c7.tar.gz barebox-5392235bddf419390817092c00fe8fb8d388a0c7.tar.xz |
fec mx27: add timeout for transmission
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/fec_imx27.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/fec_imx27.c b/drivers/net/fec_imx27.c index 580ba25a49..279c06434e 100644 --- a/drivers/net/fec_imx27.c +++ b/drivers/net/fec_imx27.c @@ -431,6 +431,7 @@ static void fec_halt(struct eth_device *dev) static int fec_send(struct eth_device *dev, void *eth_data, int data_length) { unsigned int status; + uint64_t tmo; /* * This routine transmits one frame. This routine only accepts @@ -476,8 +477,12 @@ static int fec_send(struct eth_device *dev, void *eth_data, int data_length) /* * wait until frame is sent . */ + tmo = get_time_ns(); while (readw(&fec->tbd_base[fec->tbd_index].status) & FEC_TBD_READY) { - /* FIXME: Timeout */ + if (is_timeout(tmo, 1 * SECOND)) { + printf("transmission timeout\n"); + break; + } } /* for next transmission use the other buffer */ @@ -508,6 +513,7 @@ static int fec_recv(struct eth_device *dev) */ ievent = readl(&fec->eth->ievent); writel(ievent, &fec->eth->ievent); + if (ievent & (FEC_IEVENT_BABT | FEC_IEVENT_XFIFO_ERROR | FEC_IEVENT_RFIFO_ERROR)) { /* BABT, Rx/Tx FIFO errors */ |