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

net: dsa: bcm_sf2: Qualify phydev->dev_flags based on port

Similar to commit 92696286f3bb37ba50e4bd8d1beb24afb759a799 ("net:
bcmgenet: Set phydev->dev_flags only for internal PHYs") we need to
qualify the phydev->dev_flags based on whether the port is connected to
an internal or external PHY otherwise we risk having a flags collision
with a completely different interpretation depending on the driver.

Fixes: aa9aef77c761 ("net: dsa: bcm_sf2: communicate integrated PHY revision to PHY driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Florian Fainelli and committed by
David S. Miller
47142ed6 d45c36ba

+4 -2
+4 -2
drivers/net/dsa/bcm_sf2.c
··· 588 588 * in bits 15:8 and the patch level in bits 7:0 which is exactly what 589 589 * the REG_PHY_REVISION register layout is. 590 590 */ 591 - 592 - return priv->hw_params.gphy_rev; 591 + if (priv->int_phy_mask & BIT(port)) 592 + return priv->hw_params.gphy_rev; 593 + else 594 + return 0; 593 595 } 594 596 595 597 static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port,