From patchwork Tue Nov 28 06:33:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Yan X-Patchwork-Id: 841987 X-Patchwork-Delegate: philipp.tomsich@theobroma-systems.com 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.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3ymDQx1g16z9sPt for ; Tue, 28 Nov 2017 17:34:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id C5F57C21D8C; Tue, 28 Nov 2017 06:34:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_SORBS_WEB autolearn=no autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 25111C21D56; Tue, 28 Nov 2017 06:34:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6F6EFC21C4C; Tue, 28 Nov 2017 06:34:10 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.99.140]) by lists.denx.de (Postfix) with ESMTPS id 56A94C21C29 for ; Tue, 28 Nov 2017 06:34:09 +0000 (UTC) Received: from andy.yan?rock-chips.com (unknown [192.168.167.205]) by regular1.263xmail.com (Postfix) with ESMTP id 30B2D4A76 for ; Tue, 28 Nov 2017 14:34:04 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 876F23B0; Tue, 28 Nov 2017 14:34:04 +0800 (CST) X-RL-SENDER: andy.yan@rock-chips.com X-FST-TO: philipp.tomsich@theobroma-systems.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: andy.yan@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: yxj@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 12936IANMZQ; Tue, 28 Nov 2017 14:34:05 +0800 (CST) From: Andy Yan To: philipp.tomsich@theobroma-systems.com Date: Tue, 28 Nov 2017 14:33:58 +0800 Message-Id: <1511850838-32621-1-git-send-email-andy.yan@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511850761-32567-1-git-send-email-andy.yan@rock-chips.com> References: <1511850761-32567-1-git-send-email-andy.yan@rock-chips.com> Cc: u-boot@lists.denx.de, Andy Yan , david.wu@rock-chips.com Subject: [U-Boot] [PATCH 1/3] rockchip: boot mode: parse adc channel from dts X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Most the current rockchip based boards use adc channel 1 detect the download key, but there are also some boards like rv1108 based plaform use adc channel 0. So we parse the adc channel from dts if we can get it, otherwise we use the channel 1 as default. Signed-off-by: Andy Yan Acked-by: Philipp Tomsich --- arch/arm/mach-rockchip/boot_mode.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c index 942849f..49dfd39 100644 --- a/arch/arm/mach-rockchip/boot_mode.c +++ b/arch/arm/mach-rockchip/boot_mode.c @@ -8,6 +8,9 @@ #include #include #include +#include + +DECLARE_GLOBAL_DATA_PTR; void set_back_to_bootrom_dnl_flag(void) { @@ -26,9 +29,19 @@ void set_back_to_bootrom_dnl_flag(void) __weak int rockchip_dnl_key_pressed(void) { + const void *blob = gd->fdt_blob; unsigned int val; + int channel = 1; + int node; + u32 chns[2]; + + node = fdt_node_offset_by_compatible(blob, 0, "adc-keys"); + if (node >= 0) { + if (!fdtdec_get_int_array(blob, node, "io-channels", chns, 2)) + channel = chns[1]; + } - if (adc_channel_single_shot("saradc", 1, &val)) { + if (adc_channel_single_shot("saradc", channel, &val)) { pr_err("%s: adc_channel_single_shot fail!\n", __func__); return false; } From patchwork Tue Nov 28 06:34:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Yan X-Patchwork-Id: 841988 X-Patchwork-Delegate: philipp.tomsich@theobroma-systems.com 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.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3ymDRh3L8sz9sPt for ; Tue, 28 Nov 2017 17:34:56 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 149C4C21DE9; Tue, 28 Nov 2017 06:34:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_SORBS_WEB autolearn=no autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 59530C21DCE; Tue, 28 Nov 2017 06:34:48 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 206A2C21DB1; Tue, 28 Nov 2017 06:34:28 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.99.138]) by lists.denx.de (Postfix) with ESMTPS id 02863C21DCA for ; Tue, 28 Nov 2017 06:34:28 +0000 (UTC) Received: from andy.yan?rock-chips.com (unknown [192.168.167.13]) by regular1.263xmail.com (Postfix) with ESMTP id C6DF87A41 for ; Tue, 28 Nov 2017 14:34:22 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 490363BE; Tue, 28 Nov 2017 14:34:23 +0800 (CST) X-RL-SENDER: andy.yan@rock-chips.com X-FST-TO: philipp.tomsich@theobroma-systems.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: andy.yan@rock-chips.com X-UNIQUE-TAG: <084419744007f96a80e1b9be3d04759b> X-ATTACHMENT-NUM: 0 X-SENDER: yxj@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 44050U2D1B; Tue, 28 Nov 2017 14:34:23 +0800 (CST) From: Andy Yan To: philipp.tomsich@theobroma-systems.com Date: Tue, 28 Nov 2017 14:34:17 +0800 Message-Id: <1511850857-32679-1-git-send-email-andy.yan@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511850761-32567-1-git-send-email-andy.yan@rock-chips.com> References: <1511850761-32567-1-git-send-email-andy.yan@rock-chips.com> Cc: u-boot@lists.denx.de, Andy Yan , david.wu@rock-chips.com Subject: [U-Boot] [PATCH 2/3] rockchip: rv1108: add adc key dt node for evb_rv1108 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" RV1108 EVB uses a adc-based recovery(VOL+) key, which connected to saradc channel 0. This patch add dt node for it. Signed-off-by: Andy Yan Acked-by: Philipp Tomsich --- arch/arm/dts/rv1108-evb.dts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/dts/rv1108-evb.dts b/arch/arm/dts/rv1108-evb.dts index 8e857b2..66da40c 100644 --- a/arch/arm/dts/rv1108-evb.dts +++ b/arch/arm/dts/rv1108-evb.dts @@ -7,11 +7,32 @@ /dts-v1/; #include "rv1108.dtsi" +#include / { model = "Rockchip RV1108 Evaluation board"; compatible = "rockchip,rv1108-evb", "rockchip,rv1108"; + adc-keys { + compatible = "adc-keys"; + io-channels = <&saradc 0>; + io-channel-names = "buttons"; + poll-interval = <100>; + keyup-threshold-microvolt = <3300000>; + + button-up { + label = "Volume Up"; + linux,code = ; + press-threshold-microvolt = <0>; + }; + + button-down { + label = "Volume Down"; + linux,code = ; + press-threshold-microvolt = <1650000>; + }; + }; + memory@60000000 { device_type = "memory"; reg = <0x60000000 0x08000000>; From patchwork Tue Nov 28 06:34:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Yan X-Patchwork-Id: 841989 X-Patchwork-Delegate: philipp.tomsich@theobroma-systems.com 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.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3ymDSf1nkPz9sPt for ; Tue, 28 Nov 2017 17:35:46 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id F208EC21DD0; Tue, 28 Nov 2017 06:35:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_SORBS_WEB autolearn=no autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3FF35C21DB0; Tue, 28 Nov 2017 06:34:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6CA06C21DC1; Tue, 28 Nov 2017 06:34:44 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.99.135]) by lists.denx.de (Postfix) with ESMTPS id 84E6DC21DDA for ; Tue, 28 Nov 2017 06:34:43 +0000 (UTC) Received: from andy.yan?rock-chips.com (unknown [192.168.167.235]) by regular1.263xmail.com (Postfix) with ESMTP id D5D061E020 for ; Tue, 28 Nov 2017 14:34:39 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 11BEE3A3; Tue, 28 Nov 2017 14:34:39 +0800 (CST) X-RL-SENDER: andy.yan@rock-chips.com X-FST-TO: philipp.tomsich@theobroma-systems.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: andy.yan@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: yxj@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 282663E3WM2; Tue, 28 Nov 2017 14:34:40 +0800 (CST) From: Andy Yan To: philipp.tomsich@theobroma-systems.com Date: Tue, 28 Nov 2017 14:34:34 +0800 Message-Id: <1511850874-32733-1-git-send-email-andy.yan@rock-chips.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511850761-32567-1-git-send-email-andy.yan@rock-chips.com> References: <1511850761-32567-1-git-send-email-andy.yan@rock-chips.com> Cc: u-boot@lists.denx.de, Andy Yan , david.wu@rock-chips.com Subject: [U-Boot] [PATCH 3/3] rockchip: rv1108: call setup_boot_mode X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Call setup_boot_mode to check current boot mode. Signed-off-by: Andy Yan Acked-by: Philipp Tomsich Reviewed-by: Philipp Tomsich --- arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/rv1108/rv1108.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index a26736a..b555d60 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -130,6 +130,7 @@ config ROCKCHIP_RK3399 config ROCKCHIP_RV1108 bool "Support Rockchip RV1108" select CPU_V7 + select BOARD_LATE_INIT help The Rockchip RV1108 is a ARM-based SoC with a single-core Cortex-A7 and a DSP. diff --git a/arch/arm/mach-rockchip/rv1108/rv1108.c b/arch/arm/mach-rockchip/rv1108/rv1108.c index 868cdd5..e21e505 100644 --- a/arch/arm/mach-rockchip/rv1108/rv1108.c +++ b/arch/arm/mach-rockchip/rv1108/rv1108.c @@ -5,6 +5,7 @@ */ #include +#include #ifndef CONFIG_SYS_DCACHE_OFF void enable_caches(void) @@ -13,3 +14,8 @@ void enable_caches(void) dcache_enable(); } #endif + +int board_late_init(void) +{ + return setup_boot_mode(); +}