1 From 3ae3bc426eaf57ca8f53d75777d9a5ef779bc7b7 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Fri, 8 Dec 2023 15:51:54 +0100
4 Subject: [PATCH 07/13] net: phy: at803x: move specific at8031 config_init to
7 Move specific at8031 config_init to dedicated function to make
8 at803x_config_init more generic and tidy things up.
10 Signed-off-by: Christian Marangi <ansuelsmth@gmail.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 | 45 ++++++++++++++++++++++------------------
15 1 file changed, 25 insertions(+), 20 deletions(-)
17 --- a/drivers/net/phy/at803x.c
18 +++ b/drivers/net/phy/at803x.c
19 @@ -951,27 +951,8 @@ static int at803x_hibernation_mode_confi
21 static int at803x_config_init(struct phy_device *phydev)
23 - struct at803x_priv *priv = phydev->priv;
26 - if (phydev->drv->phy_id == ATH8031_PHY_ID) {
27 - /* Some bootloaders leave the fiber page selected.
28 - * Switch to the appropriate page (fiber or copper), as otherwise we
29 - * read the PHY capabilities from the wrong page.
31 - phy_lock_mdio_bus(phydev);
32 - ret = at803x_write_page(phydev,
33 - priv->is_fiber ? AT803X_PAGE_FIBER :
34 - AT803X_PAGE_COPPER);
35 - phy_unlock_mdio_bus(phydev);
39 - ret = at8031_pll_config(phydev);
44 /* The RX and TX delay default is:
45 * after HW reset: RX delay enabled and TX delay disabled
46 * after SW reset: RX delay enabled, while TX delay retains the
47 @@ -1604,6 +1585,30 @@ static int at8031_probe(struct phy_devic
51 +static int at8031_config_init(struct phy_device *phydev)
53 + struct at803x_priv *priv = phydev->priv;
56 + /* Some bootloaders leave the fiber page selected.
57 + * Switch to the appropriate page (fiber or copper), as otherwise we
58 + * read the PHY capabilities from the wrong page.
60 + phy_lock_mdio_bus(phydev);
61 + ret = at803x_write_page(phydev,
62 + priv->is_fiber ? AT803X_PAGE_FIBER :
63 + AT803X_PAGE_COPPER);
64 + phy_unlock_mdio_bus(phydev);
68 + ret = at8031_pll_config(phydev);
72 + return at803x_config_init(phydev);
75 static int qca83xx_config_init(struct phy_device *phydev)
78 @@ -2113,7 +2118,7 @@ static struct phy_driver at803x_driver[]
79 .name = "Qualcomm Atheros AR8031/AR8033",
80 .flags = PHY_POLL_CABLE_TEST,
81 .probe = at8031_probe,
82 - .config_init = at803x_config_init,
83 + .config_init = at8031_config_init,
84 .config_aneg = at803x_config_aneg,
85 .soft_reset = genphy_soft_reset,
86 .set_wol = at803x_set_wol,