dd886adaa282dbff8b9112d94393c1027b0f90e2
[openwrt/staging/neocturne.git] /
1 From e612922de7070a28802216650ee88128a57290de 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: Tue, 6 Feb 2024 01:08:05 +0300
4 Subject: [PATCH 15/30] net: dsa: mt7530: call port 6 setup from
5 mt7530_mac_config()
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 mt7530_pad_clk_setup() is called if port 6 is enabled. It used to do more
11 things than setting up port 6. That part was moved to more appropriate
12 locations, mt7530_setup() and mt7530_pll_setup().
13
14 Now that all it does is set up port 6, rename it to mt7530_setup_port6(),
15 and move it to a more appropriate location, under mt7530_mac_config().
16
17 Change mt7530_setup_port6() to void as there're no error cases.
18
19 Leave an empty mt7530_pad_clk_setup() to satisfy the pad_setup function
20 pointer.
21
22 This is the code path for setting up the ports before:
23
24 dsa_switch_ops :: phylink_mac_config() -> mt753x_phylink_mac_config()
25 -> mt753x_mac_config()
26 -> mt753x_info :: mac_port_config() -> mt7530_mac_config()
27 -> mt7530_setup_port5()
28 -> mt753x_pad_setup()
29 -> mt753x_info :: pad_setup() -> mt7530_pad_clk_setup()
30
31 This is after:
32
33 dsa_switch_ops :: phylink_mac_config() -> mt753x_phylink_mac_config()
34 -> mt753x_mac_config()
35 -> mt753x_info :: mac_port_config() -> mt7530_mac_config()
36 -> mt7530_setup_port5()
37 -> mt7530_setup_port6()
38
39 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
40 Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
41 Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
42 Link: https://lore.kernel.org/r/20240206-for-netnext-mt7530-improvements-2-v5-4-d7d92a185cb1@arinc9.com
43 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
44 ---
45 drivers/net/dsa/mt7530.c | 19 +++++++++++--------
46 1 file changed, 11 insertions(+), 8 deletions(-)
47
48 --- a/drivers/net/dsa/mt7530.c
49 +++ b/drivers/net/dsa/mt7530.c
50 @@ -414,8 +414,8 @@ mt753x_preferred_default_local_cpu_port(
51 }
52
53 /* Setup port 6 interface mode and TRGMII TX circuit */
54 -static int
55 -mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
56 +static void
57 +mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface)
58 {
59 struct mt7530_priv *priv = ds->priv;
60 u32 ncpo1, ssc_delta, xtal;
61 @@ -426,7 +426,7 @@ mt7530_pad_clk_setup(struct dsa_switch *
62 if (interface == PHY_INTERFACE_MODE_RGMII) {
63 mt7530_rmw(priv, MT7530_P6ECR, P6_INTF_MODE_MASK,
64 P6_INTF_MODE(0));
65 - return 0;
66 + return;
67 }
68
69 mt7530_rmw(priv, MT7530_P6ECR, P6_INTF_MODE_MASK, P6_INTF_MODE(1));
70 @@ -465,7 +465,11 @@ mt7530_pad_clk_setup(struct dsa_switch *
71
72 /* Enable the MT7530 TRGMII clocks */
73 core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_TRGMIICK_EN);
74 +}
75
76 +static int
77 +mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
78 +{
79 return 0;
80 }
81
82 @@ -2649,11 +2653,10 @@ mt7530_mac_config(struct dsa_switch *ds,
83 {
84 struct mt7530_priv *priv = ds->priv;
85
86 - /* Only need to setup port5. */
87 - if (port != 5)
88 - return 0;
89 -
90 - mt7530_setup_port5(priv->ds, interface);
91 + if (port == 5)
92 + mt7530_setup_port5(priv->ds, interface);
93 + else if (port == 6)
94 + mt7530_setup_port6(priv->ds, interface);
95
96 return 0;
97 }