Merge "[rdk-b][common][bsp][Refactor and sync kernel/wifi from Openwrt]"
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/003-rdkb-mtd-kernel-ubi-relayout.patch b/recipes-kernel/linux/linux-mediatek-5.4/003-rdkb-mtd-kernel-ubi-relayout.patch
index 8c36db3..c5382db 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/003-rdkb-mtd-kernel-ubi-relayout.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/003-rdkb-mtd-kernel-ubi-relayout.patch
@@ -32,7 +32,7 @@
  
  			partition@780000 {
  				label = "ubi";
--				reg = <0x780000 0x4000000>;
+-				reg = <0x780000 0x7880000>;
 +				reg = <0x780000 0xF880000>;
  			};
  		};
@@ -45,7 +45,7 @@
  
  			partition@780000 {
  				label = "ubi";
--				reg = <0x780000 0x4000000>;
+-				reg = <0x780000 0x7880000>;
 +				reg = <0x780000 0xF880000>;
  			};
  		};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988-clkitg.dtsi b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988-clkitg.dtsi
index c97cb24..1e020d8 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988-clkitg.dtsi
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988-clkitg.dtsi
@@ -253,30 +253,30 @@
 			<&infracfg_ao CK_INFRA_RTC>,
 			<&infracfg_ao CK_INFRA_26M_ADC_BCK>,
 			<&infracfg_ao CK_INFRA_RC_ADC>,
-			<&infracfg_ao CK_INFRA_MSDC400>,
-			<&infracfg_ao CK_INFRA_MSDC2_HCK>,
-			<&infracfg_ao CK_INFRA_133M_MSDC_0_HCK>,
-			<&infracfg_ao CK_INFRA_66M_MSDC_0_HCK>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
 			<&infracfg_ao CK_INFRA_133M_CPUM_BCK>,
 			<&infracfg_ao CK_INFRA_BIST2FPC>,
 			<&infracfg_ao CK_INFRA_I2C_X16W_MCK_CK_P1>,
 			<&infracfg_ao CK_INFRA_I2C_X16W_PCK_CK_P1>,
-			<&infracfg_ao CK_INFRA_133M_USB_HCK>,
-			<&infracfg_ao CK_INFRA_133M_USB_HCK_CK_P1>,
-			<&infracfg_ao CK_INFRA_66M_USB_HCK>,
-			<&infracfg_ao CK_INFRA_66M_USB_HCK_CK_P1>,
-			<&infracfg_ao CK_INFRA_USB_SYS>,
-			<&infracfg_ao CK_INFRA_USB_SYS_CK_P1>,
-			<&infracfg_ao CK_INFRA_USB_REF>,
-			<&infracfg_ao CK_INFRA_USB_CK_P1>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
 			<&infracfg_ao CK_INFRA_USB_FRMCNT>,
 			<&infracfg_ao CK_INFRA_USB_FRMCNT_CK_P1>,
-			<&infracfg_ao CK_INFRA_USB_PIPE>,
-			<&infracfg_ao CK_INFRA_USB_PIPE_CK_P1>,
-			<&infracfg_ao CK_INFRA_USB_UTMI>,
-			<&infracfg_ao CK_INFRA_USB_UTMI_CK_P1>,
-			<&infracfg_ao CK_INFRA_USB_XHCI>,
-			<&infracfg_ao CK_INFRA_USB_XHCI_CK_P1>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
+			<&system_clk>,
 			<&system_clk>,
 			<&system_clk>,
 			<&system_clk>,
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 28e702e..a93f9c2 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
@@ -549,13 +549,12 @@
 			  0x30000000 0x00 0x00200000>,
 			 <0x82000000 0x00 0x30200000 0x00
 			  0x30200000 0x00 0x07e00000>;
-		status = "disabled";
-
-		clocks = <&topckgen CK_TOP_PEXTP_P0_SEL>,
+		clocks = <&infracfg_ao CK_INFRA_PCIE_PIPE_P0>,
 			 <&infracfg_ao CK_INFRA_PCIE_GFMUX_TL_P0>,
-			 <&infracfg_ao CK_INFRA_PCIE_PIPE_P0>,
-			 <&infracfg_ao CK_INFRA_133M_PCIE_CK_P0>,
-			 <&infracfg_ao CK_INFRA_PCIE_PERI_26M_CK_P0>;
+			 <&infracfg_ao CK_INFRA_PCIE_PERI_26M_CK_P0>,
+			 <&infracfg_ao CK_INFRA_133M_PCIE_CK_P0>;
+		clock-names = "pl_250m", "tl_26m", "peri_26m", "top_133m";
+		status = "disabled";
 
 		#interrupt-cells = <1>;
 		interrupt-map-mask = <0 0 0 0x7>;
@@ -585,13 +584,12 @@
 			  0x38000000 0x00 0x00200000>,
 			 <0x82000000 0x00 0x38200000 0x00
 			  0x38200000 0x00 0x07e00000>;
-		status = "disabled";
-
-		clocks = <&topckgen CK_TOP_PEXTP_P1_SEL>,
+		clocks = <&infracfg_ao CK_INFRA_PCIE_PIPE_P1>,
 			 <&infracfg_ao CK_INFRA_PCIE_GFMUX_TL_P1>,
-			 <&infracfg_ao CK_INFRA_PCIE_PIPE_P1>,
-			 <&infracfg_ao CK_INFRA_133M_PCIE_CK_P1>,
-			 <&infracfg_ao CK_INFRA_PCIE_PERI_26M_CK_P1>;
+			 <&infracfg_ao CK_INFRA_PCIE_PERI_26M_CK_P1>,
+			 <&infracfg_ao CK_INFRA_133M_PCIE_CK_P1>;
+		clock-names = "pl_250m", "tl_26m", "peri_26m", "top_133m";
+		status = "disabled";
 
 		#interrupt-cells = <1>;
 		interrupt-map-mask = <0 0 0 0x7>;
@@ -621,14 +619,12 @@
 			  0x20000000 0x00 0x00200000>,
 			 <0x82000000 0x00 0x20200000 0x00
 			  0x20200000 0x00 0x07e00000>;
-		status = "disabled";
-
-		clocks = <&topckgen CK_TOP_PEXTP_P2_SEL>,
+		clocks = <&infracfg_ao CK_INFRA_PCIE_PIPE_P2>,
 			 <&infracfg_ao CK_INFRA_PCIE_GFMUX_TL_P2>,
-			 <&infracfg_ao CK_INFRA_PCIE_PIPE_P2>,
-			 <&infracfg_ao CK_INFRA_133M_PCIE_CK_P2>,
 			 <&infracfg_ao CK_INFRA_PCIE_PERI_26M_CK_P2>,
-			 <&infracfg_ao CK_INFRA_PCIE_PERI_26M_CK_P3>;
+			 <&infracfg_ao CK_INFRA_133M_PCIE_CK_P2>;
+		clock-names = "pl_250m", "tl_26m", "peri_26m", "top_133m";
+		status = "disabled";
 
 		phys = <&xphyu3port0 PHY_TYPE_PCIE>;
 		phy-names = "pcie-phy";
@@ -661,13 +657,12 @@
 			  0x28000000 0x00 0x00200000>,
 			 <0x82000000 0x00 0x28200000 0x00
 			  0x28200000 0x00 0x07e00000>;
-		status = "disabled";
-
-		clocks = <&topckgen CK_TOP_PEXTP_P3_SEL>,
+		clocks = <&infracfg_ao CK_INFRA_PCIE_PIPE_P3>,
 			 <&infracfg_ao CK_INFRA_PCIE_GFMUX_TL_P3>,
-			 <&infracfg_ao CK_INFRA_PCIE_PIPE_P3>,
-			 <&infracfg_ao CK_INFRA_133M_PCIE_CK_P3>,
-			 <&infracfg_ao CK_INFRA_PCIE_PERI_26M_CK_P3>;
+			 <&infracfg_ao CK_INFRA_PCIE_PERI_26M_CK_P3>,
+			 <&infracfg_ao CK_INFRA_133M_PCIE_CK_P3>;
+		clock-names = "pl_250m", "tl_26m", "peri_26m", "top_133m";
+		status = "disabled";
 
 		#interrupt-cells = <1>;
 		interrupt-map-mask = <0 0 0 0x7>;
@@ -961,11 +956,11 @@
 		interrupts = <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>;
 		phys = <&xphyu2port0 PHY_TYPE_USB2>,
 		       <&xphyu3port0 PHY_TYPE_USB3>;
-		clocks = <&system_clk>,
-			 <&system_clk>,
-			 <&system_clk>,
-			 <&system_clk>,
-			 <&system_clk>;
+		clocks = <&infracfg_ao CK_INFRA_USB_SYS>,
+			 <&infracfg_ao CK_INFRA_USB_XHCI>,
+			 <&infracfg_ao CK_INFRA_USB_REF>,
+			 <&infracfg_ao CK_INFRA_66M_USB_HCK>,
+			 <&infracfg_ao CK_INFRA_133M_USB_HCK>;
 		clock-names = "sys_ck",
 			      "xhci_ck",
 			      "ref_ck",
@@ -987,7 +982,7 @@
 
 		xphyu2port0: usb-phy@11e10000 {
 			reg = <0 0x11e10000 0 0x400>;
-			clocks = <&system_clk>;
+			clocks = <&infracfg_ao CK_INFRA_USB_UTMI>;
 			clock-names = "ref";
 			#phy-cells = <1>;
 			status = "okay";
@@ -995,7 +990,7 @@
 
 		xphyu3port0: usb-phy@11e13000 {
 			reg = <0 0x11e13400 0 0x500>;
-			clocks = <&system_clk>;
+			clocks = <&infracfg_ao CK_INFRA_USB_PIPE>;
 			clock-names = "ref";
 			#phy-cells = <1>;
 			mediatek,syscon-type = <&topmisc 0x218 0>;
@@ -1012,11 +1007,11 @@
 		interrupts = <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>;
 		phys = <&tphyu2port0 PHY_TYPE_USB2>,
 		       <&tphyu3port0 PHY_TYPE_USB3>;
-		clocks = <&system_clk>,
-			 <&system_clk>,
-			 <&system_clk>,
-			 <&system_clk>,
-			 <&system_clk>;
+		clocks = <&infracfg_ao CK_INFRA_USB_SYS_CK_P1>,
+			 <&infracfg_ao CK_INFRA_USB_XHCI_CK_P1>,
+			 <&infracfg_ao CK_INFRA_USB_CK_P1>,
+			 <&infracfg_ao CK_INFRA_66M_USB_HCK_CK_P1>,
+			 <&infracfg_ao CK_INFRA_133M_USB_HCK_CK_P1>;
 		clock-names = "sys_ck",
 			      "xhci_ck",
 			      "ref_ck",
@@ -1037,7 +1032,7 @@
 
 		tphyu2port0: usb-phy@11c50000 {
 			reg = <0 0x11c50000 0 0x700>;
-			clocks = <&system_clk>;
+			clocks = <&infracfg_ao CK_INFRA_USB_UTMI_CK_P1>;
 			clock-names = "ref";
 			#phy-cells = <1>;
 			status = "okay";
@@ -1045,7 +1040,7 @@
 
 		tphyu3port0: usb-phy@11c50700 {
 			reg = <0 0x11c50700 0 0x900>;
-			clocks = <&system_clk>;
+			clocks = <&infracfg_ao CK_INFRA_USB_PIPE_CK_P1>;
 			clock-names = "ref";
 			#phy-cells = <1>;
 			mediatek,usb3-pll-ssc-delta;
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-emmc.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-emmc.dts
index aad2e1a..858021e 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-emmc.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-emmc.dts
@@ -206,7 +206,7 @@
 		phy0: ethernet-phy@0 {
 			reg = <0>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 71 1>;
+			reset-gpios = <&pio 72 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
@@ -214,7 +214,7 @@
 		phy1: ethernet-phy@8 {
 			reg = <8>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 72 1>;
+			reset-gpios = <&pio 71 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sd.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sd.dts
index 9736965..7313156 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sd.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sd.dts
@@ -197,7 +197,7 @@
 		phy0: ethernet-phy@0 {
 			reg = <0>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 71 1>;
+			reset-gpios = <&pio 72 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
@@ -205,7 +205,7 @@
 		phy1: ethernet-phy@8 {
 			reg = <8>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 72 1>;
+			reset-gpios = <&pio 71 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts
index f90abc2..c8a44ef 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts
@@ -232,7 +232,7 @@
 		phy0: ethernet-phy@0 {
 			reg = <0>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 71 1>;
+			reset-gpios = <&pio 72 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
@@ -240,7 +240,7 @@
 		phy1: ethernet-phy@8 {
 			reg = <8>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 72 1>;
+			reset-gpios = <&pio 71 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
index 01cf186..fb5ed54 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
@@ -60,7 +60,7 @@
 
 			partition@780000 {
 				label = "ubi";
-				reg = <0x780000 0x4000000>;
+				reg = <0x780000 0x7880000>;
 			};
 		};
 	};
@@ -313,7 +313,7 @@
 		phy0: ethernet-phy@0 {
 			reg = <0>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 71 1>;
+			reset-gpios = <&pio 72 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
@@ -321,7 +321,7 @@
 		phy1: ethernet-phy@8 {
 			reg = <8>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 72 1>;
+			reset-gpios = <&pio 71 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
index cdc692c..a27553c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
@@ -222,7 +222,7 @@
 		phy0: ethernet-phy@0 {
 			reg = <0>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 71 1>;
+			reset-gpios = <&pio 72 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
@@ -230,7 +230,7 @@
 		phy1: ethernet-phy@8 {
 			reg = <8>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 72 1>;
+			reset-gpios = <&pio 71 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-e2p5g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-e2p5g-spim-nand.dts
index 9f93866..6de8a1c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-e2p5g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-e2p5g-spim-nand.dts
@@ -60,7 +60,7 @@
 
 			partition@780000 {
 				label = "ubi";
-				reg = <0x780000 0x4000000>;
+				reg = <0x780000 0x7880000>;
 			};
 		};
 	};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts
index 055eba6..5fb36ca 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts
@@ -60,7 +60,7 @@
 
 			partition@780000 {
 				label = "ubi";
-				reg = <0x780000 0x4000000>;
+				reg = <0x780000 0x7880000>;
 			};
 		};
 	};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-sfp-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-sfp-spim-nand.dts
index 4b224a9..70410b6 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-sfp-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-sfp-spim-nand.dts
@@ -66,7 +66,7 @@
 
 			partition@780000 {
 				label = "ubi";
-				reg = <0x780000 0x4000000>;
+				reg = <0x780000 0x7880000>;
 			};
 		};
 	};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts
index 9d83894..fa29c13 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts
@@ -67,7 +67,7 @@
 
 			partition@780000 {
 				label = "ubi";
-				reg = <0x780000 0x4000000>;
+				reg = <0x780000 0x7880000>;
 			};
 		};
 	};
@@ -328,7 +328,7 @@
 		phy0: ethernet-phy@0 {
 			reg = <0>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 71 1>;
+			reset-gpios = <&pio 72 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
@@ -336,7 +336,7 @@
 		phy1: ethernet-phy@8 {
 			reg = <8>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 72 1>;
+			reset-gpios = <&pio 71 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts
index 74c3431..fe941c1 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts
@@ -68,7 +68,7 @@
 
 			partition@780000 {
 				label = "ubi";
-				reg = <0x780000 0x4000000>;
+				reg = <0x780000 0x7880000>;
 			};
 		};
 	};
@@ -348,7 +348,7 @@
 		phy0: ethernet-phy@0 {
 			reg = <0>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 71 1>;
+			reset-gpios = <&pio 72 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
@@ -356,7 +356,7 @@
 		phy1: ethernet-phy@8 {
 			reg = <8>;
 			compatible = "ethernet-phy-ieee802.3-c45";
-			reset-gpios = <&pio 72 1>;
+			reset-gpios = <&pio 71 1>;
 			reset-assert-us = <1000000>;
 			reset-deassert-us = <1000000>;
 		};
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 d35dddb..ee9cd47 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
@@ -3561,10 +3561,15 @@
 	mtk_prepare_reset_fe(eth);
 
 	/* Trigger Wifi SER reset */
-	call_netdevice_notifiers(MTK_FE_START_RESET, eth->netdev[0]);
-	rtnl_unlock();
-	wait_for_completion_timeout(&wait_ser_done, 5000);
-	rtnl_lock();
+	for (i = 0; i < MTK_MAC_COUNT; i++) {
+		if (!eth->netdev[i])
+			continue;
+		call_netdevice_notifiers(MTK_FE_START_RESET, eth->netdev[i]);
+		rtnl_unlock();
+		wait_for_completion_timeout(&wait_ser_done, 5000);
+		rtnl_lock();
+		break;
+	}
 
 	while (test_and_set_bit_lock(MTK_RESETTING, &eth->state))
 		cpu_relax();
@@ -3591,7 +3596,7 @@
 
 	/* restart DMA and enable IRQs */
 	for (i = 0; i < MTK_MAC_COUNT; i++) {
-		if (!test_bit(i, &restart))
+		if (!test_bit(i, &restart) || !eth->netdev[i])
 			continue;
 		err = mtk_open(eth->netdev[i]);
 		if (err) {
@@ -3615,6 +3620,8 @@
 
 	/* Power up sgmii */
 	for (i = 0; i < MTK_MAC_COUNT; i++) {
+		if (!eth->netdev[i])
+			continue;
 		mac = netdev_priv(eth->netdev[i]);
 		phy_node = of_parse_phandle(mac->of_node, "phy-handle", 0);
 		if (!phy_node && eth->xgmii->regmap_sgmii[i]) {
@@ -3623,11 +3630,15 @@
 		}
 	}
 
-	call_netdevice_notifiers(MTK_FE_RESET_NAT_DONE, eth->netdev[0]);
-	pr_info("[%s] HNAT reset done !\n", __func__);
-
-	call_netdevice_notifiers(MTK_FE_RESET_DONE, eth->netdev[0]);
-	pr_info("[%s] WiFi SER reset done !\n", __func__);
+	for (i = 0; i < MTK_MAC_COUNT; i++) {
+		if (!eth->netdev[i])
+			continue;
+		call_netdevice_notifiers(MTK_FE_RESET_NAT_DONE, eth->netdev[i]);
+		pr_info("[%s] HNAT reset done !\n", __func__);
+		call_netdevice_notifiers(MTK_FE_RESET_DONE, eth->netdev[i]);
+		pr_info("[%s] WiFi SER reset done !\n", __func__);
+		break;
+	}
 
 	atomic_dec(&reset_lock);
 	if (atomic_read(&force) > 0)
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c
index fd3022f..d2ccecd 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mediatek-ge.c
@@ -160,6 +160,9 @@
 #define MTK_PHY_RG_DEV1E_REG184		(0x180)
 #define   MTK_PHY_DASN_DAC_IN1_D_MASK	GENMASK(9, 0)
 
+#define MTK_PHY_RG_DEV1E_REG234		(0x234)
+#define   MTK_PHY_TR_OPEN_LOOP_EN	GENMASK(0, 0)
+
 #define MTK_PHY_RG_DEV1E_REG53D		(0x53d)
 #define   MTK_PHY_DA_TX_R50_A_NORMAL_MASK	GENMASK(13, 8)
 #define   MTK_PHY_DA_TX_R50_A_TBT_MASK		GENMASK(5, 0)
@@ -907,6 +910,9 @@
 	phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_C2, 0x2426);
 	phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D1, 0x2624);
 	phy_write_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_TX_I2MPB_TEST_MODE_D2, 0x2426);
+
+	phy_modify_mmd(phydev, MDIO_MMD_VEND1, MTK_PHY_RG_DEV1E_REG234,
+			MTK_PHY_TR_OPEN_LOOP_EN, 0x1);
 }
 
 static inline void mt7988_phy_finetune(struct phy_device *phydev)
@@ -981,14 +987,14 @@
 	return ret;
 }
 
-static int mt7981_phy_config_init(struct phy_device *phydev)
+static int mt7981_phy_probe(struct phy_device *phydev)
 {
 	mt7981_phy_finetune(phydev);
 
 	return mt798x_phy_calibration(phydev);
 }
 
-static int mt7988_phy_config_init(struct phy_device *phydev)
+static int mt7988_phy_probe(struct phy_device *phydev)
 {
 	struct device_node *np;
 	void __iomem *boottrap;
@@ -1027,11 +1033,6 @@
 	return mt798x_phy_calibration(phydev);
 }
 
-static int mt7988_phy_probe(struct phy_device *phydev)
-{
-	return mt7988_phy_config_init(phydev);
-}
-
 static struct phy_driver mtk_gephy_driver[] = {
 #if 0
 	{
@@ -1066,7 +1067,7 @@
 	{
 		PHY_ID_MATCH_EXACT(0x03a29461),
 		.name		= "MediaTek MT7981 PHY",
-		.config_init	= mt7981_phy_config_init,
+		.probe		= mt7981_phy_probe,
 		/* Interrupts are handled by the switch, not the PHY
 		 * itself.
 		 */
@@ -1081,7 +1082,6 @@
 		PHY_ID_MATCH_EXACT(0x03a29481),
 		.name		= "MediaTek MT7988 PHY",
 		.probe		= mt7988_phy_probe,
-		.config_init	= mt7988_phy_config_init,
 		/* Interrupts are handled by the switch, not the PHY
 		 * itself.
 		 */
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mtk/mt753x/mt753x_mdio.c b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mtk/mt753x/mt753x_mdio.c
index c57a5a2..03eb5b4 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mtk/mt753x/mt753x_mdio.c
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/files-5.4/drivers/net/phy/mtk/mt753x/mt753x_mdio.c
@@ -250,7 +250,6 @@
 	struct device_node *fixed_link_node;
 	struct mt753x_port_cfg *port_cfg;
 	u32 port;
-	int ret;
 
 	for_each_child_of_node(gsw->dev->of_node, port_np) {
 		if (!of_device_is_compatible(port_np, "mediatek,mt753x-port"))
@@ -281,8 +280,8 @@
 
 		port_cfg->np = port_np;
 
-		ret = of_get_phy_mode(port_cfg->np);
-		if (ret < 0) {
+		port_cfg->phy_mode = of_get_phy_mode(port_np);
+		if (port_cfg->phy_mode < 0) {
 			dev_info(gsw->dev, "incorrect phy-mode %d\n", port);
 			continue;
 		}
@@ -578,7 +577,6 @@
 	struct device_node *phy_np;
 	struct mt753x_phy *phy;
 	phy_interface_t iface;
-	int ret;
 	u32 phyad;
 
 	if (!mii_np)
@@ -591,8 +589,8 @@
 		if (phyad >= MT753X_NUM_PHYS)
 			continue;
 
-		ret = of_get_phy_mode(phy_np);
-		if (ret < 0) {
+		iface = of_get_phy_mode(phy_np);
+		if (iface < 0) {
 			dev_info(gsw->dev, "incorrect phy-mode %d for PHY %d\n",
 				 iface, phyad);
 			continue;
@@ -605,7 +603,7 @@
 		phy->netdev.netdev_ops = &mt753x_dummy_netdev_ops;
 
 		phy->phydev = of_phy_connect(&phy->netdev, phy_np,
-					     mt753x_phy_link_handler, 0, iface);
+					mt753x_phy_link_handler, 0, iface);
 		if (!phy->phydev) {
 			dev_info(gsw->dev, "could not connect to PHY %d\n",
 				 phyad);
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-add-wed-ser-support.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-add-wed-ser-support.patch
index 94956b3..d97d4c1 100755
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-add-wed-ser-support.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/flow_patch/9999-add-wed-ser-support.patch
@@ -16,34 +16,33 @@
 index c582bb9..5259141 100644
 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
-@@ -3220,10 +3220,14 @@ static void mtk_pending_work(struct work_struct *work)
- 	mtk_prepare_reset_fe(eth);
- 
- 	/* Trigger Wifi SER reset */
+@@ -3619,10 +3619,14 @@ static void mtk_pending_work(struct work_struct *work)
+ 	for (i = 0; i < MTK_MAC_COUNT; i++) {
+ 		if (!eth->netdev[i])
+ 			continue;
 +#ifdef CONFIG_NET_MEDIATEK_SOC_WED
-+	mtk_wed_fe_reset(MTK_FE_START_RESET);
++		mtk_wed_fe_reset(MTK_FE_START_RESET);
 +#else
- 	call_netdevice_notifiers(MTK_FE_START_RESET, eth->netdev[0]);
- 	rtnl_unlock();
- 	wait_for_completion_timeout(&wait_ser_done, 5000);
- 	rtnl_lock();
+ 		call_netdevice_notifiers(MTK_FE_START_RESET, eth->netdev[i]);
+ 		rtnl_unlock();
+ 		wait_for_completion_timeout(&wait_ser_done, 5000);
+ 		rtnl_lock();
 +#endif
+ 		break;
+ 	}
  
- 	while (test_and_set_bit_lock(MTK_RESETTING, &eth->state))
- 		cpu_relax();
-@@ -3284,8 +3288,11 @@ static void mtk_pending_work(struct work_struct *work)
- 
- 	call_netdevice_notifiers(MTK_FE_RESET_NAT_DONE, eth->netdev[0]);
- 	pr_info("[%s] HNAT reset done !\n", __func__);
--
+@@ -3690,7 +3694,11 @@ static void mtk_pending_work(struct work_struct *work)
+ 			continue;
+ 		call_netdevice_notifiers(MTK_FE_RESET_NAT_DONE, eth->netdev[i]);
+ 		pr_info("[%s] HNAT reset done !\n", __func__);
 +#ifdef CONFIG_NET_MEDIATEK_SOC_WED
-+	mtk_wed_fe_reset(MTK_FE_RESET_DONE);
++		mtk_wed_fe_reset(MTK_FE_RESET_DONE);
 +#else
- 	call_netdevice_notifiers(MTK_FE_RESET_DONE, eth->netdev[0]);
+ 		call_netdevice_notifiers(MTK_FE_RESET_DONE, eth->netdev[i]);
 +#endif
- 	pr_info("[%s] WiFi SER reset done !\n", __func__);
- 
- 	atomic_dec(&reset_lock);
+ 		pr_info("[%s] WiFi SER reset done !\n", __func__);
+ 		break;
+ 	}
 diff --git a/drivers/net/ethernet/mediatek/mtk_wed.c b/drivers/net/ethernet/mediatek/mtk_wed.c
 index 7552795..c98d749 100644
 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986.cfg b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986.cfg
index 22f75b1..1ea9fd7 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986.cfg
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/mt7986.cfg
@@ -536,3 +536,5 @@
 CONFIG_ZLIB_DEFLATE=y
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZONE_DMA32=y
+# CONFIG_BPF_KPROBE_OVERRIDE is not set
+# CONFIG_HIST_TRIGGERS is not set
diff --git a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/751-net-phy-aquantia-add-firmware-download.patch b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/751-net-phy-aquantia-add-firmware-download.patch
index f40c3b0..1ed206c 100644
--- a/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/751-net-phy-aquantia-add-firmware-download.patch
+++ b/recipes-kernel/linux/linux-mediatek-5.4/mediatek/patches-5.4/751-net-phy-aquantia-add-firmware-download.patch
@@ -2,13 +2,31 @@
 index 7b49c94..5a79af2 100644
 --- a/drivers/net/phy/Kconfig
 +++ b/drivers/net/phy/Kconfig
-@@ -372,7 +372,38 @@ config AMD_PHY
+@@ -372,7 +372,56 @@ config AMD_PHY
  config AQUANTIA_PHY
  	tristate "Aquantia PHYs"
  	---help---
 -	  Currently supports the Aquantia AQ1202, AQ2104, AQR105, AQR405
 +	  Currently supports the Aquantia AQ1202, AQ2104, AQR105, AQR405, AQR113C
 +
++config AQUANTIA_PHY_MDI_SWAP
++	tristate "MDI Swap Enable"
++	depends on AQUANTIA_PHY
++	---help---
++	  Currently supports the Aquantia AQR113C
++
++choice
++	prompt "Swap mode"
++	default AQUANTIA_PHY_MDI_REVERSED
++	depends on AQUANTIA_PHY_MDI_SWAP
++
++	config AQUANTIA_PHY_MDI_NORMAL
++		bool "Normal"
++
++	config AQUANTIA_PHY_MDI_REVERSED
++		bool "Reversed"
++endchoice
++
 +config AQUANTIA_PHY_FW_DOWNLOAD
 +	tristate "Firmware Download Enable"
 +	depends on AQUANTIA_PHY
@@ -60,10 +78,13 @@
 index 5a16caa..912bbe6 100644
 --- a/drivers/net/phy/aquantia.h
 +++ b/drivers/net/phy/aquantia.h
-@@ -9,8 +9,53 @@
+@@ -9,8 +9,58 @@
  #include <linux/device.h>
  #include <linux/phy.h>
  
++#define PMAPMD_RSVD_VEND_PROV				0xe400
++#define PMAPMD_RSVD_VEND_PROV_MDI_CONF			BIT(0)
++
 +/* MDIO_MMD_C22EXT */
 +#define MDIO_C22EXT_STAT_SGMII_RX_GOOD_FRAMES		0xd292
 +#define MDIO_C22EXT_STAT_SGMII_RX_BAD_FRAMES		0xd294
@@ -105,6 +126,8 @@
 +#endif
 +};
 +
++int aqr107_config_mdi(struct phy_device *phydev);
++
  #if IS_REACHABLE(CONFIG_HWMON)
  int aqr_hwmon_probe(struct phy_device *phydev);
  #else
@@ -119,7 +142,7 @@
 index 0000000..7aeec86
 --- /dev/null
 +++ b/drivers/net/phy/aquantia_firmware.c
-@@ -0,0 +1,982 @@
+@@ -0,0 +1,995 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/* FW download driver for Aquantia PHY
 + */
@@ -992,6 +1015,9 @@
 +	int result[MAX_GANGLOAD_DEVICES];
 +	int i, ret = 0;
 +
++	if (!fw)
++		return;
++
 +retry:
 +	memset(result, 0, sizeof(result));
 +
@@ -999,11 +1025,8 @@
 +					result, fw->data, fw->size);
 +	if (ret) {
 +		for (i = 0; i < MAX_GANGLOAD_DEVICES; i++) {
-+			if (result[i] == 0) {
-+				priv = phydevs[i]->priv;
-+				priv->fw_initialized = true;
++			if (result[i] == 0)
 +				continue;
-+			}
 +
 +			dev = &phydevs[i]->mdio.dev;
 +			dev_err(dev, "failed to download firmware %s, ret: %d\n",
@@ -1012,6 +1035,19 @@
 +		}
 +	}
 +
++#ifdef CONFIG_AQUANTIA_PHY_MDI_SWAP
++	mdelay(250);
++#endif
++	for (i = 0; i < MAX_GANGLOAD_DEVICES; i++) {
++		if (result[i] == 0) {
++			priv = phydevs[i]->priv;
++			priv->fw_initialized = true;
++#ifdef CONFIG_AQUANTIA_PHY_MDI_SWAP
++			aqr107_config_mdi(phydevs[i]);
++#endif
++		}
++	}
++
 +	release_firmware(fw);
 +}
 +
@@ -1157,10 +1193,32 @@
  static int aqr107_get_sset_count(struct phy_device *phydev)
  {
  	return AQR107_SGMII_STAT_SZ;
-@@ -517,6 +480,10 @@ static int aqr107_config_init(struct phy_device *phydev)
+@@ -498,6 +461,17 @@ static void aqr107_chip_info(struct phy_device *phydev)
+ 		   fw_major, fw_minor, build_id, prov_id);
+ }
+ 
++int aqr107_config_mdi(struct phy_device *phydev)
++{
++#ifdef CONFIG_AQUANTIA_PHY_MDI_REVERSED
++	return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, PMAPMD_RSVD_VEND_PROV,
++			     PMAPMD_RSVD_VEND_PROV_MDI_CONF, 1);
++#else
++	return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, PMAPMD_RSVD_VEND_PROV,
++			     PMAPMD_RSVD_VEND_PROV_MDI_CONF, 0);
++#endif
++}
++
+ static int aqr107_config_init(struct phy_device *phydev)
+ {
+ 	int ret;
+@@ -517,6 +491,14 @@ static int aqr107_config_init(struct phy_device *phydev)
  	if (!ret)
  		aqr107_chip_info(phydev);
  
++#if !defined(CONFIG_AQUANTIA_PHY_FW_DOWNLOAD) && defined(CONFIG_AQUANTIA_PHY_MDI_SWAP)
++	aqr107_config_mdi(phydev);
++#endif
++
 +#ifdef CONFIG_AQUANTIA_PHY_FW_DOWNLOAD
 +	aqr_firmware_download(phydev);
 +#endif