mediatek: fix sysupgrade on eMMC boards
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.9 / 0092-dsa3.patch
1 From patchwork Wed Mar 29 09:38:21 2017
2 Content-Type: text/plain; charset="utf-8"
3 MIME-Version: 1.0
4 Content-Transfer-Encoding: 7bit
5 Subject: [net-next, v3,
6 3/5] net-next: ethernet: mediatek: add CDM able to recognize the tag
7 for DSA
8 From: sean.wang@mediatek.com
9 X-Patchwork-Id: 9651091
10 Message-Id: <1490780303-18598-4-git-send-email-sean.wang@mediatek.com>
11 To: <andrew@lunn.ch>, <f.fainelli@gmail.com>,
12 <vivien.didelot@savoirfairelinux.com>, <matthias.bgg@gmail.com>,
13 <robh+dt@kernel.org>, <mark.rutland@arm.com>
14 Cc: devicetree@vger.kernel.org, Landen.Chao@mediatek.com, keyhaede@gmail.com,
15 netdev@vger.kernel.org, sean.wang@mediatek.com,
16 linux-kernel@vger.kernel.org,
17 linux-mediatek@lists.infradead.org, objelf@gmail.com, davem@davemloft.net
18 Date: Wed, 29 Mar 2017 17:38:21 +0800
19
20 From: Sean Wang <sean.wang@mediatek.com>
21
22 The patch adds the setup for allowing CDM can recognize these packets with
23 carrying port-distinguishing tag. Otherwise, these tagging packets will be
24 handled incorrectly by CDM. The setup is also working out for general
25 untag packets as well.
26
27 Signed-off-by: Sean Wang <sean.wang@mediatek.com>
28 Signed-off-by: Landen Chao <Landen.Chao@mediatek.com>
29 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
30 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
31 ---
32 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++++++
33 drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 ++++
34 2 files changed, 10 insertions(+)
35
36 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
37 index 9e75768..c21ed99 100644
38 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
39 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
40 @@ -1846,6 +1846,12 @@ static int mtk_hw_init(struct mtk_eth *eth)
41 /* GE2, Force 1000M/FD, FC ON */
42 mtk_w32(eth, MAC_MCR_FIXED_LINK, MTK_MAC_MCR(1));
43
44 + /* Indicates CDM to parse the MTK special tag from CPU
45 + * which also is working out for untag packets.
46 + */
47 + val = mtk_r32(eth, MTK_CDMQ_IG_CTRL);
48 + mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL);
49 +
50 /* Enable RX VLan Offloading */
51 mtk_w32(eth, 1, MTK_CDMP_EG_CTRL);
52
53 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
54 index 99b1c8e..996024d 100644
55 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
56 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
57 @@ -70,6 +70,10 @@
58 /* Frame Engine Interrupt Grouping Register */
59 #define MTK_FE_INT_GRP 0x20
60
61 +/* CDMP Ingress Control Register */
62 +#define MTK_CDMQ_IG_CTRL 0x1400
63 +#define MTK_CDMQ_STAG_EN BIT(0)
64 +
65 /* CDMP Exgress Control Register */
66 #define MTK_CDMP_EG_CTRL 0x404
67