* [PATCH] stm32mp1: add pull-up for gpio button PA13 and PA14
@ 2021-07-09 7:53 Patrick Delaunay
2021-07-09 12:38 ` Patrice CHOTARD
2021-07-27 9:10 ` Patrick DELAUNAY
0 siblings, 2 replies; 3+ messages in thread
From: Patrick Delaunay @ 2021-07-09 7:53 UTC (permalink / raw)
To: u-boot; +Cc: Patrick Delaunay, Patrice Chotard, U-Boot STM32
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 <patrick.delaunay@foss.st.com>
---
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 4 ++--
arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 4 ++--
board/st/stm32mp1/stm32mp1.c | 2 ++
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
index 6787619290..d44da7566f 100644
--- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
@@ -18,8 +18,8 @@
u-boot,error-led = "error";
u-boot,mmc-env-partition = "ssbl";
st,adc_usb_pd = <&adc1 18>, <&adc1 19>;
- st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
- st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
+ st,fastboot-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ st,stm32prog-gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};
firmware {
diff --git a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
index f3002e995b..3b94218b2f 100644
--- a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
+++ b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
@@ -18,8 +18,8 @@
u-boot,boot-led = "heartbeat";
u-boot,error-led = "error";
u-boot,mmc-env-partition = "ssbl";
- st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
- st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
+ st,fastboot-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
+ st,stm32prog-gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};
firmware {
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 18b8870269..e1796e7e31 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;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] stm32mp1: add pull-up for gpio button PA13 and PA14
2021-07-09 7:53 [PATCH] stm32mp1: add pull-up for gpio button PA13 and PA14 Patrick Delaunay
@ 2021-07-09 12:38 ` Patrice CHOTARD
2021-07-27 9:10 ` Patrick DELAUNAY
1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2021-07-09 12:38 UTC (permalink / raw)
To: Patrick Delaunay, u-boot; +Cc: U-Boot STM32
Hi Patrick
On 7/9/21 9:53 AM, Patrick Delaunay wrote:
> 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 <patrick.delaunay@foss.st.com>
> ---
>
> arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 4 ++--
> arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 4 ++--
> board/st/stm32mp1/stm32mp1.c | 2 ++
> 3 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
> index 6787619290..d44da7566f 100644
> --- a/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
> +++ b/arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi
> @@ -18,8 +18,8 @@
> u-boot,error-led = "error";
> u-boot,mmc-env-partition = "ssbl";
> st,adc_usb_pd = <&adc1 18>, <&adc1 19>;
> - st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
> - st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
> + st,fastboot-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + st,stm32prog-gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> };
>
> firmware {
> diff --git a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
> index f3002e995b..3b94218b2f 100644
> --- a/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
> +++ b/arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi
> @@ -18,8 +18,8 @@
> u-boot,boot-led = "heartbeat";
> u-boot,error-led = "error";
> u-boot,mmc-env-partition = "ssbl";
> - st,fastboot-gpios = <&gpioa 13 GPIO_ACTIVE_LOW>;
> - st,stm32prog-gpios = <&gpioa 14 GPIO_ACTIVE_LOW>;
> + st,fastboot-gpios = <&gpioa 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> + st,stm32prog-gpios = <&gpioa 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
> };
>
> firmware {
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index 18b8870269..e1796e7e31 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;
>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] stm32mp1: add pull-up for gpio button PA13 and PA14
2021-07-09 7:53 [PATCH] stm32mp1: add pull-up for gpio button PA13 and PA14 Patrick Delaunay
2021-07-09 12:38 ` Patrice CHOTARD
@ 2021-07-27 9:10 ` Patrick DELAUNAY
1 sibling, 0 replies; 3+ messages in thread
From: Patrick DELAUNAY @ 2021-07-27 9:10 UTC (permalink / raw)
To: u-boot; +Cc: Patrice Chotard, U-Boot STM32
Hi,
On 7/9/21 9:53 AM, Patrick Delaunay wrote:
> 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 <patrick.delaunay@foss.st.com>
> ---
>
> arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 4 ++--
> arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 4 ++--
> board/st/stm32mp1/stm32mp1.c | 2 ++
> 3 files changed, 6 insertions(+), 4 deletions(-)
>
Applied to u-boot-stm/master, thanks!
Regards
Patrick
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-27 9:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 7:53 [PATCH] stm32mp1: add pull-up for gpio button PA13 and PA14 Patrick Delaunay
2021-07-09 12:38 ` Patrice CHOTARD
2021-07-27 9:10 ` Patrick DELAUNAY
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.