From patchwork Tue Nov 28 21:51:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Lamparter X-Patchwork-Id: 842336 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ncFDImHy"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uIlGWnl5"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ymcpM1jmHz9sNV for ; Wed, 29 Nov 2017 08:52:27 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=onR92tkhn/IdzaoBYL6MzIqhWBeo+gm9mdUJsMMFogM=; b=ncFDImHyiyFlt8duLXdVdscEIZ 1zhDmGlKqFWuHV0Z0M3YhtfCmb+vz+Ybupf1a33FqjuApqsd1Yff6vdAN1jsati8ZTsWA0WxD/c7/ yhuWToPRBs1fi0/np5kzC4KtQb+OL6kZmxYR63l3poOk+9Xb0n4GpW7TU0f7VZ8XU3ZkKiP8o5k9P AW7n+mWMa0ncr9GywsGi5JMwPMSnUpohQKUYiePUiujin3OjDXnpMy+UGxZrrBTH8+eC+o3X79ljN Uep0mnzDgPGA0eaRiOWLZ7krTgktHxAxGxjo+oWnbTv/4eNqns2L2Fis53Jb+wrz54AiMRPE/E/ff JmFvsvEg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eJnnl-00048E-1q; Tue, 28 Nov 2017 21:52:25 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eJnmx-0003CR-HZ for lede-dev@lists.infradead.org; Tue, 28 Nov 2017 21:51:40 +0000 Received: by mail-wr0-x244.google.com with SMTP id o2so1517221wro.5 for ; Tue, 28 Nov 2017 13:51:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:in-reply-to :references; bh=BZbAf3LzZg9fH9hBkgFUS5Us7xAy94cZgMu2O0q9+MM=; b=uIlGWnl53o/1A/svoeuOwyP8+p5AEZEPo9+it5GvolBA4+aO2m8xPjbPWBHzzGx5wc m7Sq5EVlaIvRDsPQnSJb4au0lA1Nz1Z1LtTumwnvz3WxnDSRROqgD/Ic6p5kWXijIpjM V4j9IIm79/jo4H+tcg26GoQoDLoaqhm2iBzFEK4hXaN7ZkRp8FiJggLsLi2sPSu7S9pr F/vkO8TX9HimeNOe4BQQY95MwpUNr+fSjpBGsGVZlYdtEKr7+YLWVZq0Ilx4gcbQgaQl 05irNmZ/GBEiANn7eKK84Cno24OKq7rZ0irNMxHd3f4h8ZpKhPuDP+nuXEX9Jk3RMwwS nc9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=BZbAf3LzZg9fH9hBkgFUS5Us7xAy94cZgMu2O0q9+MM=; b=c4N7eQmvlG9BWbDntnCtoRcFE647Jjqg2xPlUb7/M3xwK51LMVpO6Q4Q/ftdqCsvPo nEpTLKaXGCEf8agTrWjVQeFJJPwH0V75H4quNYbbpA1sYp9/adRBcCZPYeetprbh9Uen VHjixt5cPb8vm8ifixKSHY9+frRPAxlOeWphkHjU/PD7JPqfBkSz++5arH0HQJZslr8l I34IfbjT560bdabEsOBKFl7HHXa71RXsrSouJt70cwzkQvaUeXYutgIMTVy8SgKu0hBr 8NwUya4wil91E2audc/scH8jBGMoBBxo1jTFYMrjOX7QwJwtEy8HpocK/pG0mlDHekOM AKnQ== X-Gm-Message-State: AJaThX7fB7m/cFL/du59q4lQqFGa9qlbNGQmZjXYCwT2t9IASEbN64jA ADC1s4he5roMxYnRTO6cZkUO2asY X-Google-Smtp-Source: AGs4zMb1u2FG1gCHy5IefiyNhgAuleg74LDn5MTQQ6rGvJMEK6w8lcIiku4HSXUuMmhzvGuW0E9O6Q== X-Received: by 10.223.163.11 with SMTP id c11mr485347wrb.214.1511905872922; Tue, 28 Nov 2017 13:51:12 -0800 (PST) Received: from debian64.daheim (p200300D5FBC552FC0000000000000830.dip0.t-ipconnect.de. [2003:d5:fbc5:52fc::830]) by smtp.gmail.com with ESMTPSA id 92sm46173wrd.15.2017.11.28.13.51.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Nov 2017 13:51:10 -0800 (PST) Received: from chuck by debian64.daheim with local (Exim 4.89) (envelope-from ) id 1eJnmX-0001x4-FG for lede-dev@lists.infradead.org; Tue, 28 Nov 2017 22:51:09 +0100 From: Christian Lamparter To: lede-dev@lists.infradead.org Date: Tue, 28 Nov 2017 22:51:07 +0100 Message-Id: X-Mailer: git-send-email 2.15.0 In-Reply-To: <9bf13786bcddfa7a6edebe1a685d57ce0c1f6f94.1511905744.git.chunkeey@gmail.com> References: <9bf13786bcddfa7a6edebe1a685d57ce0c1f6f94.1511905744.git.chunkeey@gmail.com> In-Reply-To: <4ab7bbf6c1c3b16972fe0431106ab82a88de50fe.1511905744.git.chunkeey@gmail.com> References: <9bf13786bcddfa7a6edebe1a685d57ce0c1f6f94.1511905744.git.chunkeey@gmail.com> <4ab7bbf6c1c3b16972fe0431106ab82a88de50fe.1511905744.git.chunkeey@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171128_135135_798817_4350A339 X-CRM114-Status: UNSURE ( 9.13 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c0c:0:0:0:244 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (chunkeey[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Subject: [LEDE-DEV] [PATCH 3/5] apm821xx: convert to dt based diag LED script X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 --- target/linux/apm821xx/base-files/etc/diag.sh | 48 +++++++++++++++------------- target/linux/apm821xx/dts/MR24.dts | 8 +++-- target/linux/apm821xx/dts/MX60.dts | 8 +++-- target/linux/apm821xx/dts/apollo3g.dtsi | 8 +++-- target/linux/apm821xx/dts/wndr4700.dts | 8 +++-- 5 files changed, 49 insertions(+), 31 deletions(-) diff --git a/target/linux/apm821xx/base-files/etc/diag.sh b/target/linux/apm821xx/base-files/etc/diag.sh index eb9b04b525..e45f2a8522 100755 --- a/target/linux/apm821xx/base-files/etc/diag.sh +++ b/target/linux/apm821xx/base-files/etc/diag.sh @@ -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 } diff --git a/target/linux/apm821xx/dts/MR24.dts b/target/linux/apm821xx/dts/MR24.dts index 8d20872c3f..75bb32255c 100644 --- a/target/linux/apm821xx/dts/MR24.dts +++ b/target/linux/apm821xx/dts/MR24.dts @@ -20,6 +20,10 @@ aliases { serial0 = &UART1; + led-boot = &status; + led-failsafe = &failsafe; + led-running = &status; + led-upgrade = &status; }; chosen { @@ -91,12 +95,12 @@ 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>; }; diff --git a/target/linux/apm821xx/dts/MX60.dts b/target/linux/apm821xx/dts/MX60.dts index 4ec0043f32..6c753639b2 100644 --- a/target/linux/apm821xx/dts/MX60.dts +++ b/target/linux/apm821xx/dts/MX60.dts @@ -20,6 +20,10 @@ aliases { serial0 = &UART1; + led-boot = &status; + led-failsafe = &failsafe; + led-running = &status; + led-upgrade = &status; }; chosen { @@ -120,12 +124,12 @@ 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>; }; diff --git a/target/linux/apm821xx/dts/apollo3g.dtsi b/target/linux/apm821xx/dts/apollo3g.dtsi index 783348a678..09a8b8518c 100644 --- a/target/linux/apm821xx/dts/apollo3g.dtsi +++ b/target/linux/apm821xx/dts/apollo3g.dtsi @@ -14,6 +14,10 @@ aliases { serial0 = &UART0; + led-boot = &status; + led-failsafe = &status; + led-running = &status; + led-upgrade = &status; }; }; @@ -113,13 +117,13 @@ 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>; }; diff --git a/target/linux/apm821xx/dts/wndr4700.dts b/target/linux/apm821xx/dts/wndr4700.dts index d1a65f3e62..2e0addf74b 100644 --- a/target/linux/apm821xx/dts/wndr4700.dts +++ b/target/linux/apm821xx/dts/wndr4700.dts @@ -19,6 +19,10 @@ aliases { serial0 = &UART0; + led-boot = &status; + led-failsafe = &failsafe; + led-running = &status; + led-upgrade = &status; }; chosen { @@ -348,12 +352,12 @@ 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";