diff options
author | Michael Scott <michael.scott@linaro.org> | 2014-10-16 20:43:35 -0700 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2014-11-14 18:13:20 -0600 |
commit | d43e9bcfeb53bf602a2c78b94891393f912d7939 (patch) | |
tree | 3716aeddfd49b3c1b65b4a53b21b91fb4c8ad89d | |
parent | fd497aed65383ef3cfcf198aba7b9c79ee061db9 (diff) |
arm: tegra: jetson: add small delay to check FORCE_RECOVERY button press
By pressing the FORCE_RECOVERY button on Jetson within the first 2 seconds
of power on, it turns on "recovery" mode. No more need for a serial cable
or working Android OS to trigger recovery.
Signed-off-by: Michael Scott <michael.scott@linaro.org>
-rw-r--r-- | board/nvidia/jetson-tk1/jetson-tk1.c | 39 | ||||
-rw-r--r-- | include/configs/jetson-tk1.h | 1 |
2 files changed, 40 insertions, 0 deletions
diff --git a/board/nvidia/jetson-tk1/jetson-tk1.c b/board/nvidia/jetson-tk1/jetson-tk1.c index 5d37718f3b..9e6c4d4e3d 100644 --- a/board/nvidia/jetson-tk1/jetson-tk1.c +++ b/board/nvidia/jetson-tk1/jetson-tk1.c @@ -8,8 +8,11 @@ #include <common.h> #include <asm/arch/gpio.h> #include <asm/arch/pinmux.h> +#include <asm/gpio.h> #include "pinmux-config-jetson-tk1.h" +#define KEY_RECOVERY_GPIO GPIO_PI1 + /* * Routine: pinmux_init * Description: Do individual peripheral pinmux configs @@ -27,3 +30,39 @@ void pinmux_init(void) pinmux_config_drvgrp_table(jetson_tk1_drvgrps, ARRAY_SIZE(jetson_tk1_drvgrps)); } + +#ifdef CONFIG_MISC_INIT_R +int misc_init_r(void) +{ + int bootdelay = 2; + int abort = 0; + unsigned long ts; + + /* Get GPIOs */ + gpio_request(KEY_RECOVERY_GPIO, "recovery_btn"); + + printf("Checking for recovery ...\n"); + /* delay 1000 ms */ + while ((bootdelay > 0) && (!abort)) { + --bootdelay; + /* delay 1000 ms */ + ts = get_timer(0); + do { + /* check for FORCE_RECOVERY button */ + if (!gpio_get_value(KEY_RECOVERY_GPIO)) { + printf("\n*** RECOVERY BUTTON ***"); + setenv("recovery", "1"); + abort = 1; + } + udelay(10000); + } while (!abort && get_timer(ts) < 1000); + printf("."); + } + printf("\n"); + + /* Free GPIOs */ + gpio_free(KEY_RECOVERY_GPIO); + + return 0; +} +#endif diff --git a/include/configs/jetson-tk1.h b/include/configs/jetson-tk1.h index f5a5490f09..70501234b3 100644 --- a/include/configs/jetson-tk1.h +++ b/include/configs/jetson-tk1.h @@ -22,6 +22,7 @@ #define CONFIG_OF_LIBFDT #define CONFIG_OF_BOARD_SETUP +#define CONFIG_MISC_INIT_R /* call misc_init_r during start up */ #define CONFIG_SERIAL_TAG |