]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: sja1105: fix SGMII PCS being forced to SPEED_UNKNOWN instead of SPEED_10
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 4 Mar 2021 10:56:53 +0000 (12:56 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 Mar 2021 22:19:01 +0000 (14:19 -0800)
commitce2457eb52286bc42f4e080a3f9933c5c92721f7
tree1e78be70c7fe83001a8c68957e6da91d15d81a61
parente4760fdcb6f48d365bf9041134562c3eee70aa8b
net: dsa: sja1105: fix SGMII PCS being forced to SPEED_UNKNOWN instead of SPEED_10

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: 89a26b5b0d24 ("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>
drivers/net/dsa/sja1105/sja1105_main.c