Skip to contentSkip to conversation

stmmac: fix pcs_lynx link failure

PATCH In review Arnd Bergmann 3 participants 4 messages Jun 7, 2023

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 stmmac: fix pcs_lynx link failure

From: Arnd Bergmann <[email protected]>

The mdio code in stmmac now directly links into both the lynx_pcs and the xpcs device drivers, but the lynx_pcs dependency is only enforced for the altera variant of stmmac, which is the one that actually uses it.

Building stmmac for a non-altera platform therefore causes a link failure:

arm-linux-gnueabi-ld: drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.o: in function `stmmac_mdio_unregister':
stmmac_mdio.c:(.text+0x1418): undefined reference to `lynx_pcs_destroy'

I've tried to come up with a patch that moves this dependency back into the dwmac-socfpga.c file, but there was no easy and obvious way to do this. It also seems that this would not be a proper solution, but instead there should be a real abstraction for pcs drivers that lets device drivers handle this transparently.

As the lynx_pcs driver is tiny, it appears that we can just avoid the link error by always forcing it to be built when the stmmac driver is, even for non-altera platforms. This matches what we already do for the xpcs variant that is used by the intel and tegra variants of stmmac.

Fixes 5d1f3fe7d2d54 ("net: stmmac: dwmac-sogfpga: use the lynx pcs driver")
---
 drivers/net/ethernet/stmicro/stmmac/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/Kconfig +1 -1
index 5583f0b055ec7..fa956f2081a53 100644
@@ -5,6 +5,7 @@ config STMMAC_ETH
 	depends on PTP_1588_CLOCK_OPTIONAL
 	select MII
 	select PCS_XPCS
+	select PCS_LYNX
 	select PAGE_POOL
 	select PHYLINK
 	select CRC32
@@ -160,7 +161,6 @@ config DWMAC_SOCFPGA
 	select MFD_SYSCON
 	select MDIO_REGMAP
 	select REGMAP_MMIO
-	select PCS_LYNX
 	help
 	  Support for ethernet controller on Altera SOCFPGA
 
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 net: altera-tse: fix broken Kconfig dependency

From: Arnd Bergmann <[email protected]>

The CONFIG_PCS_ALTERA_TSE symbol is gone, so make sure the ethernet driver selects the correct symbol for its replacement, avoiding:

x86_64-linux-ld: drivers/net/ethernet/altera/altera_tse_main.o: in function `altera_tse_remove':
altera_tse_main.c:(.text+0xdf): undefined reference to `lynx_pcs_destroy'

Fixes 196eec4062b00 ("net: pcs: Drop the TSE PCS driver")
---
 drivers/net/ethernet/altera/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/altera/Kconfig +1 -1
index 93533ba034294..17985319088c1 100644
@@ -4,7 +4,7 @@ config ALTERA_TSE
 	depends on HAS_DMA
 	select PHYLIB
 	select PHYLINK
-	select PCS_ALTERA_TSE
+	select PCS_LYNX
 	select MDIO_REGMAP
 	select REGMAP_MMIO
 	help
Signature · 1 line
2.39.2
#2 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The mdio code in stmmac now directly links into both the lynx_pcs and the xpcs device drivers, but the lynx_pcs dependency is only enforced for the altera variant of stmmac, which is the one that actually uses it.

Building stmmac for a non-altera platform therefore causes a link failure:

Quoted 8 lines

arm-linux-gnueabi-ld: drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.o: in function `stmmac_mdio_unregister':
stmmac_mdio.c:(.text+0x1418): undefined reference to `lynx_pcs_destroy'

I've tried to come up with a patch that moves this dependency back into the dwmac-socfpga.c file, but there was no easy and obvious way to do this. It also seems that this would not be a proper solution, but instead there should be a real abstraction for pcs drivers that lets device drivers handle this transparently.

There is already a patch set on netdev fixing this properly.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#3 lore raw
Quoted 13 lines · Russell King (Oracle)
Quoted 12 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The mdio code in stmmac now directly links into both the lynx_pcs and the xpcs device drivers, but the lynx_pcs dependency is only enforced for the altera variant of stmmac, which is the one that actually uses it.

Building stmmac for a non-altera platform therefore causes a link failure:

arm-linux-gnueabi-ld: drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.o: in function `stmmac_mdio_unregister':
stmmac_mdio.c:(.text+0x1418): undefined reference to `lynx_pcs_destroy'

Quoted 7 lines
Quoted 5 lines

I've tried to come up with a patch that moves this dependency back into the dwmac-socfpga.c file, but there was no easy and obvious way to do this. It also seems that this would not be a proper solution, but instead there should be a real abstraction for pcs drivers that lets device drivers handle this transparently.

There is already a patch set on netdev fixing this properly.

Yes, let's focus on the solution proposed here:
https://lore.kernel.org/netdev/[email protected]/T/#t

Signature · 1 line
pw-bot: reject