0baca3d7c2d6946690ecaf5d432c7ee0702ff7d3
[openwrt/staging/blocktrron.git] /
1 From 86b9ea6412af41914ef6549f85a849c3b987f4f3 Mon Sep 17 00:00:00 2001
2 From: Martin Schiller <ms@dev.tdt.de>
3 Date: Tue, 11 Jun 2024 15:54:28 +0200
4 Subject: net: dsa: lantiq_gswip: do also enable or disable cpu port
5
6 Before commit 74be4babe72f ("net: dsa: do not enable or disable non user
7 ports"), gswip_port_enable/disable() were also executed for the cpu port
8 in gswip_setup() which disabled the cpu port during initialization.
9
10 Let's restore this by removing the dsa_is_user_port checks. Also, let's
11 clean up the gswip_port_enable() function so that we only have to check
12 for the cpu port once. The operation reordering done here is safe.
13
14 Signed-off-by: Martin Schiller <ms@dev.tdt.de>
15 Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
16 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
17 Link: https://lore.kernel.org/r/20240611135434.3180973-7-ms@dev.tdt.de
18 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
19 ---
20 drivers/net/dsa/lantiq_gswip.c | 24 ++++++++----------------
21 1 file changed, 8 insertions(+), 16 deletions(-)
22
23 --- a/drivers/net/dsa/lantiq_gswip.c
24 +++ b/drivers/net/dsa/lantiq_gswip.c
25 @@ -688,13 +688,18 @@ static int gswip_port_enable(struct dsa_
26 struct gswip_priv *priv = ds->priv;
27 int err;
28
29 - if (!dsa_is_user_port(ds, port))
30 - return 0;
31 -
32 if (!dsa_is_cpu_port(ds, port)) {
33 + u32 mdio_phy = 0;
34 +
35 err = gswip_add_single_port_br(priv, port, true);
36 if (err)
37 return err;
38 +
39 + if (phydev)
40 + mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK;
41 +
42 + gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy,
43 + GSWIP_MDIO_PHYp(port));
44 }
45
46 /* RMON Counter Enable for port */
47 @@ -707,16 +712,6 @@ static int gswip_port_enable(struct dsa_
48 gswip_switch_mask(priv, 0, GSWIP_SDMA_PCTRL_EN,
49 GSWIP_SDMA_PCTRLp(port));
50
51 - if (!dsa_is_cpu_port(ds, port)) {
52 - u32 mdio_phy = 0;
53 -
54 - if (phydev)
55 - mdio_phy = phydev->mdio.addr & GSWIP_MDIO_PHY_ADDR_MASK;
56 -
57 - gswip_mdio_mask(priv, GSWIP_MDIO_PHY_ADDR_MASK, mdio_phy,
58 - GSWIP_MDIO_PHYp(port));
59 - }
60 -
61 return 0;
62 }
63
64 @@ -724,9 +719,6 @@ static void gswip_port_disable(struct ds
65 {
66 struct gswip_priv *priv = ds->priv;
67
68 - if (!dsa_is_user_port(ds, port))
69 - return;
70 -
71 gswip_switch_mask(priv, GSWIP_FDMA_PCTRL_EN, 0,
72 GSWIP_FDMA_PCTRLp(port));
73 gswip_switch_mask(priv, GSWIP_SDMA_PCTRL_EN, 0,