[openwrt/openwrt] bcm53xx: backport nvmem mac for meraki mr26
LEDE Commits
lede-commits at lists.infradead.org
Sat Jan 4 06:15:18 PST 2025
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/58056df84f6dfd0c86d45e2e22d715a3c501ce1e
commit 58056df84f6dfd0c86d45e2e22d715a3c501ce1e
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Sun Nov 24 12:43:07 2024 -0800
bcm53xx: backport nvmem mac for meraki mr26
Avoids having to set the MAC in userspace.
Also added a mac-base change to set the wifi MACs. It's not clear if
upstream would want it once mac-base is upstreamed.
Signed-off-by: Rosen Penev <rosenp at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17064
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
.../bcm53xx/base-files/etc/board.d/02_network | 5 --
.../etc/hotplug.d/ieee80211/10-fix-mac-address | 18 ------
...dts-meraki-mr26-set-mac-address-for-gmac0.patch | 52 +++++++++++++++++
.../051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch | 67 ++++++++++++++++++++++
4 files changed, 119 insertions(+), 23 deletions(-)
diff --git a/target/linux/bcm53xx/base-files/etc/board.d/02_network b/target/linux/bcm53xx/base-files/etc/board.d/02_network
index 19569e7a78..5edf6ec9b8 100644
--- a/target/linux/bcm53xx/base-files/etc/board.d/02_network
+++ b/target/linux/bcm53xx/base-files/etc/board.d/02_network
@@ -71,11 +71,6 @@ bcm53xx_setup_macs()
etXmacaddr=$(nvram get et0macaddr)
offset=5
;;
- meraki,mr26)
- label_mac="$(mtd_get_mac_binary_ubi board-config 0x66)"
- ucidef_set_interface_macaddr "lan" "$label_mac"
- ucidef_set_label_macaddr "$label_mac"
- ;;
meraki,mx64 | \
meraki,mx64-a0 | \
meraki,mx65)
diff --git a/target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address b/target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address
deleted file mode 100644
index c1c56a10f3..0000000000
--- a/target/linux/bcm53xx/base-files/etc/hotplug.d/ieee80211/10-fix-mac-address
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/ash
-
-[ "$ACTION" = "add" ] || exit 0
-
-PHYNBR=${DEVPATH##*/phy}
-
-[ -n $PHYNBR ] || exit 0
-
-. /lib/functions.sh
-. /lib/functions/system.sh
-
-board=$(board_name)
-
-case "$board" in
-meraki,mr26)
- macaddr_add "$(macaddr_setbit_la $(mtd_get_mac_binary_ubi 'board-config' 0x66))" $(($PHYNBR * 8 + 1)) > /sys${DEVPATH}/macaddress
- ;;
-esac
diff --git a/target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch b/target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch
new file mode 100644
index 0000000000..f6a6f819d1
--- /dev/null
+++ b/target/linux/bcm53xx/patches-6.6/050-v6.13-ARM-dts-meraki-mr26-set-mac-address-for-gmac0.patch
@@ -0,0 +1,52 @@
+From ad1915e2070cf832bfb81dcbeb44b073c09e6dcc Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp at gmail.com>
+Date: Sun, 20 Oct 2024 18:51:47 -0700
+Subject: [PATCH] ARM: dts: meraki-mr26: set mac address for gmac0
+
+Currently this needs to be done in userspace.
+
+Signed-off-by: Rosen Penev <rosenp at gmail.com>
+Link: https://lore.kernel.org/r/20241021015147.172700-1-rosenp@gmail.com
+Signed-off-by: Florian Fainelli <florian.fainelli at broadcom.com>
+---
+ .../dts/broadcom/bcm53015-meraki-mr26.dts | 20 +++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+--- a/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts
++++ b/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts
+@@ -59,6 +59,9 @@
+
+ &gmac0 {
+ status = "okay";
++
++ nvmem-cells = <&macaddr_board_config_66>;
++ nvmem-cell-names = "mac-address";
+ };
+
+ &gmac1 {
+@@ -102,8 +105,25 @@
+ };
+
+ partition at 800000 {
++ compatible = "linux,ubi";
+ label = "ubi";
+ reg = <0x800000 0x7780000>;
++
++ volumes {
++ ubi-volume-board-config {
++ volname = "board-config";
++
++ nvmem-layout {
++ compatible = "fixed-layout";
++ #address-cells = <1>;
++ #size-cells = <1>;
++
++ macaddr_board_config_66: macaddr at 66 {
++ reg = <0x66 0x6>;
++ };
++ };
++ };
++ };
+ };
+ };
+ };
diff --git a/target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch b/target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch
new file mode 100644
index 0000000000..fd31438cdb
--- /dev/null
+++ b/target/linux/bcm53xx/patches-6.6/051-ARM-dts-meraki-mr26-wifi-MACs-in-dts.patch
@@ -0,0 +1,67 @@
+From c18e0b14b466fb0aa17c8ca6e61f16ba1254aebd Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp at gmail.com>
+Date: Sun, 24 Nov 2024 12:58:51 -0800
+Subject: [PATCH] ARM: dts: meraki-mr26: wifi MACs in dts
+
+OPENWRT HACK. Probably will not be accepted upstream.
+
+Signed-off-by: Rosen Penev <rosenp at gmail.com>
+---
+ .../dts/broadcom/bcm53015-meraki-mr26.dts | 31 ++++++++++++++++++-
+ 1 file changed, 30 insertions(+), 1 deletion(-)
+
+--- a/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts
++++ b/arch/arm/boot/dts/broadcom/bcm53015-meraki-mr26.dts
+@@ -60,7 +60,7 @@
+ &gmac0 {
+ status = "okay";
+
+- nvmem-cells = <&macaddr_board_config_66>;
++ nvmem-cells = <&macaddr_board_config_66 0>;
+ nvmem-cell-names = "mac-address";
+ };
+
+@@ -74,6 +74,33 @@
+ status = "disabled";
+ };
+
++&pcie0 {
++ wifi at 0,0 {
++ reg = <0x0000 0 0 0 0>;
++ compatible = "brcm,bcm43431";
++ nvmem-cells = <&macaddr_board_config_66 1>;
++ nvmem-cell-names = "mac-address";
++ };
++};
++
++&pcie1 {
++ wifi at 0,0 {
++ reg = <0x0000 0 0 0 0>;
++ compatible = "brcm,bcm43431";
++ nvmem-cells = <&macaddr_board_config_66 2>;
++ nvmem-cell-names = "mac-address";
++ };
++};
++
++&pcie2 {
++ wifi at 0,0 {
++ reg = <0x0000 0 0 0 0>;
++ compatible = "brcm,bcm43428";
++ nvmem-cells = <&macaddr_board_config_66 3>;
++ nvmem-cell-names = "mac-address";
++ };
++};
++
+ &nandcs {
+ partitions {
+ compatible = "fixed-partitions";
+@@ -119,7 +146,9 @@
+ #size-cells = <1>;
+
+ macaddr_board_config_66: macaddr at 66 {
++ compatible = "mac-base";
+ reg = <0x66 0x6>;
++ #nvmem-cell-cells = <1>;
+ };
+ };
+ };
More information about the lede-commits
mailing list