0bb64c3c5e99247923266d8043975d57d92c666a
[openwrt/staging/robimarko.git] /
1 From 6de2852297737171ba96b91e89bf302ca1fda869 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Mon, 3 Apr 2023 02:18:04 +0100
4 Subject: [PATCH 08/16] net: dsa: mt7530: move SGMII PCS creation to
5 mt7530_probe function
6
7 Move creating the SGMII PCS from mt753x_setup() to the more appropriate
8 mt7530_probe() function.
9 This is done also in preparation of moving all functions related to
10 MDIO-connected MT753x switches to a separate module.
11
12 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
13 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
15 ---
16 drivers/net/dsa/mt7530.c | 13 +++++++------
17 1 file changed, 7 insertions(+), 6 deletions(-)
18
19 --- a/drivers/net/dsa/mt7530.c
20 +++ b/drivers/net/dsa/mt7530.c
21 @@ -3007,12 +3007,6 @@ mt753x_setup(struct dsa_switch *ds)
22 if (ret && priv->irq)
23 mt7530_free_irq_common(priv);
24
25 - if (priv->id == ID_MT7531) {
26 - ret = mt7531_create_sgmii(priv);
27 - if (ret && priv->irq)
28 - mt7530_free_irq_common(priv);
29 - }
30 -
31 return ret;
32 }
33
34 @@ -3129,6 +3123,7 @@ mt7530_probe(struct mdio_device *mdiodev
35 static struct regmap_config *regmap_config;
36 struct mt7530_priv *priv;
37 struct device_node *dn;
38 + int ret;
39
40 dn = mdiodev->dev.of_node;
41
42 @@ -3221,6 +3216,12 @@ mt7530_probe(struct mdio_device *mdiodev
43 if (IS_ERR(priv->regmap))
44 return PTR_ERR(priv->regmap);
45
46 + if (priv->id == ID_MT7531) {
47 + ret = mt7531_create_sgmii(priv);
48 + if (ret)
49 + return ret;
50 + }
51 +
52 return dsa_register_switch(priv->ds);
53 }
54