]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
rockchip: spl: Add a read_brom_bootsource_id() helper
authorJonas Karlman <jonas@kwiboo.se>
Sun, 19 Oct 2025 15:47:16 +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 and RK3576 for e.g.
SPI NOR and USB differs slightly compared to prior SoCs:

- Booting from sfc0 (ROCK 4D) report the normal bootsource id 0x3.
- Booting from sfc1 M1 (NanoPi M5) report a new bootsource id 0x23.
- Booting from sfc1 M0 has not been tested (no board using this config).
- Booting from USB report a new bootsource id 0x81 on RK3528 and RK3576.

Add a helper function to read the bootsource id. This helper function
will be used to translate the new values to the common BROM_BOOTSOURCE
enum values on RK3528 and RK3576.

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

index e736772fda755a5b8f96d6605a0bb989fb95e697..b15938c021d6c857550f320751d59d539ad7b975 100644 (file)
@@ -64,4 +64,6 @@ extern const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1];
  */
 #define BROM_BOOTSOURCE_ID_ADDR   (CFG_IRAM_BASE + 0x10)
 
+u32 read_brom_bootsource_id(void);
+
 #endif
index f4d29bbdd17e8b57dc0b2fdd90a8600fba6ee866..1ce3a3b0554709549d3df7396a61df032f8c1d41 100644 (file)
@@ -31,6 +31,11 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
 __weak const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
 };
 
+__weak u32 read_brom_bootsource_id(void)
+{
+       return readl(BROM_BOOTSOURCE_ID_ADDR);
+}
+
 const char *board_spl_was_booted_from(void)
 {
        static u32 brom_bootsource_id_cache = BROM_BOOTSOURCE_UNKNOWN;
@@ -40,7 +45,7 @@ const char *board_spl_was_booted_from(void)
        if (brom_bootsource_id_cache != BROM_BOOTSOURCE_UNKNOWN)
                bootdevice_brom_id = brom_bootsource_id_cache;
        else
-               bootdevice_brom_id = readl(BROM_BOOTSOURCE_ID_ADDR);
+               bootdevice_brom_id = read_brom_bootsource_id();
 
        if (bootdevice_brom_id < ARRAY_SIZE(boot_devices))
                bootdevice_ofpath = boot_devices[bootdevice_brom_id];