diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network index e3a6e242284..a498cbf9d3e 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -219,19 +219,6 @@ ipq40xx_setup_macs() wan_mac=$(mmc_get_mac_ascii devinfo hw_mac_addr) lan_mac="$wan_mac" ;; - mikrotik,cap-ac |\ - mikrotik,hap-ac2|\ - mikrotik,hap-ac3|\ - mikrotik,hap-ac3-lte6-kit) - wan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base) - lan_mac=$(macaddr_add $wan_mac 1) - label_mac="$wan_mac" - ;; - mikrotik,lhgg-60ad|\ - mikrotik,sxtsq-5-ac) - lan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base) - label_mac="$lan_mac" - ;; netgear,rbr50|\ netgear,rbs50|\ netgear,srr60|\ diff --git a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh index 1ede544aacc..b25dddfcfbb 100644 --- a/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh +++ b/target/linux/ipq40xx/base-files/lib/preinit/05_set_iface_mac_ipq40xx.sh @@ -36,13 +36,6 @@ preinit_set_mac_address() { ip link set dev lan address "$base_mac" ip link set dev wan address "$base_mac" ;; - mikrotik,wap-ac|\ - mikrotik,wap-ac-lte|\ - mikrotik,wap-r-ac) - base_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base) - ip link set dev sw-eth1 address "$base_mac" - ip link set dev sw-eth2 address $(macaddr_add "$base_mac" 1) - ;; zyxel,nbg6617) base_mac=$(cat /sys/class/net/eth0/address) ip link set dev eth0 address $(macaddr_add "$base_mac" 2) diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts index b061428bb34..6cecb113e65 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-cap-ac.dts @@ -25,6 +25,7 @@ led-failsafe = &led_user; led-running = &led_user; led-upgrade = &led_user; + label-mac_device = &swport5; }; soc { @@ -180,6 +181,14 @@ hard_config { read-only; + + nvmem-layout { + compatible = "mikrotik,routerboot-nvmem"; + + macaddr_hard: base-mac-address { + #nvmem-cell-cells = <1>; + }; + }; }; dtb_config { @@ -226,6 +235,9 @@ &gmac { status = "okay"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; &switch { @@ -240,6 +252,9 @@ &swport5 { status = "okay"; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; &wifi0 { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts index 07ad4d3d520..8eea8e2974a 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-hap-ac2.dts @@ -25,6 +25,7 @@ led-failsafe = &led_user; led-running = &led_user; led-upgrade = &led_user; + label-mac-device = &swport5; }; soc { @@ -176,6 +177,14 @@ hard_config { read-only; size = <0x2000>; + + nvmem-layout { + compatible = "mikrotik,routerboot-nvmem"; + + macaddr_hard: base-mac-address { + #nvmem-cell-cells = <1>; + }; + }; }; dtb_config { @@ -255,6 +264,9 @@ &gmac { status = "okay"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; &switch { @@ -264,25 +276,40 @@ &swport1 { status = "okay"; label = "lan4"; + + nvmem-cells = <&macaddr_hard 4>; + nvmem-cell-names = "mac-address"; }; &swport2 { status = "okay"; label = "lan3"; + + nvmem-cells = <&macaddr_hard 3>; + nvmem-cell-names = "mac-address"; }; &swport3 { status = "okay"; label = "lan2"; + + nvmem-cells = <&macaddr_hard 2>; + nvmem-cell-names = "mac-address"; }; &swport4 { status = "okay"; label = "lan1"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; &swport5 { status = "okay"; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; &wifi0 { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts index 23e9457f029..2beb8397a06 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-sxtsq-5-ac.dts @@ -25,6 +25,7 @@ led-failsafe = &led_user; led-running = &led_user; led-upgrade = &led_user; + label-mac-device = &gmac; }; soc { @@ -179,6 +180,14 @@ hard_config { read-only; + + nvmem-layout { + compatible = "mikrotik,routerboot-nvmem"; + + macaddr_hard: base-mac-address { + #nvmem-cell-cells = <1>; + }; + }; }; dtb_config { @@ -221,6 +230,9 @@ &gmac { status = "okay"; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; &switch { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi index 2b357a1f033..05e68378a8b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4018-wap-ac.dtsi @@ -22,6 +22,7 @@ led-failsafe = &led_user; led-running = &led_user; led-upgrade = &led_user; + label-mac-device = &swport5; }; soc { @@ -144,6 +145,14 @@ hard_config { read-only; size = <0x2000>; + + nvmem-layout { + compatible = "mikrotik,routerboot-nvmem"; + + macaddr_hard: base-mac-address { + #nvmem-cell-cells = <1>; + }; + }; }; dtb_config { @@ -197,11 +206,17 @@ &swport4 { status = "okay"; label = "sw-eth2"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; &swport5 { status = "okay"; label = "sw-eth1"; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; &wifi0 { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts index b1a04012fb2..3b3690fad9a 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3-lte6-kit.dts @@ -25,6 +25,7 @@ led-failsafe = &led_status_red; led-running = &led_status_blue; led-upgrade = &led_status_red; + label-mac-device = &swport5; }; soc { @@ -208,6 +209,14 @@ hard_config { size = <0x2000>; + + nvmem-layout { + compatible = "mikrotik,routerboot-nvmem"; + + macaddr_hard: base-mac-address { + #nvmem-cell-cells = <1>; + }; + }; }; dtb_config { @@ -263,6 +272,9 @@ &gmac { status = "okay"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; &switch { @@ -272,25 +284,40 @@ &swport1 { status = "okay"; label = "lan4"; + + nvmem-cells = <&macaddr_hard 4>; + nvmem-cell-names = "mac-address"; }; &swport2 { status = "okay"; label = "lan3"; + + nvmem-cells = <&macaddr_hard 3>; + nvmem-cell-names = "mac-address"; }; &swport3 { status = "okay"; label = "lan2"; + + nvmem-cells = <&macaddr_hard 2>; + nvmem-cell-names = "mac-address"; }; &swport4 { status = "okay"; label = "lan1"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; &swport5 { status = "okay"; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; &wifi0 { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts index 4a3a323b5ff..d565633740f 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-hap-ac3.dts @@ -25,6 +25,7 @@ led-failsafe = &led_status_red; led-running = &led_status_blue; led-upgrade = &led_status_red; + label-mac-device = &swport5; }; soc { @@ -247,6 +248,14 @@ hard_config { read-only; size = <0x2000>; + + nvmem-layout { + compatible = "mikrotik,routerboot-nvmem"; + + macaddr_hard: base-mac-address { + #nvmem-cell-cells = <1>; + }; + }; }; dtb_config { @@ -314,6 +323,9 @@ &gmac { status = "okay"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; &switch { @@ -323,25 +335,40 @@ &swport1 { status = "okay"; label = "lan4"; + + nvmem-cells = <&macaddr_hard 4>; + nvmem-cell-names = "mac-address"; }; &swport2 { status = "okay"; label = "lan3"; + + nvmem-cells = <&macaddr_hard 3>; + nvmem-cell-names = "mac-address"; }; &swport3 { status = "okay"; label = "lan2"; + + nvmem-cells = <&macaddr_hard 2>; + nvmem-cell-names = "mac-address"; }; &swport4 { status = "okay"; label = "lan1"; + + nvmem-cells = <&macaddr_hard 1>; + nvmem-cell-names = "mac-address"; }; &swport5 { status = "okay"; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; &wifi0 { diff --git a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts index a5b55ff421f..3c2f216d75b 100644 --- a/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts +++ b/target/linux/ipq40xx/files-6.6/arch/arm/boot/dts/qcom/qcom-ipq4019-lhgg-60ad.dts @@ -39,6 +39,7 @@ led-failsafe = &user; led-running = &user; led-upgrade = &user; + label-mac-device = &gmac; }; soc { @@ -193,6 +194,14 @@ hard_config { read-only; size = <0x2000>; + + nvmem-layout { + compatible = "mikrotik,routerboot-nvmem"; + + macaddr_hard: base-mac-address { + #nvmem-cell-cells = <1>; + }; + }; }; dtb_config { @@ -279,6 +288,9 @@ &gmac { status = "okay"; + + nvmem-cells = <&macaddr_hard 0>; + nvmem-cell-names = "mac-address"; }; &switch { diff --git a/target/linux/ipq40xx/mikrotik/config-default b/target/linux/ipq40xx/mikrotik/config-default index 9f90ea4193f..8f3e6b250f5 100644 --- a/target/linux/ipq40xx/mikrotik/config-default +++ b/target/linux/ipq40xx/mikrotik/config-default @@ -9,5 +9,5 @@ CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_NVMEM=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 -# CONFIG_NVMEM_LAYOUT_MIKROTIK is not set +CONFIG_NVMEM_LAYOUT_MIKROTIK=y CONFIG_UBIFS_FS=y