[PATCH] rockchip: boot_mode: fix download key detection
Jonas Karlman
jonas at kwiboo.se
Wed Jun 10 15:25:51 CEST 2026
Hi Tianling,
On 6/10/2026 5:01 AM, Tianling Shen wrote:
> rockchip_dnl_key_pressed() looks for the ADC device by checking
> whether the device name starts with "saradc".
>
> On RK3328, RK3576, RK3588 etc., the SARADC node is named "adc at ...",
> so the device name no longer has the "saradc" prefix. As a result,
> U-Boot fails to find the SARADC device and does not sample the
> download key state.
>
> Do not rely on the DT node name. Match the bound Rockchip SARADC
> driver instead, which works for both "saradc at ..." and "adc at ..."
> node names.
>
> Signed-off-by: Tianling Shen <cnsztl at gmail.com>
> ---
> arch/arm/mach-rockchip/boot_mode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c
> index 55e9456668ae..363fad523cbd 100644
> --- a/arch/arm/mach-rockchip/boot_mode.c
> +++ b/arch/arm/mach-rockchip/boot_mode.c
> @@ -51,7 +51,7 @@ __weak int rockchip_dnl_key_pressed(void)
>
> ret = -ENODEV;
> uclass_foreach_dev(dev, uc) {
> - if (!strncmp(dev->name, "saradc", 6)) {
> + if (!strcmp(dev->driver->name, "rockchip_saradc")) {
The adc channel used below may not fit all boards/SoCs, so this change
may have unintended consequences.
I have previously avoided "fixing"/enable this code path for RK35xx
because the download key selection should really be improved when this
is fixed/expanded to more boards/SoCs.
E.g. maybe add support to declare a recovery button in u-boot,config
node and use UCLASS_BUTTON to check if such button was pressed or
something similar?
Regards,
Jonas
> ret = adc_channel_single_shot(dev->name, 1, &val);
> break;
> }
More information about the U-Boot
mailing list