ramips: mt7620a: convert to nvmem-layout
[openwrt/openwrt.git] / target / linux / ramips / dts / mt7621_phicomm_k2p.dts
index 9e9e2c0df4511706321a008d41333aaa65e160df..fd3b42f6edbd446d22b7a29dfeff7c432dd8529c 100644 (file)
@@ -1,5 +1,3 @@
-/dts-v1/;
-
 #include "mt7621.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
                led-upgrade = &led_blue;
        };
 
-       chosen {
-               bootargs = "console=ttyS0,57600";
-       };
-
        leds {
                compatible = "gpio-leds";
 
                stat_r {
-                       label = "k2p:red:status";
-                       gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
+                       label = "red:status";
+                       gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
                };
 
                stat_y {
-                       label = "k2p:yellow:status";
-                       gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
+                       label = "yellow:status";
+                       gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
                };
 
                led_blue: stat_b {
-                       label = "k2p:blue:status";
-                       gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
+                       label = "blue:status";
+                       gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
                };
        };
 
@@ -44,7 +38,7 @@
 
                reset {
                        label = "reset";
-                       gpios = <&gpio0 3 GPIO_ACTIVE_LOW>;
+                       gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_RESTART>;
                };
        };
 &spi0 {
        status = "okay";
 
-       m25p80@0 {
+       flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
-               spi-max-frequency = <10000000>;
+               spi-max-frequency = <50000000>;
 
                partitions {
                        compatible = "fixed-partitions";
                        };
 
                        factory: partition@40000 {
+                               compatible = "nvmem-cells";
                                label = "factory";
                                reg = <0x40000 0x10000>;
+                               #address-cells = <1>;
+                               #size-cells = <1>;
                                read-only;
+
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0x4da8>;
+                               };
+
+                               macaddr_factory_4: macaddr@4 {
+                                       reg = <0x4 0x6>;
+                               };
+
+                               macaddr_factory_e000: macaddr@e000 {
+                                       reg = <0xe000 0x6>;
+                               };
+
+                               macaddr_factory_e006: macaddr@e006 {
+                                       reg = <0xe006 0x6>;
+                               };
                        };
 
                        partition@50000 {
 };
 
 &pcie0 {
-       mt76@0,0 {
+       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 */
+               nvmem-cells = <&eeprom_factory_0>, <&macaddr_factory_4>;
+               nvmem-cell-names = "eeprom", "mac-address";
        };
 };
 
-&ethernet {
-       mtd-mac-address = <&factory 0xe000>;
+&gmac0 {
+       nvmem-cells = <&macaddr_factory_e000>;
+       nvmem-cell-names = "mac-address";
+};
+
+&gmac1 {
+       status = "okay";
+       label = "wan";
+       phy-handle = <&ethphy4>;
+
+       nvmem-cells = <&macaddr_factory_e006>;
+       nvmem-cell-names = "mac-address";
+};
+
+&mdio {
+       ethphy4: ethernet-phy@4 {
+               reg = <4>;
+       };
+};
+
+&switch0 {
+       ports {
+               port@0 {
+                       status = "okay";
+                       label = "lan1";
+               };
+
+               port@1 {
+                       status = "okay";
+                       label = "lan2";
+               };
+
+               port@2 {
+                       status = "okay";
+                       label = "lan3";
+               };
+
+               port@3 {
+                       status = "okay";
+                       label = "lan4";
+               };
+       };
 };
 
 &state_default {
        gpio {
-               ralink,group = "i2c", "jtag";
-               ralink,function = "gpio";
+               groups = "i2c", "jtag";
+               function = "gpio";
        };
 };