a5cc67a8c8e19c22708322045ed694e3f1d934a8
[openwrt/staging/neocturne.git] /
1 From 900eef75cc5018e149c52fe305c9c3fe424c52a7 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Fri, 8 Dec 2023 15:51:52 +0100
4 Subject: [PATCH 05/13] net: phy: at803x: move specific DT option for at8031 to
5 specific probe
6
7 Move specific DT options for at8031 to specific probe to tidy things up
8 and make at803x_parse_dt more generic.
9
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>
13 ---
14 drivers/net/phy/at803x.c | 55 ++++++++++++++++++++++------------------
15 1 file changed, 31 insertions(+), 24 deletions(-)
16
17 --- a/drivers/net/phy/at803x.c
18 +++ b/drivers/net/phy/at803x.c
19 @@ -825,30 +825,6 @@ static int at803x_parse_dt(struct phy_de
20 }
21 }
22
23 - /* Only supported on AR8031/AR8033, the AR8030/AR8035 use strapping
24 - * options.
25 - */
26 - if (phydev->drv->phy_id == ATH8031_PHY_ID) {
27 - if (of_property_read_bool(node, "qca,keep-pll-enabled"))
28 - priv->flags |= AT803X_KEEP_PLL_ENABLED;
29 -
30 - ret = at8031_register_regulators(phydev);
31 - if (ret < 0)
32 - return ret;
33 -
34 - ret = devm_regulator_get_enable_optional(&phydev->mdio.dev,
35 - "vddio");
36 - if (ret) {
37 - phydev_err(phydev, "failed to get VDDIO regulator\n");
38 - return ret;
39 - }
40 -
41 - /* Only AR8031/8033 support 1000Base-X for SFP modules */
42 - ret = phy_sfp_probe(phydev, &at803x_sfp_ops);
43 - if (ret < 0)
44 - return ret;
45 - }
46 -
47 return 0;
48 }
49
50 @@ -1582,6 +1558,30 @@ static int at803x_cable_test_start(struc
51 return 0;
52 }
53
54 +static int at8031_parse_dt(struct phy_device *phydev)
55 +{
56 + struct device_node *node = phydev->mdio.dev.of_node;
57 + struct at803x_priv *priv = phydev->priv;
58 + int ret;
59 +
60 + if (of_property_read_bool(node, "qca,keep-pll-enabled"))
61 + priv->flags |= AT803X_KEEP_PLL_ENABLED;
62 +
63 + ret = at8031_register_regulators(phydev);
64 + if (ret < 0)
65 + return ret;
66 +
67 + ret = devm_regulator_get_enable_optional(&phydev->mdio.dev,
68 + "vddio");
69 + if (ret) {
70 + phydev_err(phydev, "failed to get VDDIO regulator\n");
71 + return ret;
72 + }
73 +
74 + /* Only AR8031/8033 support 1000Base-X for SFP modules */
75 + return phy_sfp_probe(phydev, &at803x_sfp_ops);
76 +}
77 +
78 static int at8031_probe(struct phy_device *phydev)
79 {
80 int ret;
81 @@ -1590,6 +1590,13 @@ static int at8031_probe(struct phy_devic
82 if (ret)
83 return ret;
84
85 + /* Only supported on AR8031/AR8033, the AR8030/AR8035 use strapping
86 + * options.
87 + */
88 + ret = at8031_parse_dt(phydev);
89 + if (ret)
90 + return ret;
91 +
92 /* Disable WoL in 1588 register which is enabled
93 * by default
94 */