From patchwork Wed Jan 10 10:33:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jorge Ramirez-Ortiz, Gmail" X-Patchwork-Id: 124040 Delivered-To: patch@linaro.org Received: by 10.80.140.226 with SMTP id r31csp1489995edr; Wed, 10 Jan 2018 02:38:54 -0800 (PST) X-Google-Smtp-Source: ACJfBovmrmFjdqzw/DcsAs4G6RR4DHavJEliTkQ0GKRAZTqVejXWhqm7sQQezkVkn+HJFBYMbIg3 X-Received: by 10.80.240.205 with SMTP id a13mr1714978edm.77.1515580734914; Wed, 10 Jan 2018 02:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515580734; cv=none; d=google.com; s=arc-20160816; b=V6kSaDRUjF+1L1XWfVELesgu6+LzOXY3ZmQsyjMGXgbnOh6kx2ufldIONHguao8Lo3 8ycpKvkMyoAa6qkkYDhLYNegxtUUQ4zzEdafDakPwAmVEJQdmuZTuAZkKY1fR6DMgps3 d3MiduHpDB1kgOj+9ui37F3lx+TOE6p+NNnXTCxtFL5llPXWxIvxrnsWh9kbxc5wVtpX ZXYYUiNKs4ncPNZ2qCbVJMu7Obw5TPjeazejn41UqJ61Fi5GVZshqNI9x0zsIPquutSd QrRgOHtIditsWyt91S5xsW2+ERjbmK3p4vviL0UU7z80NoOPRc3ZtOPpE5J1bDgejWST zqMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:arc-authentication-results; bh=38Gr2cClpK+/xfDR2Lo9S20UTlEQYKjYnTa+WOgSDVE=; b=IZX3+yn32W0QatBBdY9qgxK/q2h2KLe6klwS3GtgNagBW+wTfIgqZY8n/m4EsChVjF QzmeeoxzqvFTx9ngxT9gx3yLe6PTPs5YYRdo7jxbnG0Tu+/QLziw7/YgU4LH1IFQABpV IaaJYYB0aYS/B3JRSuvEkOdpDkG+YfkMx5MYKv3/o/DXSgcKqZS8REU84zDFILcn1ABY V7uh1YLePYRwoImax3cxzLbmtOtqLDqr1djkWPyBtqPJgH8pdalHnDCsIaDu4Rr/PDjJ uKoqKPPErbt1lrOojxkHmZGVtWHFvvDFN8tuzGy39BGVuFkvinc62/IHUajicco4xQzr VbbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=D4Ekuuc7; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 94si374920edn.200.2018.01.10.02.38.54; Wed, 10 Jan 2018 02:38:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=D4Ekuuc7; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: by lists.denx.de (Postfix, from userid 105) id 79FE2C221AD; Wed, 10 Jan 2018 10:37:48 +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.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 873D3C2210C; Wed, 10 Jan 2018 10:35:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 41037C21E3B; Wed, 10 Jan 2018 10:34:08 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id D45CBC22131 for ; Wed, 10 Jan 2018 10:34:04 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id f140so26014023wmd.2 for ; Wed, 10 Jan 2018 02:34:04 -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; bh=+XaRkCdyPJYhoMc4iI+JkYTJeS403hhlK75QjOH5lR0=; b=D4Ekuuc7gKvMTH22IndTi+YfqlFCuFEA6h0LNdDSWi/+mGFlXNJyKV2+LrSGw7vsHA H2f1JQ3jeZYmqUBHmiUz56V/OHFagS4aOZ+PqBvH39XBrsy/FdSMC15aof10VGDa+C+v g+NercxMP+E/4Zm+gzHivadQ0t1kbka/FzosXNYIVLbjckV+q5xi37IxyyMKznhoxJ5Y vgWZXyvsPZXQxXDrc91Xj2PKrUZ0BdDvwZZhrdV7q6xsUXRUEQsD3vXBIrYooj/PjiDM lMNsrlNow1EVDjPx4iMVz4bGqZ/7Pe6wF+yAaLxE9G2e2cxf4UW74l7EtwEWgbXO3V2+ XlUA== 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; bh=+XaRkCdyPJYhoMc4iI+JkYTJeS403hhlK75QjOH5lR0=; b=kCrtFv+jj6HrX/8QBn0iREeR6euXCNAgYDkEE4Z4o8ImHnyctLWc5BUF+BQ8vklCX0 dstccqsriW64f/v4SG6sRE1KUINmxWTpaz/83cMfu52T56rvqptPPeOUXI19/+nQer7o uwGxAiI6WSpXBkAvilCwuWDWoFy8ayncZMKZtH7yKT7zUkBZR6R/U78PfFBJbJ161+9N 7x8pTV8EzDxLyVYl/E12nTkw9R1sU/CyKIx0acWcWFP5LmAsD1LAJ1FGiEt5TsF2CQXa rspa/C3nFXrJCmBbCjznHbu7n4a+ckFAA4qTHkwNJVIItevSJOj4z0retHw2FX3hrHG0 5k2Q== X-Gm-Message-State: AKwxytewCm/VGD+UPUvfGN28fLhNW7bq4mr24RnF42lXXTNoS2HIIIpj sJkpuRFadmEa+w99EWsVW6he7g== X-Received: by 10.28.54.221 with SMTP id y90mr3879909wmh.156.1515580444350; Wed, 10 Jan 2018 02:34:04 -0800 (PST) Received: from igloo.80.58.61.254 (141.pool85-51-114.dynamic.orange.es. [85.51.114.141]) by smtp.gmail.com with ESMTPSA id z71sm5091969wrc.11.2018.01.10.02.34.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Jan 2018 02:34:03 -0800 (PST) From: Jorge Ramirez-Ortiz To: u-boot@lists.denx.de Date: Wed, 10 Jan 2018 11:33:52 +0100 Message-Id: <1515580432-25985-5-git-send-email-jorge.ramirez.ortiz@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515580432-25985-1-git-send-email-jorge.ramirez.ortiz@gmail.com> References: <1515580432-25985-1-git-send-email-jorge.ramirez.ortiz@gmail.com> Subject: [U-Boot] [PATCH v1 05/05] db820c: stop autoboot when vol- pressed 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" From: Jorge Ramirez-Ortiz Signed-off-by: Jorge Ramirez-Ortiz --- arch/arm/dts/dragonboard820c-uboot.dtsi | 19 ++++++++++++ board/qualcomm/dragonboard820c/dragonboard820c.c | 37 +++++++++++++++++++++++- include/configs/dragonboard820c.h | 2 ++ 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/dragonboard820c-uboot.dtsi diff --git a/arch/arm/dts/dragonboard820c-uboot.dtsi b/arch/arm/dts/dragonboard820c-uboot.dtsi new file mode 100644 index 0000000..167e72c --- /dev/null +++ b/arch/arm/dts/dragonboard820c-uboot.dtsi @@ -0,0 +1,19 @@ +/* + * U-Boot addition to handle Dragonboard 820c pins + * + * (C) Copyright 2017 Jorge Ramirez-Ortiz + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +&pm8994_pon { + key_vol_down { + gpios = <&pm8994_pon 1 0>; + label = "key_vol_down"; + }; + + key_power { + gpios = <&pm8994_pon 0 0>; + label = "key_power"; + }; +}; diff --git a/board/qualcomm/dragonboard820c/dragonboard820c.c b/board/qualcomm/dragonboard820c/dragonboard820c.c index 8f40ba4..d4a20d2 100644 --- a/board/qualcomm/dragonboard820c/dragonboard820c.c +++ b/board/qualcomm/dragonboard820c/dragonboard820c.c @@ -1,7 +1,7 @@ /* * Board init file for Dragonboard 820C * - * (C) Copyright 2017 Jorge Ramirez-Ortiz + * (C) Copyright 2017 Jorge Ramirez-Ortiz * * SPDX-License-Identifier: GPL-2.0+ */ @@ -14,6 +14,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -126,3 +127,37 @@ void reset_cpu(ulong addr) { psci_system_reset(); } + +/* Check for vol- button - if pressed - stop autoboot */ +int misc_init_r(void) +{ + struct udevice *pon; + struct gpio_desc resin; + int node, ret; + + ret = uclass_get_device_by_name(UCLASS_GPIO, "pm8994_pon@800", &pon); + if (ret < 0) { + printf("Failed to find PMIC pon node. Check device tree\n"); + return 0; + } + + node = fdt_subnode_offset(gd->fdt_blob, dev_of_offset(pon), + "key_vol_down"); + if (node < 0) { + printf("Failed to find key_vol_down node. Check device tree\n"); + return 0; + } + + if (gpio_request_by_name_nodev(offset_to_ofnode(node), "gpios", 0, + &resin, 0)) { + printf("Failed to request key_vol_down button.\n"); + return 0; + } + + if (dm_gpio_get_value(&resin)) { + env_set("bootdelay", "-1"); + printf("Power button pressed - dropping to console.\n"); + } + + return 0; +} diff --git a/include/configs/dragonboard820c.h b/include/configs/dragonboard820c.h index 76bcaf8..e0c3c0c 100644 --- a/include/configs/dragonboard820c.h +++ b/include/configs/dragonboard820c.h @@ -12,6 +12,8 @@ #include #include +#define CONFIG_MISC_INIT_R /* To stop autoboot */ + /* Physical Memory Map */ #define CONFIG_NR_DRAM_BANKS 2