1 From 4f3a00c7f5b2cfe4e127fd3fe49b55e1b318c01f Mon Sep 17 00:00:00 2001
2 From: Robert Hancock <robert.hancock@calian.com>
3 Date: Tue, 25 Jan 2022 10:54:08 -0600
4 Subject: [PATCH] net: phy: at803x: move page selection fix to config_init
6 The fix to select the copper page on AR8031 was being done in the probe
7 function rather than config_init, so it would not be redone after resume
8 from suspend. Move this to config_init so it is always redone when
11 Fixes: c329e5afb42f ("net: phy: at803x: select correct page on config init")
12 Signed-off-by: Robert Hancock <robert.hancock@calian.com>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
15 drivers/net/phy/at803x.c | 40 ++++++++++++++++------------------------
16 1 file changed, 16 insertions(+), 24 deletions(-)
18 --- a/drivers/net/phy/at803x.c
19 +++ b/drivers/net/phy/at803x.c
20 @@ -651,25 +651,7 @@ static int at803x_probe(struct phy_devic
24 - /* Some bootloaders leave the fiber page selected.
25 - * Switch to the copper page, as otherwise we read
26 - * the PHY capabilities from the fiber side.
28 - if (at803x_match_phy_id(phydev, ATH8031_PHY_ID)) {
29 - phy_lock_mdio_bus(phydev);
30 - ret = at803x_write_page(phydev, AT803X_PAGE_COPPER);
31 - phy_unlock_mdio_bus(phydev);
40 - regulator_disable(priv->vddio);
45 static void at803x_remove(struct phy_device *phydev)
46 @@ -745,6 +727,22 @@ static int at803x_config_init(struct phy
50 + if (phydev->drv->phy_id == ATH8031_PHY_ID) {
51 + /* Some bootloaders leave the fiber page selected.
52 + * Switch to the copper page, as otherwise we read
53 + * the PHY capabilities from the fiber side.
55 + phy_lock_mdio_bus(phydev);
56 + ret = at803x_write_page(phydev, AT803X_PAGE_COPPER);
57 + phy_unlock_mdio_bus(phydev);
61 + ret = at8031_pll_config(phydev);
66 /* The RX and TX delay default is:
67 * after HW reset: RX delay enabled and TX delay disabled
68 * after SW reset: RX delay enabled, while TX delay retains the
69 @@ -770,12 +768,6 @@ static int at803x_config_init(struct phy
73 - if (at803x_match_phy_id(phydev, ATH8031_PHY_ID)) {
74 - ret = at8031_pll_config(phydev);