9
0
Fork 0

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>
This commit is contained in:
Andrey Smirnov 2016-03-15 20:33:42 -07:00 committed by Sascha Hauer
parent 5d60aa5269
commit 57ab72c903
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}
}
/*