From patchwork Fri Jan 5 10:29:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 123495 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp638162qgn; Fri, 5 Jan 2018 02:36:51 -0800 (PST) X-Google-Smtp-Source: ACJfBot4iYA0jn5/aSN6Jszrt5ExQFyjVu9xmFMkHKVPMDb0+FOtw0PHYG0RKmViFxerSEUAIY02 X-Received: by 10.80.230.8 with SMTP id y8mr3489861edm.203.1515148611219; Fri, 05 Jan 2018 02:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515148611; cv=none; d=google.com; s=arc-20160816; b=waGdYyTtRHPzgyRZNbACnciU7mQPFJ1+E7BiqMDAkGKlD5eVmf1gHeaiePo8kdV3cc yHwgBFg9ZSATlArLKDhVNs8nywL+XGiAwFRFTfZkltIH08G7DIdbk+mFHmBZFJbvqMtA Afxy8+6I5M5lWyO3Wwhg5J5seGGdS0xvgOKAOCM1LMKzBa/EiPsJX2zkrBlTGQFShKn/ BZbirVKBcGxa4nrENMlV/xd1e871C4158UyDaNjkEcVQwE7BJTOfGfocIx2RJevrJPSG x+n5D4zvtFQ0KkQIU476+uLLCXA+DP/+V3echkRWxRdNvtkXsO4ZRBx2DEfAhn0Wmx85 bQPg== 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=ldyVEBCPkqEk02ey8v3vXKJcYoepk8jx/W3is2Zn380=; b=MD1HEfbU7x31DPpHLKX5VZkbzF2FeW8CBs0ewAkFkYzaqBmXuNljHLAu8VeeMU8Yys vU0o3CgjkbdOKUez5oGudRG65kgZpZ2oJ+Dgkq/DE138/5hUlHBfYfuzMaTgVNMgllH3 BM+PgnwYGj3B62MpcQL0sx2PC6Ndmc6FdQ1LkINziok+1pW5tNxZgO9GpItwqM5SMABD r4TovmjS28RZ95G0A/N4328mCFa//O/Q8OFyRiCgOEKVnqm8JKHdedgwURXaMEtJAISq 7QaPjargPq4KNIjgBbFMiTe1KDWSWEJuNKt6b/3piqpR5aF1LD37CicQVFydWtPLCGuq 5pgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NpGA23MF; 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=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id j63si2451983edd.461.2018.01.05.02.36.50; Fri, 05 Jan 2018 02:36:51 -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=@linaro.org header.s=google header.b=NpGA23MF; 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=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id C2617C21E39; Fri, 5 Jan 2018 10:35:34 +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=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 1264AC21E65; Fri, 5 Jan 2018 10:29:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 705F2C21E51; Fri, 5 Jan 2018 10:29:41 +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 6FE8AC21E48 for ; Fri, 5 Jan 2018 10:29:25 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id i11so1590432wmf.4 for ; Fri, 05 Jan 2018 02:29:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=wKzRuce3P+iEFxIknGFX2DqQX3URZH2aaYkYMFj+/hw=; b=NpGA23MFHVi4lDCDgCt0g2ws2X87015Y3/GtiIXnK2/uJfr2Vwsf1qv7Ir1yGGLp6h 03bqQMEmi5QsmPWh8YdAm9dKEk5dw6rfYplMHLPOXOEsApT7rn1iMfl7NbozhVL8dli3 iG9rqpjyNsIaGYWIflpBKB/u+ZMIGXPZIg0v8= 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=wKzRuce3P+iEFxIknGFX2DqQX3URZH2aaYkYMFj+/hw=; b=YUzoAruoN/wjg7SrG6AKUBHWyWft9B89bmmXdgZwwyA3YVuA12j+yXfqK4tk0lofjq MTD4g+kxCLYNTTQiOxC5az4Bx0ldgoSc7gHy+d4seQi7Y/L/ugmH3XqAheMZ7zpfQVpO nsv1Vf4Aw2NVVGUkoCBi2SoLXXeb1qEG94c4vY84IsLrhi6QnMwXbJeNGe9Qh6beqhOP K9Glx/Bf8nmGlq2em21OjVeTWxLs0+DpchaFlyymxhzTmn3JiXl3Q2iw2V17NOZZhS/a 66dkFChoDndRYdRg33Sv8ayb4mxNnRQa7tVNUoSG3k726jYfMr+weARsipMwDsYmD9a1 t7NA== X-Gm-Message-State: AKGB3mKp4eF5r9MFPZdGL6ZpSpjWmugYpcqbx2tsqFYRjofhFR4p26MT mDiAQ2zGjyIkNdGKWXfLv/fEo+v1xEc= X-Received: by 10.28.12.14 with SMTP id 14mr2029674wmm.121.1515148165033; Fri, 05 Jan 2018 02:29:25 -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 n33sm10367629wrn.76.2018.01.05.02.29.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Jan 2018 02:29:23 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, u-boot@lists.denx.de Date: Fri, 5 Jan 2018 11:29:14 +0100 Message-Id: <1515148154-30138-5-git-send-email-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515148154-30138-1-git-send-email-jorge.ramirez-ortiz@linaro.org> References: <1515148154-30138-1-git-send-email-jorge.ramirez-ortiz@linaro.org> Subject: [U-Boot] [PATCH 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" 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