[][kernel][mt7988][eth][Add support for the permanent MAC address of the ethtool]
[Description]
Add support for the permanent MAC address of the ethtool.
Usage: ethtool -P ethX
Without this patch, the ethtool is unable to retrieve the permanent MAC
address from the NAND/NOR Flash.
[Release-log]
N/A
Change-Id: I99507ca05c62318af43907545bbf535dfdb5e098
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9034726
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-88d-10g-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-88d-10g-spim-nand.dts
index 8ebcbaf..c558535 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-88d-10g-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-88d-10g-spim-nand.dts
@@ -416,6 +416,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -429,6 +430,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy0>;
@@ -437,6 +439,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sfp-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sfp-spim-nand.dts
index 54e2cf0..8fbe9c5 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sfp-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-sfp-spim-nand.dts
@@ -352,6 +352,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -365,6 +366,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
managed = "in-band-status";
@@ -374,6 +376,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
managed = "in-band-status";
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts
index 7881834..cde918b 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-snfi-nand.dts
@@ -287,6 +287,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -300,6 +301,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy0>;
@@ -308,6 +310,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand-CASAN.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand-CASAN.dts
index 2404a40..834eb41 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand-CASAN.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand-CASAN.dts
@@ -411,6 +411,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -424,6 +425,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy0>;
@@ -432,6 +434,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
index 2624584..224583a 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nand.dts
@@ -411,6 +411,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -424,6 +425,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy0>;
@@ -432,6 +434,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
index 2fa9f5d..24c7799 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-10g-spim-nor.dts
@@ -279,6 +279,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -292,6 +293,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy0>;
@@ -300,6 +302,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-e2p5g-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-e2p5g-spim-nand.dts
index dc27135..4562413 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-e2p5g-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-e2p5g-spim-nand.dts
@@ -321,6 +321,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -334,6 +335,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "gdm";
phy-mode = "2500base-x";
phy-handle = <&phy13>;
@@ -342,6 +344,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "gdm";
phy-mode = "2500base-x";
phy-handle = <&phy5>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts
index e88bc4f..2803b7b 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-dsa-i2p5g-spim-nand.dts
@@ -284,6 +284,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -297,6 +298,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "xgmii";
phy-handle = <&phy0>;
@@ -305,6 +307,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-sfp-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-sfp-spim-nand.dts
index d6da110..a922d57 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-sfp-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-sfp-spim-nand.dts
@@ -336,6 +336,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -349,6 +350,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
managed = "in-band-status";
@@ -358,6 +360,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
managed = "in-band-status";
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts
index daac5d7..4ee16fd 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand-4pcie.dts
@@ -324,6 +324,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -337,6 +338,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy0>;
@@ -345,6 +347,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts
index 5ea962f..b084812 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988a-gsw-10g-spim-nand.dts
@@ -356,6 +356,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -369,6 +370,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy0>;
@@ -377,6 +379,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sfp-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sfp-spim-nand.dts
index a6f3257..356ff3a 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sfp-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-sfp-spim-nand.dts
@@ -335,6 +335,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -348,6 +349,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "xgmii";
phy-handle = <&phy0>;
@@ -356,6 +358,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
managed = "in-band-status";
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts
index f3cee2b..bd4326f 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-snfi-nand.dts
@@ -298,6 +298,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -311,6 +312,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "xgmii";
phy-handle = <&phy0>;
@@ -319,6 +321,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand-CASAN.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand-CASAN.dts
index e4b03bf..42efe94 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand-CASAN.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand-CASAN.dts
@@ -392,6 +392,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -405,6 +406,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "xgmii";
phy-handle = <&phy0>;
@@ -413,6 +415,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
index d4f96c8..3e2c564 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nand.dts
@@ -392,6 +392,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -405,6 +406,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "xgmii";
phy-handle = <&phy0>;
@@ -413,6 +415,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
index be66a65..f72c5d3 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-spim-nor.dts
@@ -290,6 +290,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -303,6 +304,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "xgmii";
phy-handle = <&phy0>;
@@ -311,6 +313,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-wan-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-wan-spim-nand.dts
index a3bde2e..7a3d9a6 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-wan-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-10g-wan-spim-nand.dts
@@ -392,6 +392,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -405,6 +406,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "xgmii";
phy-handle = <&phy0>;
@@ -413,6 +415,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-e2p5g-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-e2p5g-spim-nand.dts
index 7fdec3f..78847ef 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-e2p5g-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-dsa-e2p5g-spim-nand.dts
@@ -310,6 +310,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -323,6 +324,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "xgmii";
phy-handle = <&phy0>;
@@ -331,6 +333,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "gdm";
phy-mode = "2500base-x";
phy-handle = <&phy5>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-sfp-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-sfp-spim-nand.dts
index 2ed715c..18bbfcc 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-sfp-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-sfp-spim-nand.dts
@@ -324,6 +324,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -337,6 +338,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "xgmii";
phy-handle = <&phy0>;
@@ -345,6 +347,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
managed = "in-band-status";
diff --git a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts
index ac3da71..1f5ea1f 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts
+++ b/21.02/files/target/linux/mediatek/files-5.4/arch/arm64/boot/dts/mediatek/mt7988d-gsw-10g-spim-nand.dts
@@ -354,6 +354,7 @@
gmac0: mac@0 {
compatible = "mediatek,eth-mac";
reg = <0>;
+ mtd-mac-address = <&factory 0xFFFF4>;
mac-type = "xgdm";
phy-mode = "10gbase-kr";
@@ -367,6 +368,7 @@
gmac1: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
+ mtd-mac-address = <&factory 0xFFFFA>;
mac-type = "xgdm";
phy-mode = "xgmii";
phy-handle = <&phy0>;
@@ -375,6 +377,7 @@
gmac2: mac@2 {
compatible = "mediatek,eth-mac";
reg = <2>;
+ mtd-mac-address = <&factory 0xFFFEE>;
mac-type = "xgdm";
phy-mode = "usxgmii";
phy-handle = <&phy1>;
diff --git a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 7ff8baf..b58e608 100644
--- a/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/21.02/files/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -10,6 +10,7 @@
#include <linux/of_mdio.h>
#include <linux/of_net.h>
#include <linux/of_address.h>
+#include <linux/mtd/mtd.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h>
#include <linux/clk.h>
@@ -4492,8 +4493,10 @@
const char *mac_addr;
mac_addr = of_get_mac_address(mac->of_node);
- if (!IS_ERR(mac_addr))
+ if (!IS_ERR(mac_addr)) {
ether_addr_copy(dev->dev_addr, mac_addr);
+ ether_addr_copy(dev->perm_addr, mac_addr);
+ }
/* If the mac address is invalid, use random mac address */
if (!is_valid_ether_addr(dev->dev_addr)) {
@@ -5250,6 +5253,40 @@
return 0;
}
+static int mtk_of_mtd_mac_address_is_available(struct device_node *np)
+{
+#ifdef CONFIG_MTD
+ struct device_node *mtd_np = NULL;
+ int size;
+ struct mtd_info *mtd;
+ const char *part;
+ const __be32 *list;
+ phandle phandle;
+
+ list = of_get_property(np, "mtd-mac-address", &size);
+ if (!list || (size != (2 * sizeof(*list))))
+ return 0;
+
+ phandle = be32_to_cpup(list++);
+ if (phandle)
+ mtd_np = of_find_node_by_phandle(phandle);
+
+ if (!mtd_np)
+ return 0;
+
+ part = of_get_property(mtd_np, "label", NULL);
+ if (!part)
+ part = mtd_np->name;
+
+ mtd = get_mtd_device_nm(part);
+ if (IS_ERR(mtd))
+ return -ENODEV;
+
+ return 1;
+#endif
+ return 0;
+}
+
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
{
const __be32 *_id = of_get_property(np, "reg", NULL);
@@ -5278,6 +5315,9 @@
return -EINVAL;
}
+ if (mtk_of_mtd_mac_address_is_available(np) < 0)
+ return -EPROBE_DEFER;
+
if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA))
txqs = MTK_QDMA_TX_NUM;