diff mbox series

[2/3] board: dragonboard410c: Fix fastboot

Message ID 20210714085626.5961-3-stephan@gerhold.net
State Accepted
Commit ccb8de2387c66b61bb8b974dea9018a8ab63d847
Delegated to: Tom Rini
Headers show
Series board: dragonboard410c: Fix some minor issues | expand

Commit Message

Stephan Gerhold July 14, 2021, 8:56 a.m. UTC
At the moment pressing the volume down key does not actually launch
fastboot. This is because setting "bootdelay" to "-1" actually
disables autoboot and drops to the U-Boot console. It does not execute
the "bootcmd".

The correct value for "bootdelay" here would be "-2", which disables
the delay and key checking and would immediately execute the "bootcmd".

However, even better in this case is using "preboot" to trigger Fastboot.
The advantage is that running "fastboot continue" will actually continue
the autoboot process instead of ending up in the U-Boot shell.

Also make sure to unset "preboot" again immediately in case the user
saves the environment after triggering fastboot.

Cc: Ramon Fried <rfried.dev@gmail.com>
Fixes: aa043ee91a47 ("db410c: automatically launch fastboot")
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---

 board/qualcomm/dragonboard410c/dragonboard410c.c | 3 +--
 configs/dragonboard410c_defconfig                | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Ramon Fried July 14, 2021, 8:36 p.m. UTC | #1
On Wed, Jul 14, 2021 at 11:56 AM Stephan Gerhold <stephan@gerhold.net> wrote:
>
> At the moment pressing the volume down key does not actually launch
> fastboot. This is because setting "bootdelay" to "-1" actually
> disables autoboot and drops to the U-Boot console. It does not execute
> the "bootcmd".
>
> The correct value for "bootdelay" here would be "-2", which disables
> the delay and key checking and would immediately execute the "bootcmd".
>
> However, even better in this case is using "preboot" to trigger Fastboot.
> The advantage is that running "fastboot continue" will actually continue
> the autoboot process instead of ending up in the U-Boot shell.
>
> Also make sure to unset "preboot" again immediately in case the user
> saves the environment after triggering fastboot.
>
> Cc: Ramon Fried <rfried.dev@gmail.com>
> Fixes: aa043ee91a47 ("db410c: automatically launch fastboot")
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>
>  board/qualcomm/dragonboard410c/dragonboard410c.c | 3 +--
>  configs/dragonboard410c_defconfig                | 1 +
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
> index 3b71881cac..371b3262f8 100644
> --- a/board/qualcomm/dragonboard410c/dragonboard410c.c
> +++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
> @@ -132,8 +132,7 @@ int misc_init_r(void)
>         }
>
>         if (dm_gpio_get_value(&resin)) {
> -               env_set("bootdelay", "-1");
> -               env_set("bootcmd", "fastboot 0");
> +               env_set("preboot", "setenv preboot; fastboot 0");
>                 printf("key_vol_down pressed - Starting fastboot.\n");
>         }
>
> diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig
> index dc9d0d893c..a46283f980 100644
> --- a/configs/dragonboard410c_defconfig
> +++ b/configs/dragonboard410c_defconfig
> @@ -10,6 +10,7 @@ CONFIG_DISTRO_DEFAULTS=y
>  # CONFIG_ANDROID_BOOT_IMAGE is not set
>  CONFIG_FIT=y
>  CONFIG_OF_BOARD_SETUP=y
> +CONFIG_USE_PREBOOT=y
>  # CONFIG_DISPLAY_CPUINFO is not set
>  # CONFIG_DISPLAY_BOARDINFO is not set
>  CONFIG_MISC_INIT_R=y
> --
> 2.32.0
>
I also noticed that a few days ago, it's strange because it used to
work, maybe something changed since I introduced the fastboot support.
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
Tom Rini July 24, 2021, 8:40 p.m. UTC | #2
On Wed, Jul 14, 2021 at 10:56:25AM +0200, Stephan Gerhold wrote:

> At the moment pressing the volume down key does not actually launch
> fastboot. This is because setting "bootdelay" to "-1" actually
> disables autoboot and drops to the U-Boot console. It does not execute
> the "bootcmd".
> 
> The correct value for "bootdelay" here would be "-2", which disables
> the delay and key checking and would immediately execute the "bootcmd".
> 
> However, even better in this case is using "preboot" to trigger Fastboot.
> The advantage is that running "fastboot continue" will actually continue
> the autoboot process instead of ending up in the U-Boot shell.
> 
> Also make sure to unset "preboot" again immediately in case the user
> saves the environment after triggering fastboot.
> 
> Cc: Ramon Fried <rfried.dev@gmail.com>
> Fixes: aa043ee91a47 ("db410c: automatically launch fastboot")
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 3b71881cac..371b3262f8 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -132,8 +132,7 @@  int misc_init_r(void)
 	}
 
 	if (dm_gpio_get_value(&resin)) {
-		env_set("bootdelay", "-1");
-		env_set("bootcmd", "fastboot 0");
+		env_set("preboot", "setenv preboot; fastboot 0");
 		printf("key_vol_down pressed - Starting fastboot.\n");
 	}
 
diff --git a/configs/dragonboard410c_defconfig b/configs/dragonboard410c_defconfig
index dc9d0d893c..a46283f980 100644
--- a/configs/dragonboard410c_defconfig
+++ b/configs/dragonboard410c_defconfig
@@ -10,6 +10,7 @@  CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_ANDROID_BOOT_IMAGE is not set
 CONFIG_FIT=y
 CONFIG_OF_BOARD_SETUP=y
+CONFIG_USE_PREBOOT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_MISC_INIT_R=y