1 From df9401ff3e6eeaa42bfb06761967f1b71f5afce7 Mon Sep 17 00:00:00 2001
2 From: Luo Jie <quic_luoj@quicinc.com>
3 Date: Sun, 16 Jul 2023 16:49:23 +0800
4 Subject: [PATCH 5/6] net: phy: at803x: remove qca8081 1G fast retrain and
7 The fast retrain and slave seed configs are only applicable when the 2.5G
10 Signed-off-by: Luo Jie <quic_luoj@quicinc.com>
11 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
14 drivers/net/phy/at803x.c | 50 +++++++++++++++++++++++++---------------
15 1 file changed, 32 insertions(+), 18 deletions(-)
17 --- a/drivers/net/phy/at803x.c
18 +++ b/drivers/net/phy/at803x.c
19 @@ -1755,6 +1755,11 @@ static bool qca808x_is_prefer_master(str
20 (phydev->master_slave_get == MASTER_SLAVE_CFG_MASTER_PREFERRED);
23 +static bool qca808x_has_fast_retrain_or_slave_seed(struct phy_device *phydev)
25 + return linkmode_test_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, phydev->supported);
28 static int qca808x_config_init(struct phy_device *phydev)
31 @@ -1771,20 +1776,24 @@ static int qca808x_config_init(struct ph
35 - /* Config the fast retrain for the link 2500M */
36 - ret = qca808x_phy_fast_retrain_config(phydev);
40 - ret = genphy_read_master_slave(phydev);
44 - if (!qca808x_is_prefer_master(phydev)) {
45 - /* Enable seed and configure lower ramdom seed to make phy linked as slave mode */
46 - ret = qca808x_phy_ms_seed_enable(phydev, true);
47 + if (qca808x_has_fast_retrain_or_slave_seed(phydev)) {
48 + /* Config the fast retrain for the link 2500M */
49 + ret = qca808x_phy_fast_retrain_config(phydev);
53 + ret = genphy_read_master_slave(phydev);
57 + if (!qca808x_is_prefer_master(phydev)) {
58 + /* Enable seed and configure lower ramdom seed to make phy
59 + * linked as slave mode.
61 + ret = qca808x_phy_ms_seed_enable(phydev, true);
67 /* Configure adc threshold as 100mv for the link 10M */
68 @@ -1826,11 +1835,13 @@ static int qca808x_read_status(struct ph
69 * value is configured as the same value, the link can't be up and no link change
72 - if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR ||
73 - qca808x_is_prefer_master(phydev)) {
74 - qca808x_phy_ms_seed_enable(phydev, false);
76 - qca808x_phy_ms_seed_enable(phydev, true);
77 + if (qca808x_has_fast_retrain_or_slave_seed(phydev)) {
78 + if (phydev->master_slave_state == MASTER_SLAVE_STATE_ERR ||
79 + qca808x_is_prefer_master(phydev)) {
80 + qca808x_phy_ms_seed_enable(phydev, false);
82 + qca808x_phy_ms_seed_enable(phydev, true);
87 @@ -1845,7 +1856,10 @@ static int qca808x_soft_reset(struct phy
91 - return qca808x_phy_ms_seed_enable(phydev, true);
92 + if (qca808x_has_fast_retrain_or_slave_seed(phydev))
93 + ret = qca808x_phy_ms_seed_enable(phydev, true);
98 static bool qca808x_cdt_fault_length_valid(int cdt_code)