mach-rockchip: Add xPL phase context to ROCKCHIP_BROM_HELPER
Subsystems (3)
cover mach-rockchip: Add xPL phase context to ROCKCHIP_BROM_HELPER
This series stems from the observation that the ROCKCHIP_BROM_HELPER config option lacks xPL phase context. There are 58 Rockchip board configurations that have all three options: CONFIG_TPL CONFIG_SPL and CONFIG_ROCKCHIP_BROM_HELPER. In this case, the ROCKCHIP_BROM_HELPER code is built into both TPL and SPL too, even if it is really needed in only one of them. The series splits ROCKCHIP_BROM_HELPER into TPL_ROCKCHIP_BROM_HELPER and SPL_ROCKCHIP_BROM_HELPER, allowing the back to BootROM code to be included just where needed.
The first five patches add some guards and forced selections to avoid inconsistent configurations, and drop the SPL_BOOTROM_SUPPORT option from defconfigs when unneeded. They do not introduce any functional or binary change.
The sixth patch drops SPL_BOOTROM_SUPPORT dead code for the evb-px5 and all PX30-based boards' SPL. The seventh patch drops ROCKCHIP_BROM_HELPER dead code from SPL for some configurations related to the following SoCs:
PX30 (7/7) RK322X (1/1) RK3288 (7/14) RK3328(11/12) RK3368 (1/3) and RK3399 (29/30).
The SPL size decreases by up to 522 bytes (PX30 SPL).
---
Massimo Pegorer (7):
mach-rockchip: px30: TPL_ROCKCHIP_COMMON_BOARD is not an option
mach-rockchip: rk3036: SPL_ROCKCHIP_COMMON_BOARD is not an option
mach-rockchip: px30: force TPL_ROCKCHIP_BACK_TO_BROM option selection
mach-rockchip: rk3036: force SPL_ROCKCHIP_BACK_TO_BROM option selection
mach-rockchip: Kconfig: Select xPL_BOOTROM_SUPPORT only if needed
configs: rockchip: Drop unneeded SPL_BOOTROM_SUPPORT option
mach-rockchip: Add xPL phase context to ROCKCHIP_BROM_HELPER option
arch/arm/mach-rockchip/Kconfig | 20 ++++++++++++-------- arch/arm/mach-rockchip/Makefile | 4 ++-- configs/evb-px30_defconfig | 1 - configs/evb-px5_defconfig | 1 - configs/firefly-px30_defconfig | 1 - configs/odroid-go2_defconfig | 1 - configs/px30-core-ctouch2-of10-px30_defconfig | 1 - configs/px30-core-ctouch2-px30_defconfig | 1 - configs/px30-core-edimm2.2-px30_defconfig | 1 - configs/ringneck-px30_defconfig | 1 - 10 files changed, 14 insertions(+), 18 deletions(-)
---
base-commit: 42680af8d15bb49201b298ab5f62058051c13083
change-id: 20261130-brom-4a0cdbce0463
Best regards,
Signature · 1 line
Massimo Pegorer <[email protected]>
PATCH 1/7 mach-rockchip: px30: TPL_ROCKCHIP_COMMON_BOARD is not an option
PX30 has its own TPL specific code: due to maximum size constraints, it is not possible to build TPL using the TPL_ROCKCHIP_COMMON_BOARD infrastructure. Moreover, selecting TPL_ROCKCHIP_COMMON_BOARD causes multiple definition errors to arise at build time. Make this option unavailable when the Rockchip SoC is PX30.
--- arch/arm/mach-rockchip/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +1 -1
@@ -638,7 +638,7 @@ config SPL_ROCKCHIP_COMMON_BOARD config TPL_ROCKCHIP_COMMON_BOARD bool "Rockchip TPL common board file" - depends on TPL + depends on TPL && !ROCKCHIP_PX30 help Rockchip SoCs have similar boot process, prefer to use TPL for DRAM init and back to bootrom, and SPL as Trust ATF/U-Boot loader. TPL
Signature · 1 line
2.34.1
PATCH 2/7 mach-rockchip: rk3036: SPL_ROCKCHIP_COMMON_BOARD is not an option
In reply to Massimo PegorerRK3036 has its own SPL specific code: it is not possible to build SPL using the SPL_ROCKCHIP_COMMON_BOARD infrastructure. Moreover, selecting SPL_ROCKCHIP_COMMON_BOARD causes multiple definition errors to arise at build time. Make this option unavailable when the Rockchip SoC is RK3036.
--- arch/arm/mach-rockchip/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +1 -1
@@ -630,7 +630,7 @@ config ROCKCHIP_COMMON_BOARD config SPL_ROCKCHIP_COMMON_BOARD bool "Rockchip SPL common board file" - depends on SPL + depends on SPL && !ROCKCHIP_RK3036 help Rockchip SoCs have similar boot process, SPL is mainly in charge of load and boot Trust ATF/U-Boot firmware, and DRAM init if there is
Signature · 1 line
2.34.1
PATCH 3/7 mach-rockchip: px30: force TPL_ROCKCHIP_BACK_TO_BROM option selection
In reply to Massimo PegorerDeselecting TPL_ROCKCHIP_BACK_TO_BROM causes TPL compile-time failure for any build related to PX30 SoC. Indeed, TPL config option is selected by the ROCKCHIP_PX30 one, and back to BootROM code is mandatory for the PX30-specific TPL implementation. Thus, force ROCKCHIP_PX30 to select TPL_ROCKCHIP_BACK_TO_BROM as well, preventing this option from being deselected.
--- arch/arm/mach-rockchip/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-rockchip/Kconfig +1 -0
@@ -9,6 +9,7 @@ config ROCKCHIP_PX30 select SPL select TPL select TPL_HAVE_INIT_STACK if TPL + select TPL_ROCKCHIP_BACK_TO_BROM imply SPL_SEPARATE_BSS imply SPL_SERIAL imply TPL_SERIAL
Signature · 1 line
2.34.1
PATCH 4/7 mach-rockchip: rk3036: force SPL_ROCKCHIP_BACK_TO_BROM option selection
In reply to Massimo PegorerDeselecting SPL_ROCKCHIP_BACK_TO_BROM causes SPL compile-time failure for any build related to RK3036 SoC. Indeed, SPL config option is selected by the ROCKCHIP_RK3036 one, and back to BootROM code is mandatory for the RK3036-specific SPL implementation. Therefore, force ROCKCHIP_RK3036 to select SPL_ROCKCHIP_BACK_TO_BROM as well, preventing this option from being deselected.
--- arch/arm/mach-rockchip/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/Kconfig +1 -1
@@ -30,6 +30,7 @@ config ROCKCHIP_RK3036 select CPU_V7A select SUPPORT_SPL select SPL + select SPL_ROCKCHIP_BACK_TO_BROM imply OF_UPSTREAM imply USB_FUNCTION_ROCKUSB imply CMD_ROCKUSB
@@ -602,7 +603,6 @@ config ROCKCHIP_USB_UART config SPL_ROCKCHIP_BACK_TO_BROM bool "SPL returns to boot ROM" - default y if ROCKCHIP_RK3036 select ROCKCHIP_BROM_HELPER select SPL_BOOTROM_SUPPORT depends on SPL
Signature · 1 line
2.34.1
PATCH 5/7 mach-rockchip: Kconfig: Select xPL_BOOTROM_SUPPORT only if needed
In reply to Massimo PegorerIf xPL_FRAMEWORK is not selected, the selection of xPL_BOOTROM_SUPPORT has no effect on the xPL build process. However, in the Kconfig layout, the xPL_BOOTROM_SUPPORT config option does not depend on xPL_FRAMEWORK one, therefore it ends up in the .config file, causing the qconfig.py tool to report it as used even if it is really not.
The PX30 TPL does not use the TPL_FRAMEWORK infrastructure and returns to BootROM without relying on the TPL_BOOTROM_SUPPORT code: avoid the TPL_ROCKCHIP_BACK_TO_BROM config option to select TPL_BOOTROM_SUPPORT if TPL_FRAMEWORK is not selected.
The RK3036 does not use the SPL_FRAMEWORK infrastructure and returns to BootROM without relying on the SPL_BOOTROM_SUPPORT code: avoid the SPL_ROCKCHIP_BACK_TO_BROM config option to select SPL_BOOTROM_SUPPORT if SPL_FRAMEWORK is not selected.
--- arch/arm/mach-rockchip/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-rockchip/Kconfig +2 -2
@@ -604,7 +604,7 @@ config ROCKCHIP_USB_UART config SPL_ROCKCHIP_BACK_TO_BROM bool "SPL returns to boot ROM" select ROCKCHIP_BROM_HELPER - select SPL_BOOTROM_SUPPORT + select SPL_BOOTROM_SUPPORT if SPL_FRAMEWORK depends on SPL help Rockchip SoCs have the ability to load a second loader binary
@@ -615,7 +615,7 @@ config TPL_ROCKCHIP_BACK_TO_BROM bool "TPL returns to boot ROM" default y select ROCKCHIP_BROM_HELPER if !ROCKCHIP_RK3066 - select TPL_BOOTROM_SUPPORT + select TPL_BOOTROM_SUPPORT if TPL_FRAMEWORK depends on TPL help Rockchip SoCs have the ability to load a second loader binary
Signature · 1 line
2.34.1
PATCH 6/7 configs: rockchip: Drop unneeded SPL_BOOTROM_SUPPORT option
In reply to Massimo PegorerConfigurations that do not have SPL_ROCKCHIP_BACK_TO_BROM do not need SPL_BOOTROM_SUPPORT code: in this case, the spl_boot_device() does not return BOOT_DEVICE_BOOTROM, and the board_boot_order() does not allow BOOT_DEVICE_BOOTROM to be put in the spl_boot_list in any other way. This means SPL_BOOTROM_SUPPORT code is dead code.
Drop the SPL_BOOTROM_SUPPORT option from evb-px5 and from all PX30-based boards defconfigs. Commit 259afb16922e ("rockchip: px5: update defconfig for TPL/SPL") added it to the evb-px5 defconfig. The evb-px30 one has included it since its first version, which followed previous commit. Subsequently, all other PX30-based boards defconfigs probably inherited it blindly.
On the other hand, if the SPL_BOOTROM_SUPPORT code is built in, it causes the SPL_ROCKCHIP_BROM_HELPER code to be needed too, or build-time errors will arise. That is, further dead code if SPL_ROCKCHIP_BACK_TO_BROM is not selected.
The SPL size decreases by 142 bytes.
--- configs/evb-px30_defconfig | 1 - configs/evb-px5_defconfig | 1 - configs/firefly-px30_defconfig | 1 - configs/odroid-go2_defconfig | 1 - configs/px30-core-ctouch2-of10-px30_defconfig | 1 - configs/px30-core-ctouch2-px30_defconfig | 1 - configs/px30-core-edimm2.2-px30_defconfig | 1 - configs/ringneck-px30_defconfig | 1 - 8 files changed, 8 deletions(-)
configs/evb-px30_defconfig +0 -1
@@ -23,7 +23,6 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-evb.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x20000 -CONFIG_SPL_BOOTROM_SUPPORT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_ATF=y # CONFIG_TPL_FRAMEWORK is not set
configs/evb-px5_defconfig +0 -1
@@ -42,7 +42,6 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3368-px5-evb.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_SPL_MAX_SIZE=0x40000 -CONFIG_SPL_BOOTROM_SUPPORT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_ATF=y CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
configs/firefly-px30_defconfig +0 -1
@@ -24,7 +24,6 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-firefly.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x20000 -CONFIG_SPL_BOOTROM_SUPPORT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_ATF=y # CONFIG_TPL_FRAMEWORK is not set
configs/odroid-go2_defconfig +0 -1
@@ -33,7 +33,6 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3326-odroid-go2.dtb" CONFIG_BOARD_LATE_INIT=y CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x40000 -CONFIG_SPL_BOOTROM_SUPPORT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_I2C=y CONFIG_SPL_POWER=y
configs/px30-core-ctouch2-of10-px30_defconfig +0 -1
@@ -23,7 +23,6 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-engicam-px30-core-ctouch2-of10.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x20000 -CONFIG_SPL_BOOTROM_SUPPORT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_ATF=y # CONFIG_TPL_FRAMEWORK is not set
configs/px30-core-ctouch2-px30_defconfig +0 -1
@@ -23,7 +23,6 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-engicam-px30-core-ctouch2.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x20000 -CONFIG_SPL_BOOTROM_SUPPORT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_ATF=y # CONFIG_TPL_FRAMEWORK is not set
configs/px30-core-edimm2.2-px30_defconfig +0 -1
@@ -23,7 +23,6 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-engicam-px30-core-edimm2.2.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x20000 -CONFIG_SPL_BOOTROM_SUPPORT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_ATF=y # CONFIG_TPL_FRAMEWORK is not set
configs/ringneck-px30_defconfig +0 -1
@@ -28,7 +28,6 @@ CONFIG_MISC_INIT_R=y CONFIG_SPL_MAX_SIZE=0x20000 CONFIG_SPL_PAD_TO=0x38000 CONFIG_SPL_BOARD_INIT=y -CONFIG_SPL_BOOTROM_SUPPORT=y # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set CONFIG_SPL_SYS_MALLOC=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200
Signature · 1 line
2.34.1
PATCH 7/7 mach-rockchip: Add xPL phase context to ROCKCHIP_BROM_HELPER option
In reply to Massimo PegorerThere are 58 Rockchip board configurations that have all three options:CONFIG_TPL CONFIG_SPL and CONFIG_ROCKCHIP_BROM_HELPER. In this case, the ROCKCHIP_BROM_HELPER code is built into both TPL and SPL too, even if it is really needed in only one of them. In all of these configurations only the TPL needs to return to BootROM: TPL_ROCKCHIP_BACK_TO_BROM is selected while SPL_ROCKCHIP_BACK_TO_BROM is not.
Split the current ROCKCHIP_BROM_HELPER option into TPL and SPL specific ones, and rely on the appropriate one based on the built phase context. There were 64 configurations with ROCKCHIP_BROM_HELPER. Now there are 58 with TPL_ROCKCHIP_BROM_HELPER only, and 6 with SPL_ROCKCHIP_BROM_HELPER only.
For the 58 configurations with TPL_ROCKCHIP_BROM_HELPER only, the SPL size decreases by up to 380 bytes.
--- arch/arm/mach-rockchip/Kconfig | 9 ++++++--- arch/arm/mach-rockchip/Makefile | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-)
arch/arm/mach-rockchip/Kconfig +6 -3
@@ -603,7 +603,7 @@ config ROCKCHIP_USB_UART config SPL_ROCKCHIP_BACK_TO_BROM bool "SPL returns to boot ROM" - select ROCKCHIP_BROM_HELPER + select SPL_ROCKCHIP_BROM_HELPER select SPL_BOOTROM_SUPPORT if SPL_FRAMEWORK depends on SPL help
@@ -614,7 +614,7 @@ config SPL_ROCKCHIP_BACK_TO_BROM config TPL_ROCKCHIP_BACK_TO_BROM bool "TPL returns to boot ROM" default y - select ROCKCHIP_BROM_HELPER if !ROCKCHIP_RK3066 + select TPL_ROCKCHIP_BROM_HELPER if !ROCKCHIP_RK3066 select TPL_BOOTROM_SUPPORT if TPL_FRAMEWORK depends on TPL help
@@ -686,7 +686,10 @@ config ROCKCHIP_SPL_RESERVE_IRAM address is in IRAM and may overlay with SPL text area if not reserved. -config ROCKCHIP_BROM_HELPER +config SPL_ROCKCHIP_BROM_HELPER + bool + +config TPL_ROCKCHIP_BROM_HELPER bool config SPL_ROCKCHIP_EARLYRETURN_TO_BROM
arch/arm/mach-rockchip/Makefile +2 -2
@@ -7,9 +7,9 @@ # this may have entered from ATF with the stack-pointer pointing to # inaccessible/protected memory (and the bootrom-helper assumes that # the stack-pointer is valid before switching to the U-Boot stack). -obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o +obj-spl-$(CONFIG_SPL_ROCKCHIP_BROM_HELPER) += bootrom.o obj-spl-$(CONFIG_SPL_ROCKCHIP_COMMON_BOARD) += spl.o spl-boot-order.o spl_common.o -obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o +obj-tpl-$(CONFIG_TPL_ROCKCHIP_BROM_HELPER) += bootrom.o obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o spl_common.o obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o spl_common.o
Signature · 1 line
2.34.1