ramips: improve Xiaomi Mi Router 3G support
[openwrt/openwrt.git] / target / linux / ramips / dts / MIR3G.dts
index 0cdb6d57f3e955cdeb689a7126246b9e5d2f96ab..efe98b0e100ee3157e9b93cecf744bfb0caf0f2b 100644 (file)
        gpio-leds {
                compatible = "gpio-leds";
 
-               wan {
-                       label = "mir3g:red:wan";
+               status_red {
+                       label = "mir3g:red:status";
                        gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
                };
 
-               usb {
-                       label = "mir3g:blue:usb";
+               status_blue {
+                       label = "mir3g:blue:status";
                        gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
                };
 
-               status {
+               status_yellow {
                        label = "mir3g:yellow:status";
                        gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
                };
+
+               wan_amber {
+                       label = "mir3g:amber:wan";
+                       gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+               };
+
+               lan1_amber {
+                       label = "mir3g:amber:lan1";
+                       gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
+               };
+
+               lan2_amber {
+                       label = "mir3g:amber:lan2";
+                       gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
+               };
+
        };
 
        gpio-keys-polled {
 
                reset {
                        label = "reset";
-                       gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
+                       gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_RESTART>;
                };
        };
+
+       gpio_export {
+               compatible = "gpio-export";
+               #size-cells = <0>;
+
+               usbpower {
+                       gpio-export,name = "usbpower";
+                       gpio-export,output = <1>;
+                       gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+               };
+       };
 };
 
 &nand {
@@ -63,7 +90,6 @@
        partition@80000 {
                label = "Config";
                reg = <0x80000 0x40000>;
-               read-only;
        };
 
        partition@c0000 {
        partition@140000 {
                label = "crash";
                reg = <0x140000 0x40000>;
-               read-only;
        };
 
        partition@180000 {
                label = "crash_syslog";
                reg = <0x180000 0x40000>;
-               read-only;
        };
 
        partition@1c0000 {
                read-only;
        };
 
-       /* 
-        * kernel0 partition should be erased, so 
-        * u-boot in failsafe routine switches 
-        * to next one looking for kernel image.
-        * To remind about this fact rename kernel0
-        * into kernel_erase.
+       /* uboot expects to find kernels at 0x200000 & 0x600000
+        * referred to as system 1 & system 2 respectively.
+        * a kernel is considered suitable for handing control over
+        * if its linux magic number exists & uImage CRC are correct.
+        * If either of those conditions fail, a matching sys'n'_fail flag
+        * is set in uboot env & a restart performed in the hope that the
+        * alternate kernel is okay.
+        * if neither kernel checksums ok and both are marked failed, system 2
+        * is booted anyway.
+        *
+        * Note uboot's tftp flash install writes the transferred
+        * image to both kernel partitions.
         */
+
        partition@200000 {
-               label = "kernel_erase";
+               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), 
+        * next consecutive 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 0x7580000>;
                        mediatek,mtd-eeprom = <&factory 0x0000>;
                        ieee80211-freq-limit = <2400000 2500000>;
                };
-       };      
+       };
 
        pcie1 {
                wifi@14c3,7662 {
 &pinctrl {
        state_default: pinctrl0 {
                gpio {
-                       ralink,group = "jtag", "uart3", "wdt";
+                       ralink,group = "jtag", "uart2", "uart3", "wdt";
                        ralink,function = "gpio";
                };
        };