summaryrefslogtreecommitdiff
path: root/drivers/net/phy/at803x.c
diff options
context:
space:
mode:
authorLuo Jie <luoj@codeaurora.org>2021-10-24 11:27:37 +0300
committerDavid S. Miller <davem@davemloft.net>2021-10-25 16:04:18 +0300
commit8bc1c5430c4bbeaa2b0b5d5ca147ce85d492c775 (patch)
tree20c2582617928ea8b583cf48c96259ecd1b71f5a /drivers/net/phy/at803x.c
parent9d4dae29624f1b9467f58d596174803cde9be7a1 (diff)
downloadlinux-8bc1c5430c4bbeaa2b0b5d5ca147ce85d492c775.tar.xz
net: phy: adjust qca8081 master/slave seed value if link down
1. The master/slave seed needs to be updated when the link can't be created. 2. The case where two qca8081 PHYs are connected each other and master/slave seed is generated as the same value also needs to be considered, so adding this code change into read_status instead of link_change_notify. Signed-off-by: Luo Jie <luoj@codeaurora.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/at803x.c')
-rw-r--r--drivers/net/phy/at803x.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index 1418db4f2091..00733badcda5 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -1655,6 +1655,22 @@ static int qca808x_read_status(struct phy_device *phydev)
else
phydev->interface = PHY_INTERFACE_MODE_SMII;
+ /* generate seed as a lower random value to make PHY linked as SLAVE easily,
+ * except for master/slave configuration fault detected.
+ * the reason for not putting this code into the function link_change_notify is
+ * the corner case where the link partner is also the qca8081 PHY and the seed
+ * value is configured as the same value, the link can't be up and no link change
+ * occurs.
+ */
+ if (!phydev->link) {
+ if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR) {
+ qca808x_phy_ms_seed_enable(phydev, false);
+ } else {
+ qca808x_phy_ms_random_seed_set(phydev);
+ qca808x_phy_ms_seed_enable(phydev, true);
+ }
+ }
+
return 0;
}