From 943d69083c855deeb3d7ba11d1d3f2892f90901a Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 14 Dec 2018 16:23:08 +0100 Subject: 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 Signed-off-by: Sascha Hauer --- drivers/net/fec_imx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/net') 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; -- cgit v1.2.3