arm-trusted-firmware support for rk3288
Subsystems (3)
Heiko Stuebner
maintainercover arm-trusted-firmware support for rk3288
This adds support for jumping into aarch32 ATF from u-boot spl similar to how it works on aarch64.
I guess the biggest question might be "why" ;-)
Right now the status quo on Rockchip arm32 socs is, that the linux kernel itself does smp and suspend handling. This precludes us from doing fance things like virtualization but also deep suspend with the DDR in self refresh, due to at least 2 approaches for putting generalized code into sram from the kernel side failed so far.
For Virtualization we need the kernel to start in hyp mode and hence needing to use psci for smp handling as well.
So there are multiple ways for achieving that, we could do
- psci in uboot itself is bad for coreboot and barebox who would need to reimplement the same
- psci in optee is the solution Rockchip themself choose but only provides precompiled binaries for their arm32 socs and also reimplmenting this in an open way is somewhat of a dead-end because while aarch64 can use op-tee, psci itself is always done in the atf
- atf using the somewhat new aarch32 port has the advantage of being able to share a lot of platform code making maintenance together with the aarch64 parts a lot easier
Not having to rely on binary components as part of the boot process is way nicer not only for reproducible builds but also for future proofing projects as binary blobs may not receive updates after some time.
Also it is still possible to use this together with an optee implementation for specific security foobar. The only difference is that while aarch64 can has separate states for secure monitor and secure-os, in aarch32 both need to share the bl32 space, so optee needs to be a payload during the atf build. If no secure-os is needed, atf can use the sp_min payload, which is part of atf.
This works nicely on my rk3288 evb and even virtualization worked already. Full support will still need a modified devicetree to actually make use of the new psci capabilites.
Heiko Stuebner (8):
arm: v7: add read_mpidr function for arm32
spl: atf: add arm32 variant
rockchip: rk3288: move TPL options to generic position
rockchip: rk3288: adjust load addresses
rockchip: rk3288: reserve first 2MB when build with ATF support
rockchip: rk3288: split evb into its two entities
rockchip: rk3288: convert rk3288-evb to use tpl
rockchip: rk3288: make both evb variants use atf
arch/arm/dts/Makefile | 3 +-
...evb.dts => rk3288-evb-act8846-u-boot.dtsi} | 33 +-
arch/arm/dts/rk3288-evb-act8846.dts | 188 +++++++
arch/arm/dts/rk3288-evb-rk808-u-boot.dtsi | 40 ++
arch/arm/dts/rk3288-evb-rk808.dts | 202 +++++++
arch/arm/dts/rk3288-evb.dtsi | 493 ++++++++----------
arch/arm/include/asm/system.h | 9 +
arch/arm/mach-rockchip/Kconfig | 16 +
arch/arm/mach-rockchip/rk3288/Kconfig | 16 +-
arch/arm/mach-rockchip/rk3288/rk3288.c | 16 +
board/rockchip/evb_rk3288/evb-rk3288.c | 14 +
board/rockchip/evb_rk3288/fit_spl_atf.its | 52 ++
common/spl/Kconfig | 2 +-
common/spl/spl_atf.c | 86 ++-
...defconfig => evb-rk3288-act8846_defconfig} | 14 +-
configs/evb-rk3288-rk808_defconfig | 91 ++++
include/atf_common.h | 52 ++
include/configs/rk3288_common.h | 8 +-
18 files changed, 998 insertions(+), 337 deletions(-)
rename arch/arm/dts/{rk3288-evb.dts => rk3288-evb-act8846-u-boot.dtsi} (64%)
create mode 100644 arch/arm/dts/rk3288-evb-act8846.dts
create mode 100644 arch/arm/dts/rk3288-evb-rk808-u-boot.dtsi
create mode 100644 arch/arm/dts/rk3288-evb-rk808.dts
create mode 100644 board/rockchip/evb_rk3288/fit_spl_atf.its
rename configs/{evb-rk3288_defconfig => evb-rk3288-act8846_defconfig} (87%)
create mode 100644 configs/evb-rk3288-rk808_defconfigSignature · 1 line
2.20.1
Heiko Stuebner
maintainerPATCH 1/8 arm: v7: add read_mpidr function for arm32
Function to get the contents of the mpidr register, similar to its arm64 counterpart.
--- arch/arm/include/asm/system.h | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/include/asm/system.h +9 -0
@@ -364,6 +364,15 @@ static inline int is_hyp(void)#endif } +static inline unsigned long read_mpidr (void ) +{ +unsigned long val; + + asmvolatile ("mrc p15, 0, %0, c0, c0, 5" :"=r" (val)); + +return val; +} +static inline unsigned int get_cr (void ) {unsigned int val;
Signature · 1 line
2.20.1
PATCH 1/8 arm: v7: add read_mpidr function for arm32
Quoted 4 lines · Heiko Stuebner
Function to get the contents of the mpidr register, similar to its arm64 counterpart.
Signed-off-by Heiko Stuebner <[email protected]>
Quoted 25 lines
--- arch/arm/include/asm/system.h | 9 +++++++++ 1 file changed, 9 insertions(+)arch/arm/include/asm/system.h +9
-0@@ -364,6 +364,15 @@ static inline int is_hyp(void)#endif } +static inline unsigned long read_mpidr (void ) +{ +unsigned long val; + + asmvolatile ("mrc p15, 0, %0, c0, c0, 5" :"=r" (val)); + +return val; +} +static inline unsigned int get_cr (void ) {unsigned int val;
Heiko Stuebner
maintainerPATCH 2/8 spl: atf: add arm32 variant
In reply to Heiko StuebnerATF can also support arm32 socs with being a bl32 payload either including optee or the minimal sp_min payload included in ATF itself.
So add the necessary infrasturcture to jump into ATF as bl32 from spl which then will jump into the real u-boot.
We keep using the arm64 datastructures because, while they are named bl31_*, the only difference is not populating the bl31-related fields and making the bl32 ones mandatory, so there really is no need to redefine all of them simply to drop the empty bl31 parts.
--- common/spl/Kconfig | 2 +- common/spl/spl_atf.c | 86 ++++++++++++++++++++++++++++++++++++++++++-- include/atf_common.h | 52 +++++++++++++++++++++++++++ 3 files changed, 137 insertions(+), 3 deletions(-)
common/spl/Kconfig +1 -1
@@ -886,7 +886,7 @@ config SPL_YMODEM_SUPPORT config SPL_ATF bool "Support ARM Trusted Firmware" - depends on ARM64 + depends on ARM || ARM64 help ATF(ARM Trusted Firmware) is a component for ARM AArch64 which is loaded by SPL (which is considered as BL2 in ATF terminology).
common/spl/spl_atf.c +84 -2
109 lines not on this page · raw message
include/atf_common.h +52 -0
70 lines not on this page · raw message
Signature · 1 line
2.20.1
Heiko Stuebner
maintainerPATCH 3/8 rockchip: rk3288: move TPL options to generic position
In reply to Heiko StuebnerMove the TPL-related options to the generic RK3288 config option protected by "if TPL" conditionals.
This way board wanting TPL support just need to "select TPL" to get all necessary options instead of duplicating all of them.
--- arch/arm/mach-rockchip/Kconfig | 15 +++++++++++++++ arch/arm/mach-rockchip/rk3288/Kconfig | 15 --------------- 2 files changed, 15 insertions(+), 15 deletions(-)
arch/arm/mach-rockchip/Kconfig +15 -0
@@ -63,6 +63,21 @@ config ROCKCHIP_RK3288 select SPL_BOARD_INIT if SPL select SUPPORT_SPL select SPL + select SUPPORT_TPL + select ROCKCHIP_BROM_HELPER if TPL + select TPL_BOOTROM_SUPPORT if TPL + select TPL_CLK if TPL + select TPL_DM if TPL + select TPL_DRIVERS_MISC_SUPPORT if TPL + select TPL_LIBCOMMON_SUPPORT if TPL + select TPL_LIBGENERIC_SUPPORT if TPL + select TPL_NEEDS_SEPARATE_TEXT_BASE if TPL + select TPL_OF_CONTROL if TPL + select TPL_OF_PLATDATA if TPL + select TPL_RAM if TPL + select TPL_REGMAP if TPL + select TPL_SERIAL_SUPPORT if TPL + select TPL_SYSCON if TPL imply USB_FUNCTION_ROCKUSB imply CMD_ROCKUSB help
arch/arm/mach-rockchip/rk3288/Kconfig +0 -15
@@ -98,22 +98,7 @@ config TARGET_POPMETAL_RK3288 config TARGET_VYASA_RK3288 bool "Vyasa-RK3288" select BOARD_LATE_INIT - select ROCKCHIP_BROM_HELPER - select SUPPORT_TPL select TPL - select TPL_BOOTROM_SUPPORT - select TPL_CLK - select TPL_DM - select TPL_DRIVERS_MISC_SUPPORT - select TPL_LIBCOMMON_SUPPORT - select TPL_LIBGENERIC_SUPPORT - select TPL_NEEDS_SEPARATE_TEXT_BASE if SPL - select TPL_OF_CONTROL - select TPL_OF_PLATDATA - select TPL_RAM - select TPL_REGMAP - select TPL_SERIAL_SUPPORT - select TPL_SYSCON help Vyasa is a RK3288-based development board with 2 USB ports, HDMI, VGA, micro-SD card, audio, WiFi and Gigabit Ethernet, It
Signature · 1 line
2.20.1
PATCH 3/8 rockchip: rk3288: move TPL options to generic position
Quoted 9 lines · Heiko Stuebner
Move the TPL-related options to the generic RK3288 config option protected by "if TPL" conditionals.
This way board wanting TPL support just need to "select TPL" to get all necessary options instead of duplicating all of them.
Signed-off-by Heiko Stuebner <[email protected]>---
Heiko Stuebner
maintainerPATCH 4/8 rockchip: rk3288: adjust load addresses
In reply to Heiko StuebnerThe rk3288 by default uses memory areas for u-boot and runtime parts like pxe+scriptfile that we may want to use for secure firmware and thus mark secure later on. So move the relevant parts a bit away from that.
--- include/configs/rk3288_common.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/configs/rk3288_common.h +4 -4
@@ -20,7 +20,7 @@#ifdef CONFIG_SPL_ROCKCHIP_BACK_TO_BROM /* Bootrom will load u-boot binary to 0x0 once return from SPL */ #endif -#define CONFIG_SYS_INIT_SP_ADDR 0x00100000 +#define CONFIG_SYS_INIT_SP_ADDR 0x00300000#define CONFIG_SYS_LOAD_ADDR 0x00800800#define CONFIG_SPL_STACK 0xff718000#if defined(CONFIG_SPL_BUILD ) && defined(CONFIG_TPL_BOOTROM_SUPPORT )
@@ -48,9 +48,9 @@/* usb host support */ #define ENV_MEM_LAYOUT_SETTINGS \ - "scriptaddr=0x00000000\0" \ - "pxefile_addr_r=0x00100000\0" \ - "fdt_addr_r=0x01f00000\0" \ + "scriptaddr=0x00500000\0" \ + "pxefile_addr_r=0x00600000\0" \ + "fdt_addr_r=0x5600000\0" \ "kernel_addr_r=0x02000000\0" \ "ramdisk_addr_r=0x04000000\0"
Signature · 1 line
2.20.1
Heiko Stuebner
maintainerPATCH 5/8 rockchip: rk3288: reserve first 2MB when build with ATF support
In reply to Heiko StuebnerATF resides in the first 2MB of ram and will also protect this area from non-secure access.
So similar to other Rockchip socs keep this area from the usable ram.
--- arch/arm/mach-rockchip/rk3288/rk3288.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm/mach-rockchip/rk3288/rk3288.c +16 -0
@@ -2,11 +2,27 @@/* * Copyright (c) 2016 Rockchip Electronics Co., Ltd */ +#include <common.h> #include <asm/io.h> #include <asm/arch/hardware.h> +DECLARE_GLOBAL_DATA_PTR ; +#define GRF_SOC_CON2 0xff77024c +int dram_init_banksize (void ) +{ +#ifdef CONFIG_SPL_ATF +size_t max_size =min ((unsigned long )gd->ram_size, gd->ram_top); + +/* Reserve 0x200000 for ATF bl32 */ + gd->bd->bi_dram[0 ].start =0x0200000 ; + gd->bd->bi_dram[0 ].size = max_size - gd->bd->bi_dram[0 ].start; +#endif + +return 0 ; +} +int arch_cpu_init (void ) {/* We do some SoC one time setting here. */
Signature · 1 line
2.20.1
PATCH 5/8 rockchip: rk3288: reserve first 2MB when build with ATF support
Heiko,
Quoted 17 lines · Heiko Stuebner
ATF resides in the first 2MB of ram and will also protect this area from non-secure access.
So similar to other Rockchip socs keep this area from the usable ram.
Signed-off-by Heiko Stuebner <[email protected]>--- arch/arm/mach-rockchip/rk3288/rk3288.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)arch/arm/mach-rockchip/rk3288/rk3288.c +0
-0@@ -2,11 +2,27 @@/* * Copyright (c) 2016 Rockchip Electronics Co., Ltd
arch/arm/mach-rockchip/rk3288/rk3288.c line 13
Quoted 10 lines
arch/arm/mach-rockchip/rk3288/rk3288.c +4
-0*/ +#include <common.h> #include <asm/io.h> #include <asm/arch/hardware.h> +DECLARE_GLOBAL_DATA_PTR ; +#define GRF_SOC_CON2 0xff77024c +int dram_init_banksize (void )
This break the build for vyasa-rk3288 board:
arm: + vyasa-rk3288+spl/arch/arm/mach-rockchip/rk3288-board-spl.o: In
function
`dram_init_banksize':+arch/arm/mach-rockchip/rk3288-board-spl.c:208:
multiple definition of `dram_init_banksize'+spl/arch/arm/mach-rockchip/rk3288/built-in.o:arch/arm/mach-rockchip/rk3288/rk3288.c:25:
first defined here
Thanks,
- Kever
Quoted 15 lines
arch/arm/mach-rockchip/rk3288/rk3288.c +12
-0+{ +#ifdef CONFIG_SPL_ATF +size_t max_size =min ((unsigned long )gd->ram_size, gd->ram_top); + +/* Reserve 0x200000 for ATF bl32 */ + gd->bd->bi_dram[0 ].start =0x0200000 ; + gd->bd->bi_dram[0 ].size = max_size - gd->bd->bi_dram[0 ].start; +#endif + +return 0 ; +} +int arch_cpu_init (void ) {/* We do some SoC one time setting here. */
Heiko Stuebner
maintainerPATCH 6/8 rockchip: rk3288: split evb into its two entities
In reply to Heiko StuebnerThere are actual 2 variants of the rk3288-evb in existence, mainly differing by their pmic. The one currently in u-boot is using the act8846 + syr827 ics for power regulation, while the other variant uses Rockchip's own rk808.
To be able to use u-boot on both, add separate configs and sync down the devicetrees from the Linux kernel for both variants.
As per [0] the SPDX license designation updated a bit as well to match the actual licensing.
---
arch/arm/dts/Makefile | 3 +-
...evb.dts => rk3288-evb-act8846-u-boot.dtsi} | 33 +-
arch/arm/dts/rk3288-evb-act8846.dts | 188 +++++++
arch/arm/dts/rk3288-evb-rk808-u-boot.dtsi | 40 ++
arch/arm/dts/rk3288-evb-rk808.dts | 202 +++++++
arch/arm/dts/rk3288-evb.dtsi | 493 ++++++++----------
...defconfig => evb-rk3288-act8846_defconfig} | 4 +-
configs/evb-rk3288-rk808_defconfig | 87 ++++
8 files changed, 738 insertions(+), 312 deletions(-)
rename arch/arm/dts/{rk3288-evb.dts => rk3288-evb-act8846-u-boot.dtsi} (64%)
create mode 100644 arch/arm/dts/rk3288-evb-act8846.dts
create mode 100644 arch/arm/dts/rk3288-evb-rk808-u-boot.dtsi
create mode 100644 arch/arm/dts/rk3288-evb-rk808.dts
rename configs/{evb-rk3288_defconfig => evb-rk3288-act8846_defconfig} (95%)
create mode 100644 configs/evb-rk3288-rk808_defconfigarch/arm/dts/Makefile +2 -1
@@ -65,7 +65,8 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += \ rk3128-evb.dtb \ rk3188-radxarock.dtb \ rk3229-evb.dtb \ - rk3288-evb.dtb \ + rk3288-evb-act8846.dtb \ + rk3288-evb-rk808.dtb \ rk3288-fennec.dtb \ rk3288-firefly.dtb \ rk3288-miqi.dtb \
arch/arm/dts/rk3288-evb-act8846-u-boot.dtsi renamed from arch/arm/dts/rk3288-evb.dts +8 -25
@@ -1,20 +1,8 @@ -// SPDX-License-Identifier: GPL-2.0+ OR X11 +// SPDX-License-Identifier: GPL-2.0+ /* - * (C) Copyright 2016 Rockchip Electronics Co., Ltd + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd. */ -/dts-v1/; -#include "rk3288-evb.dtsi" - -/ { - model = "Evb-RK3288"; - compatible = "evb-rk3288,evb-rk3288", "rockchip,rk3288"; - - chosen { - stdout-path = &uart2; - }; -}; - &dmc { rockchip,pctl-timing = <0x215 0xc8 0x0 0x35 0x26 0x2 0x70 0x2000d 0x6 0x0 0x8 0x4 0x17 0x24 0xd 0x6
@@ -26,31 +14,26 @@ rockchip,sdram-params = <0x20d266a4 0x5b6 2 533000000 6 9 0>; }; -&pinctrl { +&sdmmc { u-boot,dm-pre-reloc; }; -&pwm1 { - status = "okay"; -}; - -&uart2 { +&emmc { u-boot,dm-pre-reloc; - reg-shift = <2>; }; -&sdmmc { +&gpio3 { u-boot,dm-pre-reloc; }; -&emmc { +&gpio8 { u-boot,dm-pre-reloc; }; -&gpio3 { +&pinctrl { u-boot,dm-pre-reloc; }; -&gpio8 { +&uart2 { u-boot,dm-pre-reloc; };
arch/arm/dts/rk3288-evb-act8846.dts new file +188 -0
188 lines not on this page · raw message
arch/arm/dts/rk3288-evb-rk808-u-boot.dtsi new file +40 -0
@@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd. + */ + +&dmc { + rockchip,pctl-timing = <0x29a 0xc8 0x1f8 0x42 0x4e 0x4 0xea 0xa + 0x5 0x0 0xa 0x7 0x19 0x24 0xa 0x7 + 0x5 0xa 0x5 0x200 0x5 0x10 0x40 0x0 + 0x1 0x7 0x7 0x4 0xc 0x43 0x100 0x0 + 0x5 0x0>; + rockchip,phy-timing = <0x48f9aab4 0xea0910 0x1002c200 + 0xa60 0x40 0x10 0x0>; + /* Add a dummy value to cause of-platdata think this is bytes */ + rockchip,sdram-params = <0x30B25564 0x627 3 666000000 3 9 1>; +}; + +&sdmmc { + u-boot,dm-pre-reloc; +}; + +&emmc { + u-boot,dm-pre-reloc; +}; + +&gpio3 { + u-boot,dm-pre-reloc; +}; + +&gpio8 { + u-boot,dm-pre-reloc; +}; + +&pinctrl { + u-boot,dm-pre-reloc; +}; + +&uart2 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/rk3288-evb-rk808.dts new file +202 -0
202 lines not on this page · raw message
arch/arm/dts/rk3288-evb.dtsi +209 -284
616 lines not on this page · raw message
configs/evb-rk3288-act8846_defconfig renamed from configs/evb-rk3288_defconfig +2 -2
@@ -12,7 +12,7 @@ CONFIG_DEBUG_UART=y CONFIG_NR_DRAM_BANKS=1 # CONFIG_ANDROID_BOOT_IMAGE is not set CONFIG_SILENT_CONSOLE=y -CONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.dtb" +CONFIG_DEFAULT_FDT_FILE="rk3288-evb-act8846.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_STACK_R=y
@@ -33,7 +33,7 @@ CONFIG_CMD_REGULATOR=y # CONFIG_SPL_EFI_PARTITION is not set CONFIG_SPL_PARTITION_UUIDS=y CONFIG_SPL_OF_CONTROL=y -CONFIG_DEFAULT_DEVICE_TREE="rk3288-evb" +CONFIG_DEFAULT_DEVICE_TREE="rk3288-evb-act8846" CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents" CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y
configs/evb-rk3288-rk808_defconfig new file +87 -0
87 lines not on this page · raw message
Signature · 1 line
2.20.1
Heiko Stuebner
maintainerPATCH 7/8 rockchip: rk3288: convert rk3288-evb to use tpl
In reply to Heiko StuebnerWe want to use ATF loaded by the SPL, so need support for the itb FIT in SPL which therefore needs real mmc reading capabilities making it too big for the sram. So convert to use TPL for memory init beforehand similar to rk3288-vyasa.
--- arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/rk3288/Kconfig | 1 + board/rockchip/evb_rk3288/evb-rk3288.c | 4 ++++ configs/evb-rk3288-act8846_defconfig | 3 +-- configs/evb-rk3288-rk808_defconfig | 3 +-- 5 files changed, 8 insertions(+), 4 deletions(-)
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -188,6 +188,7 @@ config SPL_ROCKCHIP_BACK_TO_BROM config TPL_ROCKCHIP_BACK_TO_BROM bool "TPL returns to bootrom" + default y if ROCKCHIP_RK3288 default y if ROCKCHIP_RK3368 select ROCKCHIP_BROM_HELPER depends on TPL
arch/arm/mach-rockchip/rk3288/Kconfig +1 -0
@@ -44,6 +44,7 @@ config TARGET_CHROMEBOOK_SPEEDY config TARGET_EVB_RK3288 bool "Evb-RK3288" select BOARD_LATE_INIT + select TPL help EVB-RK3288 is a RK3288-based development board with 2 USB ports, HDMI, VGA, micro-SD card, audio, WiFi and Gigabit Ethernet, It
board/rockchip/evb_rk3288/evb-rk3288.c +4 -0
@@ -3,6 +3,8 @@* (C) Copyright 2016 Rockchip Electronics Co., Ltd */ +#ifndef CONFIG_TPL_BUILD +#include <common.h> #include <spl.h>
@@ -12,3 +14,5 @@ void board_boot_order(u32 *spl_boot_list) spl_boot_list[0 ] =BOOT_DEVICE_MMC2 ; spl_boot_list[1] = BOOT_DEVICE_MMC1; } + +#endif
configs/evb-rk3288-act8846_defconfig +1 -2
@@ -1,9 +1,8 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y -CONFIG_SYS_TEXT_BASE=0x00000000 +CONFIG_SYS_TEXT_BASE=0x00100000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ROCKCHIP_RK3288=y -CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y CONFIG_TARGET_EVB_RK3288=y CONFIG_DEBUG_UART_BASE=0xff690000 CONFIG_DEBUG_UART_CLOCK=24000000
configs/evb-rk3288-rk808_defconfig +1 -2
@@ -1,9 +1,8 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y -CONFIG_SYS_TEXT_BASE=0x00000000 +CONFIG_SYS_TEXT_BASE=0x00100000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ROCKCHIP_RK3288=y -CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y CONFIG_TARGET_EVB_RK3288=y CONFIG_DEBUG_UART_BASE=0xff690000 CONFIG_DEBUG_UART_CLOCK=24000000
Signature · 1 line
2.20.1
PATCH 7/8 rockchip: rk3288: convert rk3288-evb to use tpl
Heiko,
Quoted 19 lines · Heiko Stuebner
We want to use ATF loaded by the SPL, so need support for the itb FIT in SPL which therefore needs real mmc reading capabilities making it too big for the sram. So convert to use TPL for memory init beforehand similar to rk3288-vyasa.
Signed-off-by Heiko Stuebner <[email protected]>--- arch/arm/mach-rockchip/Kconfig | 1 + arch/arm/mach-rockchip/rk3288/Kconfig | 1 + board/rockchip/evb_rk3288/evb-rk3288.c | 4 ++++ configs/evb-rk3288-act8846_defconfig | 3 +-- configs/evb-rk3288-rk808_defconfig | 3 +-- 5 files changed, 8 insertions(+), 4 deletions(-)arch/arm/mach-rockchip/Kconfig +0
-0
arch/arm/mach-rockchip/Kconfig config SPL_ROCKCHIP_BACK_TO_BROM · line 191
Quoted 4 lines
arch/arm/mach-rockchip/Kconfig +1
-0@@ -188,6 +188,7 @@ config SPL_ROCKCHIP_BACK_TO_BROM config TPL_ROCKCHIP_BACK_TO_BROM bool "TPL returns to bootrom" + default y if ROCKCHIP_RK3288
This TPL_ROCKCHIP_BACK_TO_BROM should be default y to all SoCs, has apply in another patch from me, please rebase this patch.
Thanks,
- Kever
Quoted 65 lines
arch/arm/mach-rockchip/Kconfig +0
-0default y if ROCKCHIP_RK3368 select ROCKCHIP_BROM_HELPER depends on TPLarch/arm/mach-rockchip/rk3288/Kconfig +1
-0@@ -44,6 +44,7 @@ config TARGET_CHROMEBOOK_SPEEDY config TARGET_EVB_RK3288 bool "Evb-RK3288" select BOARD_LATE_INIT + select TPL help EVB-RK3288 is a RK3288-based development board with 2 USB ports, HDMI, VGA, micro-SD card, audio, WiFi and Gigabit Ethernet, Itboard/rockchip/evb_rk3288/evb-rk3288.c +4
-0@@ -3,6 +3,8 @@* (C) Copyright 2016 Rockchip Electronics Co., Ltd */ +#ifndef CONFIG_TPL_BUILD +#include <common.h> #include <spl.h> @@ -12,3 +14,5 @@ void board_boot_order(u32 *spl_boot_list) spl_boot_list[0 ] =BOOT_DEVICE_MMC2 ; spl_boot_list[1] = BOOT_DEVICE_MMC1; } + +#endif configs/evb-rk3288-act8846_defconfig +1
-2@@ -1,9 +1,8 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y -CONFIG_SYS_TEXT_BASE=0x00000000 +CONFIG_SYS_TEXT_BASE=0x00100000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ROCKCHIP_RK3288=y -CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y CONFIG_TARGET_EVB_RK3288=y CONFIG_DEBUG_UART_BASE=0xff690000 CONFIG_DEBUG_UART_CLOCK=24000000configs/evb-rk3288-rk808_defconfig +1
-2@@ -1,9 +1,8 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y -CONFIG_SYS_TEXT_BASE=0x00000000 +CONFIG_SYS_TEXT_BASE=0x00100000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ROCKCHIP_RK3288=y -CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y CONFIG_TARGET_EVB_RK3288=y CONFIG_DEBUG_UART_BASE=0xff690000 CONFIG_DEBUG_UART_CLOCK=24000000
Heiko Stuebner
maintainerPATCH 8/8 rockchip: rk3288: make both evb variants use atf
In reply to Heiko StuebnerEnable both rk3288-evb variants to load an ATF binary between spl and u-boot proper.
Doing the regular spl->u-boot load of course still stays possible with this change.
--- board/rockchip/evb_rk3288/evb-rk3288.c | 12 +++++- board/rockchip/evb_rk3288/fit_spl_atf.its | 52 +++++++++++++++++++++++ configs/evb-rk3288-act8846_defconfig | 9 +++- configs/evb-rk3288-rk808_defconfig | 9 +++- 4 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 board/rockchip/evb_rk3288/fit_spl_atf.its
board/rockchip/evb_rk3288/evb-rk3288.c +11 -1
@@ -15,4 +15,14 @@ void board_boot_order(u32 *spl_boot_list) spl_boot_list[1] = BOOT_DEVICE_MMC1; } -#endif +#endif + +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match (const char *name) +{ +/* Just empty function now - can't decide what to choose */ +debug ("%s: %s\n" , __func__, name); + +return 0 ; +} +#endif
board/rockchip/evb_rk3288/fit_spl_atf.its new file +52 -0
52 lines not on this page · raw message
configs/evb-rk3288-act8846_defconfig +7 -2
@@ -1,21 +1,26 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y -CONFIG_SYS_TEXT_BASE=0x00100000 +CONFIG_SYS_TEXT_BASE=0x00200000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ROCKCHIP_RK3288=y CONFIG_TARGET_EVB_RK3288=y CONFIG_DEBUG_UART_BASE=0xff690000 CONFIG_DEBUG_UART_CLOCK=24000000 -CONFIG_SPL_STACK_R_ADDR=0x80000 +CONFIG_SPL_STACK_R_ADDR=0x600000 CONFIG_DEBUG_UART=y CONFIG_NR_DRAM_BANKS=1 # CONFIG_ANDROID_BOOT_IMAGE is not set +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_FIT_SOURCE="board/rockchip/evb_rk3288/fit_spl_atf.its" CONFIG_SILENT_CONSOLE=y CONFIG_DEFAULT_FDT_FILE="rk3288-evb-act8846.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000 +CONFIG_SPL_ATF=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y
configs/evb-rk3288-rk808_defconfig +7 -2
@@ -1,21 +1,26 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y -CONFIG_SYS_TEXT_BASE=0x00100000 +CONFIG_SYS_TEXT_BASE=0x00200000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ROCKCHIP_RK3288=y CONFIG_TARGET_EVB_RK3288=y CONFIG_DEBUG_UART_BASE=0xff690000 CONFIG_DEBUG_UART_CLOCK=24000000 -CONFIG_SPL_STACK_R_ADDR=0x80000 +CONFIG_SPL_STACK_R_ADDR=0x600000 CONFIG_DEBUG_UART=y CONFIG_NR_DRAM_BANKS=1 # CONFIG_ANDROID_BOOT_IMAGE is not set +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_FIT_SOURCE="board/rockchip/evb_rk3288/fit_spl_atf.its" CONFIG_SILENT_CONSOLE=y CONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000 +CONFIG_SPL_ATF=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y
Signature · 1 line
2.20.1
PATCH 8/8 rockchip: rk3288: make both evb variants use atf
Hi Heiko,
Quoted 2 lines · Heiko Stuebner
Enable both rk3288-evb variants to load an ATF binary between spl and u-boot proper.
Does this the same as aarch64 boot/load flow?
tpl->spl->atf->u-boot
Quoted 8 lines
Doing the regular spl->u-boot load of course still stays possible with this change.
Signed-off-by Heiko Stuebner <[email protected]>--- board/rockchip/evb_rk3288/evb-rk3288.c | 12 +++++- board/rockchip/evb_rk3288/fit_spl_atf.its | 52 +++++++++++++++++++++++
Is it possible to re-use arch/arm/mach-rockchip/make_fit_atf.py?
Quoted 33 lines
configs/evb-rk3288-act8846_defconfig | 9 +++- configs/evb-rk3288-rk808_defconfig | 9 +++- 4 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 board/rockchip/evb_rk3288/fit_spl_atf.itsboard/rockchip/evb_rk3288/evb-rk3288.c +11
-1@@ -15,4 +15,14 @@ void board_boot_order(u32 *spl_boot_list) spl_boot_list[1] = BOOT_DEVICE_MMC1; } -#endif +#endif + +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match (const char *name) +{ +/* Just empty function now - can't decide what to choose */ +debug ("%s: %s\n" , __func__, name); + +return 0 ; +} +#endif board/rockchip/evb_rk3288/fit_spl_atf.its new file +1
-0@@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
board/rockchip/evb_rk3288/fit_spl_atf.its line 11
Quoted 10 lines
board/rockchip/evb_rk3288/fit_spl_atf.its new file +10
-0+/* + * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH + * + * Minimal dts for a SPL FIT image payload. + */ + +/dts-v1/; + +/ { + description = "FIT image with U-Boot proper, ATF bl32, DTB";
Why you name the ATF bl32, isn't it bl31?
Thanks,
- Kever
Quoted 107 lines
board/rockchip/evb_rk3288/fit_spl_atf.its new file +41
-0+ #address-cells = <1>; + + images { + uboot { + description = "U-Boot (64-bit)"; + data = /incbin/("../../../u-boot-nodtb.bin"); + type = "standalone"; + os = "U-Boot"; + arch = "arm64"; + compression = "none"; + load = <0x00200000>; + }; + atf { + description = "ARM Trusted Firmware"; + data = /incbin/("../../../bl32-rk3288.bin"); + type = "firmware"; + os = "arm-trusted-firmware"; + arch = "arm64"; + compression = "none"; + load = <0x00100000>; + entry = <0x00100000>; + }; + + fdt { + description = "RK3288-EVB flat device-tree"; + data = /incbin/("../../../u-boot.dtb"); + type = "flat_dt"; + compression = "none"; + }; + }; + + configurations { + default = "conf"; + conf { + description = "Rockchip RK3288-EVB"; + firmware = "atf"; + loadables = "uboot"; + fdt = "fdt"; + }; + }; +};configs/evb-rk3288-act8846_defconfig +7
-2@@ -1,21 +1,26 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y -CONFIG_SYS_TEXT_BASE=0x00100000 +CONFIG_SYS_TEXT_BASE=0x00200000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ROCKCHIP_RK3288=y CONFIG_TARGET_EVB_RK3288=y CONFIG_DEBUG_UART_BASE=0xff690000 CONFIG_DEBUG_UART_CLOCK=24000000 -CONFIG_SPL_STACK_R_ADDR=0x80000 +CONFIG_SPL_STACK_R_ADDR=0x600000 CONFIG_DEBUG_UART=y CONFIG_NR_DRAM_BANKS=1 # CONFIG_ANDROID_BOOT_IMAGE is not set +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_FIT_SOURCE="board/rockchip/evb_rk3288/fit_spl_atf.its" CONFIG_SILENT_CONSOLE=y CONFIG_DEFAULT_FDT_FILE="rk3288-evb-act8846.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000 +CONFIG_SPL_ATF=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=yconfigs/evb-rk3288-rk808_defconfig +7
-2@@ -1,21 +1,26 @@ CONFIG_ARM=y CONFIG_ARCH_ROCKCHIP=y -CONFIG_SYS_TEXT_BASE=0x00100000 +CONFIG_SYS_TEXT_BASE=0x00200000 CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_ROCKCHIP_RK3288=y CONFIG_TARGET_EVB_RK3288=y CONFIG_DEBUG_UART_BASE=0xff690000 CONFIG_DEBUG_UART_CLOCK=24000000 -CONFIG_SPL_STACK_R_ADDR=0x80000 +CONFIG_SPL_STACK_R_ADDR=0x600000 CONFIG_DEBUG_UART=y CONFIG_NR_DRAM_BANKS=1 # CONFIG_ANDROID_BOOT_IMAGE is not set +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_FIT_SOURCE="board/rockchip/evb_rk3288/fit_spl_atf.its" CONFIG_SILENT_CONSOLE=y CONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000 +CONFIG_SPL_ATF=y CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y
A message that is not in the archive (sent off-list or not yet received): 526672816.2740575.1557194072777.JavaMail.javamailuser@localhost
Heiko Stuebner
maintainerPATCH 8/8 rockchip: rk3288: make both evb variants use atf
Hi Kever,
Am Dienstag, 7. Mai 2019, 03:54:32 CEST schrieb 杨凯:
Quoted 2 lines
1 does aarch32 using atf the same way like aarch64? eg. the load/boot flow is:
tpl->spl->atf->u-boot
Yep, exactly like this - which is the beauty of using ATF :-) Btw. core rk3288 support meanwhile also reached upstream ATF:
Quoted 1 line
2 why does you name it bl32? does it should be bl31?
That is an architectural issue of ARMv7. Where ARMv8 has separate levels for secure monitor (bl31) and secure os (bl32) on ARMv7 there is no separate secure monitor and only the secure os level so they have to share.
For this ATF needs to be built together with its intented trust-os. ATF itself provides sp_min as example / minimal solution, but can also build against actual optee, with ATF providing the core psci functionality.
See
https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/docs/user-guide.rst#n200
for a bit more explanation.
The small issue I see is how to name things consistently, like it doesn't really make sense to duplicate params structs that are currently named bl31_foo, so I reused them. One might think about bl3x_params or so, or just keep it as bl31_params.
Quoted 3 lines
3 is it possible to re-use below script instead of dedicate its file?
arch/arm/mach-rockchip/make_fit_atf.py
I already switched to that in my current tree, as I needed the binary separation for pmusram code to make suspend work :-) .
Heiko
Quoted 175 lines
Thanks,
- Kever
From: "Heiko Stuebner <[email protected]>"
To: "sjg <[email protected]>","philipp.tomsich <[email protected]>"
CC "hl <[email protected]>","kever.yang <[email protected]>","u-boot <[email protected]>","Heiko Stuebner <[email protected]>"Sent: 2019-04-05 16:30
Subject: [PATCH 8/8] rockchip: rk3288: make both evb variants use atf
Enable both rk3288-evb variants to load an ATF binary between spl and u-boot proper.
Doing the regular spl->u-boot load of course still stays possible with this change.
Signed-off-by Heiko Stuebner <[email protected]>---
board/rockchip/evb_rk3288/evb-rk3288.c | 12 +++++- board/rockchip/evb_rk3288/fit_spl_atf.its | 52 +++++++++++++++++++++++ configs/evb-rk3288-act8846_defconfig | 9 +++- configs/evb-rk3288-rk808_defconfig | 9 +++- 4 files changed, 77 insertions(+), 5 deletions(-)create mode 100644 board/rockchip/evb_rk3288/fit_spl_atf.its
board/rockchip/evb_rk3288/evb-rk3288.c +11
-1@@ -15,4 +15,14 @@ void board_boot_order(u32 *spl_boot_list) spl_boot_list[1] = BOOT_DEVICE_MMC1; } -#endif +#endif + +#ifdef CONFIG_SPL_LOAD_FIT +int board_fit_config_name_match (const char *name) +{ +/* Just empty function now - can't decide what to choose */ +debug ("%s: %s\n" , __func__, name); + +return 0 ; +} +#endif board/rockchip/evb_rk3288/fit_spl_atf.its new file +52
-0@@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: GPL-2.0+ OR X11 */ +/* + * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH + * + * Minimal dts for a SPL FIT image payload. + */ + +/dts-v1/; + +/ { + description = "FIT image with U-Boot proper, ATF bl32, DTB"; + #address-cells = <1>; + + images { + uboot { + description = "U-Boot (64-bit)"; + data = /incbin/("../../../u-boot-nodtb.bin"); + type = "standalone"; + os = "U-Boot"; + arch = "arm64"; + compression = "none"; + load = <0x00200000>; + }; + atf { + description = "ARM Trusted Firmware"; + data = /incbin/("../../../bl32-rk3288.bin"); + type = "firmware"; + os = "arm-trusted-firmware"; + arch = "arm64"; + compression = "none"; + load = <0x00100000>; + entry = <0x00100000>; + }; + + fdt { + description = "RK3288-EVB flat device-tree"; + data = /incbin/("../../../u-boot.dtb"); + type = "flat_dt"; + compression = "none"; + }; + }; + + configurations { + default = "conf"; + conf { + description = "Rockchip RK3288-EVB"; + firmware = "atf"; + loadables = "uboot"; + fdt = "fdt"; + }; + }; +};configs/evb-rk3288-act8846_defconfig +0
-0@@ -1,21 +1,26 @@
CONFIG_ARM=yCONFIG_ARCH_ROCKCHIP=yconfigs/evb-rk3288-act8846_defconfig +1
-1-CONFIG_SYS_TEXT_BASE=0x00100000 +CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SYS_MALLOC_F_LEN=0x2000CONFIG_ROCKCHIP_RK3288=yCONFIG_TARGET_EVB_RK3288=yCONFIG_DEBUG_UART_BASE=0xff690000CONFIG_DEBUG_UART_CLOCK=24000000configs/evb-rk3288-act8846_defconfig +1
-1-CONFIG_SPL_STACK_R_ADDR=0x80000 +CONFIG_SPL_STACK_R_ADDR=0x600000
CONFIG_DEBUG_UART=yCONFIG_NR_DRAM_BANKS=1
#CONFIG_ANDROID_BOOT_IMAGEis not setconfigs/evb-rk3288-act8846_defconfig +4
-0+CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_FIT_SOURCE="board/rockchip/evb_rk3288/fit_spl_atf.its"
CONFIG_SILENT_CONSOLE=yCONFIG_DEFAULT_FDT_FILE="rk3288-evb-act8846.dtb"
#CONFIG_DISPLAY_CPUINFOis not setCONFIG_DISPLAY_BOARDINFO_LATE=yCONFIG_SPL_STACK_R=yCONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
+CONFIG_SPL_ATF=yCONFIG_CMD_GPIO=yCONFIG_CMD_GPT=yCONFIG_CMD_I2C=yconfigs/evb-rk3288-rk808_defconfig +0
-0@@ -1,21 +1,26 @@
CONFIG_ARM=yCONFIG_ARCH_ROCKCHIP=yconfigs/evb-rk3288-rk808_defconfig +1
-1-CONFIG_SYS_TEXT_BASE=0x00100000 +CONFIG_SYS_TEXT_BASE=0x00200000
CONFIG_SYS_MALLOC_F_LEN=0x2000CONFIG_ROCKCHIP_RK3288=yCONFIG_TARGET_EVB_RK3288=yCONFIG_DEBUG_UART_BASE=0xff690000CONFIG_DEBUG_UART_CLOCK=24000000configs/evb-rk3288-rk808_defconfig +1
-1-CONFIG_SPL_STACK_R_ADDR=0x80000 +CONFIG_SPL_STACK_R_ADDR=0x600000
CONFIG_DEBUG_UART=yCONFIG_NR_DRAM_BANKS=1
#CONFIG_ANDROID_BOOT_IMAGEis not setconfigs/evb-rk3288-rk808_defconfig +4
-0+CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_SPL_LOAD_FIT=y +CONFIG_SPL_FIT_SOURCE="board/rockchip/evb_rk3288/fit_spl_atf.its"
CONFIG_SILENT_CONSOLE=yCONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.dtb"
#CONFIG_DISPLAY_CPUINFOis not setCONFIG_DISPLAY_BOARDINFO_LATE=yCONFIG_SPL_STACK_R=yCONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
+CONFIG_SPL_ATF=yCONFIG_CMD_GPIO=yCONFIG_CMD_GPT=yCONFIG_CMD_I2C=y