* [PATCH v2] mdio: aspeed: Fix "Link is Down" issue
@ 2021-11-25 2:44 ` Dylan Hung
0 siblings, 0 replies; 9+ messages in thread
From: Dylan Hung @ 2021-11-25 2:44 UTC (permalink / raw)
To: linux-kernel, linux-aspeed, linux-arm-kernel, netdev, andrew,
joel, kuba, davem, linux, hkallweit1, andrew
Cc: BMC-SW, stable
The issue happened randomly in runtime. The message "Link is Down" is
popped but soon it recovered to "Link is Up".
The "Link is Down" results from the incorrect read data for reading the
PHY register via MDIO bus. The correct sequence for reading the data
shall be:
1. fire the command
2. wait for command done (this step was missing)
3. wait for data idle
4. read data from data register
Fixes: f160e99462c6 ("net: phy: Add mdio-aspeed")
Cc: stable@vger.kernel.org
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
---
v2: revise commit message
drivers/net/mdio/mdio-aspeed.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-aspeed.c
index cad820568f75..966c3b4ad59d 100644
--- a/drivers/net/mdio/mdio-aspeed.c
+++ b/drivers/net/mdio/mdio-aspeed.c
@@ -61,6 +61,13 @@ static int aspeed_mdio_read(struct mii_bus *bus, int addr, int regnum)
iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL);
+ rc = readl_poll_timeout(ctx->base + ASPEED_MDIO_CTRL, ctrl,
+ !(ctrl & ASPEED_MDIO_CTRL_FIRE),
+ ASPEED_MDIO_INTERVAL_US,
+ ASPEED_MDIO_TIMEOUT_US);
+ if (rc < 0)
+ return rc;
+
rc = readl_poll_timeout(ctx->base + ASPEED_MDIO_DATA, data,
data & ASPEED_MDIO_DATA_IDLE,
ASPEED_MDIO_INTERVAL_US,
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2] mdio: aspeed: Fix "Link is Down" issue
@ 2021-11-25 2:44 ` Dylan Hung
0 siblings, 0 replies; 9+ messages in thread
From: Dylan Hung @ 2021-11-25 2:44 UTC (permalink / raw)
To: linux-kernel, linux-aspeed, linux-arm-kernel, netdev, andrew,
joel, kuba, davem, linux, hkallweit1, andrew
Cc: BMC-SW, stable
The issue happened randomly in runtime. The message "Link is Down" is
popped but soon it recovered to "Link is Up".
The "Link is Down" results from the incorrect read data for reading the
PHY register via MDIO bus. The correct sequence for reading the data
shall be:
1. fire the command
2. wait for command done (this step was missing)
3. wait for data idle
4. read data from data register
Fixes: f160e99462c6 ("net: phy: Add mdio-aspeed")
Cc: stable@vger.kernel.org
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
---
v2: revise commit message
drivers/net/mdio/mdio-aspeed.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-aspeed.c
index cad820568f75..966c3b4ad59d 100644
--- a/drivers/net/mdio/mdio-aspeed.c
+++ b/drivers/net/mdio/mdio-aspeed.c
@@ -61,6 +61,13 @@ static int aspeed_mdio_read(struct mii_bus *bus, int addr, int regnum)
iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL);
+ rc = readl_poll_timeout(ctx->base + ASPEED_MDIO_CTRL, ctrl,
+ !(ctrl & ASPEED_MDIO_CTRL_FIRE),
+ ASPEED_MDIO_INTERVAL_US,
+ ASPEED_MDIO_TIMEOUT_US);
+ if (rc < 0)
+ return rc;
+
rc = readl_poll_timeout(ctx->base + ASPEED_MDIO_DATA, data,
data & ASPEED_MDIO_DATA_IDLE,
ASPEED_MDIO_INTERVAL_US,
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] mdio: aspeed: Fix "Link is Down" issue
2021-11-25 2:44 ` Dylan Hung
(?)
@ 2021-11-25 3:12 ` Andrew Jeffery
-1 siblings, 0 replies; 9+ messages in thread
From: Andrew Jeffery @ 2021-11-25 3:12 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, 25 Nov 2021, at 13:14, Dylan Hung wrote:
> The issue happened randomly in runtime. The message "Link is Down" is
> popped but soon it recovered to "Link is Up".
>
> The "Link is Down" results from the incorrect read data for reading the
> PHY register via MDIO bus. The correct sequence for reading the data
> shall be:
> 1. fire the command
> 2. wait for command done (this step was missing)
> 3. wait for data idle
> 4. read data from data register
>
> Fixes: f160e99462c6 ("net: phy: Add mdio-aspeed")
> Cc: stable@vger.kernel.org
> Reviewed-by: Joel Stanley <joel@jms.id.au>
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Acked-by: Andrew Jeffery <andrew@aj.id.au>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] mdio: aspeed: Fix "Link is Down" issue
2021-11-25 2:44 ` Dylan Hung
@ 2021-11-25 14:47 ` Andrew Lunn
-1 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2021-11-25 14:47 UTC (permalink / raw)
To: Dylan Hung
Cc: linux-kernel, linux-aspeed, linux-arm-kernel, netdev, andrew,
joel, kuba, davem, linux, hkallweit1, BMC-SW, stable
On Thu, Nov 25, 2021 at 10:44:32AM +0800, Dylan Hung wrote:
> The issue happened randomly in runtime. The message "Link is Down" is
> popped but soon it recovered to "Link is Up".
>
> The "Link is Down" results from the incorrect read data for reading the
> PHY register via MDIO bus. The correct sequence for reading the data
> shall be:
> 1. fire the command
> 2. wait for command done (this step was missing)
> 3. wait for data idle
> 4. read data from data register
>
> Fixes: f160e99462c6 ("net: phy: Add mdio-aspeed")
> Cc: stable@vger.kernel.org
> Reviewed-by: Joel Stanley <joel@jms.id.au>
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] mdio: aspeed: Fix "Link is Down" issue
@ 2021-11-25 14:47 ` Andrew Lunn
0 siblings, 0 replies; 9+ messages in thread
From: Andrew Lunn @ 2021-11-25 14:47 UTC (permalink / raw)
To: Dylan Hung
Cc: linux-kernel, linux-aspeed, linux-arm-kernel, netdev, andrew,
joel, kuba, davem, linux, hkallweit1, BMC-SW, stable
On Thu, Nov 25, 2021 at 10:44:32AM +0800, Dylan Hung wrote:
> The issue happened randomly in runtime. The message "Link is Down" is
> popped but soon it recovered to "Link is Up".
>
> The "Link is Down" results from the incorrect read data for reading the
> PHY register via MDIO bus. The correct sequence for reading the data
> shall be:
> 1. fire the command
> 2. wait for command done (this step was missing)
> 3. wait for data idle
> 4. read data from data register
>
> Fixes: f160e99462c6 ("net: phy: Add mdio-aspeed")
> Cc: stable@vger.kernel.org
> Reviewed-by: Joel Stanley <joel@jms.id.au>
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] mdio: aspeed: Fix "Link is Down" issue
2021-11-25 2:44 ` Dylan Hung
@ 2021-11-25 15:35 ` Russell King (Oracle)
-1 siblings, 0 replies; 9+ messages in thread
From: Russell King (Oracle) @ 2021-11-25 15:35 UTC (permalink / raw)
To: Dylan Hung
Cc: linux-kernel, linux-aspeed, linux-arm-kernel, netdev, andrew,
joel, kuba, davem, hkallweit1, andrew, BMC-SW, stable
On Thu, Nov 25, 2021 at 10:44:32AM +0800, Dylan Hung wrote:
> The issue happened randomly in runtime. The message "Link is Down" is
> popped but soon it recovered to "Link is Up".
>
> The "Link is Down" results from the incorrect read data for reading the
> PHY register via MDIO bus. The correct sequence for reading the data
> shall be:
> 1. fire the command
> 2. wait for command done (this step was missing)
> 3. wait for data idle
> 4. read data from data register
>
> Fixes: f160e99462c6 ("net: phy: Add mdio-aspeed")
> Cc: stable@vger.kernel.org
> Reviewed-by: Joel Stanley <joel@jms.id.au>
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] mdio: aspeed: Fix "Link is Down" issue
@ 2021-11-25 15:35 ` Russell King (Oracle)
0 siblings, 0 replies; 9+ messages in thread
From: Russell King (Oracle) @ 2021-11-25 15:35 UTC (permalink / raw)
To: Dylan Hung
Cc: linux-kernel, linux-aspeed, linux-arm-kernel, netdev, andrew,
joel, kuba, davem, hkallweit1, andrew, BMC-SW, stable
On Thu, Nov 25, 2021 at 10:44:32AM +0800, Dylan Hung wrote:
> The issue happened randomly in runtime. The message "Link is Down" is
> popped but soon it recovered to "Link is Up".
>
> The "Link is Down" results from the incorrect read data for reading the
> PHY register via MDIO bus. The correct sequence for reading the data
> shall be:
> 1. fire the command
> 2. wait for command done (this step was missing)
> 3. wait for data idle
> 4. read data from data register
>
> Fixes: f160e99462c6 ("net: phy: Add mdio-aspeed")
> Cc: stable@vger.kernel.org
> Reviewed-by: Joel Stanley <joel@jms.id.au>
> Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] mdio: aspeed: Fix "Link is Down" issue
2021-11-25 2:44 ` Dylan Hung
@ 2021-11-25 16:00 ` patchwork-bot+netdevbpf
-1 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-25 16:00 UTC (permalink / raw)
To: Dylan Hung
Cc: linux-kernel, linux-aspeed, linux-arm-kernel, netdev, andrew,
joel, kuba, davem, linux, hkallweit1, andrew, BMC-SW, stable
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 25 Nov 2021 10:44:32 +0800 you wrote:
> The issue happened randomly in runtime. The message "Link is Down" is
> popped but soon it recovered to "Link is Up".
>
> The "Link is Down" results from the incorrect read data for reading the
> PHY register via MDIO bus. The correct sequence for reading the data
> shall be:
> 1. fire the command
> 2. wait for command done (this step was missing)
> 3. wait for data idle
> 4. read data from data register
>
> [...]
Here is the summary with links:
- [v2] mdio: aspeed: Fix "Link is Down" issue
https://git.kernel.org/netdev/net/c/9dbe33cf371b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] mdio: aspeed: Fix "Link is Down" issue
@ 2021-11-25 16:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-11-25 16:00 UTC (permalink / raw)
To: Dylan Hung
Cc: linux-kernel, linux-aspeed, linux-arm-kernel, netdev, andrew,
joel, kuba, davem, linux, hkallweit1, andrew, BMC-SW, stable
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 25 Nov 2021 10:44:32 +0800 you wrote:
> The issue happened randomly in runtime. The message "Link is Down" is
> popped but soon it recovered to "Link is Up".
>
> The "Link is Down" results from the incorrect read data for reading the
> PHY register via MDIO bus. The correct sequence for reading the data
> shall be:
> 1. fire the command
> 2. wait for command done (this step was missing)
> 3. wait for data idle
> 4. read data from data register
>
> [...]
Here is the summary with links:
- [v2] mdio: aspeed: Fix "Link is Down" issue
https://git.kernel.org/netdev/net/c/9dbe33cf371b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-11-25 16:02 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-25 2:44 [PATCH v2] mdio: aspeed: Fix "Link is Down" issue Dylan Hung
2021-11-25 2:44 ` Dylan Hung
2021-11-25 3:12 ` Andrew Jeffery
2021-11-25 14:47 ` Andrew Lunn
2021-11-25 14:47 ` Andrew Lunn
2021-11-25 15:35 ` Russell King (Oracle)
2021-11-25 15:35 ` Russell King (Oracle)
2021-11-25 16:00 ` patchwork-bot+netdevbpf
2021-11-25 16:00 ` patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.