apm821xx: convert to dt based diag LED script
authorChristian Lamparter <chunkeey@gmail.com>
Tue, 28 Nov 2017 21:51:07 +0000 (22:51 +0100)
committerJohn Crispin <john@phrozen.org>
Thu, 14 Dec 2017 08:29:30 +0000 (09:29 +0100)
Please note that users with a Netgear WNDR4700
will need to update the device-tree partition
manually.

For instructions, please refere to commit 49856a4bb581
("apm821xx: make it possible to update the dtb partition on the WNDR4700")

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
target/linux/apm821xx/base-files/etc/diag.sh
target/linux/apm821xx/dts/MR24.dts
target/linux/apm821xx/dts/MX60.dts
target/linux/apm821xx/dts/apollo3g.dtsi
target/linux/apm821xx/dts/wndr4700.dts

index eb9b04b52511f36c49425a9bf54ec716cdd754a9..e45f2a85221e78134b5e8635e6e9839af5bc093c 100755 (executable)
@@ -3,40 +3,42 @@
 . /lib/functions.sh
 . /lib/functions/leds.sh
 
-get_status_led() {
-       local board=$(board_name)
-
-       case $board in
-       mbl|\
-       mr24|\
-       mx60|\
-       wndr4700)
-               status_led="$board:green:power"
-               ;;
-
-       *)
-               ;;
-       esac
-}
+boot="$(get_dt_led boot)"
+failsafe="$(get_dt_led failsafe)"
+running="$(get_dt_led running)"
+upgrade="$(get_dt_led upgrade)"
 
 set_state() {
-       get_status_led
+       status_led="$boot"
 
        case "$1" in
+       preinit_regular)
+               status_led_blink_preinit_regular
+               ;;
        preinit)
                status_led_blink_preinit
                ;;
-
        failsafe)
+               status_led_off
+               [ -n "$running" ] && {
+                       status_led="$running"
+                       status_led_off
+               }
+               status_led="$failsafe"
                status_led_blink_failsafe
                ;;
-
-       preinit_regular)
-               status_led_blink_preinit_regular
-               ;;
-
+       upgrade)
+               [ -n "$running" ] && {
+                       status_led="$upgrade"
+                       status_led_blink_preinit_regular
+               }
+                ;;
        done)
-               status_led_on
+               status_led_off
+               [ -n "$running" ] && {
+                       status_led="$running"
+                       status_led_on
+               }
                ;;
        esac
 }
index 8d20872c3f1a89ee7d356c68d0f2774e02bb2731..75bb32255c7e1bee5f50f24bd390639e6809ef85 100644 (file)
 
        aliases {
                serial0 = &UART1;
+               led-boot = &status;
+               led-failsafe = &failsafe;
+               led-running = &status;
+               led-upgrade = &status;
        };
 
        chosen {
        gpio-leds {
                compatible = "gpio-leds";
 
-               power-green {
+               status: power-green {
                        label = "mr24:green:power";
                        gpios = <&GPIO0 18 GPIO_ACTIVE_LOW>;
                };
 
-               power-orange {
+               failsafe: power-orange {
                        label = "mr24:orange:power";
                        gpios = <&GPIO0 19 GPIO_ACTIVE_LOW>;
                };
index 4ec0043f32583396c3930a2643e0d759613c6020..6c753639b2d65df9b8a2cea875436ccf73b09553 100644 (file)
 
        aliases {
                serial0 = &UART1;
+               led-boot = &status;
+               led-failsafe = &failsafe;
+               led-running = &status;
+               led-upgrade = &status;
        };
 
        chosen {
        gpio-leds {
                compatible = "gpio-leds";
 
-               power-green {
+               status: power-green {
                        label = "mx60:green:power";
                        gpios = <&GPIO0 18 GPIO_ACTIVE_LOW>;
                };
 
-               power-orange {
+               failsafe: power-orange {
                        label = "mx60:orange:power";
                        gpios = <&GPIO0 19 GPIO_ACTIVE_LOW>;
                };
index 783348a6787b6ccfc3e90fc21e7480ae4e1639b4..09a8b8518cbdc60cd6f1c94f5ca64d13e0acd2ef 100644 (file)
 
        aliases {
                serial0 = &UART0;
+               led-boot = &status;
+               led-failsafe = &status;
+               led-running = &status;
+               led-upgrade = &status;
        };
 };
 
        gpio-leds {
                compatible = "gpio-leds";
 
-               power-red {
+               failsafe: power-red {
                        label = "mbl:red:power";
                        gpios = <&GPIO1 4 GPIO_ACTIVE_HIGH>;
                        linux,default-trigger = "panic";
                };
 
-               power-green {
+               status: power-green {
                        label = "mbl:green:power";
                        gpios = <&GPIO1 5 GPIO_ACTIVE_HIGH>;
                };
index d1a65f3e62a2622fb1436875fd9b740e7ab9cdc6..2e0addf74b0b4951d585723495500a0069826837 100644 (file)
 
        aliases {
                serial0 = &UART0;
+               led-boot = &status;
+               led-failsafe = &failsafe;
+               led-running = &status;
+               led-upgrade = &status;
        };
 
        chosen {
 
        gpio-leds {
                compatible = "gpio-leds";
-               power-green {
+               status: power-green {
                        label = "wndr4700:green:power";
                        gpios = <&GPIO0 8 GPIO_ACTIVE_HIGH>;
                };
 
-               power-orange {
+               failsafe: power-orange {
                        label = "wndr4700:orange:power";
                        gpios = <&GPIO0 9 GPIO_ACTIVE_LOW>;
                        linux,default-trigger = "panic";