90cdf29d8f9c8fae1ec174dee1ec457b5b93f857
[openwrt/openwrt.git] /
1 From 69e689e28191f9a242de6821a85f2c5ae4dbd5ae 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: Fri, 1 Mar 2024 12:42:57 +0200
4 Subject: [PATCH 19/30] net: dsa: mt7530: remove .mac_port_config for MT7988
5 and make it optional
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 For the switch on the MT7988 SoC, the mac_port_config member for ID_MT7988
11 in mt753x_table is not needed as the interfaces of all MACs are already
12 handled on mt7988_mac_port_get_caps().
13
14 Therefore, remove the mac_port_config member from ID_MT7988 in
15 mt753x_table. Before calling priv->info->mac_port_config(), if there's no
16 mac_port_config member in mt753x_table, exit mt753x_mac_config()
17 successfully.
18
19 Remove calling priv->info->mac_port_config() from the sanity check as the
20 sanity check requires a pointer to a mac_port_config function to be
21 non-NULL. This will fail for MT7988 as mac_port_config won't be a member of
22 its info table.
23
24 Co-developed-by: Daniel Golle <daniel@makrotopia.org>
25 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
26 Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
27 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
28 Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
29 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
30 ---
31 drivers/net/dsa/mt7530.c | 18 ++++--------------
32 1 file changed, 4 insertions(+), 14 deletions(-)
33
34 --- a/drivers/net/dsa/mt7530.c
35 +++ b/drivers/net/dsa/mt7530.c
36 @@ -2853,17 +2853,6 @@ static bool mt753x_is_mac_port(u32 port)
37 }
38
39 static int
40 -mt7988_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
41 - phy_interface_t interface)
42 -{
43 - if (dsa_is_cpu_port(ds, port) &&
44 - interface == PHY_INTERFACE_MODE_INTERNAL)
45 - return 0;
46 -
47 - return -EINVAL;
48 -}
49 -
50 -static int
51 mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
52 phy_interface_t interface)
53 {
54 @@ -2903,6 +2892,9 @@ mt753x_mac_config(struct dsa_switch *ds,
55 {
56 struct mt7530_priv *priv = ds->priv;
57
58 + if (!priv->info->mac_port_config)
59 + return 0;
60 +
61 return priv->info->mac_port_config(ds, port, mode, state->interface);
62 }
63
64 @@ -3366,7 +3358,6 @@ const struct mt753x_info mt753x_table[]
65 .phy_write_c45 = mt7531_ind_c45_phy_write,
66 .cpu_port_config = mt7988_cpu_port_config,
67 .mac_port_get_caps = mt7988_mac_port_get_caps,
68 - .mac_port_config = mt7988_mac_config,
69 },
70 };
71 EXPORT_SYMBOL_GPL(mt753x_table);
72 @@ -3394,8 +3385,7 @@ mt7530_probe_common(struct mt7530_priv *
73 * properly.
74 */
75 if (!priv->info->sw_setup || !priv->info->phy_read_c22 ||
76 - !priv->info->phy_write_c22 || !priv->info->mac_port_get_caps ||
77 - !priv->info->mac_port_config)
78 + !priv->info->phy_write_c22 || !priv->info->mac_port_get_caps)
79 return -EINVAL;
80
81 priv->id = priv->info->id;