rockchip: rk3528: Implement read_brom_bootsource_id()
authorJonas Karlman <jonas@kwiboo.se>
Sun, 19 Oct 2025 15:47:17 +0000 (15:47 +0000)
committerTom Rini <trini@konsulko.com>
Sun, 2 Nov 2025 18:14:09 +0000 (12:14 -0600)
The bootsource ids reported by BootROM of RK3528 for e.g. USB differs
compared to prior SoCs:

- Booting from USB report a new bootsource id 0x81.

Add a RK3528 specific read_brom_bootsource_id() function to help decode
this new bootsource id value to help support booting from USB on RK3528.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/mach-rockchip/rk3528/rk3528.c

index f9bfc44..57ead00 100644 (file)
@@ -49,6 +49,21 @@ void board_debug_uart_init(void)
 {
 }
 
+u32 read_brom_bootsource_id(void)
+{
+       u32 bootsource_id = readl(BROM_BOOTSOURCE_ID_ADDR);
+
+       /* Re-map the raw value read from reg to an existing BROM_BOOTSOURCE
+        * enum value to avoid having to create a larger boot_devices table.
+        */
+       if (bootsource_id == 0x81)
+               return BROM_BOOTSOURCE_USB;
+       else if (bootsource_id > BROM_LAST_BOOTSOURCE)
+               log_debug("Unknown bootsource %x\n", bootsource_id);
+
+       return bootsource_id;
+}
+
 int arch_cpu_init(void)
 {
        u32 val;