[PATCH v2 4/6] mach-snapdragon: Integrate reboot-mode handling
Simon Glass
sjg at chromium.org
Wed May 27 06:39:08 CEST 2026
Hi Aswin,
On 2026-02-13T11:27:11, Aswin Murugan <aswin.murugan at oss.qualcomm.com> wrote:
> mach-snapdragon: Integrate reboot-mode handling
>
> Add reboot-mode detection and automatic fastboot entry to Qualcomm board
> initialization. This enables 'reboot bootloader' functionality on
> platforms with reboot-mode device tree configuration.
>
> Changes:
> - Add qcom_handle_reboot_mode() call in board_late_init()
> - Conditionally compile with CONFIG_DM_REBOOT_MODE
> - Reorganize header includes
>
> Signed-off-by: Aswin Murugan <aswin.murugan at oss.qualcomm.com>
>
> arch/arm/mach-snapdragon/board.c | 56 ++++++++++++++++++++++++++++++++--------
> 1 file changed, 45 insertions(+), 11 deletions(-)
> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> @@ -9,6 +9,15 @@
> #define LOG_CATEGORY LOGC_BOARD
> #define pr_fmt(fmt) "QCOM: " fmt
>
> +#include <command.h>
> +#include <env.h>
> +#include <fdt_support.h>
> +#include <init.h>
> +#include <lmb.h>
> +#include <malloc.h>
> +#include <sort.h>
> +#include <time.h>
> +#include <usb.h>
> #include <asm/armv8/mmu.h>
> #include <asm/gpio.h>
> #include <asm/io.h>
> @@ -16,22 +25,14 @@
> #include <asm/system.h>
> #include <dm/device.h>
> #include <dm/pinctrl.h>
> -#include <dm/uclass-internal.h>
> #include <dm/read.h>
> -#include <power/regulator.h>
> -#include <env.h>
> -#include <fdt_support.h>
> -#include <init.h>
> +#include <dm/uclass-internal.h>
Please split this header reorganisation into its own preparatory
patch - mixing cleanup with the functional change makes both harder
to review and bisect. The new headers actually required here are just
<command.h> and <reboot-mode/reboot-mode.h>; the rest is pre-existing
churn.
> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> @@ -506,6 +507,33 @@ void qcom_show_boot_source(void)
> + reboot_mode = env_get('reboot-mode');
> + if (reboot_mode && !strcmp(reboot_mode, 'bootloader')) {
> + printf("Entering fastboot mode due to reboot reason...\n");
> + run_command("run fastboot", 0);
> + }
> +}
The env-variable name 'reboot-mode' is the default but is overridable
via the 'u-boot,env-variable' DT property in
dm_reboot_mode_pre_probe(). Reading it back from a hard-coded name
defeats that. Consider reading it via
dev_get_uclass_plat(reboot_dev)->env_variable instead.
> diff --git a/arch/arm/mach-snapdragon/board.c b/arch/arm/mach-snapdragon/board.c
> @@ -575,6 +603,12 @@ int board_late_init(void)
> qcom_late_init();
>
> qcom_show_boot_source();
> +
> + /* Handle reboot-mode detection and fastboot entry */
> +#if IS_ENABLED(CONFIG_DM_REBOOT_MODE)
> + qcom_handle_reboot_mode();
> +#endif
> +
Please use if (IS_ENABLED(CONFIG_DM_REBOOT_MODE)) here rather than a
preprocessor #if
You'll need a stub for qcom_handle_reboot_mode() in the
!CONFIG_DM_REBOOT_MODE case, or guard the body of the function itself
so the call site stays unconditional.
With these:
Reviewed-by: Simon Glass <sjg at chromium.org>
Regards,
Simon
More information about the U-Boot
mailing list