* [PATCH] net: dwmac-sun8i: Use parsed internal PHY address instead of 1
@ 2025-05-19 16:49 Paul Kocialkowski
2025-05-19 19:25 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Paul Kocialkowski @ 2025-05-19 16:49 UTC (permalink / raw)
To: netdev, linux-arm-kernel, linux-sunxi, linux-kernel
Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
Corentin Labbe, Paul Kocialkowski
While the MDIO address of the internal PHY on Allwinner sun8i chips is
generally 1, of_mdio_parse_addr is used to cleanly parse the address
from the device-tree instead of hardcoding it.
A commit reworking the code ditched the parsed value and hardcoded the
value 1 instead, which didn't really break anything but is more fragile
and not future-proof.
Restore the initial behavior using the parsed address returned from the
helper.
Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs")
Signed-off-by: Paul Kocialkowski <paulk@sys-base.io>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 85723a78793a..6c7e8655a7eb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -964,7 +964,7 @@ static int sun8i_dwmac_set_syscon(struct device *dev,
/* of_mdio_parse_addr returns a valid (0 ~ 31) PHY
* address. No need to mask it again.
*/
- reg |= 1 << H3_EPHY_ADDR_SHIFT;
+ reg |= ret << H3_EPHY_ADDR_SHIFT;
} else {
/* For SoCs without internal PHY the PHY selection bit should be
* set to 0 (external PHY).
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] net: dwmac-sun8i: Use parsed internal PHY address instead of 1
2025-05-19 16:49 [PATCH] net: dwmac-sun8i: Use parsed internal PHY address instead of 1 Paul Kocialkowski
@ 2025-05-19 19:25 ` Andrew Lunn
2025-05-19 19:51 ` Paul Kocialkowski
2025-05-20 8:11 ` Corentin Labbe
2025-05-21 1:40 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2025-05-19 19:25 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: netdev, linux-arm-kernel, linux-sunxi, linux-kernel, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Corentin Labbe
On Mon, May 19, 2025 at 06:49:36PM +0200, Paul Kocialkowski wrote:
> While the MDIO address of the internal PHY on Allwinner sun8i chips is
> generally 1, of_mdio_parse_addr is used to cleanly parse the address
> from the device-tree instead of hardcoding it.
>
> A commit reworking the code ditched the parsed value and hardcoded the
> value 1 instead, which didn't really break anything but is more fragile
> and not future-proof.
>
> Restore the initial behavior using the parsed address returned from the
> helper.
>
> Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs")
> Signed-off-by: Paul Kocialkowski <paulk@sys-base.io>
Have you validated all .dts files using this binding? Any using
anything other than 1? The problem with silly bugs like this is that
there might be DT blobs with the value 42 which currently work, but
will break as soon as this patch lands.
Just stating in the commit message you have checked will help get the
patch merged.
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] net: dwmac-sun8i: Use parsed internal PHY address instead of 1
2025-05-19 19:25 ` Andrew Lunn
@ 2025-05-19 19:51 ` Paul Kocialkowski
2025-05-19 20:38 ` Andrew Lunn
0 siblings, 1 reply; 6+ messages in thread
From: Paul Kocialkowski @ 2025-05-19 19:51 UTC (permalink / raw)
To: Andrew Lunn
Cc: netdev, linux-arm-kernel, linux-sunxi, linux-kernel, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Corentin Labbe
[-- Attachment #1: Type: text/plain, Size: 1914 bytes --]
Hi Andrew,
Thanks for your reply.
Le Mon 19 May 25, 21:25, Andrew Lunn a écrit :
> On Mon, May 19, 2025 at 06:49:36PM +0200, Paul Kocialkowski wrote:
> > While the MDIO address of the internal PHY on Allwinner sun8i chips is
> > generally 1, of_mdio_parse_addr is used to cleanly parse the address
> > from the device-tree instead of hardcoding it.
> >
> > A commit reworking the code ditched the parsed value and hardcoded the
> > value 1 instead, which didn't really break anything but is more fragile
> > and not future-proof.
> >
> > Restore the initial behavior using the parsed address returned from the
> > helper.
> >
> > Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs")
> > Signed-off-by: Paul Kocialkowski <paulk@sys-base.io>
>
> Have you validated all .dts files using this binding? Any using
> anything other than 1? The problem with silly bugs like this is that
> there might be DT blobs with the value 42 which currently work, but
> will break as soon as this patch lands.
There's actually only two users of this (this code path for internal PHYs is
only used by two chips), which are platform dtsi files that have the address
already set to 1.
I have actually tested both with hardware and they work fine.
> Just stating in the commit message you have checked will help get the
> patch merged.
Do you think it's worth resending? I'd be fine with adding this when picking
up the patch:
The internal PHY is only found on the H3/H5 and V3s/V3/S3 chips which already
have the same address properly described in their platform device-tree and
were verified to work after this patch.
Cheers,
Paul
--
Paul Kocialkowski,
Independent contractor - sys-base - https://www.sys-base.io/
Free software developer - https://www.paulk.fr/
Expert in multimedia, graphics and embedded hardware support with Linux.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] net: dwmac-sun8i: Use parsed internal PHY address instead of 1
2025-05-19 19:51 ` Paul Kocialkowski
@ 2025-05-19 20:38 ` Andrew Lunn
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2025-05-19 20:38 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: netdev, linux-arm-kernel, linux-sunxi, linux-kernel, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland, Corentin Labbe
> There's actually only two users of this (this code path for internal PHYs is
> only used by two chips), which are platform dtsi files that have the address
> already set to 1.
>
> I have actually tested both with hardware and they work fine.
O.K.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
This is something to think about for patches in general. What
questions are reviewers likely to ask, and can you answer them in the
commit message?
Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] net: dwmac-sun8i: Use parsed internal PHY address instead of 1
2025-05-19 16:49 [PATCH] net: dwmac-sun8i: Use parsed internal PHY address instead of 1 Paul Kocialkowski
2025-05-19 19:25 ` Andrew Lunn
@ 2025-05-20 8:11 ` Corentin Labbe
2025-05-21 1:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: Corentin Labbe @ 2025-05-20 8:11 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: netdev, linux-arm-kernel, linux-sunxi, linux-kernel, Andrew Lunn,
David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
Le Mon, May 19, 2025 at 06:49:36PM +0200, Paul Kocialkowski a écrit :
> While the MDIO address of the internal PHY on Allwinner sun8i chips is
> generally 1, of_mdio_parse_addr is used to cleanly parse the address
> from the device-tree instead of hardcoding it.
>
> A commit reworking the code ditched the parsed value and hardcoded the
> value 1 instead, which didn't really break anything but is more fragile
> and not future-proof.
>
> Restore the initial behavior using the parsed address returned from the
> helper.
>
> Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs")
> Signed-off-by: Paul Kocialkowski <paulk@sys-base.io>
> ---
> drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> index 85723a78793a..6c7e8655a7eb 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
> @@ -964,7 +964,7 @@ static int sun8i_dwmac_set_syscon(struct device *dev,
> /* of_mdio_parse_addr returns a valid (0 ~ 31) PHY
> * address. No need to mask it again.
> */
> - reg |= 1 << H3_EPHY_ADDR_SHIFT;
> + reg |= ret << H3_EPHY_ADDR_SHIFT;
> } else {
> /* For SoCs without internal PHY the PHY selection bit should be
> * set to 0 (external PHY).
> --
> 2.49.0
>
Acked-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Tested-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Tested-on: sun50i-h6-orangepi-one-plus
Tested-on: sun8i-h3-orangepi-pc
Thanks
Regards
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] net: dwmac-sun8i: Use parsed internal PHY address instead of 1
2025-05-19 16:49 [PATCH] net: dwmac-sun8i: Use parsed internal PHY address instead of 1 Paul Kocialkowski
2025-05-19 19:25 ` Andrew Lunn
2025-05-20 8:11 ` Corentin Labbe
@ 2025-05-21 1:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-05-21 1:40 UTC (permalink / raw)
To: Paul Kocialkowski
Cc: netdev, linux-arm-kernel, linux-sunxi, linux-kernel,
andrew+netdev, davem, edumazet, kuba, pabeni, wens,
jernej.skrabec, samuel, clabbe.montjoie
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 19 May 2025 18:49:36 +0200 you wrote:
> While the MDIO address of the internal PHY on Allwinner sun8i chips is
> generally 1, of_mdio_parse_addr is used to cleanly parse the address
> from the device-tree instead of hardcoding it.
>
> A commit reworking the code ditched the parsed value and hardcoded the
> value 1 instead, which didn't really break anything but is more fragile
> and not future-proof.
>
> [...]
Here is the summary with links:
- net: dwmac-sun8i: Use parsed internal PHY address instead of 1
https://git.kernel.org/netdev/net/c/47653e4243f2
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] 6+ messages in thread
end of thread, other threads:[~2025-05-21 1:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-19 16:49 [PATCH] net: dwmac-sun8i: Use parsed internal PHY address instead of 1 Paul Kocialkowski
2025-05-19 19:25 ` Andrew Lunn
2025-05-19 19:51 ` Paul Kocialkowski
2025-05-19 20:38 ` Andrew Lunn
2025-05-20 8:11 ` Corentin Labbe
2025-05-21 1:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).