diff options
author | Ahmad Fatoum <ahmad@a3f.at> | 2022-12-25 22:20:04 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-04-05 08:49:07 +0200 |
commit | 4a6f536e4248e2bdc853250e7b9cbd1badb7cfe6 (patch) | |
tree | a3313dc689fe0a727612e60c5714b8956060911b /arch/arm/mach-rockchip/rk3568.c | |
parent | 4a26017f6dd70c6b0c0fd11d527291058c85cea5 (diff) | |
download | barebox-4a6f536e4248e2bdc853250e7b9cbd1badb7cfe6.tar.gz |
ARM: Rockchip: make bootsource logic generic to all SoCs
Decoding of the bootsource from the register value can be shared across
multiple Rockchip SoCs. Move the code to a common place to allow for
that.
At least with some TF-A versions the IRAM where the bootsource is stored
cannot not be accessed in normal mode, so read it out before we start
the TF-A. For this the scratch space is used.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-rockchip/rk3568.c')
-rw-r--r-- | arch/arm/mach-rockchip/rk3568.c | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/arch/arm/mach-rockchip/rk3568.c b/arch/arm/mach-rockchip/rk3568.c index 39bd4772a6..c0453ea0c4 100644 --- a/arch/arm/mach-rockchip/rk3568.c +++ b/arch/arm/mach-rockchip/rk3568.c @@ -2,6 +2,7 @@ #include <common.h> #include <io.h> #include <bootsource.h> +#include <mach/rockchip/bootrom.h> #include <mach/rockchip/rk3568-regs.h> #include <mach/rockchip/rockchip.h> @@ -137,35 +138,9 @@ void rk3568_lowlevel_init(void) qos_priority_init(); } -struct rk_bootsource { - enum bootsource src; - int instance; -}; - -static struct rk_bootsource bootdev_map[] = { - [0x1] = { .src = BOOTSOURCE_NAND, .instance = 0 }, - [0x2] = { .src = BOOTSOURCE_MMC, .instance = 0 }, - [0x3] = { .src = BOOTSOURCE_SPI_NOR, .instance = 0 }, - [0x4] = { .src = BOOTSOURCE_SPI_NAND, .instance = 0 }, - [0x5] = { .src = BOOTSOURCE_MMC, .instance = 1 }, - [0xa] = { .src = BOOTSOURCE_USB, .instance = 0 }, -}; - -static void rk3568_bootsource(void) -{ - u32 v; - - v = readl(RK3568_IRAM_BASE + 0x10); - - if (v >= ARRAY_SIZE(bootdev_map)) - return; - - bootsource_set(bootdev_map[v].src, bootdev_map[v].instance); -} - int rk3568_init(void) { - rk3568_bootsource(); + rockchip_parse_bootrom_iram(rockchip_scratch_space()); return 0; } |