From 2a7034c77d628627c9462e27865e2d9258aeadd0 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 9 Jul 2021 09:53:37 +0200 Subject: stm32mp1: add pull-up for gpio button PA13 and PA14 When a push-button is released and PA13/PA14 are defined as input (high-Z) the LED should not be active as the circuit is open but a small current leak through PCB or push-button close the circuit and allows a small LED bias giving erroneous level voltage. So it is recommended to activate an internal pull-up in order to clearly fix the voltage at PA13/PA14 when button is released and to wait a short delay before to read the GPIO value only when the pull-up is correctly configured. Signed-off-by: Patrick Delaunay Reviewed-by: Patrice Chotard --- board/st/stm32mp1/stm32mp1.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'board/st/stm32mp1/stm32mp1.c') diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 2faf5c81b45..59fb6e548c0 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -155,6 +155,7 @@ static void board_key_check(void) &gpio, GPIOD_IS_IN)) { log_debug("could not find a /config/st,fastboot-gpios\n"); } else { + udelay(20); if (dm_gpio_get_value(&gpio)) { log_notice("Fastboot key pressed, "); boot_mode = BOOT_FASTBOOT; @@ -168,6 +169,7 @@ static void board_key_check(void) &gpio, GPIOD_IS_IN)) { log_debug("could not find a /config/st,stm32prog-gpios\n"); } else { + udelay(20); if (dm_gpio_get_value(&gpio)) { log_notice("STM32Programmer key pressed, "); boot_mode = BOOT_STM32PROG; -- cgit v1.2.3