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

刘垣辰 <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
Hi Jonas,

I am not suggesting that this feature should be added to the mainline simply because Rockchip's U-Boot includes it.

Even if the firmware is loaded after verification (via hash comparison), that only confirms it hasn't suffered accidental corruption; if the firmware itself is flawed—such as issues arising during ATF/OP-TEE development— the boot process might stall before reaching U-Boot, and it also unable to trigger an automatic reset (even though the SPL successfully loaded the payload). Therefore, the SPL hotkey function is not intended to handle SPL firmware loading failures; rather, it provides a way to enter modes like MaskROM without relying on physical buttons. It is an optional feature.

As for watchdog-based status monitoring and automatic resetting, I haven't delved deeply into the watchdog mechanism, but I think this would be a separate, independent feature.

Additionally, we should consider adding SPL support for Loader mode and Fastboot mode in the future.

Best regards,
Valentin Liu 

> 
> 在 2026年8月21日,凌晨1:46,Jonas Karlman <[email protected]> 写道:
> 
> On 8/20/2026 6:52 PM, 刘垣辰 wrote:
>> Hi Jonas,
>> 
>> I really consider your idea before writing this patch, however, this patch is a standalone function. The Rockchip U-Boot branch has the same function
> 
> Vendor U-Boot having a feature is not always a good reason for including
> it in mainline.
> 
>> 
>> If you want to use "reset" command to reboot into MaskROM or any other mode, you must be able to enter the U-Boot (not SPL) or higher level OS. But sometime, we will unable to enter them (Like booting failure on out our control of firmware), we just need to rely on the physical buttons to hard (or cold) reset device. But if we haven't the physical button, there will be harder.
> 
> In case SPL fails to load the payload we could implement some kind of
> hang() fallback to BROM [1].
> 
> We probably would want to use a watchdog to truly recover from the event
> that next stage crashes/fails/hangs. Possible something like write value
> to boot-mode, start watchdog, try to load payload, re-arm watchdog in
> U-Boot proper and clear out boot-mode.
> 
> Btw, there is nothing that acts on BOOT_LOADER and BOOT_FASTMODE is only
> handled in U-Boot proper, so those are not really useful in SPL.
> 
> Some SoCs also clears out the boot-mode reg during reset, see [1].
> 
> [1] https://patch.msgid.link/[email protected]/
> 
>> 
>> Absolutely, we also can't rely the fallback of firmwares, so the SPL hotkey can control what mode we want to enter in SPL stage.
> 
> Are you having issues with U-Boot proper crashing, or SPL fails to load
> the payload, or it becoming corrupt or similar? What issues are you
> facing that prompts the need for this SPL hotkey feature?
> 
> Normal boot path for Rockchip is to use a FIT and let SPL checksum
> validate any payload before it gets executed. So as long as working
> firmware is loaded reaching U-Boot proper is typically not an issue.
> And SPL can typically fallback to load payload from a different boot
> media, so recovery into a working U-Boot proper it typically easy.
> 
> At least those fallback options is something I validate for each SoC
> and/or board that I contribute on.
> 
> Regards,
> Jonas
> 
>> 
>> I also like the unified "reset," but that is unrelated to the functionality provided by this patch.
>> 
>> Best regards,
>> Valentin Liu
>> 
>>> 2026年8月21日上午12:36,Jonas Karlman <[email protected]> 写道:
>>> 
>>> 
>>> Hi Valentin,
>>> 
>>>> On 8/20/2026 6:27 PM, 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 MaskROM mode and be widely used.
>>>>> Ctrl+D can be used to enter Loader mode, Ctrl+F for Fastboot mode.
>>>>> We can add more boot mode support in future.
>>> 
>>> Why the need to have special hotkey handling in SPL?
>>> 
>>> I would rather see that we extend TPL/SPL/proper with support for
>>> reading any 'syscon-reboot-mode' reg and act according to that.
>>> 
>>> Also think there is a series on list to extend the reset command to
>>> accept a reboot-mode.
>>> 
>>> That way we would be able to reboot from OS or U-Boot proper into
>>> maskrom (or any other) mode, instead of trying to implement platform
>>> specific hotkey handling.
>>> 
>>> Regards,
>>> Jonas
>>> 
>>>> 
>>>> 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]>
>>>> ---
>>>> Changes for v2:
>>>> - Simplify the dependencies of SPL_ROCKCHIP_HOTKEY.
>>>> - Remove the conditions for the newly added includes.
>>>> ---
>>>> Changes for v3:
>>>> - Add a dummy spl_hotkey_init() to avoid undefined reference errors
>>>> when building without CONFIG_SPL_ROCKCHIP_HOTKEY.
>>>> ---
>>>> Changes for v4:
>>>> - Add condition of CONFIG_ROCKCHIP_BOOT_MODE_REG != 0 to prevent
>>>> SPL hotkey be compiled and used on unsupported platforms.
>>>> - Add more hotkey support (Ctrl+D and Ctrl+F).
>>>> - Remove prints on the standard path.
>>>> - Add some code comment.
>>>> 
>>>> arch/arm/mach-rockchip/Kconfig | 14 +++++++++
>>>> arch/arm/mach-rockchip/spl.c | 54 ++++++++++++++++++++++++++++++++++
>>>> 2 files changed, 68 insertions(+)
>>> 
>>> [snip]
>> 
>> 
>
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.