2021-04-24 00:19:22 +00:00
|
|
|
From 3630d519d7c3eab92567658690e44ffe0517d109 Mon Sep 17 00:00:00 2001
|
2020-10-24 19:14:16 +00:00
|
|
|
From: Felix Fietkau <nbd@nbd.name>
|
2021-04-24 00:19:22 +00:00
|
|
|
Date: Thu, 22 Apr 2021 22:20:58 -0700
|
|
|
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: reduce MDIO bus access latency
|
2020-10-24 19:14:16 +00:00
|
|
|
|
|
|
|
usleep_range often ends up sleeping much longer than the 10-20us provided
|
|
|
|
as a range here. This causes significant latency in mdio bus acceses,
|
|
|
|
which easily adds multiple seconds to the boot time on MT7621 when polling
|
|
|
|
DSA slave ports.
|
|
|
|
Use cond_resched instead of usleep_range, since the MDIO access does not
|
|
|
|
take much time
|
|
|
|
|
|
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
2021-04-24 00:19:22 +00:00
|
|
|
Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
|
|
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
2020-10-24 19:14:16 +00:00
|
|
|
---
|
2021-04-24 00:19:22 +00:00
|
|
|
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +-
|
|
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
2020-10-24 19:14:16 +00:00
|
|
|
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
2021-04-10 11:20:04 +00:00
|
|
|
@@ -86,7 +86,7 @@ static int mtk_mdio_busy_wait(struct mtk
|
2020-10-24 19:14:16 +00:00
|
|
|
return 0;
|
|
|
|
if (time_after(jiffies, t_start + PHY_IAC_TIMEOUT))
|
|
|
|
break;
|
|
|
|
- usleep_range(10, 20);
|
|
|
|
+ cond_resched();
|
|
|
|
}
|
|
|
|
|
|
|
|
dev_err(eth->dev, "mdio: MDIO timeout\n");
|