c121eb4a35859806f36ad163eefb2d4c3ba40237
[openwrt/staging/blogic.git] /
1 From 3b423061eb3a62e59b57939ae1e1234756a0f6a1 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
3 Date: Mon, 22 Jan 2024 08:35:58 +0300
4 Subject: [PATCH 29/48] net: dsa: mt7530: do not run mt7530_setup_port5() if
5 port 5 is disabled
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 There's no need to run all the code on mt7530_setup_port5() if port 5 is
11 disabled. The only case for calling mt7530_setup_port5() from
12 mt7530_setup() is when PHY muxing is enabled. That is because port 5 is not
13 defined as a port on the devicetree, therefore, it cannot be controlled by
14 phylink.
15
16 Because of this, run mt7530_setup_port5() if priv->p5_intf_sel is
17 P5_INTF_SEL_PHY_P0 or P5_INTF_SEL_PHY_P4. Remove the P5_DISABLED case from
18 mt7530_setup_port5().
19
20 Stop initialising the interface variable as the remaining cases will always
21 call mt7530_setup_port5() with it initialised.
22
23 Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
24 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
25 Link: https://lore.kernel.org/r/20240122-for-netnext-mt7530-improvements-1-v3-7-042401f2b279@arinc9.com
26 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
27 ---
28 drivers/net/dsa/mt7530.c | 9 +++------
29 1 file changed, 3 insertions(+), 6 deletions(-)
30
31 --- a/drivers/net/dsa/mt7530.c
32 +++ b/drivers/net/dsa/mt7530.c
33 @@ -935,9 +935,6 @@ static void mt7530_setup_port5(struct ds
34 /* MT7530_P5_MODE_GMAC: P5 -> External phy or 2nd GMAC */
35 val &= ~MHWTRAP_P5_DIS;
36 break;
37 - case P5_DISABLED:
38 - interface = PHY_INTERFACE_MODE_NA;
39 - break;
40 default:
41 dev_err(ds->dev, "Unsupported p5_intf_sel %d\n",
42 priv->p5_intf_sel);
43 @@ -2358,8 +2355,6 @@ mt7530_setup(struct dsa_switch *ds)
44 * Set priv->p5_intf_sel to the appropriate value if PHY muxing
45 * is detected.
46 */
47 - interface = PHY_INTERFACE_MODE_NA;
48 -
49 for_each_child_of_node(dn, mac_np) {
50 if (!of_device_is_compatible(mac_np,
51 "mediatek,eth-mac"))
52 @@ -2391,7 +2386,9 @@ mt7530_setup(struct dsa_switch *ds)
53 break;
54 }
55
56 - mt7530_setup_port5(ds, interface);
57 + if (priv->p5_intf_sel == P5_INTF_SEL_PHY_P0 ||
58 + priv->p5_intf_sel == P5_INTF_SEL_PHY_P4)
59 + mt7530_setup_port5(ds, interface);
60 }
61
62 #ifdef CONFIG_GPIOLIB