Skip to contentSkip to conversation

net: dsa: bcm_sf2: don't warn when BCM4908 port 7 is not used

PATCH In review Kordian Chmielewski 2 participants 3 messages Dec 2 – Dec 3

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

PATCH 1/1 net: dsa: bcm_sf2: don't warn when BCM4908 port 7 is not used

bcm_sf2_crossbar_setup() connects port 7 of the BCM4908 switch to the internal GPHY4 or to the RGMII pins, depending on the port's mode, and warns "Invalid port mode" otherwise. A device tree that does not use port 7, such as bcm94908.dts, leaves that mode at PHY_INTERFACE_MODE_NA, so bcm_sf2_crossbar_setup() hits the WARN on every call, from bcm_sf2_sw_probe() and from bcm_sf2_sw_resume(), although nothing is wrong.

Return before setting up the port 7 route when port 7 has no mode. The function did not write the register in that case before either, so only the warning goes away. A port 7 node without a valid phy-mode is treated the same way. A port 7 with a mode that the crossbar code does not handle still warns.

Fixes a9349f08ec6c ("net: dsa: bcm_sf2: setup BCM4908 internal crossbar")

---
Tested on a TP-Link Archer AX6000 v1 with OpenWrt and Linux 6.18.55, whose bcm_sf2_crossbar_setup() is the one in net, and a device tree without port 7. Without this patch the boot log has the warning twice, once in each of the two calls of bcm_sf2_sw_probe(); with it there is none. In both cases the four LAN ports registered, and TCP between the router and a host on lan1, the only port with a link, ran at 941 Mbit/s in both directions. Resume was not tested.

 drivers/net/dsa/bcm_sf2.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/dsa/bcm_sf2.c +4 -0
index cbaa5de9b107..f30cedb9ec73 100644
@@ -518,6 +518,10 @@ static void bcm_sf2_crossbar_setup(struct bcm_sf2_priv *priv)
 	reg = reg_readl(priv, REG_CROSSBAR);
 	switch (priv->type) {
 	case BCM4908_DEVICE_ID:
+		/* Nothing to route when the device tree does not use port 7 */
+		if (priv->port_sts[7].mode == PHY_INTERFACE_MODE_NA)
+			return;
+
 		shift = CROSSBAR_BCM4908_INT_P7 * priv->num_crossbar_ext_bits;
 		reg &= ~(mask << shift);
 		if (0) /* FIXME */

base-commit: 0d39bf81267861742b80d5f1c52e8a63e9ca0ca1

Signature · 1 line
2.56.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Kordian Chmielewski

bcm_sf2_crossbar_setup() connects port 7 of the BCM4908 switch to the internal GPHY4 or to the RGMII pins, depending on the port's mode, and warns "Invalid port mode" otherwise. A device tree that does not use port 7, such as bcm94908.dts, leaves that mode at PHY_INTERFACE_MODE_NA, so bcm_sf2_crossbar_setup() hits the WARN on every call, from bcm_sf2_sw_probe() and from bcm_sf2_sw_resume(), although nothing is wrong.

Quoted 8 lines

Return before setting up the port 7 route when port 7 has no mode. The function did not write the register in that case before either, so only the warning goes away. A port 7 node without a valid phy-mode is treated the same way. A port 7 with a mode that the crossbar code does not handle still warns.

Fixes a9349f08ec6c ("net: dsa: bcm_sf2: setup BCM4908 internal crossbar")

Just a nit, and only if Sashiko requires you to respin: there is a disabled encoding with the value 0b11 which would be more appropriate for a disabled port than leave it to GPHY4, but that would be a potential behavioral change, potentially a subsequent change?

Signature · 1 line
Florian
#2 lore raw

Hi Florian,

Quoted 4 lines

Just a nit, and only if Sashiko requires you to respin: there is a disabled encoding with the value 0b11 which would be more appropriate for a disabled port than leave it to GPHY4, but that would be a potential behavioral change, potentially a subsequent change?

Agreed. Writing 0b11 would change the crossbar setting, which this fix leaves alone when port 7 has no mode, so I would keep it out of this fix; it can be a separate change for net-next.

Thanks for the review.

Kordian