Skip to contentSkip to conversation

rockchip: rk3399-gru: Fix missing TPL and SPL banner on debug UART

PATCH In review Jonas Karlman 4 participants 10 messages Feb 8, 2025 – Feb 19, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover rockchip: rk3399-gru: Fix missing TPL and SPL banner on debug UART

The PP1500 and PP3000 power rails must be on very early for the U-Boot TPL and SPL banner to be shown on debug UART for bob and kevin.

This series restore the early power on of these power rails in board_debug_uart_init() for both TPL and SPL to restore the missing U-Boot TPL/SPL banner.

The reverted patches was introduced in v2024.04-rc1.

Jonas Karlman (3):
Revert "rockchip: rk3399: Drop unneeded bob and kevin board specific
code"
rockchip: rk3399-gru: Enable TPL_GPIO for bob and kevin Revert "rockchip: rk3399: Fix TPL build of bob and kevin"

 arch/arm/mach-rockchip/rk3399/rk3399.c | 23 ++++++++++++++++++++++-
 configs/chromebook_bob_defconfig       |  1 +
 configs/chromebook_kevin_defconfig     |  1 +
 3 files changed, 24 insertions(+), 1 deletion(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/3 Revert "rockchip: rk3399: Drop unneeded bob and kevin board specific code"

These power rails must be on very early for the U-Boos SPL banner to be show over debug UART.

This reverts commit af518a1dfe637cb4dc486d7a832585e4a48bc970.

---
 arch/arm/mach-rockchip/rk3399/rk3399.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3399/rk3399.c +22 -1
index 1ce43c6f0d40..ba89079b1e73 100644
@@ -7,6 +7,7 @@
 #include <init.h>
 #include <log.h>
 #include <spl.h>
+#include <spl_gpio.h>
 #include <syscon.h>
 #include <asm/armv8/mmu.h>
 #include <asm/arch-rockchip/bootrom.h>
@@ -15,7 +16,6 @@
 #include <asm/arch-rockchip/gpio.h>
 #include <asm/arch-rockchip/grf_rk3399.h>
 #include <asm/arch-rockchip/hardware.h>
-#include <asm/gpio.h>
 #include <linux/bitops.h>
 #include <linux/printk.h>
 #include <power/regulator.h>
@@ -133,6 +133,27 @@ void board_debug_uart_init(void)
 		     GRF_GPIO3B7_SEL_MASK,
 		     GRF_UART3_SOUT << GRF_GPIO3B7_SEL_SHIFT);
 #else
+	struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE;
+	struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE;
+
+	if (IS_ENABLED(CONFIG_SPL_BUILD) &&
+	    (IS_ENABLED(CONFIG_TARGET_CHROMEBOOK_BOB) ||
+	     IS_ENABLED(CONFIG_TARGET_CHROMEBOOK_KEVIN))) {
+		rk_setreg(&grf->io_vsel, 1 << 0);
+
+		/*
+		 * Let's enable these power rails here, we are already running
+		 * the SPI-Flash-based code.
+		 */
+		spl_gpio_output(gpio, GPIO(BANK_B, 2), 1);  /* PP1500_EN */
+		spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 2),
+				  GPIO_PULL_NORMAL);
+
+		spl_gpio_output(gpio, GPIO(BANK_B, 4), 1);  /* PP3000_EN */
+		spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 4),
+				  GPIO_PULL_NORMAL);
+	}
+
 	/* Enable early UART2 channel C on the RK3399 */
 	rk_clrsetreg(&grf->gpio4c_iomux,
 		     GRF_GPIO4C3_SEL_MASK,
Signature · 1 line
2.48.1
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] Revert "rockchip: rk3399: Drop unneeded bob and kevin board specific code"

Quoted 6 lines · Jonas Karlman

These power rails must be on very early for the U-Boos SPL banner to be show over debug UART.

This reverts commit af518a1dfe637cb4dc486d7a832585e4a48bc970.

Thanks,
- Kever

Quoted 52 lines
---
  arch/arm/mach-rockchip/rk3399/rk3399.c | 23 ++++++++++++++++++++++-
  1 file changed, 22 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3399/rk3399.c +22 -1
index 1ce43c6f0d40..ba89079b1e73 100644
@@ -7,6 +7,7 @@
  #include <init.h>
  #include <log.h>
  #include <spl.h>
+#include <spl_gpio.h>
  #include <syscon.h>
  #include <asm/armv8/mmu.h>
  #include <asm/arch-rockchip/bootrom.h>
@@ -15,7 +16,6 @@
  #include <asm/arch-rockchip/gpio.h>
  #include <asm/arch-rockchip/grf_rk3399.h>
  #include <asm/arch-rockchip/hardware.h>
-#include <asm/gpio.h>
  #include <linux/bitops.h>
  #include <linux/printk.h>
  #include <power/regulator.h>
@@ -133,6 +133,27 @@ void board_debug_uart_init(void)
  		     GRF_GPIO3B7_SEL_MASK,
  		     GRF_UART3_SOUT << GRF_GPIO3B7_SEL_SHIFT);
  #else
+	struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE;
+	struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE;
+
+	if (IS_ENABLED(CONFIG_SPL_BUILD) &&
+	    (IS_ENABLED(CONFIG_TARGET_CHROMEBOOK_BOB) ||
+	     IS_ENABLED(CONFIG_TARGET_CHROMEBOOK_KEVIN))) {
+		rk_setreg(&grf->io_vsel, 1 << 0);
+
+		/*
+		 * Let's enable these power rails here, we are already running
+		 * the SPI-Flash-based code.
+		 */
+		spl_gpio_output(gpio, GPIO(BANK_B, 2), 1);  /* PP1500_EN */
+		spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 2),
+				  GPIO_PULL_NORMAL);
+
+		spl_gpio_output(gpio, GPIO(BANK_B, 4), 1);  /* PP3000_EN */
+		spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 4),
+				  GPIO_PULL_NORMAL);
+	}
+
  	/* Enable early UART2 channel C on the RK3399 */
  	rk_clrsetreg(&grf->gpio4c_iomux,
  		     GRF_GPIO4C3_SEL_MASK,
#3 lore raw

PATCH 2/3 rockchip: rk3399-gru: Enable TPL_GPIO for bob and kevin

In reply to Jonas Karlman

The PP1500 and PP3000 power rails must be on very early for the U-Boot TPL banner to be shown on debug UART.

Enable TPL_GPIO Kconfig option for bob and kevin to allow use of spl_gpio.h functions in TPL.

---
This fixes a linking issue that otherwise would happen with next patch.

---
 configs/chromebook_bob_defconfig   | 1 +
 configs/chromebook_kevin_defconfig | 1 +
 2 files changed, 2 insertions(+)
configs/chromebook_bob_defconfig +1 -0
index 1b018ef4d7c8..5b8c0d35de6d 100644
@@ -35,6 +35,7 @@ CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
+CONFIG_TPL_GPIO=y
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
configs/chromebook_kevin_defconfig +1 -0
index 1ee0c0e6c9d8..a29a04aaddef 100644
@@ -36,6 +36,7 @@ CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
 CONFIG_TPL=y
+CONFIG_TPL_GPIO=y
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
Signature · 1 line
2.48.1
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] rockchip: rk3399-gru: Enable TPL_GPIO for bob and kevin

Quoted 7 lines · Jonas Karlman

The PP1500 and PP3000 power rails must be on very early for the U-Boot TPL banner to be shown on debug UART.

Enable TPL_GPIO Kconfig option for bob and kevin to allow use of spl_gpio.h functions in TPL.

Thanks,
- Kever

Quoted 31 lines

---
This fixes a linking issue that otherwise would happen with next patch.

---
  configs/chromebook_bob_defconfig   | 1 +
  configs/chromebook_kevin_defconfig | 1 +
  2 files changed, 2 insertions(+)
configs/chromebook_bob_defconfig +1 -0
index 1b018ef4d7c8..5b8c0d35de6d 100644
@@ -35,6 +35,7 @@ CONFIG_SPL_SPI_LOAD=y
  CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
  CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
  CONFIG_TPL=y
+CONFIG_TPL_GPIO=y
  CONFIG_CMD_BOOTZ=y
  CONFIG_CMD_GPIO=y
  CONFIG_CMD_GPT=y
configs/chromebook_kevin_defconfig +1 -0
index 1ee0c0e6c9d8..a29a04aaddef 100644
@@ -36,6 +36,7 @@ CONFIG_SPL_SPI_LOAD=y
  CONFIG_SYS_SPI_U_BOOT_OFFS=0xE0000
  CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
  CONFIG_TPL=y
+CONFIG_TPL_GPIO=y
  CONFIG_CMD_BOOTZ=y
  CONFIG_CMD_GPIO=y
  CONFIG_CMD_GPT=y
#5 lore raw

PATCH 3/3 Revert "rockchip: rk3399: Fix TPL build of bob and kevin"

In reply to Jonas Karlman

These power rails must be on very early for the U-Boos TPL banner to be show over debug UART.

This reverts commit 4576e65a5d6b10fd207c3a44061676ce0220d794.

---
 arch/arm/mach-rockchip/rk3399/rk3399.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3399/rk3399.c +1 -1
index ba89079b1e73..0c28241c603e 100644
@@ -136,7 +136,7 @@ void board_debug_uart_init(void)
 	struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE;
 	struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE;
 
-	if (IS_ENABLED(CONFIG_SPL_BUILD) &&
+	if (IS_ENABLED(CONFIG_XPL_BUILD) &&
 	    (IS_ENABLED(CONFIG_TARGET_CHROMEBOOK_BOB) ||
 	     IS_ENABLED(CONFIG_TARGET_CHROMEBOOK_KEVIN))) {
 		rk_setreg(&grf->io_vsel, 1 << 0);
Signature · 1 line
2.48.1
Reviewed-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] Revert "rockchip: rk3399: Fix TPL build of bob and kevin"

Quoted 6 lines · Jonas Karlman

These power rails must be on very early for the U-Boos TPL banner to be show over debug UART.

This reverts commit 4576e65a5d6b10fd207c3a44061676ce0220d794.

Thanks,
- Kever

Quoted 17 lines
---
  arch/arm/mach-rockchip/rk3399/rk3399.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3399/rk3399.c +1 -1
index ba89079b1e73..0c28241c603e 100644
@@ -136,7 +136,7 @@ void board_debug_uart_init(void)
  	struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE;
  	struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE;
 
-	if (IS_ENABLED(CONFIG_SPL_BUILD) &&
+	if (IS_ENABLED(CONFIG_XPL_BUILD) &&
  	    (IS_ENABLED(CONFIG_TARGET_CHROMEBOOK_BOB) ||
  	     IS_ENABLED(CONFIG_TARGET_CHROMEBOOK_KEVIN))) {
  		rk_setreg(&grf->io_vsel, 1 << 0);
#7 lore raw
In reply to Jonas Karlman

Hi Jonas,

Quoted 16 lines · Jonas Karlman

The PP1500 and PP3000 power rails must be on very early for the U-Boot TPL and SPL banner to be shown on debug UART for bob and kevin.

This series restore the early power on of these power rails in board_debug_uart_init() for both TPL and SPL to restore the missing U-Boot TPL/SPL banner.

The reverted patches was introduced in v2024.04-rc1.

Jonas Karlman (3):
Revert "rockchip: rk3399: Drop unneeded bob and kevin board specific
code"
rockchip: rk3399-gru: Enable TPL_GPIO for bob and kevin Revert "rockchip: rk3399: Fix TPL build of bob and kevin"

Quoted 8 lines
 arch/arm/mach-rockchip/rk3399/rk3399.c | 23 ++++++++++++++++++++++-
 configs/chromebook_bob_defconfig       |  1 +
 configs/chromebook_kevin_defconfig     |  1 +
 3 files changed, 24 insertions(+), 1 deletion(-)

--
2.48.1

Thanks for figuring this out! I'll let Tom run this through the labs.

Regards,
SImon

#8 lore raw
Quoted 24 lines · Simon Glass

Hi Jonas,

Quoted 21 lines · Jonas Karlman

The PP1500 and PP3000 power rails must be on very early for the U-Boot TPL and SPL banner to be shown on debug UART for bob and kevin.

This series restore the early power on of these power rails in board_debug_uart_init() for both TPL and SPL to restore the missing U-Boot TPL/SPL banner.

The reverted patches was introduced in v2024.04-rc1.

Jonas Karlman (3):
Revert "rockchip: rk3399: Drop unneeded bob and kevin board specific
code"
rockchip: rk3399-gru: Enable TPL_GPIO for bob and kevin Revert "rockchip: rk3399: Fix TPL build of bob and kevin"

 arch/arm/mach-rockchip/rk3399/rk3399.c | 23 ++++++++++++++++++++++-
 configs/chromebook_bob_defconfig       |  1 +
 configs/chromebook_kevin_defconfig     |  1 +
 3 files changed, 24 insertions(+), 1 deletion(-)
Quoted 5 lines
Quoted 3 lines

--
2.48.1

Thanks for figuring this out! I'll let Tom run this through the labs.

You should test it when you rebase your work on top of master again.

Signature · 1 line
Tom
#9 lore raw

Hi,

Quoted 25 lines · Tom Rini
Quoted 24 lines · Simon Glass

Hi Jonas,

Quoted 21 lines · Jonas Karlman

The PP1500 and PP3000 power rails must be on very early for the U-Boot TPL and SPL banner to be shown on debug UART for bob and kevin.

This series restore the early power on of these power rails in board_debug_uart_init() for both TPL and SPL to restore the missing U-Boot TPL/SPL banner.

The reverted patches was introduced in v2024.04-rc1.

Jonas Karlman (3):
Revert "rockchip: rk3399: Drop unneeded bob and kevin board specific
code"
rockchip: rk3399-gru: Enable TPL_GPIO for bob and kevin Revert "rockchip: rk3399: Fix TPL build of bob and kevin"

 arch/arm/mach-rockchip/rk3399/rk3399.c | 23 ++++++++++++++++++++++-
 configs/chromebook_bob_defconfig       |  1 +
 configs/chromebook_kevin_defconfig     |  1 +
 3 files changed, 24 insertions(+), 1 deletion(-)
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

--
2.48.1

Thanks for figuring this out! I'll let Tom run this through the labs.

You should test it when you rebase your work on top of master again.

Simon did a test-run of these two reverts and the addition of TPL_GPIO and reported the result over IRC before I posted this series. See https://www.irccloud.com/pastebin/tYAxuilC/

  $ pe
  e99d2863179 (HEAD) rockchip: rk3399: Enable TPL_GPIO for bob and kevin
  0cf50ad5247 Revert "rockchip: rk3399: Fix TPL build of bob and kevin"
  1973a377839 Revert "rockchip: rk3399: Drop unneeded bob and kevin board specific code"
  c2e00482d00 (us/master, us/WIP/06Feb2025) Merge tag 'xilinx-for-v2025.04-rc2' of https://source.denx.de/u-boot/custodians/u-boot-microblaze
  b3c09eb3652 (us/WIP/05Feb2025, tpm/master) arm64: configs: Remove SYS_BOOTM_LEN for TI devices
  93bcabd9b24 arm: Correct dependency for STATIC_MACH_TYPE
  b16e1db2a07 armv7m: kconfig adds the NVIC option and masks the GIC option when NVIC is selected
  e335f1e3bea Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sh
  0f019056b2d zynqmp: Save "bootseq" environment variable in decimal format
  eade90fd005 arm64: zynqmp: Describe images without TF-A
  $ ub-int bob
  Building U-Boot in sourcedir for chromebook_bob
  Bootstrapping U-Boot from dir /tmp/b/chromebook_bob
  Writing U-Boot using method em100

U-Boot TPL 2025.04-rc1-00144-ge99d28631796 (Feb 07 2025 - 07:09:15) Channel 0: LPDDR3, 933MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB Channel 1: LPDDR3, 933MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB 256B stride
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2025.04-rc1-00144-ge99d28631796 (Feb 07 2025 - 07:09:15 -0700) Bloblist at 100000 not found (err=-2)
Trying to boot from SPI
## Checking hash(es) for config config-1 ... OK
## Checking hash(es) for Image atf-1 ... sha256+ OK
## Checking hash(es) for Image u-boot ... sha256+ OK
## Checking hash(es) for Image fdt-1 ... sha256+ OK

Regards,
Jonas