[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201209102959.2131-1-u.kleine-koenig@pengutronix.de>
Date: Wed, 9 Dec 2020 11:29:59 +0100
From: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
To: Fugang Duan <fugang.duan@....com>,
"David S. Miller" <davem@...emloft.net>,
Andrew Lunn <andrew@...n.ch>
Cc: kernel@...gutronix.de, netdev@...r.kernel.org
Subject: [PATCH] net: ethernet: fec: Clear stale flag in IEVENT register before MII transfers
For some mii transfers the MII bit in the event register is already set
before a read or write transfer is started. This breaks evaluating the
transfer's result because it is checked too early.
Before MII transfers were switched from irq to polling this was not an
issue because then it just resulted in an irq which completed the
mdio_done completion. This completion however was reset before each
transfer and so the event didn't hurt.
This fixes NFS booting on an i.MX25 based machine.
Fixes: f166f890c8f0 ("net: ethernet: fec: Replace interrupt driven MDIO with polled IO")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
---
Hello,
I tried (shortly) to find out what actually results in this bit being
set because looking at f166f890c8f0 I'd say it cares enough. It's just
proven by the real world that it's not good enough :-)
Best regards
Uwe
drivers/net/ethernet/freescale/fec_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 2e209142f2d1..ab21d2bcda75 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1869,6 +1869,8 @@ static int fec_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
frame_addr = regnum;
}
+ writel(FEC_ENET_MII, fep->hwp + FEC_IEVENT);
+
/* start a read op */
writel(frame_start | frame_op |
FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(frame_addr) |
@@ -1926,6 +1928,8 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum,
frame_addr = regnum;
}
+ writel(FEC_ENET_MII, fep->hwp + FEC_IEVENT);
+
/* start a write op */
writel(frame_start | FEC_MMFR_OP_WRITE |
FEC_MMFR_PA(mii_id) | FEC_MMFR_RA(frame_addr) |
--
2.20.1
Powered by blists - more mailing lists