Re: [PATCH] arm: rockchip: spl: Add hotkey detection support.

Tom Rini <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <20260815175902.GN3297518@bill-the-cat>
On Sun, Aug 16, 2026 at 01:08:44AM +0800, Valentin Liu wrote:
> Add a configurable Rockchip SPL hotkey feature that checks the
> serial console during SPL startup.
> 
> Ctrl+B can be used to enter BootROM download (MASKROM) mode and
> be widely used. We can add more boot mode support in future.
> 
> Add CONFIG_SPL_ROCKCHIP_HOTKEY to enable the feature and wait for
> the serial port to be ready to receive input before checking for
> hotkeys.
> 
> Signed-off-by: Valentin Liu <[email protected]>
> ---
>  arch/arm/mach-rockchip/Kconfig | 15 ++++++++++++
>  arch/arm/mach-rockchip/spl.c    | 42 ++++++++++++++++++++++++++++++++++
>  2 files changed, 57 insertions(+)
> 
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index 1a2e7847c9e..a5de483bbb9 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -743,6 +743,21 @@ config TPL_ROCKCHIP_EARLYRETURN_TO_BROM
>  config SPL_MMC
>  	default y if !SPL_ROCKCHIP_BACK_TO_BROM
>  
> +config SPL_ROCKCHIP_HOTKEY
> +	bool "SPL hotkey support"
> +	depends on SPL
> +	depends on SPL_DM_RESET
> +	depends on SPL_SERIAL

This can just be:
	depends on SPL_DM_RESET && SPL_SERIAL

[snip]
> diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
> index e989c148079..46140e5af3c 100644
> --- a/arch/arm/mach-rockchip/spl.c
> +++ b/arch/arm/mach-rockchip/spl.c
> @@ -19,6 +19,11 @@
>  #include <asm/global_data.h>
>  #include <asm/io.h>
>  #include <linux/bitops.h>
> +#if IS_ENABLED(CONFIG_SPL_ROCKCHIP_HOTKEY)
> +#include <serial.h>
> +#include <asm/arch-rockchip/boot_mode.h>
> +#include <linux/delay.h>
> +#endif

Guarding includes like this isn't a good practice and should be avoided
unless strictly needed.

-- 
Tom
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQTzzqh0PWDgGS+bTHor4qD1Cr/kCgUCaoCo2gAKCRAr4qD1Cr/k
Cg2FAPoCGjUu9ld+kfVJHfu/jMBxYQWMlxdGaNYsmH92uq6PjQEAnnhyJrHOybCl
YH0AbD1n3Hu+1zXylfCz+KvGysjuEQ4=
=phr7
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.