mediatek: update to latest kernel patchset from v4.13-rc
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.9 / 0029-net-next-ethernet-mediatek-add-CDM-able-to-recognize.patch
1 From de3c04b820e1d396bf12e88ea87271a84f6fedb7 Mon Sep 17 00:00:00 2001
2 From: Sean Wang <sean.wang@mediatek.com>
3 Date: Wed, 29 Mar 2017 17:38:21 +0800
4 Subject: [PATCH 29/57] net-next: ethernet: mediatek: add CDM able to recognize
5 the tag for DSA
6
7 The patch adds the setup for allowing CDM can recognize these packets with
8 carrying port-distinguishing tag. Otherwise, these tagging packets will be
9 handled incorrectly by CDM. The setup is also working out for general
10 untag packets as well.
11
12 Signed-off-by: Sean Wang <sean.wang@mediatek.com>
13 Signed-off-by: Landen Chao <Landen.Chao@mediatek.com>
14 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
15 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
16 ---
17 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++++++
18 drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 ++++
19 2 files changed, 10 insertions(+)
20
21 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
22 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
23 @@ -1864,6 +1864,12 @@ static int mtk_hw_init(struct mtk_eth *e
24 val = mtk_r32(eth, MTK_CDMQ_IG_CTRL);
25 mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL);
26
27 + /* Indicates CDM to parse the MTK special tag from CPU
28 + * which also is working out for untag packets.
29 + */
30 + val = mtk_r32(eth, MTK_CDMQ_IG_CTRL);
31 + mtk_w32(eth, val | MTK_CDMQ_STAG_EN, MTK_CDMQ_IG_CTRL);
32 +
33 /* Enable RX VLan Offloading */
34 mtk_w32(eth, 1, MTK_CDMP_EG_CTRL);
35
36 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
37 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
38 @@ -74,6 +74,10 @@
39 #define MTK_CDMQ_IG_CTRL 0x1400
40 #define MTK_CDMQ_STAG_EN BIT(0)
41
42 +/* CDMP Ingress Control Register */
43 +#define MTK_CDMQ_IG_CTRL 0x1400
44 +#define MTK_CDMQ_STAG_EN BIT(0)
45 +
46 /* CDMP Exgress Control Register */
47 #define MTK_CDMP_EG_CTRL 0x404
48