ramips: add NMBM support for ipTIME AX2004M
[openwrt/staging/stintel.git] / target / linux / ramips / dts / mt7621_iptime_ax2004m.dts
index 554d73ce3d4cd34459b81a4d5aed8771ef2f6277..7237bf822f46a948e47bca8985b3f731b8225f02 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 
 / {
        compatible = "iptime,ax2004m", "mediatek,mt7621-soc";
@@ -24,7 +25,8 @@
                compatible = "gpio-leds";
 
                led_cpu: cpu {
-                       label = "amber:cpu";
+                       function = LED_FUNCTION_CPU;
+                       color = <LED_COLOR_ID_AMBER>;
                        gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
                };
 
 &nand {
        status = "okay";
 
+       mediatek,nmbm;
+       mediatek,bmt-max-ratio = <1>;
+       mediatek,bmt-max-reserved-blocks = <64>;
+       mediatek,bmt-remap-range = <0x000000 0x580000>;
+
        partitions {
                compatible = "fixed-partitions";
                #address-cells = <1>;
                        read-only;
                };
 
-               factory: partition@100000 {
+               partition@100000 {
                        label = "factory";
                        reg = <0x100000 0x80000>;
                        read-only;
 
-                       compatible = "nvmem-cells";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
+                       nvmem-layout {
+                               compatible = "fixed-layout";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
 
-                       macaddr_factory_4: macaddr@4 {
-                               reg = <0x4 0x6>;
+                               eeprom_factory_0: eeprom@0 {
+                                       reg = <0x0 0xe00>;
+                               };
+
+                               macaddr_factory_4: macaddr@4 {
+                                       compatible = "mac-base";
+                                       reg = <0x4 0x6>;
+                                       #nvmem-cell-cells = <1>;
+                               };
+
+                               precal_factory_e10: precal@e10 {
+                                       reg = <0xe10 0x19c10>;
+                               };
                        };
                };
 
                                reg = <0x400000 0x7280000>;
                        };
                };
+
+               /* last 8 MiB is reserved for NMBM bad block table */
        };
 };
 
 };
 
 &gmac0 {
-       nvmem-cells = <&macaddr_factory_4>;
+       nvmem-cells = <&macaddr_factory_4 3>;
        nvmem-cell-names = "mac-address";
-       mac-address-increment = <3>;
 };
 
 &gmac1 {
        label = "wan";
        phy-handle = <&ethphy0>;
 
-       nvmem-cells = <&macaddr_factory_4>;
+       nvmem-cells = <&macaddr_factory_4 1>;
        nvmem-cell-names = "mac-address";
-       mac-address-increment = <1>;
 };
 
 &mdio {
        wifi@0,0 {
                compatible = "mediatek,mt76";
                reg = <0x0000 0 0 0 0>;
-               mediatek,mtd-eeprom = <&factory 0x0>;
+               nvmem-cells = <&eeprom_factory_0>, <&precal_factory_e10>;
+               nvmem-cell-names = "eeprom", "precal";
        };
 };