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

net: dsa: bcm_sf2: Fix bcm_sf2_reg_rgmii_cntrl() call for non-RGMII port

We cannot call bcm_sf2_reg_rgmii_cntrl() for a port that is not RGMII,
yet we do that in bcm_sf2_sw_mac_link_up() irrespective of the port's
interface. Move that read until we have properly qualified the PHY
interface mode. This avoids triggering a warning on 7278 platforms that
have GMII ports.

Fixes: 55cfeb396965 ("net: dsa: bcm_sf2: add function finding RGMII register")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Florian Fainelli and committed by
David S. Miller
fc516d3a e5bfaed7

+2 -3
+2 -3
drivers/net/dsa/bcm_sf2.c
··· 821 821 bcm_sf2_sw_mac_link_set(ds, port, interface, true); 822 822 823 823 if (port != core_readl(priv, CORE_IMP0_PRT_ID)) { 824 - u32 reg_rgmii_ctrl; 824 + u32 reg_rgmii_ctrl = 0; 825 825 u32 reg, offset; 826 - 827 - reg_rgmii_ctrl = bcm_sf2_reg_rgmii_cntrl(priv, port); 828 826 829 827 if (priv->type == BCM4908_DEVICE_ID || 830 828 priv->type == BCM7445_DEVICE_ID) ··· 834 836 interface == PHY_INTERFACE_MODE_RGMII_TXID || 835 837 interface == PHY_INTERFACE_MODE_MII || 836 838 interface == PHY_INTERFACE_MODE_REVMII) { 839 + reg_rgmii_ctrl = bcm_sf2_reg_rgmii_cntrl(priv, port); 837 840 reg = reg_readl(priv, reg_rgmii_ctrl); 838 841 reg &= ~(RX_PAUSE_EN | TX_PAUSE_EN); 839 842