ramips: switch all supported devices to nvmem-cells
This commit is contained in:
@@ -53,67 +53,73 @@
|
||||
#size-cells = <1>;
|
||||
compatible = "mtk,mt7620-nand";
|
||||
|
||||
partition@0 {
|
||||
label = "Bootloader";
|
||||
reg = <0x0 0x40000>;
|
||||
read-only;
|
||||
};
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
partition@40000 {
|
||||
label = "Config";
|
||||
reg = <0x40000 0x40000>;
|
||||
};
|
||||
partition@0 {
|
||||
label = "Bootloader";
|
||||
reg = <0x0 0x40000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@80000 {
|
||||
label = "Bdata";
|
||||
reg = <0x80000 0x40000>;
|
||||
read-only;
|
||||
};
|
||||
partition@40000 {
|
||||
label = "Config";
|
||||
reg = <0x40000 0x40000>;
|
||||
};
|
||||
|
||||
factory: partition@0xc0000 {
|
||||
label = "factory";
|
||||
reg = <0xc0000 0x40000>;
|
||||
read-only;
|
||||
};
|
||||
partition@80000 {
|
||||
label = "Bdata";
|
||||
reg = <0x80000 0x40000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@100000 {
|
||||
label = "crash";
|
||||
reg = <0x100000 0x40000>;
|
||||
read-only;
|
||||
};
|
||||
factory: partition@0xc0000 {
|
||||
label = "factory";
|
||||
reg = <0xc0000 0x40000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@140000 {
|
||||
label = "crash_syslog";
|
||||
reg = <0x140000 0x40000>;
|
||||
read-only;
|
||||
};
|
||||
partition@100000 {
|
||||
label = "crash";
|
||||
reg = <0x100000 0x40000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@180000 {
|
||||
label = "reserved0";
|
||||
reg = <0x180000 0x80000>;
|
||||
read-only;
|
||||
};
|
||||
partition@140000 {
|
||||
label = "crash_syslog";
|
||||
reg = <0x140000 0x40000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@200000 {
|
||||
label = "kernel_stock";
|
||||
reg = <0x200000 0x400000>;
|
||||
};
|
||||
partition@180000 {
|
||||
label = "reserved0";
|
||||
reg = <0x180000 0x80000>;
|
||||
read-only;
|
||||
};
|
||||
|
||||
partition@600000 {
|
||||
label = "kernel";
|
||||
reg = <0x600000 0x400000>;
|
||||
};
|
||||
partition@200000 {
|
||||
label = "kernel_stock";
|
||||
reg = <0x200000 0x400000>;
|
||||
};
|
||||
|
||||
/* ubi partition is the result of squashing
|
||||
* next consequent stock partitions:
|
||||
* - rootfs0 (rootfs partition for stock kernel0),
|
||||
* - rootfs1 (rootfs partition for stock failsafe kernel1),
|
||||
* - overlay (used as ubi overlay in stock fw)
|
||||
* resulting 117,5MiB space for packages.
|
||||
*/
|
||||
partition@a00000 {
|
||||
label = "ubi";
|
||||
reg = <0xa00000 0x7600000>;
|
||||
partition@600000 {
|
||||
label = "kernel";
|
||||
reg = <0x600000 0x400000>;
|
||||
};
|
||||
|
||||
/* ubi partition is the result of squashing
|
||||
* next consequent stock partitions:
|
||||
* - rootfs0 (rootfs partition for stock kernel0),
|
||||
* - rootfs1 (rootfs partition for stock failsafe kernel1),
|
||||
* - overlay (used as ubi overlay in stock fw)
|
||||
* resulting 117,5MiB space for packages.
|
||||
*/
|
||||
partition@a00000 {
|
||||
label = "ubi";
|
||||
reg = <0xa00000 0x7600000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -133,7 +139,8 @@
|
||||
ðernet {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&ephy_pins>;
|
||||
mtd-mac-address = <&factory 0x28>;
|
||||
nvmem-cells = <&macaddr_factory_28>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
mediatek,portmap = "llllw";
|
||||
};
|
||||
|
||||
@@ -167,3 +174,13 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&factory {
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
macaddr_factory_28: macaddr@28 {
|
||||
reg = <0x28 0x6>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -151,7 +151,8 @@
|
||||
ðernet {
|
||||
compatible = "mediatek,ralink-mt7621-eth";
|
||||
mediatek,switch = <&gsw>;
|
||||
mtd-mac-address = <&factory 0xe000>;
|
||||
nvmem-cells = <&macaddr_factory_e000>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
|
||||
@@ -113,7 +113,8 @@
|
||||
ðernet {
|
||||
compatible = "mediatek,ralink-mt7621-eth";
|
||||
mediatek,switch = <&gsw>;
|
||||
mtd-mac-address = <&factory 0xe000>;
|
||||
nvmem-cells = <&macaddr_factory_e000>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
|
||||
@@ -91,7 +91,8 @@
|
||||
ðernet {
|
||||
compatible = "mediatek,ralink-mt7621-eth";
|
||||
mediatek,switch = <&gsw>;
|
||||
mtd-mac-address = <&factory 0xe000>;
|
||||
nvmem-cells = <&macaddr_factory_e000>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
led-failsafe = &led_red;
|
||||
led-running = &led_green;
|
||||
led-upgrade = &led_blue;
|
||||
label-mac-device = &gmac0;
|
||||
};
|
||||
|
||||
chosen {
|
||||
@@ -75,7 +74,7 @@
|
||||
read-only;
|
||||
};
|
||||
|
||||
config: partition@30000 {
|
||||
partition@30000 {
|
||||
label = "config";
|
||||
reg = <0x30000 0x10000>;
|
||||
read-only;
|
||||
@@ -108,10 +107,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
mtd-mac-address-ascii = <&config 0x4429>;
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
ports {
|
||||
port@0 {
|
||||
@@ -138,7 +133,6 @@
|
||||
&pcie0 {
|
||||
wifi@0,0 {
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
mtd-mac-address-ascii = <&config 0x4429>;
|
||||
mediatek,mtd-eeprom = <&factory 0x0>;
|
||||
};
|
||||
};
|
||||
@@ -146,9 +140,6 @@
|
||||
&pcie1 {
|
||||
wifi@0,0 {
|
||||
reg = <0x0000 0 0 0 0>;
|
||||
mtd-mac-address-ascii = <&config 0x4429>;
|
||||
mtd-mac-address-increment = <0x80>;
|
||||
mtd-mac-address-increment-byte = <3>;
|
||||
mediatek,mtd-eeprom = <&factory 0x8000>;
|
||||
ieee80211-freq-limit = <5000000 6000000>;
|
||||
};
|
||||
|
||||
@@ -164,7 +164,8 @@
|
||||
ðernet {
|
||||
compatible = "mediatek,ralink-mt7621-eth";
|
||||
mediatek,switch = <&gsw>;
|
||||
mtd-mac-address = <&factory 0x4>;
|
||||
nvmem-cells = <&macaddr_factory_4>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
|
||||
@@ -105,7 +105,8 @@
|
||||
ðernet {
|
||||
compatible = "mediatek,ralink-mt7621-eth";
|
||||
mediatek,switch = <&gsw>;
|
||||
mtd-mac-address = <&factory 0xe000>;
|
||||
nvmem-cells = <&macaddr_factory_e000>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
ðernet {
|
||||
compatible = "mediatek,ralink-mt7621-eth";
|
||||
mediatek,switch = <&gsw>;
|
||||
mtd-mac-address = <&factory 0xe006>;
|
||||
nvmem-cells = <&macaddr_factory_e000>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
|
||||
@@ -87,7 +87,8 @@
|
||||
ðernet {
|
||||
compatible = "mediatek,ralink-mt7621-eth";
|
||||
mediatek,switch = <&gsw>;
|
||||
mtd-mac-address = <&factory 0x4>;
|
||||
nvmem-cells = <&macaddr_factory_4>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
compatible = "zbtlink,zbt-wg108", "mediatek,mt7621-soc";
|
||||
model = "Zbtlink ZBT-WG108";
|
||||
|
||||
aliases {
|
||||
label-mac-device = &wifi1;
|
||||
};
|
||||
|
||||
chosen {
|
||||
bootargs = "console=ttyS0,115200";
|
||||
};
|
||||
@@ -76,7 +72,8 @@
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
mtd-mac-address = <&factory 0xe000>;
|
||||
nvmem-cells = <&macaddr_factory_e000>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
|
||||
&switch0 {
|
||||
@@ -104,7 +101,8 @@
|
||||
port@4 {
|
||||
status = "okay";
|
||||
label = "wan";
|
||||
mtd-mac-address = <&factory 0xe006>;
|
||||
nvmem-cells = <&macaddr_factory_e006>;
|
||||
nvmem-cell-names = "mac-address";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -132,3 +130,17 @@
|
||||
&sdhci {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&factory {
|
||||
compatible = "nvmem-cells";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
macaddr_factory_e000: macaddr@e000 {
|
||||
reg = <0xe000 0x6>;
|
||||
};
|
||||
|
||||
macaddr_factory_e006: macaddr@e006 {
|
||||
reg = <0xe006 0x6>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -33,6 +33,7 @@ ramips_setup_interfaces()
|
||||
;;
|
||||
asiarf,ap7621-nv1|\
|
||||
jcg,q20|\
|
||||
jdcloud,re-sp-01b|\
|
||||
lenovo,newifi-d1|\
|
||||
mikrotik,routerboard-m33g|\
|
||||
xiaomi,mi-router-3g|\
|
||||
@@ -142,7 +143,10 @@ ramips_setup_macs()
|
||||
wan_mac="$(grep -m1 mac= "/dev/mtd${index}" | cut -d= -f2)"
|
||||
lan_mac=$wan_mac
|
||||
;;
|
||||
d-team,newifi-d2)
|
||||
d-team,newifi-d2|\
|
||||
phicomm,k2p|\
|
||||
xiaomi,mi-router-ac2100|\
|
||||
xiaomi,redmi-router-ac2100)
|
||||
lan_mac=$(cat /sys/class/net/eth0/address)
|
||||
wan_mac=$(mtd_get_mac_binary factory 0xe006)
|
||||
;;
|
||||
@@ -188,6 +192,12 @@ ramips_setup_macs()
|
||||
wan_mac=$(mtd_get_mac_binary factory 0xe006)
|
||||
label_mac=$(mtd_get_mac_binary factory 0x4)
|
||||
;;
|
||||
jdcloud,re-sp-01b)
|
||||
local index="$(find_mtd_index "config")"
|
||||
label_mac=$(macaddr_canonicalize $(dd if="/dev/mtd${index}" bs=12 skip=17449 iflag=skip_bytes count=1 2>/dev/null))
|
||||
lan_mac=$label_mac
|
||||
wan_mac=$label_mac
|
||||
;;
|
||||
linksys,e5600|\
|
||||
linksys,ea7300-v1|\
|
||||
linksys,ea7300-v2|\
|
||||
@@ -211,14 +221,6 @@ ramips_setup_macs()
|
||||
lan_mac=$(mtd_get_mac_binary factory 0x4)
|
||||
wan_mac=$(macaddr_add "$lan_mac" 2)
|
||||
;;
|
||||
phicomm,k2p)
|
||||
wan_mac=$(mtd_get_mac_binary factory 0xe006)
|
||||
;;
|
||||
xiaomi,mi-router-ac2100|\
|
||||
xiaomi,redmi-router-ac2100)
|
||||
lan_mac=$(cat /sys/class/net/eth0/address)
|
||||
wan_mac=$(mtd_get_mac_binary factory 0xe000)
|
||||
;;
|
||||
xiaoyu,xy-c5)
|
||||
wan_mac=$(macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1)
|
||||
;;
|
||||
|
||||
@@ -29,6 +29,12 @@ case "$board" in
|
||||
[ "$PHYNBR" = "1" ] && \
|
||||
macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
jdcloud,re-sp-01b)
|
||||
local index="$(find_mtd_index "config")"
|
||||
local label_mac=$(macaddr_canonicalize $(dd if="/dev/mtd${index}" bs=12 skip=17449 iflag=skip_bytes count=1 2>/dev/null))
|
||||
[ "$PHYNBR" -eq 0 ] && echo $label_mac > /sys${DEVPATH}/macaddress
|
||||
[ "$PHYNBR" -eq 1 ] && macaddr_add $label_mac 0x800000 > /sys${DEVPATH}/macaddress
|
||||
;;
|
||||
linksys,e5600|\
|
||||
linksys,ea7300-v1|\
|
||||
linksys,ea7300-v2|\
|
||||
|
||||
Reference in New Issue
Block a user