From ba3d92c5a087cd4d28124fc366fc63a34732ff3d Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Tue, 17 Aug 2021 20:53:27 +0200 Subject: [PATCH] ramips: convert most mtd-mac-address cases in DTSI to nvmem Convert most of the cases from mtd-mac-address to nvmem where MAC addresses are set in the DTSI, but the partitions are only located in the device DTS. This posed some problems earlier, since in these cases we are using partitions before they are defined, and the nvmem system did not seem to like that. There have been a few different resolution approaches, based on the different tradeoffs of deduplication vs. maintainability: 1. In many cases, the partition tables were identical except for the firmware partition size, and the firmware partition was the last in the table. In these cases, the partition table has been moved to the DTSI, and only the firmware partition's "reg" property has been kept in the DTS files. So, the updated nvmem definition could stay in the DTSI files as well. 2. For all other cases, splitting up the partition table would have introduced additional complexity. Thus, the nodes to be converted to nvmem have been moved to the DTS files where the partitioning was defined. 3. For Netgear EX2700 and WN3000RP v3, the remaining DTSI file was completely dissolved, as it was quite small and the name was not really nice either. 4. The D-Link DIR-853 A3 was converted to nvmem as well, though it is just a plain DTS file not taken care of in the first wave. In addition, some minor rearrangements have been made for tidyness. Not covered (yet) by this patch are: * Various unielec devices * The D-Link DIR-8xx family Signed-off-by: Adrian Schmutzler --- .../ramips/dts/mt7620a_netgear_ex2700.dts | 106 +++++++++++++++--- .../mt7620a_netgear_ex2700_wn3000rp-v3.dtsi | 58 ---------- .../dts/mt7620a_netgear_wn3000rp-v3.dts | 106 +++++++++++++++--- .../dts/mt7620a_zbtlink_zbt-we826-16m.dts | 40 +------ .../dts/mt7620a_zbtlink_zbt-we826-32m.dts | 40 +------ .../dts/mt7620a_zbtlink_zbt-we826-e.dts | 40 +------ .../ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi | 53 ++++++++- .../ramips/dts/mt7620n_nexx_wt3020-4m.dts | 40 +------ .../ramips/dts/mt7620n_nexx_wt3020-8m.dts | 44 +------- .../linux/ramips/dts/mt7620n_nexx_wt3020.dtsi | 53 ++++++++- .../ramips/dts/mt7621_dlink_dir-853-a3.dts | 27 ++++- .../linux/ramips/dts/mt7621_netgear_r6220.dts | 25 +++++ .../dts/mt7621_netgear_sercomm_ayx.dtsi | 9 +- .../ramips/dts/mt7621_netgear_wndr3700-v5.dts | 25 +++++ .../ramips/dts/mt7621_ubnt_unifi-6-lite.dts | 8 ++ .../ramips/dts/mt7621_ubnt_unifi-nanohd.dts | 19 ++++ .../linux/ramips/dts/mt7621_ubnt_unifi.dtsi | 5 - .../dts/mt7628an_vocore_vocore2-lite.dts | 40 +------ .../ramips/dts/mt7628an_vocore_vocore2.dts | 40 +------ .../ramips/dts/mt7628an_vocore_vocore2.dtsi | 53 ++++++++- .../ramips/dts/mt7628an_widora_neo-16m.dts | 50 +-------- .../ramips/dts/mt7628an_widora_neo-32m.dts | 50 +-------- .../linux/ramips/dts/mt7628an_widora_neo.dtsi | 63 ++++++++++- .../ramips/dts/rt3050_allnet_all0256n-4m.dts | 40 +------ .../ramips/dts/rt3050_allnet_all0256n-8m.dts | 40 +------ .../ramips/dts/rt3050_allnet_all0256n.dtsi | 53 ++++++++- .../dts/rt3050_alphanetworks_asl26555-16m.dts | 15 +++ .../dts/rt3050_alphanetworks_asl26555-8m.dts | 15 +++ .../dts/rt3050_alphanetworks_asl26555.dtsi | 4 - .../ramips/dts/rt5350_7links_px-4885-4m.dts | 40 +------ .../ramips/dts/rt5350_7links_px-4885-8m.dts | 40 +------ .../ramips/dts/rt5350_7links_px-4885.dtsi | 53 ++++++++- .../dts/rt5350_asiarf_awm002-evb-4m.dts | 40 +------ .../dts/rt5350_asiarf_awm002-evb-8m.dts | 40 +------ .../ramips/dts/rt5350_asiarf_awm002-evb.dtsi | 53 ++++++++- .../ramips/dts/rt5350_nexx_wt1520-4m.dts | 40 +------ .../ramips/dts/rt5350_nexx_wt1520-8m.dts | 40 +------ .../linux/ramips/dts/rt5350_nexx_wt1520.dtsi | 53 ++++++++- .../ramips/dts/rt5350_nixcore_x1-16m.dts | 40 +------ .../linux/ramips/dts/rt5350_nixcore_x1-8m.dts | 40 +------ .../linux/ramips/dts/rt5350_nixcore_x1.dtsi | 53 ++++++++- .../linux/ramips/dts/rt5350_poray_m4-4m.dts | 40 +------ .../linux/ramips/dts/rt5350_poray_m4-8m.dts | 40 +------ target/linux/ramips/dts/rt5350_poray_m4.dtsi | 53 ++++++++- .../ramips/dts/rt5350_vocore_vocore-16m.dts | 40 +------ .../ramips/dts/rt5350_vocore_vocore-8m.dts | 40 +------ .../ramips/dts/rt5350_vocore_vocore.dtsi | 53 ++++++++- 47 files changed, 938 insertions(+), 1021 deletions(-) delete mode 100644 target/linux/ramips/dts/mt7620a_netgear_ex2700_wn3000rp-v3.dtsi diff --git a/target/linux/ramips/dts/mt7620a_netgear_ex2700.dts b/target/linux/ramips/dts/mt7620a_netgear_ex2700.dts index 9ed0883b45..e09d9c607b 100644 --- a/target/linux/ramips/dts/mt7620a_netgear_ex2700.dts +++ b/target/linux/ramips/dts/mt7620a_netgear_ex2700.dts @@ -3,7 +3,10 @@ * Copyright (C) 2016 Joseph C. Lehner */ -#include "mt7620a_netgear_ex2700_wn3000rp-v3.dtsi" +#include "mt7620a.dtsi" + +#include +#include / { compatible = "netgear,ex2700", "ralink,mt7620a-soc"; @@ -16,6 +19,22 @@ led-upgrade = &led_power_green; }; + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + leds { compatible = "gpio-leds"; @@ -57,28 +76,79 @@ }; }; -&partitions { - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; +&gpio1 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x40000 0x3b0000>; + }; + + art: partition@3f0000 { + label = "art"; + reg = <0x3f0000 0x10000>; + read-only; + }; + }; }; +}; + +ðernet { + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; +}; + +&wmac { + ralink,mtd-eeprom = <&art 0x1000>; + + nvmem-cells = <&macaddr_art_6>; + nvmem-cell-names = "mac-address"; +}; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; +&state_default { + default { + groups = "i2c", "uartf", "spi refclk"; + function = "gpio"; }; +}; + +&art { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; - partition@40000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x40000 0x3b0000>; + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; }; - art: partition@3f0000 { - label = "art"; - reg = <0x3f0000 0x10000>; - read-only; + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; }; }; diff --git a/target/linux/ramips/dts/mt7620a_netgear_ex2700_wn3000rp-v3.dtsi b/target/linux/ramips/dts/mt7620a_netgear_ex2700_wn3000rp-v3.dtsi deleted file mode 100644 index e7b1f4bf40..0000000000 --- a/target/linux/ramips/dts/mt7620a_netgear_ex2700_wn3000rp-v3.dtsi +++ /dev/null @@ -1,58 +0,0 @@ -#include "mt7620a.dtsi" - -#include -#include - -/ { - keys { - compatible = "gpio-keys"; - - reset { - label = "reset"; - gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - - wps { - label = "wps"; - gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; -}; - -&gpio1 { - status = "okay"; -}; - -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions: partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - }; - }; -}; - -ðernet { - mtd-mac-address = <&art 0x0>; -}; - -&wmac { - ralink,mtd-eeprom = <&art 0x1000>; - mtd-mac-address = <&art 0x6>; -}; - -&state_default { - default { - groups = "i2c", "uartf", "spi refclk"; - function = "gpio"; - }; -}; diff --git a/target/linux/ramips/dts/mt7620a_netgear_wn3000rp-v3.dts b/target/linux/ramips/dts/mt7620a_netgear_wn3000rp-v3.dts index c9b1806243..c6fe7baa67 100644 --- a/target/linux/ramips/dts/mt7620a_netgear_wn3000rp-v3.dts +++ b/target/linux/ramips/dts/mt7620a_netgear_wn3000rp-v3.dts @@ -1,6 +1,9 @@ /* This file is released into the public domain */ -#include "mt7620a_netgear_ex2700_wn3000rp-v3.dtsi" +#include "mt7620a.dtsi" + +#include +#include / { compatible = "netgear,wn3000rp-v3", "ralink,mt7620a-soc"; @@ -13,6 +16,22 @@ led-upgrade = &led_power_green; }; + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + leds { compatible = "gpio-leds"; @@ -64,28 +83,79 @@ }; }; -&partitions { - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; +&gpio1 { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + partition@40000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x40000 0x7b0000>; + }; + + art: partition@7f0000 { + label = "art"; + reg = <0x7f0000 0x10000>; + read-only; + }; + }; }; +}; + +ðernet { + nvmem-cells = <&macaddr_art_0>; + nvmem-cell-names = "mac-address"; +}; + +&wmac { + ralink,mtd-eeprom = <&art 0x1000>; - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; + nvmem-cells = <&macaddr_art_6>; + nvmem-cell-names = "mac-address"; +}; + +&state_default { + default { + groups = "i2c", "uartf", "spi refclk"; + function = "gpio"; }; +}; + +&art { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; - partition@40000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x40000 0x7b0000>; + macaddr_art_0: macaddr@0 { + reg = <0x0 0x6>; }; - art: partition@7f0000 { - label = "art"; - reg = <0x7f0000 0x10000>; - read-only; + macaddr_art_6: macaddr@6 { + reg = <0x6 0x6>; }; }; diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-16m.dts b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-16m.dts index c3de5330b0..ecad0d6582 100644 --- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-16m.dts +++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-16m.dts @@ -5,42 +5,6 @@ model = "Zbtlink ZBT-WE826 (16M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - firmware: partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0xfb0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0xfb0000>; }; diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-32m.dts b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-32m.dts index 6f5bc41d5d..c86890193d 100644 --- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-32m.dts +++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-32m.dts @@ -5,42 +5,6 @@ model = "Zbtlink ZBT-WE826 (32M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - firmware: partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x1fb0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x1fb0000>; }; diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-e.dts b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-e.dts index bce6afe263..3808538ab8 100644 --- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-e.dts +++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826-e.dts @@ -33,44 +33,8 @@ }; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - firmware: partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x1fb0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x1fb0000>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi index cf2ca1cd27..8e781aa505 100644 --- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi +++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi @@ -49,6 +49,46 @@ }; }; +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; +}; + &gpio1 { status = "okay"; }; @@ -70,7 +110,8 @@ }; ðernet { - mtd-mac-address = <&factory 0x4>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; mediatek,portmap = "llllw"; }; @@ -89,3 +130,13 @@ &pcie { status = "okay"; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7620n_nexx_wt3020-4m.dts b/target/linux/ramips/dts/mt7620n_nexx_wt3020-4m.dts index ed9170fed4..bcbe22eaa4 100644 --- a/target/linux/ramips/dts/mt7620n_nexx_wt3020-4m.dts +++ b/target/linux/ramips/dts/mt7620n_nexx_wt3020-4m.dts @@ -5,42 +5,6 @@ model = "Nexx WT3020 (4M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x3b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x3b0000>; }; diff --git a/target/linux/ramips/dts/mt7620n_nexx_wt3020-8m.dts b/target/linux/ramips/dts/mt7620n_nexx_wt3020-8m.dts index ac46ccbfad..8bbb22220b 100644 --- a/target/linux/ramips/dts/mt7620n_nexx_wt3020-8m.dts +++ b/target/linux/ramips/dts/mt7620n_nexx_wt3020-8m.dts @@ -5,50 +5,14 @@ model = "Nexx WT3020 (8M)"; }; -&ehci { - status = "okay"; +&firmware { + reg = <0x50000 0x7b0000>; }; -&ohci { +&ehci { status = "okay"; }; -&spi0 { +&ohci { status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x7b0000>; - }; - }; - }; }; diff --git a/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi b/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi index 1597c088bc..7f17f1957f 100644 --- a/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi +++ b/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi @@ -34,12 +34,53 @@ }; }; +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; +}; + &gpio3 { status = "okay"; }; ðernet { - mtd-mac-address = <&factory 0x4>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; mediatek,portmap = "wllll"; }; @@ -54,3 +95,13 @@ function = "gpio"; }; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts b/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts index 738bcdc7d6..e866fb1242 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts @@ -158,12 +158,14 @@ mediatek,mtd-eeprom = <&factory 0x0>; /* 5 GHz (phy1) does not take the address from calibration data, but setting it manually here works */ - mtd-mac-address = <&factory 0x4>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; }; }; &gmac0 { - mtd-mac-address = <&factory 0xe000>; + nvmem-cells = <&macaddr_factory_e000>; + nvmem-cell-names = "mac-address"; }; &switch0 { @@ -191,7 +193,8 @@ port@4 { status = "okay"; label = "wan"; - mtd-mac-address = <&factory 0xe006>; + nvmem-cells = <&macaddr_factory_e006>; + nvmem-cell-names = "mac-address"; }; }; }; @@ -202,3 +205,21 @@ function = "gpio"; }; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + macaddr_factory_e000: macaddr@e000 { + reg = <0xe000 0x6>; + }; + + macaddr_factory_e006: macaddr@e006 { + reg = <0xe006 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_netgear_r6220.dts b/target/linux/ramips/dts/mt7621_netgear_r6220.dts index cc29d4ea8e..54489243b8 100644 --- a/target/linux/ramips/dts/mt7621_netgear_r6220.dts +++ b/target/linux/ramips/dts/mt7621_netgear_r6220.dts @@ -5,6 +5,10 @@ / { compatible = "netgear,r6220", "mediatek,mt7621-soc"; model = "Netgear R6220"; + + aliases { + label-mac-device = &gmac0; + }; }; &nand { @@ -50,3 +54,24 @@ }; }; }; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&wan { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi b/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi index eaf9059e39..ae9e40e621 100644 --- a/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi +++ b/target/linux/ramips/dts/mt7621_netgear_sercomm_ayx.dtsi @@ -13,7 +13,6 @@ led-failsafe = &led_power; led-running = &led_power; led-upgrade = &led_power; - label-mac-device = &gmac0; }; keys { @@ -106,10 +105,6 @@ }; }; -&gmac0 { - mtd-mac-address = <&factory 0x4>; -}; - &switch0 { ports { port@0 { @@ -132,11 +127,9 @@ label = "lan1"; }; - port@4 { + wan: port@4 { status = "okay"; label = "wan"; - mtd-mac-address = <&factory 0x4>; - mac-address-increment = <1>; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_netgear_wndr3700-v5.dts b/target/linux/ramips/dts/mt7621_netgear_wndr3700-v5.dts index 90c0ca1276..972aba1c5e 100644 --- a/target/linux/ramips/dts/mt7621_netgear_wndr3700-v5.dts +++ b/target/linux/ramips/dts/mt7621_netgear_wndr3700-v5.dts @@ -5,6 +5,10 @@ / { compatible = "netgear,wndr3700-v5", "mediatek,mt7621-soc"; model = "Netgear WNDR3700 v5"; + + aliases { + label-mac-device = &gmac0; + }; }; &spi0 { @@ -46,3 +50,24 @@ }; }; }; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&wan { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts index 1265a92123..0e56d16a7f 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts +++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-6-lite.dts @@ -73,13 +73,21 @@ }; }; +&gmac0 { + nvmem-cells = <&macaddr_eeprom_0>; + nvmem-cell-names = "mac-address"; +}; + &wlan_2g { + mediatek,mtd-eeprom = <&factory 0x0>; + nvmem-cells = <&macaddr_eeprom_0>; nvmem-cell-names = "mac-address"; }; &wlan_5g { mediatek,mtd-eeprom = <&factory 0x20000>; + nvmem-cells = <&macaddr_eeprom_6>; nvmem-cell-names = "mac-address"; ieee80211-freq-limit = <5000000 6000000>; diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts index 7a36ecfa7b..2762a777a3 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts +++ b/target/linux/ramips/dts/mt7621_ubnt_unifi-nanohd.dts @@ -70,6 +70,25 @@ }; }; +&gmac0 { + nvmem-cells = <&macaddr_eeprom_0>; + nvmem-cell-names = "mac-address"; +}; + +&wlan_2g { + mediatek,mtd-eeprom = <&factory 0x0>; +}; + &wlan_5g { mediatek,mtd-eeprom = <&factory 0x8000>; }; + +&eeprom { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_eeprom_0: macaddr@0 { + reg = <0x0 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_ubnt_unifi.dtsi b/target/linux/ramips/dts/mt7621_ubnt_unifi.dtsi index e0625ba500..8a0109f91b 100644 --- a/target/linux/ramips/dts/mt7621_ubnt_unifi.dtsi +++ b/target/linux/ramips/dts/mt7621_ubnt_unifi.dtsi @@ -50,7 +50,6 @@ &pcie0 { wlan_2g: wifi@0,0 { reg = <0x0 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0>; }; }; @@ -60,10 +59,6 @@ }; }; -&gmac0 { - mtd-mac-address = <&eeprom 0x0>; -}; - &switch0 { ports { port@0 { diff --git a/target/linux/ramips/dts/mt7628an_vocore_vocore2-lite.dts b/target/linux/ramips/dts/mt7628an_vocore_vocore2-lite.dts index f8bdc27c4c..26012a6a4f 100644 --- a/target/linux/ramips/dts/mt7628an_vocore_vocore2-lite.dts +++ b/target/linux/ramips/dts/mt7628an_vocore_vocore2-lite.dts @@ -21,42 +21,6 @@ }; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x7b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x7b0000>; }; diff --git a/target/linux/ramips/dts/mt7628an_vocore_vocore2.dts b/target/linux/ramips/dts/mt7628an_vocore_vocore2.dts index f4bb8720d3..44baa16bad 100644 --- a/target/linux/ramips/dts/mt7628an_vocore_vocore2.dts +++ b/target/linux/ramips/dts/mt7628an_vocore_vocore2.dts @@ -21,42 +21,6 @@ }; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0xfb0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0xfb0000>; }; diff --git a/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi b/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi index 06a80fdde7..9100e0225e 100644 --- a/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi +++ b/target/linux/ramips/dts/mt7628an_vocore_vocore2.dtsi @@ -14,6 +14,46 @@ }; }; +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; +}; + &state_default { gpio { groups = "wled_an", "refclk", "wdt"; @@ -28,7 +68,8 @@ }; ðernet { - mtd-mac-address = <&factory 0x28>; + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; }; &esw { @@ -55,3 +96,13 @@ &uart2 { status = "okay"; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/mt7628an_widora_neo-16m.dts b/target/linux/ramips/dts/mt7628an_widora_neo-16m.dts index c6bd640a6d..bd72078eff 100644 --- a/target/linux/ramips/dts/mt7628an_widora_neo-16m.dts +++ b/target/linux/ramips/dts/mt7628an_widora_neo-16m.dts @@ -5,52 +5,6 @@ model = "Widora-NEO (16M)"; }; -&spi0 { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <40000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x0fb0000>; - }; - }; - }; - - spidev@1 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "linux,spidev"; - reg = <1>; - spi-max-frequency = <40000000>; - }; +&firmware { + reg = <0x50000 0xfb0000>; }; diff --git a/target/linux/ramips/dts/mt7628an_widora_neo-32m.dts b/target/linux/ramips/dts/mt7628an_widora_neo-32m.dts index adc74e6643..c2387984c8 100644 --- a/target/linux/ramips/dts/mt7628an_widora_neo-32m.dts +++ b/target/linux/ramips/dts/mt7628an_widora_neo-32m.dts @@ -5,52 +5,6 @@ model = "Widora-NEO (32M)"; }; -&spi0 { - status = "okay"; - - pinctrl-names = "default"; - pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <40000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x1fb0000>; - }; - }; - }; - - spidev@1 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "linux,spidev"; - reg = <1>; - spi-max-frequency = <40000000>; - }; +&firmware { + reg = <0x50000 0x1fb0000>; }; diff --git a/target/linux/ramips/dts/mt7628an_widora_neo.dtsi b/target/linux/ramips/dts/mt7628an_widora_neo.dtsi index 185f554df7..74f865aac9 100644 --- a/target/linux/ramips/dts/mt7628an_widora_neo.dtsi +++ b/target/linux/ramips/dts/mt7628an_widora_neo.dtsi @@ -46,6 +46,56 @@ }; }; +&spi0 { + status = "okay"; + + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; + + spidev@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "linux,spidev"; + reg = <1>; + spi-max-frequency = <40000000>; + }; +}; + &state_default { gpio { groups = "gpio"; @@ -105,7 +155,8 @@ }; ðernet { - mtd-mac-address = <&factory 0x28>; + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; }; &sdhci { @@ -118,3 +169,13 @@ mediatek,mtd-eeprom = <&factory 0x0>; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/rt3050_allnet_all0256n-4m.dts b/target/linux/ramips/dts/rt3050_allnet_all0256n-4m.dts index efb96da57a..fc1d050c02 100644 --- a/target/linux/ramips/dts/rt3050_allnet_all0256n-4m.dts +++ b/target/linux/ramips/dts/rt3050_allnet_all0256n-4m.dts @@ -5,42 +5,6 @@ model = "Allnet ALL0256N (4M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x3b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x3b0000>; }; diff --git a/target/linux/ramips/dts/rt3050_allnet_all0256n-8m.dts b/target/linux/ramips/dts/rt3050_allnet_all0256n-8m.dts index 866d9a9b35..c2ae6f423b 100644 --- a/target/linux/ramips/dts/rt3050_allnet_all0256n-8m.dts +++ b/target/linux/ramips/dts/rt3050_allnet_all0256n-8m.dts @@ -5,42 +5,6 @@ model = "Allnet ALL0256N (8M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x7b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x7b0000>; }; diff --git a/target/linux/ramips/dts/rt3050_allnet_all0256n.dtsi b/target/linux/ramips/dts/rt3050_allnet_all0256n.dtsi index 7458165bc4..13933e335c 100644 --- a/target/linux/ramips/dts/rt3050_allnet_all0256n.dtsi +++ b/target/linux/ramips/dts/rt3050_allnet_all0256n.dtsi @@ -37,6 +37,46 @@ }; }; +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; +}; + &state_default { gpio { groups = "i2c", "jtag", "rgmii", "mdio", "uartf"; @@ -45,7 +85,8 @@ }; ðernet { - mtd-mac-address = <&factory 0x28>; + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; }; &esw { @@ -55,3 +96,13 @@ &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/rt3050_alphanetworks_asl26555-16m.dts b/target/linux/ramips/dts/rt3050_alphanetworks_asl26555-16m.dts index 9cc29d0afd..52b8668be9 100644 --- a/target/linux/ramips/dts/rt3050_alphanetworks_asl26555-16m.dts +++ b/target/linux/ramips/dts/rt3050_alphanetworks_asl26555-16m.dts @@ -62,3 +62,18 @@ }; }; }; + +ðernet { + nvmem-cells = <&macaddr_devdata_4004>; + nvmem-cell-names = "mac-address"; +}; + +&devdata { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_devdata_4004: macaddr@4004 { + reg = <0x4004 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/rt3050_alphanetworks_asl26555-8m.dts b/target/linux/ramips/dts/rt3050_alphanetworks_asl26555-8m.dts index c5465b4812..4e03f7beb7 100644 --- a/target/linux/ramips/dts/rt3050_alphanetworks_asl26555-8m.dts +++ b/target/linux/ramips/dts/rt3050_alphanetworks_asl26555-8m.dts @@ -56,3 +56,18 @@ }; }; }; + +ðernet { + nvmem-cells = <&macaddr_devdata_4004>; + nvmem-cell-names = "mac-address"; +}; + +&devdata { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_devdata_4004: macaddr@4004 { + reg = <0x4004 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/rt3050_alphanetworks_asl26555.dtsi b/target/linux/ramips/dts/rt3050_alphanetworks_asl26555.dtsi index 028238a3d2..6cd75da68b 100644 --- a/target/linux/ramips/dts/rt3050_alphanetworks_asl26555.dtsi +++ b/target/linux/ramips/dts/rt3050_alphanetworks_asl26555.dtsi @@ -84,10 +84,6 @@ }; }; -ðernet { - mtd-mac-address = <&devdata 0x4004>; -}; - &esw { mediatek,portmap = <0x1e>; }; diff --git a/target/linux/ramips/dts/rt5350_7links_px-4885-4m.dts b/target/linux/ramips/dts/rt5350_7links_px-4885-4m.dts index 383bde706f..40c4ff48b4 100644 --- a/target/linux/ramips/dts/rt5350_7links_px-4885-4m.dts +++ b/target/linux/ramips/dts/rt5350_7links_px-4885-4m.dts @@ -5,42 +5,6 @@ model = "7Links PX-4885 (4M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; - - partition@20000 { - label = "devdata"; - reg = <0x20000 0x20000>; - read-only; - }; - - devconf: partition@40000 { - label = "devconf"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x3b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x3b0000>; }; diff --git a/target/linux/ramips/dts/rt5350_7links_px-4885-8m.dts b/target/linux/ramips/dts/rt5350_7links_px-4885-8m.dts index 25c635aa11..930e875762 100644 --- a/target/linux/ramips/dts/rt5350_7links_px-4885-8m.dts +++ b/target/linux/ramips/dts/rt5350_7links_px-4885-8m.dts @@ -5,42 +5,6 @@ model = "7Links PX-4885 (8M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x20000>; - read-only; - }; - - partition@20000 { - label = "devdata"; - reg = <0x20000 0x20000>; - read-only; - }; - - devconf: partition@40000 { - label = "devconf"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x7b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x7b0000>; }; diff --git a/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi b/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi index a15d140f3e..2d43e0a30d 100644 --- a/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi +++ b/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi @@ -41,6 +41,46 @@ }; }; +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "devdata"; + reg = <0x20000 0x20000>; + read-only; + }; + + devconf: partition@40000 { + label = "devconf"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; +}; + &state_default { gpio { groups = "i2c", "jtag", "uartf"; @@ -49,7 +89,8 @@ }; ðernet { - mtd-mac-address = <&devconf 0x28>; + nvmem-cells = <&macaddr_devconf_28>; + nvmem-cell-names = "mac-address"; }; &esw { @@ -59,3 +100,13 @@ &wmac { ralink,mtd-eeprom = <&devconf 0x0>; }; + +&devconf { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_devconf_28: macaddr@28 { + reg = <0x28 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/rt5350_asiarf_awm002-evb-4m.dts b/target/linux/ramips/dts/rt5350_asiarf_awm002-evb-4m.dts index 56f1cedebd..0a60e07fcd 100644 --- a/target/linux/ramips/dts/rt5350_asiarf_awm002-evb-4m.dts +++ b/target/linux/ramips/dts/rt5350_asiarf_awm002-evb-4m.dts @@ -5,42 +5,6 @@ model = "AsiaRF AWM002 EVB (4M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - reg = <0>; - compatible = "jedec,spi-nor"; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x3b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x3b0000>; }; diff --git a/target/linux/ramips/dts/rt5350_asiarf_awm002-evb-8m.dts b/target/linux/ramips/dts/rt5350_asiarf_awm002-evb-8m.dts index 43b599abe6..529220ae9d 100644 --- a/target/linux/ramips/dts/rt5350_asiarf_awm002-evb-8m.dts +++ b/target/linux/ramips/dts/rt5350_asiarf_awm002-evb-8m.dts @@ -5,42 +5,6 @@ model = "AsiaRF AWM002 EVB (8M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - reg = <0>; - compatible = "jedec,spi-nor"; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x7b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x7b0000>; }; diff --git a/target/linux/ramips/dts/rt5350_asiarf_awm002-evb.dtsi b/target/linux/ramips/dts/rt5350_asiarf_awm002-evb.dtsi index 80965a48b8..18e59431fb 100644 --- a/target/linux/ramips/dts/rt5350_asiarf_awm002-evb.dtsi +++ b/target/linux/ramips/dts/rt5350_asiarf_awm002-evb.dtsi @@ -43,8 +43,49 @@ }; }; +&spi0 { + status = "okay"; + + flash@0 { + reg = <0>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; +}; + ðernet { - mtd-mac-address = <&factory 0x28>; + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; }; &wmac { @@ -61,3 +102,13 @@ &esw { mediatek,portmap = <0x3f>; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/rt5350_nexx_wt1520-4m.dts b/target/linux/ramips/dts/rt5350_nexx_wt1520-4m.dts index 0b1b57c99a..de291f7d51 100644 --- a/target/linux/ramips/dts/rt5350_nexx_wt1520-4m.dts +++ b/target/linux/ramips/dts/rt5350_nexx_wt1520-4m.dts @@ -5,42 +5,6 @@ model = "Nexx WT1520 (4M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x3b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x3b0000>; }; diff --git a/target/linux/ramips/dts/rt5350_nexx_wt1520-8m.dts b/target/linux/ramips/dts/rt5350_nexx_wt1520-8m.dts index c28dae3468..7520d21a63 100644 --- a/target/linux/ramips/dts/rt5350_nexx_wt1520-8m.dts +++ b/target/linux/ramips/dts/rt5350_nexx_wt1520-8m.dts @@ -5,42 +5,6 @@ model = "Nexx WT1520 (8M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x7b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x7b0000>; }; diff --git a/target/linux/ramips/dts/rt5350_nexx_wt1520.dtsi b/target/linux/ramips/dts/rt5350_nexx_wt1520.dtsi index 540fd253eb..9783e5a7e5 100644 --- a/target/linux/ramips/dts/rt5350_nexx_wt1520.dtsi +++ b/target/linux/ramips/dts/rt5350_nexx_wt1520.dtsi @@ -18,6 +18,46 @@ }; }; +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; +}; + &state_default { gpio { groups = "jtag", "uartf"; @@ -26,9 +66,20 @@ }; ðernet { - mtd-mac-address = <&factory 0x4>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; }; &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/rt5350_nixcore_x1-16m.dts b/target/linux/ramips/dts/rt5350_nixcore_x1-16m.dts index 19b7f39cf4..ff44041571 100644 --- a/target/linux/ramips/dts/rt5350_nixcore_x1-16m.dts +++ b/target/linux/ramips/dts/rt5350_nixcore_x1-16m.dts @@ -5,42 +5,6 @@ model = "NixcoreX1 (16M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0xfb0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0xfb0000>; }; diff --git a/target/linux/ramips/dts/rt5350_nixcore_x1-8m.dts b/target/linux/ramips/dts/rt5350_nixcore_x1-8m.dts index 888c67ddf0..8cecba3fa7 100644 --- a/target/linux/ramips/dts/rt5350_nixcore_x1-8m.dts +++ b/target/linux/ramips/dts/rt5350_nixcore_x1-8m.dts @@ -5,42 +5,6 @@ model = "NixcoreX1 (8M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x7b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x7b0000>; }; diff --git a/target/linux/ramips/dts/rt5350_nixcore_x1.dtsi b/target/linux/ramips/dts/rt5350_nixcore_x1.dtsi index 2459c6b65b..ea10d50182 100644 --- a/target/linux/ramips/dts/rt5350_nixcore_x1.dtsi +++ b/target/linux/ramips/dts/rt5350_nixcore_x1.dtsi @@ -108,6 +108,46 @@ }; }; +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; +}; + &gpio1 { status = "okay"; }; @@ -129,7 +169,8 @@ }; ðernet { - mtd-mac-address = <&factory 0x4>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; }; &esw { @@ -139,3 +180,13 @@ &wmac { ralink,mtd-eeprom = <&factory 0x0>; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/rt5350_poray_m4-4m.dts b/target/linux/ramips/dts/rt5350_poray_m4-4m.dts index f6f6a5a332..a457929457 100644 --- a/target/linux/ramips/dts/rt5350_poray_m4-4m.dts +++ b/target/linux/ramips/dts/rt5350_poray_m4-4m.dts @@ -5,42 +5,6 @@ model = "Poray M4 (4M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x3b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x3b0000>; }; diff --git a/target/linux/ramips/dts/rt5350_poray_m4-8m.dts b/target/linux/ramips/dts/rt5350_poray_m4-8m.dts index 2cf5891495..7d860186f2 100644 --- a/target/linux/ramips/dts/rt5350_poray_m4-8m.dts +++ b/target/linux/ramips/dts/rt5350_poray_m4-8m.dts @@ -5,42 +5,6 @@ model = "Poray M4 (8M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x7b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x7b0000>; }; diff --git a/target/linux/ramips/dts/rt5350_poray_m4.dtsi b/target/linux/ramips/dts/rt5350_poray_m4.dtsi index 9b36961ffb..4addfcbef8 100644 --- a/target/linux/ramips/dts/rt5350_poray_m4.dtsi +++ b/target/linux/ramips/dts/rt5350_poray_m4.dtsi @@ -34,6 +34,46 @@ }; }; +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; +}; + &state_default { gpio { groups = "i2c", "jtag", "uartf"; @@ -42,7 +82,8 @@ }; ðernet { - mtd-mac-address = <&factory 0x4>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; }; &esw { @@ -54,3 +95,13 @@ ralink,mtd-eeprom = <&factory 0x0>; ralink,led-polarity = <1>; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; diff --git a/target/linux/ramips/dts/rt5350_vocore_vocore-16m.dts b/target/linux/ramips/dts/rt5350_vocore_vocore-16m.dts index e28563c608..624f0fb6c9 100644 --- a/target/linux/ramips/dts/rt5350_vocore_vocore-16m.dts +++ b/target/linux/ramips/dts/rt5350_vocore_vocore-16m.dts @@ -5,42 +5,6 @@ model = "VoCore (16M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0xfb0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0xfb0000>; }; diff --git a/target/linux/ramips/dts/rt5350_vocore_vocore-8m.dts b/target/linux/ramips/dts/rt5350_vocore_vocore-8m.dts index 4fa291a2e2..a824e9dfc7 100644 --- a/target/linux/ramips/dts/rt5350_vocore_vocore-8m.dts +++ b/target/linux/ramips/dts/rt5350_vocore_vocore-8m.dts @@ -5,42 +5,6 @@ model = "VoCore (8M)"; }; -&spi0 { - status = "okay"; - - flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "uboot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "uboot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x7b0000>; - }; - }; - }; +&firmware { + reg = <0x50000 0x7b0000>; }; diff --git a/target/linux/ramips/dts/rt5350_vocore_vocore.dtsi b/target/linux/ramips/dts/rt5350_vocore_vocore.dtsi index 0c82919669..652f9384e5 100644 --- a/target/linux/ramips/dts/rt5350_vocore_vocore.dtsi +++ b/target/linux/ramips/dts/rt5350_vocore_vocore.dtsi @@ -156,6 +156,46 @@ }; }; +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "uboot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "uboot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + /* reg property is set based on flash size in DTS files */ + }; + }; + }; +}; + &gpio1 { status = "okay"; }; @@ -172,7 +212,8 @@ }; ðernet { - mtd-mac-address = <&factory 0x4>; + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; }; &esw { @@ -193,3 +234,13 @@ reg = <0>; }; }; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; +}; -- 2.30.2