Add a rk3568 specific barebox entry function to simplify board code. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- arch/arm/mach-rockchip/atf.c | 22 ++++++++++++++++++++++ include/mach/rockchip/atf.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/arch/arm/mach-rockchip/atf.c b/arch/arm/mach-rockchip/atf.c index 93025faf68..a7d626226e 100644 --- a/arch/arm/mach-rockchip/atf.c +++ b/arch/arm/mach-rockchip/atf.c @@ -5,6 +5,9 @@ #include <mach/rockchip/atf.h> #include <elf.h> #include <asm/atf_common.h> +#include <asm/barebox-arm.h> +#include <mach/rockchip/dmc.h> +#include <mach/rockchip/rockchip.h> static unsigned long load_elf64_image_phdr(const void *elf) { @@ -69,3 +72,22 @@ void rk3568_atf_load_bl31(void *fdt) { rockchip_atf_load_bl31(RK3568, rk3568_bl31_bin, rk3568_op_tee_bin, fdt); } + +void __noreturn rk3568_barebox_entry(void *fdt) +{ + unsigned long membase, memsize; + + membase = RK3568_DRAM_BOTTOM; + memsize = rk3568_ram0_size() - RK3568_DRAM_BOTTOM; + + if (current_el() == 3) { + relocate_to_adr_full(RK3568_BAREBOX_LOAD_ADDRESS); + setup_c(); + + rk3568_lowlevel_init(); + rk3568_atf_load_bl31(fdt); + /* not reached when CONFIG_ARCH_ROCKCHIP_ATF */ + } + + barebox_arm_entry(membase, memsize, fdt); +} diff --git a/include/mach/rockchip/atf.h b/include/mach/rockchip/atf.h index e5d55af3d7..e1e68825d1 100644 --- a/include/mach/rockchip/atf.h +++ b/include/mach/rockchip/atf.h @@ -28,4 +28,6 @@ static inline void rk3568_atf_load_bl31(void *fdt) { } #endif #endif +void __noreturn rk3568_barebox_entry(void *fdt); + #endif /* __MACH_ATF_H */ -- 2.30.2