diff options
author | Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> | 2018-01-10 11:33:52 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-01-15 16:29:02 -0500 |
commit | 100fb0bd9989d1722c75d83baaf08d5285e7a62c (patch) | |
tree | abeb6ba9600cc97211fab5b32c69ee11d0f8f40e /board/qualcomm | |
parent | e0cc0b6c6d84de8f36b85c5c324ea74d338068ca (diff) | |
download | u-boot-100fb0bd9989d1722c75d83baaf08d5285e7a62c.tar.gz |
db820c: stop autoboot when vol- pressed
Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Diffstat (limited to 'board/qualcomm')
-rw-r--r-- | board/qualcomm/dragonboard820c/dragonboard820c.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/board/qualcomm/dragonboard820c/dragonboard820c.c b/board/qualcomm/dragonboard820c/dragonboard820c.c index f6307f3a6e..6040787cff 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 <jorge.ramirez-ortiz@gmail.com> + * (C) Copyright 2017 Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> * * SPDX-License-Identifier: GPL-2.0+ */ @@ -14,6 +14,7 @@ #include <asm/io.h> #include <linux/bitops.h> #include <asm/psci.h> +#include <asm/gpio.h> DECLARE_GLOBAL_DATA_PTR; @@ -125,3 +126,38 @@ int board_init(void) 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; +} |