u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Quentin Schulz <foss+uboot@0leil.net>
Cc: sjg@chromium.org, philipp.tomsich@vrull.eu,
	kever.yang@rock-chips.com, klaus.goger@theobroma-systems.com,
	knaerzche@gmail.com, u-boot@lists.denx.de,
	Quentin Schulz <quentin.schulz@theobroma-systems.com>,
	Quentin Schulz <foss+uboot@0leil.net>
Subject: [PATCH 09/12] rockchip: puma-rk3399: migrate to TPL
Date: Fri, 22 Jul 2022 18:06:52 +0200	[thread overview]
Message-ID: <20220722160655.3904213-10-foss+uboot@0leil.net> (raw)
In-Reply-To: <20220722160655.3904213-1-foss+uboot@0leil.net>

From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Depending on the toolchain used to compile the SPL for Puma RK3399-Q7
module, the board does not boot because the resulting binary is too big
to fit in SRAM.

Let's add a TPL so that there's no need to fiddle with or hack the
defconfig to have a working bootloader.

This follows what's been done for the majority of other RK3399-based
boards.

See the original commit for the first migrations:
bdc00080111f "rockchip: rk3399: update defconfig for TPL"

Unfortunately, the offset in SPI-NOR for U-Boot proper needs to be
modified, since the move from SPL to TPL+SPL for idbloader.img (and the
"only the first 2KB per 4KB blocks are written" "hack" for rkspi format)
increased the size above 256KB. Let's move it to 512KB to, hopefully, be
safe.

Cc: Quentin Schulz <foss+uboot@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi | 2 +-
 board/theobroma-systems/puma_rk3399/README  | 8 ++++----
 configs/puma-rk3399_defconfig               | 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi b/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
index 5dc345bbe8..27a792fe6d 100644
--- a/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
@@ -14,7 +14,7 @@
 
 / {
 	config {
-		u-boot,spl-payload-offset = <0x40000>; /* @ 256KB */
+		u-boot,spl-payload-offset = <0x80000>; /* @ 512KB */
 		u-boot,mmc-env-offset = <0x4000>;      /* @  16KB */
 		u-boot,efi-partition-entries-offset = <0x200000>; /* 2MB */
 		u-boot,boot-led = "module_led";
diff --git a/board/theobroma-systems/puma_rk3399/README b/board/theobroma-systems/puma_rk3399/README
index 254c3bbe96..550bdfb1f4 100644
--- a/board/theobroma-systems/puma_rk3399/README
+++ b/board/theobroma-systems/puma_rk3399/README
@@ -51,13 +51,13 @@ The SPL image for SD-Card/eMMC is readily available in idbloader.img at the
 root of U-Boot after compilation.
 
 Creating an SPL image for SPI-NOR:
-  > tools/mkimage -n rk3399 -T rkspi -d spl/u-boot-spl.bin idbloader-spi.img
+  > tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl.bin:spl/u-boot-spl.bin idbloader-spi.img
 
 Flash the image
 ===============
 
-Copy the SPL to offset 32k for SD/eMMC, offset 0 for NOR-Flash and the FIT
-image to offset 256k.
+Copy the SPL to offset 32k and the FIT image to offset 256k for SD/eMMC.
+Copy the SPL to offset 0 and the FIT image to offset 512k for NOR-Flash.
 
 SD-Card
 -------
@@ -98,4 +98,4 @@ help of the Rockchip loader binary.
   > ./rkdeveloptool db rkbin/rk3399_loader_spinor_v1.25.114.bin
   > ./rkdeveloptool ef
   > ./rkdeveloptool wl 0 ../idbloader-spi.img
-  > ./rkdeveloptool wl 512 ../u-boot.itb
+  > ./rkdeveloptool wl 1024 ../u-boot.itb
diff --git a/configs/puma-rk3399_defconfig b/configs/puma-rk3399_defconfig
index 3567cd078b..c70dbe9ed5 100644
--- a/configs/puma-rk3399_defconfig
+++ b/configs/puma-rk3399_defconfig
@@ -7,7 +7,6 @@ CONFIG_SPL_GPIO=y
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3399-puma-haikou"
-CONFIG_SPL_TEXT_BASE=0xff8c2000
 CONFIG_ROCKCHIP_RK3399=y
 CONFIG_ROCKCHIP_BOOT_MODE_REG=0x0
 CONFIG_TARGET_PUMA_RK3399=y
@@ -22,11 +21,12 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_MISC_INIT_R=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200
 CONFIG_SPL_I2C=y
 CONFIG_SPL_POWER=y
 CONFIG_SPL_SPI_LOAD=y
+CONFIG_TPL=y
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
-- 
2.37.1


  parent reply	other threads:[~2022-07-22 16:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 16:06 [PATCH 00/12] Puma RK3399 migration to TPL and numerous fixes Quentin Schulz
2022-07-22 16:06 ` [PATCH 01/12] rockchip: puma-rk3399: fix boot_targets swap depending on U-Boot proper load medium Quentin Schulz
2022-09-04 11:41   ` Kever Yang
2022-07-22 16:06 ` [PATCH 02/12] rockchip: puma-rk3399: use gpio-hog instead of fixed-regulator for enabling eMMC/SPI-NOR Quentin Schulz
2022-09-01 13:04   ` Kever Yang
2022-07-22 16:06 ` [PATCH 03/12] rockchip: puma-rk3399: allow non-SD-Card-loaded SPL to load U-Boot proper from SD-Card Quentin Schulz
2022-09-01 13:04   ` Kever Yang
2022-07-22 16:06 ` [PATCH 04/12] rockchip: puma-rk3399: remove unused default ENV_OFFSET for SPI flashes Quentin Schulz
2022-09-01 13:04   ` Kever Yang
2022-07-22 16:06 ` [PATCH 05/12] rockchip: puma-rk3399: load environment from same MMC as used for loading U-Boot proper Quentin Schulz
2022-09-01 13:05   ` Kever Yang
2022-07-22 16:06 ` [PATCH 06/12] rockchip: puma-rk3399: allow loading environment from SPI-NOR flash Quentin Schulz
2022-09-01 13:05   ` Kever Yang
2022-07-22 16:06 ` [PATCH 07/12] rockchip: puma-rk3399: load environment from same medium as one used to load U-Boot proper Quentin Schulz
2022-09-01 13:03   ` Kever Yang
2022-09-01 13:13     ` Quentin Schulz
2022-09-04 11:49       ` Kever Yang
2022-09-06  9:22         ` Quentin Schulz
2022-09-14  9:17           ` patrick.delaunay
2022-09-20 12:28             ` Kever Yang
2022-09-20 14:02               ` Quentin Schulz
2022-07-22 16:06 ` [PATCH 08/12] rockchip: puma-rk3399: remove useless CONFIG_SYS_SPI_U_BOOT_OFFS Quentin Schulz
2022-09-01 13:05   ` Kever Yang
2022-07-22 16:06 ` Quentin Schulz [this message]
2022-09-01 13:05   ` [PATCH 09/12] rockchip: puma-rk3399: migrate to TPL Kever Yang
2022-09-04 11:52   ` Kever Yang
2022-07-22 16:06 ` [PATCH 10/12] rockchip: puma-rk3399: migrate to u-boot-rockchip.bin Quentin Schulz
2022-09-01 13:06   ` Kever Yang
2022-07-22 16:06 ` [PATCH 11/12] rockchip: lion-rk3368: " Quentin Schulz
2022-07-22 16:06 ` [PATCH 12/12] rockchip: puma-rk3399: migrate to u-boot-rockchip-spi.bin Quentin Schulz
2022-09-01 13:06   ` Kever Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220722160655.3904213-10-foss+uboot@0leil.net \
    --to=foss+uboot@0leil.net \
    --cc=kever.yang@rock-chips.com \
    --cc=klaus.goger@theobroma-systems.com \
    --cc=knaerzche@gmail.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=quentin.schulz@theobroma-systems.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).