c0bfd9bd042e07fe3ed80d76339f2748fb773bbb
[openwrt/staging/neocturne.git] /
1 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
2 Date: Sun, 5 Feb 2023 20:53:31 +0300
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: enable special tag when any MAC
4 uses DSA
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 The special tag is only enabled when the first MAC uses DSA. However, it
10 must be enabled when any MAC uses DSA. Change the check accordingly.
11
12 This fixes hardware DSA untagging not working on the second MAC of the
13 MT7621 and MT7623 SoCs, and likely other SoCs too. Therefore, remove the
14 check that disables hardware DSA untagging for the second MAC of the MT7621
15 and MT7623 SoCs.
16
17 Fixes: a1f47752fd62 ("net: ethernet: mtk_eth_soc: disable hardware DSA untagging for second MAC")
18 Co-developed-by: Richard van Schagen <richard@routerhints.com>
19 Signed-off-by: Richard van Schagen <richard@routerhints.com>
20 Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
21 Signed-off-by: David S. Miller <davem@davemloft.net>
22 ---
23
24 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
25 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
26 @@ -3134,7 +3134,7 @@ static void mtk_gdm_config(struct mtk_et
27
28 val |= config;
29
30 - if (!i && eth->netdev[0] && netdev_uses_dsa(eth->netdev[0]))
31 + if (eth->netdev[i] && netdev_uses_dsa(eth->netdev[i]))
32 val |= MTK_GDMA_SPECIAL_TAG;
33
34 mtk_w32(eth, val, MTK_GDMA_FWD_CFG(i));
35 @@ -3199,8 +3199,7 @@ static int mtk_open(struct net_device *d
36 struct mtk_eth *eth = mac->hw;
37 int i, err;
38
39 - if ((mtk_uses_dsa(dev) && !eth->prog) &&
40 - !(mac->id == 1 && MTK_HAS_CAPS(eth->soc->caps, MTK_GMAC1_TRGMII))) {
41 + if (mtk_uses_dsa(dev) && !eth->prog) {
42 for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) {
43 struct metadata_dst *md_dst = eth->dsa_meta[i];
44
45 @@ -3217,8 +3216,7 @@ static int mtk_open(struct net_device *d
46 }
47 } else {
48 /* Hardware special tag parsing needs to be disabled if at least
49 - * one MAC does not use DSA, or the second MAC of the MT7621 and
50 - * MT7623 SoCs is being used.
51 + * one MAC does not use DSA.
52 */
53 u32 val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
54 val &= ~MTK_CDMP_STAG_EN;