summaryrefslogtreecommitdiff
path: root/board/liebherr/display5/spl.c
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2018-05-11 17:51:08 +0300
committerStefano Babic <sbabic@denx.de>2018-06-18 16:42:38 +0300
commit27aede24bcdec3777da7b23efc0a8cb777d83d6a (patch)
tree52d450f184d823083c60f03592650e7fe81b3064 /board/liebherr/display5/spl.c
parentcf74e0a96b0f99c4c6025f07549cc51e06a772e0 (diff)
downloadu-boot-27aede24bcdec3777da7b23efc0a8cb777d83d6a.tar.xz
display5: Support for the emergency PAD pressing
To enter the special mode, one needs to short cut two pads with e.g. screw driver. After power up the SPL will execute u-boot in which proper actions will be taken. It is worth noting that we do not alter envs (even the BOOT_FROM variable) and unconditionally go to recovery. Signed-off-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'board/liebherr/display5/spl.c')
-rw-r--r--board/liebherr/display5/spl.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c
index 0d25b0d996..551a14347d 100644
--- a/board/liebherr/display5/spl.c
+++ b/board/liebherr/display5/spl.c
@@ -16,6 +16,7 @@
#include <asm/arch/imx-regs.h>
#include "asm/arch/iomux.h"
#include <asm/mach-imx/iomux-v3.h>
+#include <asm/gpio.h>
#include <environment.h>
#include <fsl_esdhc.h>
#include <netdev.h>
@@ -194,10 +195,24 @@ void board_init_f(ulong dummy)
/* Clear the BSS. */
memset(__bss_start, 0, __bss_end - __bss_start);
+ displ5_set_iomux_misc_spl();
+
/* load/boot image from boot device */
board_init_r(NULL, 0);
}
+#define EM_PAD IMX_GPIO_NR(3, 29)
+int board_check_emergency_pad(void)
+{
+ int ret;
+
+ ret = gpio_direction_input(EM_PAD);
+ if (ret)
+ return ret;
+
+ return !gpio_get_value(EM_PAD);
+}
+
void board_boot_order(u32 *spl_boot_list)
{
/* Default boot sequence SPI -> MMC */
@@ -206,6 +221,13 @@ void board_boot_order(u32 *spl_boot_list)
spl_boot_list[2] = BOOT_DEVICE_UART;
spl_boot_list[3] = BOOT_DEVICE_NONE;
+ /*
+ * In case of emergency PAD pressed, we always boot
+ * to proper u-boot and perform recovery tasks there.
+ */
+ if (board_check_emergency_pad())
+ return;
+
#ifdef CONFIG_SPL_ENV_SUPPORT
/* 'fastboot' */
const char *s;