[rdkb][common][bsp][Refactor and sync kernel from openwrt]

[Description]
c94cd6df [kernel][mt7981][eth][Enable Maxlinear GPHY driver]
9c2ed502 [openwrt][common][emmc][Change and load loop kernel module at early stage during kernel startup]
ae6acab8 [kernel][mt7988][eth][Change XGAMC force-link control flow and add XGMAC reset flow]
118dc32f [[openwrt][mt7988][config][refine adma rx hang detect condition]]
ea9d072f [Kernel][hnat][Fix API clear BIND entries for WIFI]
dec786dc [kernel][common][Change reserved memory size for BL31/BL32]
3bdb1914 [kernel][common][spinor][Add EN25QX256A]
97606068 [Kernel][hnat][Fix the conditions for adding vlan info]
e4e3ae91 [kernel][common][eth][Add gangload timeout mechanism for the Aquantia PHY driver]

[Release-log]

Change-Id: I6e58fec0e34affa8568a53bc14d7b46d3750d0eb
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a.dtsi
index 81851a0..e43c306 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986a.dtsi
@@ -124,9 +124,9 @@
 		#size-cells = <2>;
 		ranges;
 
-		/* 256 KiB reserved for ARM Trusted Firmware (BL31) */
+		/* 512 KiB reserved for ARM Trusted Firmware (BL31 + BL32) */
 		secmon_reserved: secmon@43000000 {
-			reg = <0 0x43000000 0 0x40000>;
+			reg = <0 0x43000000 0 0x80000>;
 			no-map;
 		};
 
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b.dtsi
index 6fcfa57..21d8357 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm/boot/dts/mt7986b.dtsi
@@ -124,9 +124,9 @@
 		#size-cells = <2>;
 		ranges;
 
-		/* 256 KiB reserved for ARM Trusted Firmware (BL31) */
+		/* 512 KiB reserved for ARM Trusted Firmware (BL31 + BL32) */
 		secmon_reserved: secmon@43000000 {
-			reg = <0 0x43000000 0 0x40000>;
+			reg = <0 0x43000000 0 0x80000>;
 			no-map;
 		};
 
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi
index 6b47ee6..bfc734e 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7981.dtsi
@@ -140,9 +140,9 @@
 		#size-cells = <2>;
 		ranges;
 
-		/* 192 KiB reserved for ARM Trusted Firmware (BL31) */
+		/* 512 KiB reserved for ARM Trusted Firmware (BL31 + BL32) */
 		secmon_reserved: secmon@43000000 {
-			reg = <0 0x43000000 0 0x30000>;
+			reg = <0 0x43000000 0 0x80000>;
 			no-map;
 		};
 
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
index 81851a0..e43c306 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
@@ -124,9 +124,9 @@
 		#size-cells = <2>;
 		ranges;
 
-		/* 256 KiB reserved for ARM Trusted Firmware (BL31) */
+		/* 512 KiB reserved for ARM Trusted Firmware (BL31 + BL32) */
 		secmon_reserved: secmon@43000000 {
-			reg = <0 0x43000000 0 0x40000>;
+			reg = <0 0x43000000 0 0x80000>;
 			no-map;
 		};
 
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
index 6fcfa57..21d8357 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7986b.dtsi
@@ -124,9 +124,9 @@
 		#size-cells = <2>;
 		ranges;
 
-		/* 256 KiB reserved for ARM Trusted Firmware (BL31) */
+		/* 512 KiB reserved for ARM Trusted Firmware (BL31 + BL32) */
 		secmon_reserved: secmon@43000000 {
-			reg = <0 0x43000000 0 0x40000>;
+			reg = <0 0x43000000 0 0x80000>;
 			no-map;
 		};
 
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988.dtsi
index 9ef502b..3033801 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988.dtsi
@@ -308,9 +308,9 @@
 			pmsg-size = <0x2000>;
 		};
 
-		/* 320 KiB reserved for ARM Trusted Firmware (BL31 + BL32) */
+		/* 512 KiB reserved for ARM Trusted Firmware (BL31 + BL32) */
 		secmon_reserved: secmon@43000000 {
-			reg = <0 0x43000000 0 0x50000>;
+			reg = <0 0x43000000 0 0x80000>;
 			no-map;
 		};
 
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c
index 1042685..1defeaf 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.c
@@ -314,7 +314,7 @@
 	u32 i = 0, mib_base = 0, gdm_fc = 0;
 
 	for (i = 0; i < MTK_MAC_COUNT; i++) {
-		mib_base = MTK_GDM1_TX_GBCNT + MTK_STAT_OFFSET*i;
+		mib_base = MTK_GDM1_TX_GBCNT + MTK_STAT_OFFSET*i + MTK_GDM_RX_FC;
 		gdm_fc =  mtk_r32(eth, mib_base);
 		if (gdm_fc < 1)
 			return 1;
@@ -396,14 +396,16 @@
 
 u32 mtk_monitor_adma_rx(struct mtk_eth *eth)
 {
-	static u32 err_cnt_arx;
-	u32 err_flag = 0;
+	static u32 err_cnt_arx, pre_drx;
+	u32 err_flag = 0, cur_drx = 0;
+
 	u32 opq0 = (mtk_r32(eth, MTK_PSE_OQ_STA(0)) & 0x1FF) != 0;
 	u32 cdm1_fsm = (mtk_r32(eth, MTK_FE_CDM1_FSM) & 0xFFFF0000) != 0;
 	u32 cur_stat = ((mtk_r32(eth, MTK_ADMA_RX_DBG0) & 0x1F) == 0);
 	u32 fifo_rdy = ((mtk_r32(eth, MTK_ADMA_RX_DBG0) & 0x40) == 0);
+	cur_drx = mtk_r32(eth, MTK_ADMA_DRX_PTR);
 
-	if (opq0 && cdm1_fsm && cur_stat && fifo_rdy) {
+	if (opq0 && cdm1_fsm && cur_stat && fifo_rdy && (cur_drx == pre_drx)) {
 		err_cnt_arx++;
 		if (err_cnt_arx >= 3) {
 			pr_info("ADMA Rx Info\n");
@@ -416,12 +418,15 @@
 				mtk_r32(eth, MTK_ADMA_RX_DBG0));
 			pr_info("MTK_ADMA_RX_DBG1 = 0x%x\n",
 				mtk_r32(eth, MTK_ADMA_RX_DBG1));
+			pr_info("MTK_ADMA_DRX_PTR = 0x%x\n",
+				mtk_r32(eth, MTK_ADMA_DRX_PTR));
 			pr_info("==============================\n");
 			err_flag = 1;
 		}
 	} else
 		err_cnt_arx = 0;
 
+	pre_drx = cur_drx;
 	if (err_flag)
 		return MTK_FE_STOP_TRAFFIC;
 	else
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.h
index 4ac77c8..a4117f4 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_reset.h
@@ -20,6 +20,8 @@
 #define MTK_FE_START_TRAFFIC	(0x2007)
 #define MTK_FE_STOP_TRAFFIC_DONE_FAIL	(0x2008)
 
+/*FE GDM Counter */
+#define MTK_GDM_RX_FC	(0x24)
 
 /* ADMA Rx Debug Monitor */
 #define MTK_ADMA_RX_DBG0	(PDMA_BASE + 0x238)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 0c94e93..353b656 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -586,7 +586,7 @@
 					   phylink_config);
 	struct mtk_eth *eth = mac->hw;
 	u32 sid, i;
-	int val = 0, ge_mode, force_link, err = 0;
+	int val = 0, ge_mode, err = 0;
 	unsigned int mac_type = mac->type;
 
 	/* MT76x8 has no hardware settings between for the MAC */
@@ -747,43 +747,14 @@
 		mtk_w32(mac->hw, MAC_MCR_FORCE_LINK_DOWN, MTK_MAC_MCR(mac->id));
 
 		if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) {
-			switch (mac->id) {
-			case MTK_GMAC1_ID:
+			if (mac->id == MTK_GMAC1_ID)
 				mtk_setup_bridge_switch(eth);
-				break;
-			case MTK_GMAC2_ID:
-				force_link = (mac->interface ==
-					      PHY_INTERFACE_MODE_XGMII) ?
-					      MTK_XGMAC_FORCE_LINK(mac->id) : 0;
-				val = mtk_r32(eth, MTK_XGMAC_STS(mac->id));
-				mtk_w32(eth, val | force_link,
-					MTK_XGMAC_STS(mac->id));
-				break;
-			case MTK_GMAC3_ID:
-				val = mtk_r32(eth, MTK_XGMAC_STS(mac->id));
-				mtk_w32(eth,
-					val | MTK_XGMAC_FORCE_LINK(mac->id),
-					MTK_XGMAC_STS(mac->id));
-				break;
-			}
 		}
 	} else if (mac->type == MTK_GDM_TYPE) {
 		val = mtk_r32(eth, MTK_GDMA_EG_CTRL(mac->id));
 		mtk_w32(eth, val & ~MTK_GDMA_XGDM_SEL,
 			MTK_GDMA_EG_CTRL(mac->id));
 
-		if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V3)) {
-			switch (mac->id) {
-			case MTK_GMAC2_ID:
-			case MTK_GMAC3_ID:
-				val = mtk_r32(eth, MTK_XGMAC_STS(mac->id));
-				mtk_w32(eth,
-					val & ~MTK_XGMAC_FORCE_LINK(mac->id),
-					MTK_XGMAC_STS(mac->id));
-				break;
-			}
-		}
-
 		/* FIXME: In current hardware design, we have to reset FE
 		 * when swtiching XGDM to GDM. Therefore, here trigger an SER
 		 * to let GDM go back to the initial state.
@@ -915,7 +886,7 @@
 {
 	struct mtk_mac *mac = container_of(config, struct mtk_mac,
 					   phylink_config);
-	u32 mcr;
+	u32 mcr, sts;
 
 	if (mac->type == MTK_GDM_TYPE) {
 		mcr = mtk_r32(mac->hw, MTK_MAC_MCR(mac->id));
@@ -927,6 +898,10 @@
 		mcr &= 0xfffffff0;
 		mcr |= XMAC_MCR_TRX_DISABLE;
 		mtk_w32(mac->hw, mcr, MTK_XMAC_MCR(mac->id));
+
+		sts = mtk_r32(mac->hw, MTK_XGMAC_STS(mac->id));
+		sts &= ~MTK_XGMAC_FORCE_LINK(mac->id);
+		mtk_w32(mac->hw, sts, MTK_XGMAC_STS(mac->id));
 	}
 }
 
@@ -936,7 +911,7 @@
 {
 	struct mtk_mac *mac = container_of(config, struct mtk_mac,
 					   phylink_config);
-	u32 mcr, mcr_cur;
+	u32 mcr, mcr_cur, sts, force_link;
 
 	mac->speed = speed;
 
@@ -981,6 +956,28 @@
 		if (mode == MLO_AN_PHY && phy)
 			mtk_setup_eee(mac, phy_init_eee(phy, false) >= 0);
 	} else if (mac->type == MTK_XGDM_TYPE && mac->id != MTK_GMAC1_ID) {
+		/* Eliminate the interference(before link-up) caused by PHY noise */
+		mtk_m32(mac->hw, XMAC_LOGIC_RST, 0x0, MTK_XMAC_LOGIC_RST(mac->id));
+		mdelay(20);
+		mtk_m32(mac->hw, XMAC_GLB_CNTCLR, 0x1, MTK_XMAC_CNT_CTRL(mac->id));
+
+		switch (mac->id) {
+		case MTK_GMAC2_ID:
+			force_link = (mac->interface ==
+				      PHY_INTERFACE_MODE_XGMII) ?
+				      MTK_XGMAC_FORCE_LINK(mac->id) : 0;
+			sts = mtk_r32(mac->hw, MTK_XGMAC_STS(mac->id));
+			mtk_w32(mac->hw, sts | force_link,
+				MTK_XGMAC_STS(mac->id));
+			break;
+		case MTK_GMAC3_ID:
+			sts = mtk_r32(mac->hw, MTK_XGMAC_STS(mac->id));
+			mtk_w32(mac->hw,
+				sts | MTK_XGMAC_FORCE_LINK(mac->id),
+				MTK_XGMAC_STS(mac->id));
+			break;
+		}
+
 		mcr = mtk_r32(mac->hw, MTK_XMAC_MCR(mac->id));
 
 		mcr &= ~(XMAC_MCR_FORCE_TX_FC |	XMAC_MCR_FORCE_RX_FC);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 181c56a..57bf7b1 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -291,6 +291,9 @@
 #define MTK_PST_DRX_IDX0	BIT(16)
 #define MTK_PST_DRX_IDX_CFG(x)	(MTK_PST_DRX_IDX0 << (x))
 
+/*PDMA HW RX Index Register*/
+#define MTK_ADMA_DRX_PTR	(PDMA_BASE + 0x10C)
+
 /* PDMA Delay Interrupt Register */
 #define MTK_PDMA_DELAY_INT		(PDMA_BASE + 0x20c)
 #if defined(CONFIG_MEDIATEK_NETSYS_RX_V2) || defined(CONFIG_MEDIATEK_NETSYS_V3)
@@ -696,11 +699,20 @@
 #define MAC_MCR_FORCE_LINK_DOWN	(MAC_MCR_FORCE_MODE)
 
 /* XFI Mac control registers */
-#define MTK_XMAC_MCR(x)		(0x12000 + ((x - 1) * 0x1000))
+#define MTK_XMAC_BASE(x)	(0x12000 + ((x - 1) * 0x1000))
+#define MTK_XMAC_MCR(x)		(MTK_XMAC_BASE(x))
 #define XMAC_MCR_TRX_DISABLE	0xf
 #define XMAC_MCR_FORCE_TX_FC	BIT(5)
 #define XMAC_MCR_FORCE_RX_FC	BIT(4)
 
+/* XFI Mac logic reset registers */
+#define MTK_XMAC_LOGIC_RST(x)	(MTK_XMAC_BASE(x) + 0x10)
+#define XMAC_LOGIC_RST		BIT(0)
+
+/* XFI Mac count global control */
+#define MTK_XMAC_CNT_CTRL(x)	(MTK_XMAC_BASE(x) + 0x100)
+#define XMAC_GLB_CNTCLR		BIT(0)
+
 /* Mac EEE control registers */
 #define MTK_MAC_EEE(x)		(0x10104 + (x * 0x100))
 #define MAC_EEE_WAKEUP_TIME_1000	GENMASK(31, 24)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
index 7cda69f..a3eef58 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.c
@@ -33,6 +33,8 @@
 EXPORT_SYMBOL(ra_sw_nat_hook_rx);
 int (*ra_sw_nat_hook_tx)(struct sk_buff *skb, int gmac_no) = NULL;
 EXPORT_SYMBOL(ra_sw_nat_hook_tx);
+void (*ra_sw_nat_clear_bind_entries)(void) = NULL;
+EXPORT_SYMBOL(ra_sw_nat_clear_bind_entries);
 
 int (*ppe_del_entry_by_mac)(unsigned char *mac) = NULL;
 EXPORT_SYMBOL(ppe_del_entry_by_mac);
@@ -610,6 +612,7 @@
 		ra_sw_nat_hook_tx = mtk_sw_nat_hook_tx;
 		ppe_dev_register_hook = mtk_ppe_dev_register_hook;
 		ppe_dev_unregister_hook = mtk_ppe_dev_unregister_hook;
+		ra_sw_nat_clear_bind_entries = foe_clear_all_bind_entries;
 	}
 
 	if (hnat_register_nf_hooks())
@@ -628,6 +631,7 @@
 
 	ra_sw_nat_hook_tx = NULL;
 	ra_sw_nat_hook_rx = NULL;
+	ra_sw_nat_clear_bind_entries = NULL;
 	hnat_unregister_nf_hooks();
 
 	for (i = 0; i < CFG_PPE_NUM; i++) {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
index 8026921..2337f0e 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat.h
@@ -1230,6 +1230,7 @@
 void cr_set_field(void __iomem *reg, u32 field, u32 val);
 int mtk_sw_nat_hook_tx(struct sk_buff *skb, int gmac_no);
 int mtk_sw_nat_hook_rx(struct sk_buff *skb);
+void foe_clear_all_bind_entries(void);
 void mtk_ppe_dev_register_hook(struct net_device *dev);
 void mtk_ppe_dev_unregister_hook(struct net_device *dev);
 int nf_hnat_netdevice_event(struct notifier_block *unused, unsigned long event,
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
index 63315df..59b3e71 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
@@ -184,16 +184,11 @@
 	return i;
 }
 
-void foe_clear_all_bind_entries(struct net_device *dev)
+void foe_clear_all_bind_entries(void)
 {
 	int i, hash_index;
 	struct foe_entry *entry;
 
-	if (!IS_LAN_GRP(dev) && !IS_WAN(dev) &&
-	    !find_extif_from_devname(dev->name) &&
-	    !dev->netdev_ops->ndo_flow_offload_check)
-		return;
-
 	for (i = 0; i < CFG_PPE_NUM; i++) {
 		cr_set_field(hnat_priv->ppe_base[i] + PPE_TB_CFG,
 			     SMA, SMA_ONLY_FWD_CPU);
@@ -242,7 +237,12 @@
 		if (!get_wifi_hook_if_index_from_dev(dev))
 			extif_put_dev(dev);
 
-		foe_clear_all_bind_entries(dev);
+		if (!IS_LAN_GRP(dev) && !IS_WAN(dev) &&
+		    !find_extif_from_devname(dev->name) &&
+		    !dev->netdev_ops->ndo_flow_offload_check)
+			break;
+
+		foe_clear_all_bind_entries();
 
 		break;
 	case NETDEV_UNREGISTER:
@@ -1314,7 +1314,7 @@
 
 				entry.ipv4_hnapt.vlan1 = hw_path->vlan_id;
 
-				if (skb_vlan_tag_present(skb)) {
+				if (skb_vlan_tagged(skb)) {
 					entry.bfib1.vlan_layer += 1;
 
 					if (entry.ipv4_hnapt.vlan1)
@@ -1368,7 +1368,7 @@
 
 			entry.ipv6_5t_route.vlan1 = hw_path->vlan_id;
 
-			if (skb_vlan_tag_present(skb)) {
+			if (skb_vlan_tagged(skb)) {
 				entry.bfib1.vlan_layer += 1;
 
 				if (entry.ipv6_5t_route.vlan1)
@@ -1892,7 +1892,7 @@
 		break;
 	}
 
-	if (skb->vlan_tci) {
+	if (skb_vlan_tagged(skb)) {
 		bfib1_tx.vlan_layer = 1;
 		bfib1_tx.vpm = 1;
 		if (IS_IPV4_GRP(entry)) {
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-flow-offload-add-mtkhnat-qdma-qos.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-flow-offload-add-mtkhnat-qdma-qos.patch
old mode 100755
new mode 100644
index 570fbcd..fd9a5d4
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-flow-offload-add-mtkhnat-qdma-qos.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/999-3014-flow-offload-add-mtkhnat-qdma-qos.patch
@@ -240,19 +240,41 @@
  			   int *wed_index)
  {
  	struct mtk_wdma_info info = {};
-@@ -211,6 +211,11 @@ mtk_flow_set_output_device(struct mtk_eth *eth, struct mtk_foe_entry *foe,
+@@ -209,6 +211,9 @@ mtk_flow_set_output_device(struct mtk_eth *eth, struct mtk_foe_entry *foe,
  	if (dsa_port >= 0)
- 	mtk_foe_entry_set_dsa(foe, dsa_port);
+ 		mtk_foe_entry_set_dsa(foe, dsa_port);
  
-+	if (eth->qos_toggle == 1 || ct->mark >= 6)
-+		mtk_foe_entry_set_qid(foe, ct->mark & MTK_QDMA_TX_MASK);
 +	if (eth->qos_toggle == 2 && dsa_port >= 0)
 +		mtk_foe_entry_set_qid(foe, dsa_port & MTK_QDMA_TX_MASK);
 +
  	if (dev == eth->netdev[0])
  		pse_port = PSE_GDM1_PORT;
  	else if (dev == eth->netdev[1])
-@@ -433,7 +443,7 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f)
+@@ -217,6 +222,23 @@ mtk_flow_set_output_device(struct mtk_eth *eth, struct mtk_foe_entry *foe,
+ 		return -EOPNOTSUPP;
+ 
+ out:
++	if (eth->qos_toggle == 1 || (ct->mark & MTK_QDMA_TX_MASK) >= 6) {
++		u8 qos_ul_toggle;
++
++		if (eth->qos_toggle == 2)
++			qos_ul_toggle = ((ct->mark >> 16) & MTK_QDMA_TX_MASK) >= 6 ? 1 : 0;
++		else
++			qos_ul_toggle = ((ct->mark >> 16) & MTK_QDMA_TX_MASK) >= 1 ? 1 : 0;
++
++		if (qos_ul_toggle == 1) {
++			if (dev == eth->netdev[1])
++				mtk_foe_entry_set_qid(foe, (ct->mark >> 16) & MTK_QDMA_TX_MASK);
++			else
++				mtk_foe_entry_set_qid(foe, ct->mark & MTK_QDMA_TX_MASK);
++		} else
++			mtk_foe_entry_set_qid(foe, ct->mark & MTK_QDMA_TX_MASK);
++	}
++
+ 	mtk_foe_entry_set_pse_port(foe, pse_port);
+ 
+ 	return 0;
+@@ -432,7 +455,7 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct flow_cls_offload *f)
  	if (data.pppoe.num == 1)
  		mtk_foe_entry_set_pppoe(&foe, data.pppoe.sid);
  
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2342-drivers-mtd-spi-nor-Add-support-EN25QX256A-2S.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2342-drivers-mtd-spi-nor-Add-support-EN25QX256A-2S.patch
new file mode 100644
index 0000000..ed1ad25
--- /dev/null
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2342-drivers-mtd-spi-nor-Add-support-EN25QX256A-2S.patch
@@ -0,0 +1,12 @@
+--- a/drivers/mtd/spi-nor/spi-nor.c	2023-07-12 19:34:02.240724000 +0800
++++ b/drivers/mtd/spi-nor/spi-nor.c	2023-07-12 19:38:42.547437785 +0800
+@@ -2253,6 +2253,9 @@
+ 			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
+ 			SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) },
+ 	{ "en25qh256",  INFO(0x1c7019, 0, 64 * 1024,  512, 0) },
++	{ "en25qx256a", INFO(0x1c7119, 0, 64 * 1024,  512,
++			SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
++			SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) },
+ 	{ "en25s64",	INFO(0x1c3817, 0, 64 * 1024,  128, SECT_4K) },
+
+ 	/* ESMT */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2719-net-phy-aquantia-add-firmware-download.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2719-net-phy-aquantia-add-firmware-download.patch
index c128bbe..170b841 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2719-net-phy-aquantia-add-firmware-download.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/999-2719-net-phy-aquantia-add-firmware-download.patch
@@ -153,7 +153,7 @@
 index 000000000..d2828aad4
 --- /dev/null
 +++ b/drivers/net/phy/aquantia_firmware.c
-@@ -0,0 +1,1091 @@
+@@ -0,0 +1,1100 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/* FW download driver for Aquantia PHY
 + */
@@ -299,6 +299,7 @@
 +
 +struct task_struct *gangload_kthread = NULL;
 +struct phy_device *gangload_phydevs[MAX_GANGLOAD_DEVICES];
++static unsigned long gangload_timeout = 0;
 +static int gangload = 0;
 +
 +static int aqr_firmware_download_single(struct phy_device *phydev);
@@ -1092,7 +1093,7 @@
 +		return;
 +
 +	num_phydevs = priv->fw_dl_mode == FW_DL_GNAGLOAD ?
-+		      MAX_GANGLOAD_DEVICES : 1;
++		      gangload : 1;
 +
 +retry:
 +	if (gandload_phydev->state == PHY_HALTED) {
@@ -1178,8 +1179,9 @@
 +		if (kthread_should_stop())
 +			break;
 +
-+		/* reach maximum gangload phy devices */
-+		if (gangload == MAX_GANGLOAD_DEVICES) {
++		/* either maximum gangload phy devices or timeout is reached */
++		if (gangload == MAX_GANGLOAD_DEVICES ||
++		    time_after(jiffies, gangload_timeout)) {
 +			ret = request_firmware_nowait(THIS_MODULE, true, AQR_FIRMWARE, dev,
 +						      GFP_KERNEL, phydevs, aqr_firmware_download_cb);
 +			if (ret) {
@@ -1206,6 +1208,9 @@
 +		return 0;
 +
 +	if (!gangload_kthread) {
++		/* setup a maximum wait time limit for gangload mode */
++		gangload_timeout = jiffies + 5 * HZ;
++
 +		/* create a thread for monitor gangload devices */
 +		gangload_kthread = kthread_create(aqr_firmware_gandload_thread,
 +						  gangload_phydevs,
@@ -1219,6 +1224,10 @@
 +		wake_up_process(gangload_kthread);
 +	}
 +
++	/* fall back to single mode if timeout is reached */
++	if (time_after(jiffies, gangload_timeout))
++		return aqr_firmware_download_single(phydev);
++
 +	for (i = 0; i < gangload; i++) {
 +		if (gangload_phydevs[i] == phydev) {
 +			dev_warn(dev, "Detect duplicate gangload phydev\n");
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
index a36f979..2b9ec88 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/patches-5.4.inc
@@ -89,6 +89,7 @@
     file://999-2339-drivers-mtd-spinand-Add-calibration-support-for-spinand.patch \
     file://999-2340-drivers-mtd-spi-nor-Add-calibration-support-for-spi-nor.patch \
     file://999-2341-mtd-spinand-Add-support-etron.patch \
+    file://999-2342-drivers-mtd-spi-nor-Add-support-EN25QX256A-2S.patch \
     file://999-2350-nvmem-core-Add-functions-to-make-number-reading-easy.patch \
     file://999-2351-nvmem-mtk-efuse-support-minimum-one-byte-access-stri.patch \
     file://999-2361-add-spimem-support-to-mtk-spi.patch \