5a4d343a72cf39deed18bd91501189e65bd13c3a
[openwrt/staging/ansuel.git] /
1 From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <arinc.unal@arinc9.com>
2 Date: Sat, 28 Jan 2023 12:42:32 +0300
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: disable hardware DSA untagging
4 for second MAC
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 According to my tests on MT7621AT and MT7623NI SoCs, hardware DSA untagging
10 won't work on the second MAC. Therefore, disable this feature when the
11 second MAC of the MT7621 and MT7623 SoCs is being used.
12
13 Fixes: 2d7605a72906 ("net: ethernet: mtk_eth_soc: enable hardware DSA untagging")
14 Link: https://lore.kernel.org/netdev/6249fc14-b38a-c770-36b4-5af6d41c21d3@arinc9.com/
15 Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com>
16 Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
17 Link: https://lore.kernel.org/r/20230128094232.2451947-1-arinc.unal@arinc9.com
18 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
19 ---
20
21 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
22 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
23 @@ -3146,7 +3146,8 @@ static int mtk_open(struct net_device *d
24 struct mtk_eth *eth = mac->hw;
25 int i, err;
26
27 - if (mtk_uses_dsa(dev) && !eth->prog) {
28 + if ((mtk_uses_dsa(dev) && !eth->prog) &&
29 + !(mac->id == 1 && MTK_HAS_CAPS(eth->soc->caps, MTK_GMAC1_TRGMII))) {
30 for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) {
31 struct metadata_dst *md_dst = eth->dsa_meta[i];
32
33 @@ -3163,7 +3164,8 @@ static int mtk_open(struct net_device *d
34 }
35 } else {
36 /* Hardware special tag parsing needs to be disabled if at least
37 - * one MAC does not use DSA.
38 + * one MAC does not use DSA, or the second MAC of the MT7621 and
39 + * MT7623 SoCs is being used.
40 */
41 u32 val = mtk_r32(eth, MTK_CDMP_IG_CTRL);
42 val &= ~MTK_CDMP_STAG_EN;