summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2018-12-14 16:23:08 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-12-17 12:26:14 +0100
commit943d69083c855deeb3d7ba11d1d3f2892f90901a (patch)
tree1fe7042ebd8836c028fe7e4f34c34d794da1a1d0
parentc0eecaa80739e2d70b8973e5736953dadf4323d7 (diff)
downloadbarebox-943d69083c855deeb3d7ba11d1d3f2892f90901a.tar.gz
barebox-943d69083c855deeb3d7ba11d1d3f2892f90901a.tar.xz
net: fec_imx: fix timeout off by *1000 error
read*_poll_timeout's final timeout parameter is in microseconds, but the supplied arguments in fec_imx.c were in nanoseconds, which might lead to barebox getting seemingly stuck in fec_halt (loops for a thousand seconds instead of one). I've tested this still works on an i.MX6D by copying a file over TFTP and verifying the hash is correct. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/net/fec_imx.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index c2628cc1d6..4823b08340 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -51,7 +51,7 @@ static int fec_miibus_read(struct mii_bus *bus, int phyAddr, int regAddr)
* wait for the related interrupt
*/
if (readl_poll_timeout(fec->regs + FEC_IEVENT, reg,
- reg & FEC_IEVENT_MII, MSECOND)) {
+ reg & FEC_IEVENT_MII, USEC_PER_MSEC)) {
dev_err(&fec->edev.dev, "Read MDIO failed...\n");
return -1;
}
@@ -88,7 +88,7 @@ static int fec_miibus_write(struct mii_bus *bus, int phyAddr,
* wait for the MII interrupt
*/
if (readl_poll_timeout(fec->regs + FEC_IEVENT, reg,
- reg & FEC_IEVENT_MII, MSECOND)) {
+ reg & FEC_IEVENT_MII, USEC_PER_MSEC)) {
dev_err(&fec->edev.dev, "Write MDIO failed...\n");
return -1;
}
@@ -401,7 +401,7 @@ static void fec_halt(struct eth_device *dev)
/* wait for graceful stop to register */
if (readl_poll_timeout(fec->regs + FEC_IEVENT, reg,
- reg & FEC_IEVENT_GRA, SECOND))
+ reg & FEC_IEVENT_GRA, USEC_PER_SEC))
dev_err(&dev->dev, "graceful stop timeout\n");
/* Disable SmartDMA tasks */
@@ -475,7 +475,7 @@ static int fec_send(struct eth_device *dev, void *eth_data, int data_length)
fec_tx_task_enable(fec);
if (readw_poll_timeout(&fec->tbd_base[fec->tbd_index].status,
- status, !(status & FEC_TBD_READY), SECOND))
+ status, !(status & FEC_TBD_READY), USEC_PER_SEC))
dev_err(&dev->dev, "transmission timeout\n");
dma_unmap_single(fec->dev, dma, data_length, DMA_TO_DEVICE);
@@ -796,7 +796,7 @@ static int fec_probe(struct device_d *dev)
/* Reset chip. */
writel(FEC_ECNTRL_RESET, fec->regs + FEC_ECNTRL);
ret = readl_poll_timeout(fec->regs + FEC_ECNTRL, reg,
- !(reg & FEC_ECNTRL_RESET), SECOND);
+ !(reg & FEC_ECNTRL_RESET), USEC_PER_SEC);
if (ret)
goto free_gpio;