diff options
author | Maximus Sun <maximus.sun@nxp.com> | 2022-11-15 13:41:15 +0800 |
---|---|---|
committer | Ji Luo <ji.luo@nxp.com> | 2022-11-15 14:23:57 +0800 |
commit | 14b6c8f3e3b222f6c508b49cba319a08d207e8f4 (patch) | |
tree | 8eaf1d39a592e911e258c4ab3269d85000c57fc4 | |
parent | 62ad7799b6cad795f73acacc28bf3711fc83a886 (diff) |
MA-20886 imx8ulp: Boot from recovery mode when pressing key
Make system enter recovery mode when user pressing "sw2" when
i.MX 8ULP EVK and i.MX 8ULP EVK 9×9 board are powered on.
Signed-off-by: Maximus Sun <maximus.sun@nxp.com>
Change-Id: Ifc13c37fff4f6c7352161b6ad7d6014aeeafcc6d
-rw-r--r-- | arch/arm/include/asm/arch-imx8ulp/imx8ulp-pins.h | 2 | ||||
-rw-r--r-- | board/freescale/imx8ulp_evk/imx8ulp_evk.c | 32 |
2 files changed, 32 insertions, 2 deletions
diff --git a/arch/arm/include/asm/arch-imx8ulp/imx8ulp-pins.h b/arch/arm/include/asm/arch-imx8ulp/imx8ulp-pins.h index 3638f0db531..cdea5d6f3c2 100644 --- a/arch/arm/include/asm/arch-imx8ulp/imx8ulp-pins.h +++ b/arch/arm/include/asm/arch-imx8ulp/imx8ulp-pins.h @@ -73,6 +73,6 @@ enum { IMX8ULP_PAD_PTF5__SDHC1_D2 = IOMUX_PAD(0x0114, 0x0114, 0x8, 0x0A6C, 0x2, 0), IMX8ULP_PAD_PTF0__SDHC1_D1 = IOMUX_PAD(0x0100, 0x0100, 0x8, 0x0A68, 0x2, 0), IMX8ULP_PAD_PTF1__SDHC1_D0 = IOMUX_PAD(0x0104, 0x0104, 0x8, 0x0A64, 0x2, 0), - + IMX8ULP_PAD_PTF7__PTF7 = IOMUX_PAD(0x011C, 0x011C, 0x1, 0x0000, 0x0, 0), }; #endif /* __ASM_ARCH_IMX8ULP_PINS_H__ */ diff --git a/board/freescale/imx8ulp_evk/imx8ulp_evk.c b/board/freescale/imx8ulp_evk/imx8ulp_evk.c index 3b0c57e497c..3a6bd1da5a0 100644 --- a/board/freescale/imx8ulp_evk/imx8ulp_evk.c +++ b/board/freescale/imx8ulp_evk/imx8ulp_evk.c @@ -210,9 +210,39 @@ int board_late_init(void) #ifdef CONFIG_FSL_FASTBOOT #ifdef CONFIG_ANDROID_RECOVERY +static iomux_cfg_t const recovery_pad[] = { + IMX8ULP_PAD_PTF7__PTF7 | MUX_PAD_CTRL(PAD_CTL_IBE_ENABLE), +}; int is_recovery_key_pressing(void) { - return 0; /*TODO*/ + int ret; + struct gpio_desc desc; + + imx8ulp_iomux_setup_multiple_pads(recovery_pad, ARRAY_SIZE(recovery_pad)); + + ret = dm_gpio_lookup_name("GPIO3_7", &desc); + if (ret) { + printf("%s lookup GPIO3_7 failed ret = %d\n", __func__, ret); + return 0; + } + + ret = dm_gpio_request(&desc, "recovery"); + if (ret) { + printf("%s request recovery pad failed ret = %d\n", __func__, ret); + return 0; + } + + dm_gpio_set_dir_flags(&desc, GPIOD_IS_IN); + + ret = dm_gpio_get_value(&desc); + if (ret < 0) { + printf("%s error in retrieving GPIO value ret = %d\n", __func__, ret); + return 0; + } + + dm_gpio_free(desc.dev, &desc); + + return !ret; } #endif /*CONFIG_ANDROID_RECOVERY*/ #endif /*CONFIG_FSL_FASTBOOT*/ |