mediatek: Add support for Xiaomi Redmi Router AX6S
[openwrt/openwrt.git] / target / linux / layerscape / patches-5.4 / 701-net-0300-staging-fsl_ppfe-eth-use-mask-for-rx-max-frame-len.patch
1 From f5be11cd83a6d6d4de7bd7cbeb641bb1032c4f84 Mon Sep 17 00:00:00 2001
2 From: Calvin Johnson <calvin.johnson@nxp.com>
3 Date: Wed, 20 Jun 2018 10:22:50 +0530
4 Subject: [PATCH] staging: fsl_ppfe/eth: use mask for rx max frame len
5
6 Define and use PFE_RCR_MAX_FL_MASK to properly set Rx max frame
7 length of MAC Receive Control Register.
8
9 Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
10 ---
11 drivers/staging/fsl_ppfe/pfe_hal.c | 10 ++++++----
12 1 file changed, 6 insertions(+), 4 deletions(-)
13
14 --- a/drivers/staging/fsl_ppfe/pfe_hal.c
15 +++ b/drivers/staging/fsl_ppfe/pfe_hal.c
16 @@ -19,6 +19,8 @@
17 #include "pfe_mod.h"
18 #include "pfe/pfe.h"
19
20 +#define PFE_RCR_MAX_FL_MASK 0xC000FFFF
21 +
22 void *cbus_base_addr;
23 void *ddr_base_addr;
24 unsigned long ddr_phys_base_addr;
25 @@ -1011,8 +1013,8 @@ void gemac_no_broadcast(void *base)
26 void gemac_enable_1536_rx(void *base)
27 {
28 /* Set 1536 as Maximum frame length */
29 - writel(readl(base + EMAC_RCNTRL_REG) | (1536 << 16), base +
30 - EMAC_RCNTRL_REG);
31 + writel((readl(base + EMAC_RCNTRL_REG) & PFE_RCR_MAX_FL_MASK)
32 + | (1536 << 16), base + EMAC_RCNTRL_REG);
33 }
34
35 /* GEMAC enable jumbo function.
36 @@ -1020,8 +1022,8 @@ void gemac_enable_1536_rx(void *base)
37 */
38 void gemac_enable_rx_jmb(void *base)
39 {
40 - writel(readl(base + EMAC_RCNTRL_REG) | (JUMBO_FRAME_SIZE << 16), base
41 - + EMAC_RCNTRL_REG);
42 + writel((readl(base + EMAC_RCNTRL_REG) & PFE_RCR_MAX_FL_MASK)
43 + | (JUMBO_FRAME_SIZE << 16), base + EMAC_RCNTRL_REG);
44 }
45
46 /* GEMAC enable stacked vlan function.