f63d4d7705d6e619f43d6f02214a98c2ea3f3c33
[openwrt/staging/wigyori.git] /
1 From 6efc8ae3eb0363328f479191a0cf0dc12a16e090 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 Apr 2024 10:15:20 +0300
4 Subject: [PATCH 13/15] net: dsa: mt7530: use priv->ds->num_ports instead of
5 MT7530_NUM_PORTS
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Use priv->ds->num_ports on all for loops which configure the switch
11 registers. In the future, the value of MT7530_NUM_PORTS will depend on
12 priv->id. Therefore, this change prepares the subdriver for a simpler
13 implementation.
14
15 Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
16 ---
17 drivers/net/dsa/mt7530.c | 8 ++++----
18 1 file changed, 4 insertions(+), 4 deletions(-)
19
20 --- a/drivers/net/dsa/mt7530.c
21 +++ b/drivers/net/dsa/mt7530.c
22 @@ -1411,7 +1411,7 @@ mt7530_port_set_vlan_unaware(struct dsa_
23 mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK,
24 G0_PORT_VID_DEF);
25
26 - for (i = 0; i < MT7530_NUM_PORTS; i++) {
27 + for (i = 0; i < priv->ds->num_ports; i++) {
28 if (dsa_is_user_port(ds, i) &&
29 dsa_port_is_vlan_filtering(dsa_to_port(ds, i))) {
30 all_user_ports_removed = false;
31 @@ -2428,7 +2428,7 @@ mt7530_setup(struct dsa_switch *ds)
32 /* Enable and reset MIB counters */
33 mt7530_mib_reset(ds);
34
35 - for (i = 0; i < MT7530_NUM_PORTS; i++) {
36 + for (i = 0; i < priv->ds->num_ports; i++) {
37 /* Clear link settings and enable force mode to force link down
38 * on all ports until they're enabled later.
39 */
40 @@ -2539,7 +2539,7 @@ mt7531_setup_common(struct dsa_switch *d
41 mt7530_clear(priv, MT753X_MFC, BC_FFP_MASK | UNM_FFP_MASK |
42 UNU_FFP_MASK);
43
44 - for (i = 0; i < MT7530_NUM_PORTS; i++) {
45 + for (i = 0; i < priv->ds->num_ports; i++) {
46 /* Clear link settings and enable force mode to force link down
47 * on all ports until they're enabled later.
48 */
49 @@ -2626,7 +2626,7 @@ mt7531_setup(struct dsa_switch *ds)
50 priv->p5_sgmii = !!(val & PAD_DUAL_SGMII_EN);
51
52 /* Force link down on all ports before internal reset */
53 - for (i = 0; i < MT7530_NUM_PORTS; i++)
54 + for (i = 0; i < priv->ds->num_ports; i++)
55 mt7530_write(priv, MT753X_PMCR_P(i), MT7531_FORCE_MODE_LNK);
56
57 /* Reset the switch through internal reset */