From patchwork Thu Dec 14 13:26:58 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: 121938 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp6809943qgn; Thu, 14 Dec 2017 05:32:27 -0800 (PST) X-Google-Smtp-Source: ACJfBotstXnKagml/DRoumsu1PZFWFVp5BrNEYSpeUCZZFn3eqoQZ0Pv4EZNa4LK9bZcGxLD7pJd X-Received: by 10.80.145.3 with SMTP id e3mr12452666eda.273.1513258347200; Thu, 14 Dec 2017 05:32:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513258347; cv=none; d=google.com; s=arc-20160816; b=UsCh2oTAbh2b6zKON2zleWp/N1QRvlD7hye0/ZtEX7xyzgljr394ePP979jWIrcbK+ UfVQSwESLLXilh9LRvsPIzVS5xvKsFZHEw3LZ444eb/YTueZQEJi7mjLdwNLbKO0actW cBFtCu5jcXARFPmKZuwE22Eva6vR0zFBT8ZaqWFvYIcpBCTftS4B/is3tSuPOpd9jqZv 3SSW+Loyxdbj0UV2XpAwftJlkfUyhhMr3g9xKTlLrJ9tX2fK7ZIrWLsHKF4jEwl6+pCL TMopIQjNS5t/2N+H0xwsmoRJFv0rEX4awwaBI8D+3FGbz35Ckwsdv1cjuDQTL73F5qeO 7XhA== 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=P6Jr+wJv6e1mvLnHdnChu0Bt+xLGPxcYc1EBRNoHsB/WUrayrWcuO2Ch00XwOw3LlA TERgqs/qmjOqhL9XvQOPTH3ndA6045uiSHbnLBreC0i46hkATnMFsTJo6WuG3zlh0DDx 5Nt0OIeDUgpnP1IgjONz3EexMPg85r2RULhd9QsgsGDQxdXHQwSFXtviIwAs3QB916GQ cxY+I2mCWcQCzA8Vo+A5G2kmN1BhyItzTlpQMDglkpIdswqpJq6nIDWno8577LqyRp2i aON3/93fwLcc47wog5gi1fErTieiuW3Q838suHuVzboiC7iRMOHFeGEo6zz4eOyJ9yWp jJKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DNQ0bRbs; 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 a2si3139262edn.509.2017.12.14.05.32.26; Thu, 14 Dec 2017 05:32:27 -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=DNQ0bRbs; 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 CBF8DC21E79; Thu, 14 Dec 2017 13:30:51 +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 16E6FC21EF1; Thu, 14 Dec 2017 13:28:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2880EC21EFC; Thu, 14 Dec 2017 13:27:17 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id 3D053C21E79 for ; Thu, 14 Dec 2017 13:27:14 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id y82so26257761wmg.1 for ; Thu, 14 Dec 2017 05:27:14 -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=DNQ0bRbs94TVoiXysH/0bCJvD8f9ZEKbN1BgSxPmMAxIhehGu+oPAyO/fvzDCM9f1X 3n23f1RpFvD+FCxRKRsoDUi9aUrGUjM7l8QPGLbYQJ1wCWbldpip6+z1vHAW0Zl2Ay30 jllyT0Y9eQo9VZjfDcoqh7dz1oeqCm62MSEJY= 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=htb2/GBcbCgLe6NP3Gb9PQueMMjW7Ji2PtEdw9pQNfworDH2RBgPat2UB8VtQZxCU+ HNNJyvw0fPn48OG0RQESQOyDG3cUTyRrFUInqE8H7ST7WK3A7/adnZXsLAAjQptPCq5k tXw1pIeZKvwjN5SVDVAqoj2Gcr+t/kx5M71rJCbzwRTJLwIETYjt0JZQZtecqib5TM4u MdS4zy6a8R/HEnDGrsNNpi4JKtiZOW7zxxjiSdiR1uDyEzD7H1OfLeKziMsqe/HIeXQA 1hKswRHzmhQrIym4DRV007qMHq1XvqLAqvf1XT9SEkFo099xURpash+6zE/P+Rmrye4t Q2dA== X-Gm-Message-State: AKGB3mKXX/a4U5OYukQbECLmmOXzscCf2ZPHYwelphJjNwrwXr3YcMen oBQVr68oKWJhcgD0NIvaf6rDgg== X-Received: by 10.28.71.136 with SMTP id m8mr1700678wmi.89.1513258033795; Thu, 14 Dec 2017 05:27:13 -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 l3sm3235378wrg.2.2017.12.14.05.27.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 14 Dec 2017 05:27:12 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, u-boot@lists.denx.de Date: Thu, 14 Dec 2017 14:26:58 +0100 Message-Id: <1513258020-23589-7-git-send-email-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513258020-23589-1-git-send-email-jorge.ramirez-ortiz@linaro.org> References: <1513258020-23589-1-git-send-email-jorge.ramirez-ortiz@linaro.org> Subject: [U-Boot] [PATCH v2 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