Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dwmac-sun8i: Use parsed internal PHY address instead of 1

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>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Tested-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Link: https://patch.msgid.link/20250519164936.4172658-1-paulk@sys-base.io
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Paul Kocialkowski and committed by
Jakub Kicinski
47653e42 b80b43fe

+1 -1
+1 -1
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
··· 964 964 /* of_mdio_parse_addr returns a valid (0 ~ 31) PHY 965 965 * address. No need to mask it again. 966 966 */ 967 - reg |= 1 << H3_EPHY_ADDR_SHIFT; 967 + reg |= ret << H3_EPHY_ADDR_SHIFT; 968 968 } else { 969 969 /* For SoCs without internal PHY the PHY selection bit should be 970 970 * set to 0 (external PHY).