diff options
author | Kurt Kanzenbach <kurt@linutronix.de> | 2019-05-19 20:59:36 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-05-21 03:00:46 +0300 |
commit | 882119ff969da4ec308d1161c78d22bc9b4a1f01 (patch) | |
tree | c9f84cd837e2b3aa08d7142dbb272cc1d76466c5 /drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | |
parent | fa2c52be7129c7370e6089a8162c7119a78b9a1c (diff) | |
download | linux-882119ff969da4ec308d1161c78d22bc9b4a1f01.tar.xz |
1/2] net: axienet: use readx_poll_timeout() in mdio wait function
On loaded systems with a preemptible kernel the mdio_wait() function may
report an error while everything is working fine:
axienet_mdio_wait_until_ready():
axienet_ior() -> chip not ready
--> interrupt here (other work for some time / chip become ready)
if (time_before_eq(end, jiffies))
--> false positive error report
Replace the current code with readx_poll_timeout() which take care
of the situation.
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c')
-rw-r--r-- | drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c index 757a3b37ae8a..704babdbc8a2 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c @@ -11,6 +11,7 @@ #include <linux/of_address.h> #include <linux/of_mdio.h> #include <linux/jiffies.h> +#include <linux/iopoll.h> #include "xilinx_axienet.h" @@ -20,16 +21,11 @@ /* Wait till MDIO interface is ready to accept a new transaction.*/ int axienet_mdio_wait_until_ready(struct axienet_local *lp) { - unsigned long end = jiffies + 2; - while (!(axienet_ior(lp, XAE_MDIO_MCR_OFFSET) & - XAE_MDIO_MCR_READY_MASK)) { - if (time_before_eq(end, jiffies)) { - WARN_ON(1); - return -ETIMEDOUT; - } - udelay(1); - } - return 0; + u32 val; + + return readx_poll_timeout(axinet_ior_read_mcr, lp, + val, val & XAE_MDIO_MCR_READY_MASK, + 1, 20000); } /** |