From patchwork Tue Jan 9 09:12:03 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: 123934 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3979133qgn; Tue, 9 Jan 2018 04:47:36 -0800 (PST) X-Google-Smtp-Source: ACJfBovMmT6KYjCK8/m4HuRxe+EGGm2ssfDDzmZph/zKseqWfMYywevpAYCYjbm2zswr3Dy4SdSA X-Received: by 10.80.164.169 with SMTP id w38mr20710145edb.154.1515502056645; Tue, 09 Jan 2018 04:47:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515502056; cv=none; d=google.com; s=arc-20160816; b=qIcqvLdxhCxVJk6zU2AVTizkRrxWcHb4YtI6L33eRZqQ0adYBKMqUDmsaM3wQXdjNg 0uDuW/imXUxiDL2V/WhOESPKyoTWko1hKbEVPmM7aqJ3e7JezSqmd3mEgFKjXCugpui4 JlQIH8uXfpGx2nki/knQoHXCHCTSZKg0yp4YSq0SB2JxFzhqliSbBiW6h1HA0l/7kunR PIcOtSQlyKXxMOtzwPzVKZsbGJE599GbvgJNvg1KWJfMGICRxzea1KQDeo2vek8Cj2kq /Vaj8oD+LFwtq8jKYPO5k/euWbLLMPVomwPaeVp8ZUzDJHcu1wUlWHbVRJWHtn3FY8Ik kfGA== 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=PvQikRcZQ6EfCYyhJL+qBgIbG88aGi5Gx2VYEKzMKYsGW9E3ThERN1EPpDn2Q67jk1 GF5LzuavBYPvVhGGg7caYvJwng0DB19H+iHEMhwgzs91y6jsoLpAkPZt13gadC2oF1yM NkB0d9eZr60MO4v+/tkWPQh/DOGRekHKRjVYRZckhkMwbd7++hun0UUbZzyza/WK2OJc vjrp0cpkanqJ00pagRtN3+LhfbEOxyVSH3dflWrPpYoTP0fBSEQ0k1E0pkJ96x0u6Jhz GGxeEM7nc1WnLJHeGykgiwitdQqvfz4gwBXY1VsRp/+EEQ8t6uyBd03pAiEXmG3IUBMV 4asg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=kqq/7xt/; 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 94si496518edn.200.2018.01.09.04.47.36; Tue, 09 Jan 2018 04:47:36 -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=kqq/7xt/; 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 40DFAC21FEA; Tue, 9 Jan 2018 12:38:46 +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_H2, 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 5B525C22032; Tue, 9 Jan 2018 12:34:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 39D25C21F98; Tue, 9 Jan 2018 09:12:14 +0000 (UTC) Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by lists.denx.de (Postfix) with ESMTPS id CF4F5C22072 for ; Tue, 9 Jan 2018 09:12:13 +0000 (UTC) Received: by mail-wr0-f193.google.com with SMTP id 16so906823wry.12 for ; Tue, 09 Jan 2018 01:12:13 -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=kqq/7xt/0d516M88Voyj0vK8qyY8JT1f/1nm5E2cVkHydmBRE0LvYQMd2VGcQV1Opg eGYPhXAWZtCR7melfh9w++602iB0dm5YHXaXUahXg/KM0qcRxvAiPf3txKGK8+auKmoD vuiWthFUkNyHs3qk+8VJ+wfyv5kbYQahiLaCYdog1Ly9uucrzU4FAqTOnIXGwVPGDcY3 x673w8YaXWVWdveVHgKRUoV3xKQ0oU3td3VgBdsH1XsrCxt71Y4hebbyJ7f/LBURk6Uc 7LgyShjpRNL+R3sNqMfREx7vcbrXUZ5boR7i0l349G6YJLfeR/uWNO3Od5Wyverhedd/ ZjLA== 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=I1PoDQvL3ngZPa7NFAqPeMxrgfni75MTco3/f4xpL41mkIjLVRIZ9nKiFq37KiUFYD 3i+7TpEvtbfAa7aoBAekz6iPu4sV3FPNf7mFDz6UBIWiPmV/n8O0cj8zbvEaROqMNPoU 8bGiw5EVjNXfSWDxF5qNPcdGKOAQWWkae4sebd/AZ9zIK3AN9gzQtvUTnLnQXVBpUw0h 3ppbzGplpaZBpc1tFHIPqaT84uE6B8A+GRmSBcfs/fFZKU5Edi6CbCJRxUfWYJsTuH35 lRv+5wG+5OZhVfhTX3Q53RKctHtRhm5uUvPFIDtskOjT3TQ9giwyTtJLPUmbxb/OefmJ PTsQ== X-Gm-Message-State: AKGB3mIpqP1sNnSPoFxc553LBlMwcKzENcez/z3qAqtZMA9bjeWmTS2X YTLCvLAEyvAp4UYVBFx29GI= X-Received: by 10.223.160.6 with SMTP id k6mr13057819wrk.116.1515489133542; Tue, 09 Jan 2018 01:12: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 q7sm9943830wrf.31.2018.01.09.01.12.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jan 2018 01:12:12 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge.ramirez.ortiz@gmail.com, U-Boot@lists.denx.de, pbrobinson@gmail.com Date: Tue, 9 Jan 2018 10:12:03 +0100 Message-Id: <1515489123-6846-5-git-send-email-jorge.ramirez.ortiz@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515489123-6846-1-git-send-email-jorge.ramirez.ortiz@gmail.com> References: <1515489123-6846-1-git-send-email-jorge.ramirez.ortiz@gmail.com> X-Mailman-Approved-At: Tue, 09 Jan 2018 12:34:32 +0000 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" 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