diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2016-03-15 20:33:42 -0700 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-03-17 08:22:57 +0100 |
commit | 57ab72c9036603adb2b9b869190169542eea9c91 (patch) | |
tree | 966bf30c3972862c71c56b7f14467786c60217bd /drivers/net/fec_imx.c | |
parent | 5d60aa52692c8e8ffb5f17c8e9755e171f99896d (diff) | |
download | barebox-57ab72c9036603adb2b9b869190169542eea9c91.tar.gz barebox-57ab72c9036603adb2b9b869190169542eea9c91.tar.xz |
fec_imx: Implement reset timeout
Don't wait for more than one second for IP block to finish resetting. If
the block is dead it makes more sence to continue execution in hopes
that the rest of the processor is fine, rather than spin indefinetly
inside of the fec_probe function
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/net/fec_imx.c')
-rw-r--r-- | drivers/net/fec_imx.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index 601edbabba..fc2c8e1289 100644 --- a/drivers/net/fec_imx.c +++ b/drivers/net/fec_imx.c @@ -656,6 +656,7 @@ static int fec_probe(struct device_d *dev) enum fec_type type; int phy_reset; u32 msec = 1; + u64 start; ret = dev_get_drvdata(dev, (const void **)&type); if (ret) @@ -708,9 +709,13 @@ static int fec_probe(struct device_d *dev) } /* Reset chip. */ + start = get_time_ns(); writel(FEC_ECNTRL_RESET, fec->regs + FEC_ECNTRL); while(readl(fec->regs + FEC_ECNTRL) & FEC_ECNTRL_RESET) { - udelay(10); + if (is_timeout(start, SECOND)) { + ret = -ETIMEDOUT; + goto free_gpio; + } } /* |