Commit e28a100e authored by Florian Fainelli's avatar Florian Fainelli Committed by Zheng Zengkai
Browse files

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



stable inclusion
from stable-5.10.27
commit 4c91fc60e3f60be4cfcf180c247de97995b1ed00
bugzilla: 51493

--------------------------------

[ Upstream commit 47142ed6 ]

Similar to commit 92696286 ("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: aa9aef77 ("net: dsa: bcm_sf2: communicate integrated PHY revision to PHY driver")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Acked-by: default avatar&nbsp; Weilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 7d8e0370
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -584,8 +584,10 @@ static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port)
	 * in bits 15:8 and the patch level in bits 7:0 which is exactly what
	 * the REG_PHY_REVISION register layout is.
	 */

	if (priv->int_phy_mask & BIT(port))
		return priv->hw_params.gphy_rev;
	else
		return 0;
}

static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port,