6c5bebdd8024df71497780443949d9c07a5f4e05
[openwrt/staging/neocturne.git] /
1 From f3cf1d06e2aef644b426c23b4bb570780b1f8d47 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 05/13] 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 @@ -3049,12 +3049,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 @@ -3171,6 +3165,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 @@ -3263,6 +3258,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