From patchwork Thu Dec 14 11:53:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 121916 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp6711308qgn; Thu, 14 Dec 2017 04:04:54 -0800 (PST) X-Google-Smtp-Source: ACJfBosnP7w1SJa9j/Kkbtj8YDMC7LK6tJSfH9YxiQDnu2mNe7BUO6uxA4oIPRabJEgz/CQy5vH+ X-Received: by 10.80.147.195 with SMTP id o61mr12177223eda.88.1513253094835; Thu, 14 Dec 2017 04:04:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513253094; cv=none; d=google.com; s=arc-20160816; b=lxMjXIu90J/m/ZV1ecbOI6d8sf0LL9XUd11FwKaxUMDMVkbrM/q4baMmDWffNDYqys 0aPx/iEdtc1sbPeCXj86xTkIJse+Wb8DfwVhowXNyXi2N13Dw1UOv69ZjEb7aADW4Esy sbmnJq4cLaWiPMyzU26HJUyEXD0UpGJvMMBl37wPZY3YL9BFZaItCPYf2EBXkeTQzsxD d6XQxzRkMZVxWihcZ4RYMr3EC46Aa/QccWga4deaKIlGFS6m5RF9diHTCbysFAkvtlTi vHo2oACe84WnJFk1WToZrrju144LLVWSdOsFxXDFIvGgsmfENY9wnxC+O8elLgAGE/WA g+9w== 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=yVxJ0NW6lnPJp3wjaif7FnYARpV/qTbg1wuFaL5AKik=; b=DzhUspcZpOwfplpS2Ctl/X8THYdZLwT+uAJ/ROiG847QHOFlZSPppbDNu8Bz3roNdt URlpVCUO8yRAJAa7j9VX0mMcJVZ+3ynkH3c9CULXrK0wVZmjHtGnrXt9hzLENTB881QL BpRhvtj/v2q7vW9T00Niq+PyOC8/8DhRZSCgk+GeOgY/rbA6K7aWxD5hs+AiIH4IrNFl Ut25MhurznEaVM1pcGnPKQXUgL5/YqJtbrkb2zFbAbkSkItItL3W5XzNnW7DHENO6R5w klWcLmfpsY6uCXqP/LnvPFbRaZpQN1p2m8WrrcC/xnFw/hs8fwNE46B+M8Jd/HPzq27H qf3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Sjny6Mqx; 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 m12si2609992edi.220.2017.12.14.04.04.54; Thu, 14 Dec 2017 04:04: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=@linaro.org header.s=google header.b=Sjny6Mqx; 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 3C1A1C21EE9; Thu, 14 Dec 2017 12:00:56 +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 36C05C21E77; Thu, 14 Dec 2017 11:55:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4478AC21EAB; Thu, 14 Dec 2017 11:54:21 +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 C14CFC21DA6 for ; Thu, 14 Dec 2017 11:54:16 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id 64so10868091wme.3 for ; Thu, 14 Dec 2017 03:54:16 -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=XHEPpaJhe2GoNnSDnVdYNtMIVKDpHvyOQV0oQ9QAtds=; b=Sjny6MqxIP1QdkObC9gOz1DcM5I5ViY5LR7VSZ7NtyjCO+5bGAiUdwo3Ev9KRDipqz k1M8kQNVvjk7EVQeXG7Y7EwWifxJJQ52Huk3wgXOKSEZhZlMSXJaHlGF4giPD9XPf+Lq HZ1lmdW4zsBqtVlaWtJkG12pF8SFrGcC/ayzE= 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=XHEPpaJhe2GoNnSDnVdYNtMIVKDpHvyOQV0oQ9QAtds=; b=CCJrMif2fBJYyf3s1ZpwAGEHkVlPPbHRImHBAy2M55WVNwNwAcMJjFsWfU6S5C0FLM CvZHeygAVZAgOs1P6ieodfNkBQswPs+LMs125X1Y6VJM6aR/Zao1SL+lx9ZOV6eKCvvO q1tmaCSGaY13gvGwt4QpuS+3KockwvRXFkcgVXd07n2/nOCho0fiXOlXswOczBWw0872 3/jAhgbjfQioxDjPUAhBc01nMaQ6RqTdAaOKa1kRW7HsXIfZXzmcN437nsKM60dBwI0y Yu8jP1crAr38fCLUTF/YfPgbr/1QaFApN+Qr9YcT1Defx7CGQ6vSzvAzP+qOCyJJCV3S vxVA== X-Gm-Message-State: AKGB3mJVe3BN9w15vuP2edox7Z2V6J17Iqvvm9PVQdewnpzIhaWgdzSZ GBjBySye9P9waWXbN2paBk9dh4q3vNY= X-Received: by 10.28.66.138 with SMTP id k10mr2092597wmi.88.1513252456323; Thu, 14 Dec 2017 03:54:16 -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 e197sm11797509wmf.42.2017.12.14.03.54.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Dec 2017 03:54:15 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, u-boot@lists.denx.de Date: Thu, 14 Dec 2017 12:53:59 +0100 Message-Id: <1513252441-29520-6-git-send-email-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513252441-29520-1-git-send-email-jorge.ramirez-ortiz@linaro.org> References: <1513252441-29520-1-git-send-email-jorge.ramirez-ortiz@linaro.org> Subject: [U-Boot] [PATCH 6/8] 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 31a6853..947674a 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