[openwrt/openwrt] qualcommax: ipq50xx: use ascii-env driver to set mac address for Linksys MX devices
LEDE Commits
lede-commits at lists.infradead.org
Thu Feb 20 09:24:44 PST 2025
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/eacc4d8c9b31ac17df034d2140558bdaaa56c16b
commit eacc4d8c9b31ac17df034d2140558bdaaa56c16b
Author: George Moussalem <george.moussalem at outlook.com>
AuthorDate: Thu Feb 6 12:14:27 2025 +0400
qualcommax: ipq50xx: use ascii-env driver to set mac address for Linksys MX devices
The ascii-env driver enables reading name pair values from nand in ascii layout.
So, let's pick up and set the mac address accordingly.
Signed-off-by: George Moussalem <george.moussalem at outlook.com>
Link: https://github.com/openwrt/openwrt/pull/18029
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
target/linux/qualcommax/config-6.6 | 1 +
.../arch/arm64/boot/dts/qcom/ipq5018-mx-base.dtsi | 14 +++++++++++--
.../arch/arm64/boot/dts/qcom/ipq5018-mx2000.dts | 4 ++++
.../arch/arm64/boot/dts/qcom/ipq5018-mx5500.dts | 4 ++++
.../arch/arm64/boot/dts/qcom/ipq5018-spnmx56.dts | 5 +++++
.../ipq50xx/base-files/etc/board.d/02_network | 24 ----------------------
6 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/target/linux/qualcommax/config-6.6 b/target/linux/qualcommax/config-6.6
index a24a617124..1467bc968b 100644
--- a/target/linux/qualcommax/config-6.6
+++ b/target/linux/qualcommax/config-6.6
@@ -278,6 +278,7 @@ CONFIG_NR_CPUS=4
CONFIG_NVIDIA_CARMEL_CNP_ERRATUM=y
CONFIG_NVMEM=y
CONFIG_NVMEM_LAYOUTS=y
+CONFIG_NVMEM_LAYOUT_ASCII_ENV=y
CONFIG_NVMEM_LAYOUT_U_BOOT_ENV=y
CONFIG_NVMEM_QCOM_QFPROM=y
# CONFIG_NVMEM_QCOM_SEC_QFPROM is not set
diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx-base.dtsi b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx-base.dtsi
index 57fe5c53a9..a015fcbd34 100644
--- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx-base.dtsi
+++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx-base.dtsi
@@ -8,8 +8,6 @@
/ {
aliases {
- ethernet0 = &dp1;
- ethernet1 = &dp2;
led-boot = &led_system_blue;
led-failsafe = &led_system_red;
led-running = &led_system_blue;
@@ -209,6 +207,18 @@
label = "devinfo";
reg = <0x00680000 0x40000>;
read-only;
+
+ nvmem-layout {
+ compatible = "ascii-eq-delim-env";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ hw_mac_addr: hw_mac_addr {
+ compatible = "mac-base";
+
+ #nvmem-cell-cells = <1>;
+ };
+ };
};
partition at 6c0000 {
diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx2000.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx2000.dts
index 108b26f8d1..e563cca779 100644
--- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx2000.dts
+++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx2000.dts
@@ -48,8 +48,12 @@
// MAC1 ---SGMII---> QCA8337 SerDes
&dp2 {
status = "okay";
+
phy-mode = "sgmii";
+ nvmem-cells = <&hw_mac_addr 0>;
+ nvmem-cell-names = "mac-address";
+
fixed-link {
speed = <1000>;
full-duplex;
diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx5500.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx5500.dts
index 630e8ba310..ab3e00a9cc 100644
--- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx5500.dts
+++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-mx5500.dts
@@ -48,8 +48,12 @@
// MAC1 ---SGMII---> QCA8337 SerDes
&dp2 {
status = "okay";
+
phy-mode = "sgmii";
+ nvmem-cells = <&hw_mac_addr 0>;
+ nvmem-cell-names = "mac-address";
+
fixed-link {
speed = <1000>;
full-duplex;
diff --git a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-spnmx56.dts b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-spnmx56.dts
index 75b9444514..d25ff0f1cb 100644
--- a/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-spnmx56.dts
+++ b/target/linux/qualcommax/files/arch/arm64/boot/dts/qcom/ipq5018-spnmx56.dts
@@ -53,6 +53,9 @@
// MAC0 -> GE Phy
&dp1 {
status = "okay";
+
+ nvmem-cells = <&hw_mac_addr 0>;
+ nvmem-cell-names = "mac-address";
};
// MAC1 ---SGMII---> QCA8081
@@ -61,6 +64,8 @@
label = "wan";
phy-handle = <&qca8081>;
+ nvmem-cells = <&hw_mac_addr 0>;
+ nvmem-cell-names = "mac-address";
};
&mdio0 {
diff --git a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network
index c80b259d27..6c8574c474 100644
--- a/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network
+++ b/target/linux/qualcommax/ipq50xx/base-files/etc/board.d/02_network
@@ -15,33 +15,9 @@ ipq50xx_setup_interfaces()
esac
}
-ipq50xx_setup_macs()
-{
- local board="$1"
- local lan_mac=""
- local wan_mac=""
- local label_mac=""
-
- case "$board" in
- linksys,mx2000|\
- linksys,mx5500|\
- linksys,spnmx56)
- label_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr)
- lan_mac=$label_mac
- wan_mac=$label_mac
- ucidef_set_network_device_mac eth0 $label_mac
- ;;
- esac
-
- [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
- [ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
- [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
-}
-
board_config_update
board=$(board_name)
ipq50xx_setup_interfaces $board
-ipq50xx_setup_macs $board
board_config_flush
exit 0
More information about the lede-commits
mailing list