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") Signed-off-by: Kordian Chmielewski --- 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(+) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index cbaa5de9b107..f30cedb9ec73 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -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 -- 2.56.1