Skip to content

Commit

Permalink
net: dsa: sja1105: fix SGMII PCS being forced to SPEED_UNKNOWN instea…
Browse files Browse the repository at this point in the history
…d of SPEED_10

commit 053d8ad upstream.

When using MLO_AN_PHY or MLO_AN_FIXED, the MII_BMCR of the SGMII PCS is
read before resetting the switch so it can be reprogrammed afterwards.
This works for the speeds of 1Gbps and 100Mbps, but not for 10Mbps,
because SPEED_10 is actually 0, so AND-ing anything with 0 is false,
therefore that last branch is dead code.

Do what others do (genphy_read_status_fixed, phy_mii_ioctl) and just
remove the check for SPEED_10, let it fall into the default case.

Fixes: ffe10e6 ("net: dsa: sja1105: Add support for the SGMII port")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
vladimiroltean authored and gregkh committed Mar 17, 2021
1 parent 2930991 commit 12e1eb5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/dsa/sja1105/sja1105_main.c
Expand Up @@ -1834,7 +1834,7 @@ int sja1105_static_config_reload(struct sja1105_private *priv,
speed = SPEED_1000;
else if (bmcr & BMCR_SPEED100)
speed = SPEED_100;
else if (bmcr & BMCR_SPEED10)
else
speed = SPEED_10;

sja1105_sgmii_pcs_force_speed(priv, speed);
Expand Down

0 comments on commit 12e1eb5

Please sign in to comment.