* [PATCH v3 0/5] rockchip: Use external TPL binary to create a working firmware image
@ 2023-02-17 20:52 Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 3/5] Revert "board: rockchip: Fix binman_init failure on EVB-RK3568" Jonas Karlman
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Jonas Karlman @ 2023-02-17 20:52 UTC (permalink / raw)
To: Simon Glass, Philipp Tomsich, Kever Yang, Joseph Chen,
Alper Nebi Yasak
Cc: Quentin Schulz, Jagan Teki, Heinrich Schuchardt, u-boot,
Jonas Karlman
Rockchip SoCs typically use U-Boot TPL to initialize DRAM, then jumps
back to BootRom to load next stage, U-Boot SPL, into DRAM. BootRom then
jumps to U-Boot SPL to continue the boot flow.
For RK356x there is no support to initialize DRAM using U-Boot
TPL and instead an external TPL binary must be used to generate a
bootable u-boot-rockchip.bin image.
This adds a new rockchip-tpl entry to binman and make use of this new
entry in rockchip-u-boot.dtsi.
Build U-Boot with ROCKCHIP_TPL=/path/to/ddr.bin to generate a
bootable u-boot-rockchip.bin image for RK356x.
I have dropped the RFC patch that was related to showing a friendly
message instead of a generic file not found message when TPL blob is
missing in v3. Will address that in a follow-up series.
The last patch that updates evb-rk3568_defconfig is strictly not needed,
it updates a few options that seemed relevant during testing.
Tested on RK3568 (ODROID-M1, ROCK 3A) and RK3566 (ROCK 3C, Quartz64)
boards using evb-rk3568_defconfig.
Changes in v3:
- Move test function last
- Add help text to Kconfig option
- Add build step for rk3568 to documentation
- Resync init size limit table
- Drop missing message RFC patch
Changes in v2:
- Renamed external-tpl to rockchip-tpl
- Renamed EXTERNAL_TPL to ROCKCHIP_TPL
- Add CONFIG_ROCKCHIP_EXTERNAL_TPL Kconfig option
- New patch to sync init size limit in mkimage
- New RFC patch to improve allow-missing/fake-ext-blobs handling for
binman mkimage entry
Jonas Karlman (5):
binman: Add support for a rockchip-tpl entry
rockchip: Use an external TPL binary on RK3568
Revert "board: rockchip: Fix binman_init failure on EVB-RK3568"
rockchip: mkimage: Update init size limit
rockchip: evb-rk3568: Update defconfig
Makefile | 1 +
arch/arm/dts/rockchip-u-boot.dtsi | 10 ++++++++--
arch/arm/mach-rockchip/Kconfig | 8 ++++++++
configs/evb-rk3568_defconfig | 8 ++++----
doc/board/rockchip/rockchip.rst | 11 +++++++++++
tools/binman/entries.rst | 14 ++++++++++++++
tools/binman/etype/rockchip_tpl.py | 20 ++++++++++++++++++++
tools/binman/ftest.py | 7 +++++++
tools/binman/missing-blob-help | 5 +++++
tools/binman/test/277_rockchip_tpl.dts | 16 ++++++++++++++++
tools/rkcommon.c | 10 +++++-----
11 files changed, 99 insertions(+), 11 deletions(-)
create mode 100644 tools/binman/etype/rockchip_tpl.py
create mode 100644 tools/binman/test/277_rockchip_tpl.dts
--
2.39.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/5] binman: Add support for a rockchip-tpl entry
2023-02-17 20:52 [PATCH v3 0/5] rockchip: Use external TPL binary to create a working firmware image Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 3/5] Revert "board: rockchip: Fix binman_init failure on EVB-RK3568" Jonas Karlman
@ 2023-02-17 20:52 ` Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 2/5] rockchip: Use an external TPL binary on RK3568 Jonas Karlman
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Jonas Karlman @ 2023-02-17 20:52 UTC (permalink / raw)
To: Simon Glass, Philipp Tomsich, Kever Yang, Joseph Chen,
Alper Nebi Yasak
Cc: Quentin Schulz, Jagan Teki, Heinrich Schuchardt, u-boot,
Jonas Karlman, Eugen Hristev
The rockchip-tpl entry can be used when an external TPL binary should be
used instead of the normal U-Boot TPL.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Eugen Hristev <eugen.hristev@collabora.com>
---
v3:
- Move test function last
- Collect r-b and t-b tags
v2:
- Rename external-tpl to rockchip-tpl
- Missing message moved to this patch
tools/binman/entries.rst | 14 ++++++++++++++
tools/binman/etype/rockchip_tpl.py | 20 ++++++++++++++++++++
tools/binman/ftest.py | 7 +++++++
tools/binman/missing-blob-help | 5 +++++
tools/binman/test/277_rockchip_tpl.dts | 16 ++++++++++++++++
5 files changed, 62 insertions(+)
create mode 100644 tools/binman/etype/rockchip_tpl.py
create mode 100644 tools/binman/test/277_rockchip_tpl.dts
diff --git a/tools/binman/entries.rst b/tools/binman/entries.rst
index 7a04a613992d..e177860a6a82 100644
--- a/tools/binman/entries.rst
+++ b/tools/binman/entries.rst
@@ -1386,6 +1386,20 @@ For example, this creates an image with a pre-load header and a binary::
+.. _etype_rockchip_tpl:
+
+Entry: rockchip-tpl: Rockchip TPL binary
+----------------------------------------
+
+Properties / Entry arguments:
+ - rockchip-tpl-path: Filename of file to read into the entry,
+ typically <soc>_ddr_<version>.bin
+
+This entry holds an external TPL binary used by some Rockchip SoCs
+instead of normal U-Boot TPL, typically to initialize DRAM.
+
+
+
.. _etype_scp:
Entry: scp: System Control Processor (SCP) firmware blob
diff --git a/tools/binman/etype/rockchip_tpl.py b/tools/binman/etype/rockchip_tpl.py
new file mode 100644
index 000000000000..74f58ba8570c
--- /dev/null
+++ b/tools/binman/etype/rockchip_tpl.py
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Entry-type module for Rockchip TPL binary
+#
+
+from binman.etype.blob_named_by_arg import Entry_blob_named_by_arg
+
+class Entry_rockchip_tpl(Entry_blob_named_by_arg):
+ """Rockchip TPL binary
+
+ Properties / Entry arguments:
+ - rockchip-tpl-path: Filename of file to read into the entry,
+ typically <soc>_ddr_<version>.bin
+
+ This entry holds an external TPL binary used by some Rockchip SoCs
+ instead of normal U-Boot TPL, typically to initialize DRAM.
+ """
+ def __init__(self, section, etype, node):
+ super().__init__(section, etype, node, 'rockchip-tpl')
+ self.external = True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 062f54adb0ed..48ac1540bfd8 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -90,6 +90,7 @@ TEE_OS_DATA = b'this is some tee OS data'
ATF_BL2U_DATA = b'bl2u'
OPENSBI_DATA = b'opensbi'
SCP_DATA = b'scp'
+ROCKCHIP_TPL_DATA = b'rockchip-tpl'
TEST_FDT1_DATA = b'fdt1'
TEST_FDT2_DATA = b'test-fdt2'
ENV_DATA = b'var1=1\nvar2="2"'
@@ -205,6 +206,7 @@ class TestFunctional(unittest.TestCase):
TestFunctional._MakeInputFile('bl2u.bin', ATF_BL2U_DATA)
TestFunctional._MakeInputFile('fw_dynamic.bin', OPENSBI_DATA)
TestFunctional._MakeInputFile('scp.bin', SCP_DATA)
+ TestFunctional._MakeInputFile('rockchip-tpl.bin', ROCKCHIP_TPL_DATA)
# Add a few .dtb files for testing
TestFunctional._MakeInputFile('%s/test-fdt1.dtb' % TEST_FDT_SUBDIR,
@@ -6386,6 +6388,11 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
self.assertEqual(['u-boot', 'atf-2'],
fdt_util.GetStringList(node, 'loadables'))
+ def testPackRockchipTpl(self):
+ """Test that an image with a Rockchip TPL binary can be created"""
+ data = self._DoReadFile('277_rockchip_tpl.dts')
+ self.assertEqual(ROCKCHIP_TPL_DATA, data[:len(ROCKCHIP_TPL_DATA)])
+
if __name__ == "__main__":
unittest.main()
diff --git a/tools/binman/missing-blob-help b/tools/binman/missing-blob-help
index 4448ac93112a..f3a44d08acce 100644
--- a/tools/binman/missing-blob-help
+++ b/tools/binman/missing-blob-help
@@ -34,6 +34,11 @@ If CONFIG_WDT_K3_RTI_LOAD_FW is enabled, a firmware image is needed for
the R5F core(s) to trigger the system reset. One possible source is
https://github.com/siemens/k3-rti-wdt.
+rockchip-tpl:
+An external TPL is required to initialize DRAM. Get the external TPL
+binary and build with ROCKCHIP_TPL=/path/to/ddr.bin. One possible source
+for the external TPL binary is https://github.com/rockchip-linux/rkbin.
+
tee-os:
See the documentation for your board. You may need to build Open Portable
Trusted Execution Environment (OP-TEE) with TEE=/path/to/tee.bin
diff --git a/tools/binman/test/277_rockchip_tpl.dts b/tools/binman/test/277_rockchip_tpl.dts
new file mode 100644
index 000000000000..269f56e2545c
--- /dev/null
+++ b/tools/binman/test/277_rockchip_tpl.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ binman {
+ size = <16>;
+
+ rockchip-tpl {
+ filename = "rockchip-tpl.bin";
+ };
+ };
+};
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 3/5] Revert "board: rockchip: Fix binman_init failure on EVB-RK3568"
2023-02-17 20:52 [PATCH v3 0/5] rockchip: Use external TPL binary to create a working firmware image Jonas Karlman
@ 2023-02-17 20:52 ` Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 1/5] binman: Add support for a rockchip-tpl entry Jonas Karlman
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Jonas Karlman @ 2023-02-17 20:52 UTC (permalink / raw)
To: Simon Glass, Philipp Tomsich, Kever Yang, Joseph Chen,
Alper Nebi Yasak
Cc: Quentin Schulz, Jagan Teki, Heinrich Schuchardt, u-boot,
Jonas Karlman
An external TPL binary is now expected to be provided using ROCKCHIP_TPL
when building RK3568 targets.
This reverts commit 31500e7bcfaca08ab7c2879f502a6cf852410244.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---
v3:
- Collect r-b tag
v2:
- Collect r-b tag
configs/evb-rk3568_defconfig | 1 -
1 file changed, 1 deletion(-)
diff --git a/configs/evb-rk3568_defconfig b/configs/evb-rk3568_defconfig
index c7e0e5a796f4..0f72925b3a32 100644
--- a/configs/evb-rk3568_defconfig
+++ b/configs/evb-rk3568_defconfig
@@ -65,5 +65,4 @@ CONFIG_BAUDRATE=1500000
CONFIG_DEBUG_UART_SHIFT=2
CONFIG_SYS_NS16550_MEM32=y
CONFIG_SYSRESET=y
-# CONFIG_BINMAN_FDT is not set
CONFIG_ERRNO_STR=y
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 2/5] rockchip: Use an external TPL binary on RK3568
2023-02-17 20:52 [PATCH v3 0/5] rockchip: Use external TPL binary to create a working firmware image Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 3/5] Revert "board: rockchip: Fix binman_init failure on EVB-RK3568" Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 1/5] binman: Add support for a rockchip-tpl entry Jonas Karlman
@ 2023-02-17 20:52 ` Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 4/5] rockchip: mkimage: Update init size limit Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 5/5] rockchip: evb-rk3568: Update defconfig Jonas Karlman
4 siblings, 0 replies; 9+ messages in thread
From: Jonas Karlman @ 2023-02-17 20:52 UTC (permalink / raw)
To: Simon Glass, Philipp Tomsich, Kever Yang, Joseph Chen,
Alper Nebi Yasak
Cc: Quentin Schulz, Jagan Teki, Heinrich Schuchardt, u-boot,
Jonas Karlman, Eugen Hristev
Rockchip SoCs typically use U-Boot TPL to initialize DRAM, then jumps
back to BootRom to load next stage, U-Boot SPL, into DRAM. BootRom then
jumps to U-Boot SPL to continue the normal boot flow.
However, there is no support to initialize DRAM on RK35xx SoCs using
U-Boot TPL and instead an external TPL binary must be used to generate a
bootable u-boot-rockchip.bin image.
Add CONFIG_ROCKCHIP_EXTERNAL_TPL to indicate that an external TPL should
be used. Build U-Boot with ROCKCHIP_TPL=/path/to/ddr.bin to generate a
bootable u-boot-rockchip.bin image for RK3568.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Tested-by: Eugen Hristev <eugen.hristev@collabora.com>
---
v3:
- Add help text to Kconfig option
- Add build step for rk3568 to documentation
- Collect r-b and t-b tags
v2:
- Rename external-tpl-path to rockchip-tpl-path
- Rename EXTERNAL_TPL to ROCKCHIP_TPL
- Add CONFIG_ROCKCHIP_EXTERNAL_TPL option
Makefile | 1 +
arch/arm/dts/rockchip-u-boot.dtsi | 10 ++++++++--
arch/arm/mach-rockchip/Kconfig | 8 ++++++++
doc/board/rockchip/rockchip.rst | 11 +++++++++++
4 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 54f894dab841..58f8c7a35335 100644
--- a/Makefile
+++ b/Makefile
@@ -1335,6 +1335,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
-a opensbi-path=${OPENSBI} \
-a default-dt=$(default_dt) \
-a scp-path=$(SCP) \
+ -a rockchip-tpl-path=$(ROCKCHIP_TPL) \
-a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \
-a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \
-a spl-dtb=$(CONFIG_SPL_OF_REAL) \
diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
index 6c662a72d4f9..2878b80926c4 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -20,9 +20,12 @@
mkimage {
filename = "idbloader.img";
args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
-#ifdef CONFIG_TPL
multiple-data-files;
+#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
+ rockchip-tpl {
+ };
+#elif defined(CONFIG_TPL)
u-boot-tpl {
};
#endif
@@ -134,9 +137,12 @@
mkimage {
filename = "idbloader-spi.img";
args = "-n", CONFIG_SYS_SOC, "-T", "rkspi";
-#ifdef CONFIG_TPL
multiple-data-files;
+#ifdef CONFIG_ROCKCHIP_EXTERNAL_TPL
+ rockchip-tpl {
+ };
+#elif defined(CONFIG_TPL)
u-boot-tpl {
};
#endif
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index b678ec41318e..0b191b364264 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -401,6 +401,14 @@ config TPL_ROCKCHIP_COMMON_BOARD
common board is a basic TPL board init which can be shared for most
of SoCs to avoid copy-paste for different SoCs.
+config ROCKCHIP_EXTERNAL_TPL
+ bool "Use external TPL binary"
+ default y if ROCKCHIP_RK3568
+ help
+ Some Rockchip SoCs require an external TPL to initialize DRAM.
+ Enable this option and build with ROCKCHIP_TPL=/path/to/ddr.bin to
+ include the external TPL in the image built by binman.
+
config ROCKCHIP_BOOT_MODE_REG
hex "Rockchip boot mode flag register address"
help
diff --git a/doc/board/rockchip/rockchip.rst b/doc/board/rockchip/rockchip.rst
index 28c837a38200..ac4dcce1a77d 100644
--- a/doc/board/rockchip/rockchip.rst
+++ b/doc/board/rockchip/rockchip.rst
@@ -86,6 +86,8 @@ List of mainline supported Rockchip boards:
- Radxa ROCK Pi 4 (rock-pi-4-rk3399)
- Rockchip Evb-RK3399 (evb_rk3399)
- Theobroma Systems RK3399-Q7 SoM - Puma (puma_rk3399)
+* rk3568
+ - Rockchip Evb-RK3568 (evb-rk3568)
* rv1108
- Rockchip Evb-rv1108 (evb-rv1108)
- Elgin-R1 (elgin-rv1108)
@@ -167,6 +169,15 @@ To build rk3399 boards:
make evb-rk3399_defconfig
make CROSS_COMPILE=aarch64-linux-gnu-
+To build rk3568 boards:
+
+.. code-block:: bash
+
+ export BL31=../rkbin/bin/rk35/rk3568_bl31_v1.34.elf
+ export ROCKCHIP_TPL=../rkbin/bin/rk35/rk3568_ddr_1560MHz_v1.13.bin
+ make evb-rk3568_defconfig
+ make CROSS_COMPILE=aarch64-linux-gnu-
+
Flashing
--------
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 4/5] rockchip: mkimage: Update init size limit
2023-02-17 20:52 [PATCH v3 0/5] rockchip: Use external TPL binary to create a working firmware image Jonas Karlman
` (2 preceding siblings ...)
2023-02-17 20:52 ` [PATCH v3 2/5] rockchip: Use an external TPL binary on RK3568 Jonas Karlman
@ 2023-02-17 20:52 ` Jonas Karlman
2023-02-18 4:43 ` Johan Jonker
2023-02-17 20:52 ` [PATCH v3 5/5] rockchip: evb-rk3568: Update defconfig Jonas Karlman
4 siblings, 1 reply; 9+ messages in thread
From: Jonas Karlman @ 2023-02-17 20:52 UTC (permalink / raw)
To: Simon Glass, Philipp Tomsich, Kever Yang, Joseph Chen,
Alper Nebi Yasak
Cc: Quentin Schulz, Jagan Teki, Heinrich Schuchardt, u-boot,
Jonas Karlman
Sync init size limit from vendor u-boot:
px30: 12KiB (+2KiB)
rk3066: 32KiB (+2KiB)
rk3328: 30KiB (+2KiB)
rk3568: 60KiB (-16KiB)
This makes it possible to use latest vendor TPL with RK3328 without
getting a size limit error running the mkimage command.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
v3:
- Sync with vendor u-boot as-is
- Update commit message to include size changes
v2:
- New patch
tools/rkcommon.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/rkcommon.c b/tools/rkcommon.c
index 1f1eaa16752b..630e54b1a54d 100644
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -121,20 +121,20 @@ struct spl_info {
};
static struct spl_info spl_infos[] = {
- { "px30", "RK33", 0x2800, false, RK_HEADER_V1 },
+ { "px30", "RK33", 0x4000 - 0x1000, false, RK_HEADER_V1 },
{ "rk3036", "RK30", 0x1000, false, RK_HEADER_V1 },
- { "rk3066", "RK30", 0x8000 - 0x800, true, RK_HEADER_V1 },
- { "rk3128", "RK31", 0x1800, false, RK_HEADER_V1 },
+ { "rk3066", "RK30", 0x8000, true, RK_HEADER_V1 },
+ { "rk3128", "RK31", 0x2000 - 0x800, false, RK_HEADER_V1 },
{ "rk3188", "RK31", 0x8000 - 0x800, true, RK_HEADER_V1 },
{ "rk322x", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
{ "rk3288", "RK32", 0x8000, false, RK_HEADER_V1 },
{ "rk3308", "RK33", 0x40000 - 0x1000, false, RK_HEADER_V1 },
- { "rk3328", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
+ { "rk3328", "RK32", 0x8000 - 0x800, false, RK_HEADER_V1 },
{ "rk3368", "RK33", 0x8000 - 0x1000, false, RK_HEADER_V1 },
{ "rk3399", "RK33", 0x30000 - 0x2000, false, RK_HEADER_V1 },
{ "rv1108", "RK11", 0x1800, false, RK_HEADER_V1 },
{ "rv1126", "110B", 0x10000 - 0x1000, false, RK_HEADER_V1 },
- { "rk3568", "RK35", 0x14000 - 0x1000, false, RK_HEADER_V2 },
+ { "rk3568", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
};
/**
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v3 5/5] rockchip: evb-rk3568: Update defconfig
2023-02-17 20:52 [PATCH v3 0/5] rockchip: Use external TPL binary to create a working firmware image Jonas Karlman
` (3 preceding siblings ...)
2023-02-17 20:52 ` [PATCH v3 4/5] rockchip: mkimage: Update init size limit Jonas Karlman
@ 2023-02-17 20:52 ` Jonas Karlman
4 siblings, 0 replies; 9+ messages in thread
From: Jonas Karlman @ 2023-02-17 20:52 UTC (permalink / raw)
To: Simon Glass, Philipp Tomsich, Kever Yang, Joseph Chen,
Alper Nebi Yasak
Cc: Quentin Schulz, Jagan Teki, Heinrich Schuchardt, u-boot,
Jonas Karlman
Update defconfig for evb-rk3568 with new defaults.
Remove the SPL_ROCKCHIP_BACK_TO_BROM=y option, SPL is expected to load
next stage from a FIT image and then jump to next stage not back to
BootRom.
Add CONFIG_SPL_FIT_SIGNATURE=y to let SPL verify an auto generated hash
of FIT images. This help indicate if there is an issue loading any of
the images to DRAM or SRAM.
Extend SPL_MAX_SIZE to 0x40000, SPL is loaded to 0x0 and TF-A is loaded
to 0x40000, use the space in between as SPL_MAX_SIZE.
Add CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y to prevent vendor TF-A from
crashing in some cases when fdt_addr is provided as platform param.
Filter out assigned-clock props with CONFIG_OF_SPL_REMOVE_PROPS,
U-Boot proper will read and configure assigned-clock props.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
v3:
- Rebased on resynced savedefconfigs
v2:
- New patch
configs/evb-rk3568_defconfig | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/configs/evb-rk3568_defconfig b/configs/evb-rk3568_defconfig
index 0f72925b3a32..9c380aa5fe3d 100644
--- a/configs/evb-rk3568_defconfig
+++ b/configs/evb-rk3568_defconfig
@@ -11,9 +11,7 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc00000
CONFIG_DEFAULT_DEVICE_TREE="rk3568-evb"
CONFIG_DM_RESET=y
CONFIG_ROCKCHIP_RK3568=y
-CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
CONFIG_SPL_ROCKCHIP_COMMON_BOARD=y
-CONFIG_SPL_MMC=y
CONFIG_SPL_SERIAL=y
CONFIG_SPL_STACK_R_ADDR=0x600000
CONFIG_TARGET_EVB_RK3568=y
@@ -24,11 +22,12 @@ CONFIG_SYS_LOAD_ADDR=0xc00800
CONFIG_DEBUG_UART=y
CONFIG_FIT=y
CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_FIT_SIGNATURE=y
CONFIG_SPL_LOAD_FIT=y
CONFIG_DEFAULT_FDT_FILE="rockchip/rk3568-evb.dtb"
# CONFIG_DISPLAY_CPUINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SPL_MAX_SIZE=0x20000
+CONFIG_SPL_MAX_SIZE=0x40000
CONFIG_SPL_PAD_TO=0x7f8000
CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
CONFIG_SPL_BSS_START_ADDR=0x4000000
@@ -37,12 +36,14 @@ CONFIG_SPL_BSS_MAX_SIZE=0x4000
# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
CONFIG_SPL_STACK_R=y
CONFIG_SPL_ATF=y
+CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
CONFIG_CMD_GPT=y
CONFIG_CMD_MMC=y
# CONFIG_CMD_SETEXPR is not set
# CONFIG_SPL_DOS_PARTITION is not set
CONFIG_SPL_OF_CONTROL=y
CONFIG_OF_LIVE=y
+CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_SPL_REGMAP=y
CONFIG_SPL_SYSCON=y
--
2.39.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v3 4/5] rockchip: mkimage: Update init size limit
2023-02-17 20:52 ` [PATCH v3 4/5] rockchip: mkimage: Update init size limit Jonas Karlman
@ 2023-02-18 4:43 ` Johan Jonker
2023-02-18 11:48 ` Johan Jonker
0 siblings, 1 reply; 9+ messages in thread
From: Johan Jonker @ 2023-02-18 4:43 UTC (permalink / raw)
To: Jonas Karlman, Simon Glass, Philipp Tomsich, Kever Yang,
Joseph Chen, Alper Nebi Yasak
Cc: Quentin Schulz, Jagan Teki, Heinrich Schuchardt, u-boot
Hi Jonas,
On 2/17/23 21:52, Jonas Karlman wrote:
> Sync init size limit from vendor u-boot:
This sync might not be correct.
Please recheck with each SoC or limit your change to the rk3328 SoC if prove fails.
Could Kever disclose SoC details here?
Johan
>
> px30: 12KiB (+2KiB)
> rk3066: 32KiB (+2KiB)
On the rk3066 the limitation depends on the bootrom logic and the tpl location it is loaded in memory:
//SPL
flash_boot_size = idb_buf[0].flash_boot_size;
size = flash_boot_size - 5;
if ( size >= 32763 )
flash_boot_size = 10;
//TPL
flash_data_size = idb_buf[0].flash_data_size;
if (flash_data_size - 4 >= 61 ||
flash_boot_size < flash_data_size ||
flash_data_size & 3) {
flash_data_size = 4;
}
offset = idb_buf[0].boot_code1_offset + start;
===
CONFIG_TPL_TEXT_BASE=0x10080C00
TPL/SPL truncated to 2048 = 4 sectors of 512bytes per NAND page.
Header size = 4 x 512bytes
limit1: flash_data_size - 4 >= 61
limit2: flash_boot_size < flash_data_size
===
usFlashDataSec = (ALIGN(dwLoaderDataSize, 2048)) / SECTOR_SIZE;
usFlashBootSec = (ALIGN(dwLoaderSize, 2048)) / SECTOR_SIZE;
dwSectorNum = 4 + usFlashDataSec + usFlashBootSec;
pSec0->usBootDataSize = usFlashDataSec;
pSec0->usBootCodeSize = usFlashDataSec + usFlashBootSec;
> rk3328: 30KiB (+2KiB)
> rk3568: 60KiB (-16KiB)
>
> This makes it possible to use latest vendor TPL with RK3328 without
> getting a size limit error running the mkimage command.
>
> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
> ---
> v3:
> - Sync with vendor u-boot as-is
> - Update commit message to include size changes
>
> v2:
> - New patch
>
> tools/rkcommon.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/tools/rkcommon.c b/tools/rkcommon.c
> index 1f1eaa16752b..630e54b1a54d 100644
> --- a/tools/rkcommon.c
> +++ b/tools/rkcommon.c
> @@ -121,20 +121,20 @@ struct spl_info {
> };
>
> static struct spl_info spl_infos[] = {
> - { "px30", "RK33", 0x2800, false, RK_HEADER_V1 },
> + { "px30", "RK33", 0x4000 - 0x1000, false, RK_HEADER_V1 },
> { "rk3036", "RK30", 0x1000, false, RK_HEADER_V1 },
> - { "rk3066", "RK30", 0x8000 - 0x800, true, RK_HEADER_V1 },
This is OK.
> - { "rk3128", "RK31", 0x1800, false, RK_HEADER_V1 },
> + { "rk3066", "RK30", 0x8000, true, RK_HEADER_V1 },
This wrong.
printf "%d\n" $(((0x8000 - 0x800 ) / 512))
60 sectors of size 512
> + { "rk3128", "RK31", 0x2000 - 0x800, false, RK_HEADER_V1 },
> { "rk3188", "RK31", 0x8000 - 0x800, true, RK_HEADER_V1 },
> { "rk322x", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
> { "rk3288", "RK32", 0x8000, false, RK_HEADER_V1 },
> { "rk3308", "RK33", 0x40000 - 0x1000, false, RK_HEADER_V1 },
> - { "rk3328", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
> + { "rk3328", "RK32", 0x8000 - 0x800, false, RK_HEADER_V1 },
> { "rk3368", "RK33", 0x8000 - 0x1000, false, RK_HEADER_V1 },
> { "rk3399", "RK33", 0x30000 - 0x2000, false, RK_HEADER_V1 },
> { "rv1108", "RK11", 0x1800, false, RK_HEADER_V1 },
> { "rv1126", "110B", 0x10000 - 0x1000, false, RK_HEADER_V1 },
> - { "rk3568", "RK35", 0x14000 - 0x1000, false, RK_HEADER_V2 },
> + { "rk3568", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
> };
>
> /**
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 4/5] rockchip: mkimage: Update init size limit
2023-02-18 4:43 ` Johan Jonker
@ 2023-02-18 11:48 ` Johan Jonker
2023-02-18 13:00 ` Jonas Karlman
0 siblings, 1 reply; 9+ messages in thread
From: Johan Jonker @ 2023-02-18 11:48 UTC (permalink / raw)
To: Jonas Karlman, Simon Glass, Philipp Tomsich, Kever Yang,
Joseph Chen, Alper Nebi Yasak
Cc: Quentin Schulz, Jagan Teki, Heinrich Schuchardt, u-boot
On 2/18/23 05:43, Johan Jonker wrote:
> Hi Jonas,
>
> On 2/17/23 21:52, Jonas Karlman wrote:
>> Sync init size limit from vendor u-boot:
>
> This sync might not be correct.
> Please recheck with each SoC or limit your change to the rk3328 SoC if prove fails.
> Could Kever disclose SoC details here?
>
> Johan
>
>>
>> px30: 12KiB (+2KiB)
>
>> rk3066: 32KiB (+2KiB)
>
>
> On the rk3066 the limitation depends on the bootrom logic and the tpl location it is loaded in memory:
>
> //SPL
> flash_boot_size = idb_buf[0].flash_boot_size;
> size = flash_boot_size - 5;
> if ( size >= 32763 )
> flash_boot_size = 10;
> //TPL
> flash_data_size = idb_buf[0].flash_data_size;
> if (flash_data_size - 4 >= 61 ||
> flash_boot_size < flash_data_size ||
> flash_data_size & 3) {
> flash_data_size = 4;
> }
>
> offset = idb_buf[0].boot_code1_offset + start;
>
> ===
>
> CONFIG_TPL_TEXT_BASE=0x10080C00
> TPL/SPL truncated to 2048 = 4 sectors of 512bytes per NAND page.
> Header size = 4 x 512bytes
>
> limit1: flash_data_size - 4 >= 61
> limit2: flash_boot_size < flash_data_size
>
> ===
>
> usFlashDataSec = (ALIGN(dwLoaderDataSize, 2048)) / SECTOR_SIZE;
> usFlashBootSec = (ALIGN(dwLoaderSize, 2048)) / SECTOR_SIZE;
>
> dwSectorNum = 4 + usFlashDataSec + usFlashBootSec;
>
> pSec0->usBootDataSize = usFlashDataSec;
> pSec0->usBootCodeSize = usFlashDataSec + usFlashBootSec;
>
>> rk3328: 30KiB (+2KiB)
>> rk3568: 60KiB (-16KiB)
>>
>> This makes it possible to use latest vendor TPL with RK3328 without
>> getting a size limit error running the mkimage command.
>>
>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>> ---
>> v3:
>> - Sync with vendor u-boot as-is
>> - Update commit message to include size changes
>>
>> v2:
>> - New patch
>>
>> tools/rkcommon.c | 10 +++++-----
>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/rkcommon.c b/tools/rkcommon.c
>> index 1f1eaa16752b..630e54b1a54d 100644
>> --- a/tools/rkcommon.c
>> +++ b/tools/rkcommon.c
>> @@ -121,20 +121,20 @@ struct spl_info {
>> };
>>
>> static struct spl_info spl_infos[] = {
>> - { "px30", "RK33", 0x2800, false, RK_HEADER_V1 },
>> + { "px30", "RK33", 0x4000 - 0x1000, false, RK_HEADER_V1 },
>> { "rk3036", "RK30", 0x1000, false, RK_HEADER_V1 },
>
>> - { "rk3066", "RK30", 0x8000 - 0x800, true, RK_HEADER_V1 },
>
> This is OK.
>
>> - { "rk3128", "RK31", 0x1800, false, RK_HEADER_V1 },
>
>> + { "rk3066", "RK30", 0x8000, true, RK_HEADER_V1 },
>
> This wrong.
This 0x8000 value was introduced in the manufacturer kernel with this patch.
rockchip: mkimage: add support for rockchip nand boot image
https://github.com/rockchip-linux/u-boot/commit/6f14746b0c5977b93f126c43b2a80198758399b9
However mainline u-boot for rk3066 makes use of BROM.
rockchip: rk3188: use boot0 hook to load up SPL in 2 steps
https://source.denx.de/u-boot/u-boot/-/commit/4d9253fb76f59c6f474ca54fe2d45c5706cd86e3
It follows the same size rules as for rk3188.
/* spl size 32kb sram - 2kb bootrom */
Unless Philipp Tomsich or someone else explains that it should be something different, please keep it as it is.
Johan
>
> printf "%d\n" $(((0x8000 - 0x800 ) / 512))
> 60 sectors of size 512
>
>
>> + { "rk3128", "RK31", 0x2000 - 0x800, false, RK_HEADER_V1 },
>> { "rk3188", "RK31", 0x8000 - 0x800, true, RK_HEADER_V1 },
>> { "rk322x", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
>> { "rk3288", "RK32", 0x8000, false, RK_HEADER_V1 },
>> { "rk3308", "RK33", 0x40000 - 0x1000, false, RK_HEADER_V1 },
>> - { "rk3328", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
>> + { "rk3328", "RK32", 0x8000 - 0x800, false, RK_HEADER_V1 },
>> { "rk3368", "RK33", 0x8000 - 0x1000, false, RK_HEADER_V1 },
>> { "rk3399", "RK33", 0x30000 - 0x2000, false, RK_HEADER_V1 },
>> { "rv1108", "RK11", 0x1800, false, RK_HEADER_V1 },
>> { "rv1126", "110B", 0x10000 - 0x1000, false, RK_HEADER_V1 },
>> - { "rk3568", "RK35", 0x14000 - 0x1000, false, RK_HEADER_V2 },
>> + { "rk3568", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
>> };
>>
>> /**
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 4/5] rockchip: mkimage: Update init size limit
2023-02-18 11:48 ` Johan Jonker
@ 2023-02-18 13:00 ` Jonas Karlman
0 siblings, 0 replies; 9+ messages in thread
From: Jonas Karlman @ 2023-02-18 13:00 UTC (permalink / raw)
To: Johan Jonker, Simon Glass, Philipp Tomsich, Kever Yang,
Joseph Chen, Alper Nebi Yasak
Cc: Quentin Schulz, Jagan Teki, Heinrich Schuchardt, u-boot
Hi Johan,
On 2023-02-18 12:48, Johan Jonker wrote:
>
>
> On 2/18/23 05:43, Johan Jonker wrote:
>> Hi Jonas,
>>
>> On 2/17/23 21:52, Jonas Karlman wrote:
>>> Sync init size limit from vendor u-boot:
>>
>> This sync might not be correct.
>> Please recheck with each SoC or limit your change to the rk3328 SoC if prove fails.
>> Could Kever disclose SoC details here?
>>
>> Johan
>>
>>>
>>> px30: 12KiB (+2KiB)
>>
>>> rk3066: 32KiB (+2KiB)
>>
>>
>> On the rk3066 the limitation depends on the bootrom logic and the tpl location it is loaded in memory:
>>
>> //SPL
>> flash_boot_size = idb_buf[0].flash_boot_size;
>> size = flash_boot_size - 5;
>> if ( size >= 32763 )
>> flash_boot_size = 10;
>> //TPL
>> flash_data_size = idb_buf[0].flash_data_size;
>> if (flash_data_size - 4 >= 61 ||
>> flash_boot_size < flash_data_size ||
>> flash_data_size & 3) {
>> flash_data_size = 4;
>> }
>>
>> offset = idb_buf[0].boot_code1_offset + start;
>>
>> ===
>>
>> CONFIG_TPL_TEXT_BASE=0x10080C00
>> TPL/SPL truncated to 2048 = 4 sectors of 512bytes per NAND page.
>> Header size = 4 x 512bytes
>>
>> limit1: flash_data_size - 4 >= 61
>> limit2: flash_boot_size < flash_data_size
>>
Interesting details, not sure from where this is referenced, is this
from the bootrom code?
If my understanding is correct these refer to the same thing:
usBootDataSize = flash_data_size = init_size
usBootCodeSize = flash_boot_size = init_boot_size
With 32KiB limit these would then in extreme case be:
flash_data_size = 4 + 64 = 68 (full use of 32KiB)
flash_boot_size = 68 + 1024 = 1092 (RK_MAX_BOOT_SIZE)
and with a 30KiB limit:
flash_data_size = 4 + 60 = 64 (full use of 30KiB)
flash_boot_size = 68 + 1024 = 1088 (RK_MAX_BOOT_SIZE)
With these limitations I fully understand why the value for rk3066
should not be changed, thanks.
>> ===
>>
>> usFlashDataSec = (ALIGN(dwLoaderDataSize, 2048)) / SECTOR_SIZE;
>> usFlashBootSec = (ALIGN(dwLoaderSize, 2048)) / SECTOR_SIZE;
>>
>> dwSectorNum = 4 + usFlashDataSec + usFlashBootSec;
>>
>> pSec0->usBootDataSize = usFlashDataSec;
>> pSec0->usBootCodeSize = usFlashDataSec + usFlashBootSec;
>>
>>> rk3328: 30KiB (+2KiB)
>>> rk3568: 60KiB (-16KiB)
>>>
>>> This makes it possible to use latest vendor TPL with RK3328 without
>>> getting a size limit error running the mkimage command.
>>>
>>> Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>>> ---
>>> v3:
>>> - Sync with vendor u-boot as-is
>>> - Update commit message to include size changes
>>>
>>> v2:
>>> - New patch
>>>
>>> tools/rkcommon.c | 10 +++++-----
>>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/tools/rkcommon.c b/tools/rkcommon.c
>>> index 1f1eaa16752b..630e54b1a54d 100644
>>> --- a/tools/rkcommon.c
>>> +++ b/tools/rkcommon.c
>>> @@ -121,20 +121,20 @@ struct spl_info {
>>> };
>>>
>>> static struct spl_info spl_infos[] = {
>>> - { "px30", "RK33", 0x2800, false, RK_HEADER_V1 },
>>> + { "px30", "RK33", 0x4000 - 0x1000, false, RK_HEADER_V1 },
>>> { "rk3036", "RK30", 0x1000, false, RK_HEADER_V1 },
>>
>
>>> - { "rk3066", "RK30", 0x8000 - 0x800, true, RK_HEADER_V1 },
>>
>> This is OK.
>>
>>> - { "rk3128", "RK31", 0x1800, false, RK_HEADER_V1 },
>>
>
>>> + { "rk3066", "RK30", 0x8000, true, RK_HEADER_V1 },
>>
>> This wrong.
>
> This 0x8000 value was introduced in the manufacturer kernel with this patch.
> rockchip: mkimage: add support for rockchip nand boot image
> https://github.com/rockchip-linux/u-boot/commit/6f14746b0c5977b93f126c43b2a80198758399b9>>
> However mainline u-boot for rk3066 makes use of BROM.
> rockchip: rk3188: use boot0 hook to load up SPL in 2 steps
> https://source.denx.de/u-boot/u-boot/-/commit/4d9253fb76f59c6f474ca54fe2d45c5706cd86e3>>
> It follows the same size rules as for rk3188.
> /* spl size 32kb sram - 2kb bootrom */
From what I could find in datasheet and TRM, the rk3066 have 64KiB sram
and the rk3188 have 32KiB, but I have learned you can not always trust
the datasheet and TRM :-)
>
> Unless Philipp Tomsich or someone else explains that it should be something different, please keep it as it is.
I fully agree, I will keep the value for rk3066 as it is.
The limit for rk3328 and rk3568 are the only ones I can confirm fixes
existing issues.
rk3328: vendor tpl size is exceeding the current limit of 28KiB
rk3568: only has 64KiB sram, current limit of 76 KiB do not fit
Will limit the change to only include rk3328 and rk3568.
Regards,
Jonas
>
> Johan
>
>
>>
>> printf "%d\n" $(((0x8000 - 0x800 ) / 512))
>> 60 sectors of size 512
>>
>>
>>> + { "rk3128", "RK31", 0x2000 - 0x800, false, RK_HEADER_V1 },
>>> { "rk3188", "RK31", 0x8000 - 0x800, true, RK_HEADER_V1 },
>>> { "rk322x", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
>>> { "rk3288", "RK32", 0x8000, false, RK_HEADER_V1 },
>>> { "rk3308", "RK33", 0x40000 - 0x1000, false, RK_HEADER_V1 },
>>> - { "rk3328", "RK32", 0x8000 - 0x1000, false, RK_HEADER_V1 },
>>> + { "rk3328", "RK32", 0x8000 - 0x800, false, RK_HEADER_V1 },
>>> { "rk3368", "RK33", 0x8000 - 0x1000, false, RK_HEADER_V1 },
>>> { "rk3399", "RK33", 0x30000 - 0x2000, false, RK_HEADER_V1 },
>>> { "rv1108", "RK11", 0x1800, false, RK_HEADER_V1 },
>>> { "rv1126", "110B", 0x10000 - 0x1000, false, RK_HEADER_V1 },
>>> - { "rk3568", "RK35", 0x14000 - 0x1000, false, RK_HEADER_V2 },
>>> + { "rk3568", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
>>> };
>>>
>>> /**
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-02-18 13:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-17 20:52 [PATCH v3 0/5] rockchip: Use external TPL binary to create a working firmware image Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 3/5] Revert "board: rockchip: Fix binman_init failure on EVB-RK3568" Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 1/5] binman: Add support for a rockchip-tpl entry Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 2/5] rockchip: Use an external TPL binary on RK3568 Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 4/5] rockchip: mkimage: Update init size limit Jonas Karlman
2023-02-18 4:43 ` Johan Jonker
2023-02-18 11:48 ` Johan Jonker
2023-02-18 13:00 ` Jonas Karlman
2023-02-17 20:52 ` [PATCH v3 5/5] rockchip: evb-rk3568: Update defconfig Jonas Karlman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.