Skip to content

Commit

Permalink
ramips: convert mtd-mac-address to nvmem for D-Link DIR-8xx
Browse files Browse the repository at this point in the history
Convert this series by moving the definitions to the individual
devices.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
  • Loading branch information
adschm committed Aug 20, 2021
1 parent cc0112d commit 7f1b0f6
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 13 deletions.
1 change: 1 addition & 0 deletions target/linux/ramips/dts/mt7621_dlink_dir-853-a3.dts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

aliases {
label-mac-device = &gmac0;

led-boot = &led_power_orange;
led-failsafe = &led_power_blue;
led-running = &led_power_blue;
Expand Down
26 changes: 21 additions & 5 deletions target/linux/ramips/dts/mt7621_dlink_dir-853-r1.dts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

aliases {
label-mac-device = &wan;

led-boot = &led_power_orange;
led-failsafe = &led_power_blue;
led-running = &led_power_blue;
Expand Down Expand Up @@ -93,16 +94,20 @@
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;

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 0x4>;
mtd-mac-address-increment = <(-1)>;
nvmem-cells = <&macaddr_factory_4>;
nvmem-cell-names = "mac-address";
mac-address-increment = <(-1)>;
};

&switch0 {
Expand Down Expand Up @@ -130,8 +135,9 @@
wan: port@4 {
status = "okay";
label = "wan";
mtd-mac-address = <&factory 0x4>;
mtd-mac-address-increment = <(-2)>;
nvmem-cells = <&macaddr_factory_4>;
nvmem-cell-names = "mac-address";
mac-address-increment = <(-2)>;
};
};
};
Expand All @@ -142,3 +148,13 @@
function = "gpio";
};
};

&factory {
compatible = "nvmem-cells";
#address-cells = <1>;
#size-cells = <1>;

macaddr_factory_4: macaddr@4 {
reg = <0x4 0x6>;
};
};
3 changes: 2 additions & 1 deletion target/linux/ramips/dts/mt7621_dlink_dir-860l-b1.dts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
model = "D-Link DIR-860L B1";

aliases {
label-mac-device = &gmac0;

led-boot = &led_power_green;
led-failsafe = &led_power_green;
led-running = &led_power_green;
led-upgrade = &led_power_green;
label-mac-device = &gmac0;
};

leds {
Expand Down
28 changes: 28 additions & 0 deletions target/linux/ramips/dts/mt7621_dlink_dir-867-a1.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,32 @@
/ {
compatible = "dlink,dir-867-a1", "mediatek,mt7621-soc";
model = "D-Link DIR-867 A1";

aliases {
label-mac-device = &gmac0;
};
};

&gmac0 {
nvmem-cells = <&macaddr_factory_e000>;
nvmem-cell-names = "mac-address";
};

&wan {
nvmem-cells = <&macaddr_factory_e006>;
nvmem-cell-names = "mac-address";
};

&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>;
};
};
28 changes: 28 additions & 0 deletions target/linux/ramips/dts/mt7621_dlink_dir-878-a1.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,32 @@
/ {
compatible = "dlink,dir-878-a1", "mediatek,mt7621-soc";
model = "D-Link DIR-878 A1";

aliases {
label-mac-device = &gmac0;
};
};

&gmac0 {
nvmem-cells = <&macaddr_factory_e000>;
nvmem-cell-names = "mac-address";
};

&wan {
nvmem-cells = <&macaddr_factory_e006>;
nvmem-cell-names = "mac-address";
};

&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>;
};
};
28 changes: 28 additions & 0 deletions target/linux/ramips/dts/mt7621_dlink_dir-882-a1.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
/ {
compatible = "dlink,dir-882-a1", "mediatek,mt7621-soc";
model = "D-Link DIR-882 A1";

aliases {
label-mac-device = &gmac0;
};
};

&leds {
Expand All @@ -23,3 +27,27 @@
linux,default-trigger = "usbport";
};
};

&gmac0 {
nvmem-cells = <&macaddr_factory_e000>;
nvmem-cell-names = "mac-address";
};

&wan {
nvmem-cells = <&macaddr_factory_e006>;
nvmem-cell-names = "mac-address";
};

&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>;
};
};
28 changes: 28 additions & 0 deletions target/linux/ramips/dts/mt7621_dlink_dir-882-r1.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
/ {
compatible = "dlink,dir-882-r1", "mediatek,mt7621-soc";
model = "D-Link DIR-882 R1";

aliases {
label-mac-device = &gmac0;
};
};

&leds {
Expand All @@ -23,3 +27,27 @@
linux,default-trigger = "usbport";
};
};

&gmac0 {
nvmem-cells = <&macaddr_factory_e000>;
nvmem-cell-names = "mac-address";
};

&wan {
nvmem-cells = <&macaddr_factory_e006>;
nvmem-cell-names = "mac-address";
};

&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>;
};
};
8 changes: 1 addition & 7 deletions target/linux/ramips/dts/mt7621_dlink_dir-8xx.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

/ {
aliases {
label-mac-device = &gmac0;
led-boot = &led_power_orange;
led-failsafe = &led_power_green;
led-running = &led_power_green;
Expand Down Expand Up @@ -91,10 +90,6 @@
};
};

&gmac0 {
mtd-mac-address = <&factory 0xe000>;
};

&switch0 {
ports {
port@0 {
Expand All @@ -117,10 +112,9 @@
label = "lan1";
};

port@4 {
wan: port@4 {
status = "okay";
label = "wan";
mtd-mac-address = <&factory 0xe006>;
};
};
};
Expand Down

0 comments on commit 7f1b0f6

Please sign in to comment.