mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 06:31:31 +00:00
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>
This commit is contained in:
parent
cf74e0a96b
commit
27aede24bc
5 changed files with 58 additions and 2 deletions
|
@ -34,6 +34,16 @@ void displ5_set_iomux_uart(void)
|
||||||
SETUP_IOMUX_PADS(uart_pads);
|
SETUP_IOMUX_PADS(uart_pads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iomux_v3_cfg_t const misc_pads_spl[] = {
|
||||||
|
/* Emergency recovery pin */
|
||||||
|
MX6_PAD_EIM_D29__GPIO3_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL),
|
||||||
|
};
|
||||||
|
|
||||||
|
void displ5_set_iomux_misc_spl(void)
|
||||||
|
{
|
||||||
|
SETUP_IOMUX_PADS(misc_pads_spl);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MXC_SPI
|
#ifdef CONFIG_MXC_SPI
|
||||||
iomux_v3_cfg_t const ecspi_pads[] = {
|
iomux_v3_cfg_t const ecspi_pads[] = {
|
||||||
/* SPI3 */
|
/* SPI3 */
|
||||||
|
|
|
@ -37,5 +37,6 @@ void displ5_set_iomux_ecspi_spl(void);
|
||||||
void displ5_set_iomux_ecspi(void);
|
void displ5_set_iomux_ecspi(void);
|
||||||
void displ5_set_iomux_usdhc_spl(void);
|
void displ5_set_iomux_usdhc_spl(void);
|
||||||
void displ5_set_iomux_usdhc(void);
|
void displ5_set_iomux_usdhc(void);
|
||||||
|
void displ5_set_iomux_misc_spl(void);
|
||||||
|
|
||||||
#endif /* __DISPL5_COMMON_H_ */
|
#endif /* __DISPL5_COMMON_H_ */
|
||||||
|
|
|
@ -44,6 +44,7 @@ static bool sw_ids_valid;
|
||||||
static u32 cpu_id;
|
static u32 cpu_id;
|
||||||
static u32 unit_id;
|
static u32 unit_id;
|
||||||
|
|
||||||
|
#define EM_PAD IMX_GPIO_NR(3, 29)
|
||||||
#define SW0 IMX_GPIO_NR(2, 4)
|
#define SW0 IMX_GPIO_NR(2, 4)
|
||||||
#define SW1 IMX_GPIO_NR(2, 5)
|
#define SW1 IMX_GPIO_NR(2, 5)
|
||||||
#define SW2 IMX_GPIO_NR(2, 6)
|
#define SW2 IMX_GPIO_NR(2, 6)
|
||||||
|
@ -179,6 +180,9 @@ iomux_v3_cfg_t const misc_pads[] = {
|
||||||
|
|
||||||
/* XTALOSC */
|
/* XTALOSC */
|
||||||
MX6_PAD_GPIO_3__XTALOSC_REF_CLK_24M | MUX_PAD_CTRL(NO_PAD_CTRL),
|
MX6_PAD_GPIO_3__XTALOSC_REF_CLK_24M | MUX_PAD_CTRL(NO_PAD_CTRL),
|
||||||
|
|
||||||
|
/* Emergency recovery pin */
|
||||||
|
MX6_PAD_EIM_D29__GPIO3_IO29 | MUX_PAD_CTRL(NO_PAD_CTRL),
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_FSL_ESDHC
|
#ifdef CONFIG_FSL_ESDHC
|
||||||
|
@ -369,7 +373,22 @@ static inline void setup_boot_modes(void) {}
|
||||||
|
|
||||||
int misc_init_r(void)
|
int misc_init_r(void)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
setup_boot_modes();
|
setup_boot_modes();
|
||||||
|
|
||||||
|
ret = gpio_request(EM_PAD, "Emergency_PAD");
|
||||||
|
if (ret) {
|
||||||
|
printf("Can't request emergency PAD gpio\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = gpio_direction_input(EM_PAD);
|
||||||
|
if (ret) {
|
||||||
|
printf("Can't set emergency PAD direction\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <asm/arch/imx-regs.h>
|
#include <asm/arch/imx-regs.h>
|
||||||
#include "asm/arch/iomux.h"
|
#include "asm/arch/iomux.h"
|
||||||
#include <asm/mach-imx/iomux-v3.h>
|
#include <asm/mach-imx/iomux-v3.h>
|
||||||
|
#include <asm/gpio.h>
|
||||||
#include <environment.h>
|
#include <environment.h>
|
||||||
#include <fsl_esdhc.h>
|
#include <fsl_esdhc.h>
|
||||||
#include <netdev.h>
|
#include <netdev.h>
|
||||||
|
@ -194,10 +195,24 @@ void board_init_f(ulong dummy)
|
||||||
/* Clear the BSS. */
|
/* Clear the BSS. */
|
||||||
memset(__bss_start, 0, __bss_end - __bss_start);
|
memset(__bss_start, 0, __bss_end - __bss_start);
|
||||||
|
|
||||||
|
displ5_set_iomux_misc_spl();
|
||||||
|
|
||||||
/* load/boot image from boot device */
|
/* load/boot image from boot device */
|
||||||
board_init_r(NULL, 0);
|
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)
|
void board_boot_order(u32 *spl_boot_list)
|
||||||
{
|
{
|
||||||
/* Default boot sequence SPI -> MMC */
|
/* 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[2] = BOOT_DEVICE_UART;
|
||||||
spl_boot_list[3] = BOOT_DEVICE_NONE;
|
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
|
#ifdef CONFIG_SPL_ENV_SUPPORT
|
||||||
/* 'fastboot' */
|
/* 'fastboot' */
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
|
@ -100,11 +100,13 @@
|
||||||
#define CONFIG_BAUDRATE 115200
|
#define CONFIG_BAUDRATE 115200
|
||||||
|
|
||||||
#ifndef CONFIG_BOOTCOMMAND
|
#ifndef CONFIG_BOOTCOMMAND
|
||||||
#define CONFIG_BOOTCOMMAND "if test ${BOOT_FROM} = FACTORY; then " \
|
#define CONFIG_BOOTCOMMAND "if run check_em_pad; then " \
|
||||||
|
"run recovery;" \
|
||||||
|
"else if test ${BOOT_FROM} = FACTORY; then " \
|
||||||
"run factory_nfs;" \
|
"run factory_nfs;" \
|
||||||
"else " \
|
"else " \
|
||||||
"run boot_mmc;" \
|
"run boot_mmc;" \
|
||||||
"fi"
|
"fi;fi"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PARTS_DEFAULT \
|
#define PARTS_DEFAULT \
|
||||||
|
@ -246,6 +248,8 @@
|
||||||
|
|
||||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||||
PARTS_DEFAULT \
|
PARTS_DEFAULT \
|
||||||
|
"gpio_recovery=93\0" \
|
||||||
|
"check_em_pad=gpio input ${gpio_recovery};test $? -eq 0;\0" \
|
||||||
"display=tianma-tm070-800x480\0" \
|
"display=tianma-tm070-800x480\0" \
|
||||||
"board=display5\0" \
|
"board=display5\0" \
|
||||||
"mmcdev=0\0" \
|
"mmcdev=0\0" \
|
||||||
|
|
Loading…
Add table
Reference in a new issue