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 <[email protected]>
---
 drivers/net/fec_imx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index d304b94c567b..642517de6e98 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -61,7 +61,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;
        }
@@ -98,7 +98,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;
        }
@@ -411,7 +411,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 */
@@ -485,7 +485,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);
@@ -806,7 +806,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;
 
-- 
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to