Skip to contentSkip to conversation

rockchip: tpl.c #ifdef fixes

PATCH New Chris Webb 2 participants 7 messages Jul 19, 2019 – Jul 23, 2019

Subsystems (3)
lore
Share & tools
lore

Chris Webb

author
#0 lore raw

cover rockchip: tpl.c #ifdef fixes

These are two trivial patches which fix up the #ifdef conditionals in mach-rockchip/tpl.c to do the right thing in two configuration scenarios:

1. Debug UART enabled (for SPL and main U-Boot) but serial support disabled for the TPL stage.

2. TPL banner disabled by unsetting CONFIG_TPL_BANNER_PRINT.

I stumbled over these edge cases while trying various permitted config permutations, trying to make U-Boot less noisy without killing useful error messages.

The diffs are against u-boot-rockchip.git: this already has changes that haven't yet reached mainline u-boot yet, moving the relevant code from board specific source files into the shared mach-rockchip/tpl.c.

author
#1 lore raw

PATCH 1/2 rockchip: Fix TPL build without CONFIG_TPL_SERIAL_SUPPORT

If CONFIG_DEBUG_UART is set but CONFIG_TPL_SERIAL_SUPPORT is not, the serial output should be available in SPL and full U-Boot, but not built in TPL. However, the rockchip tpl.c instead fails to compile with undefined references to the debug UART.

Instead, initialise the debug UART and print the TPL banner only if both CONFIG_DEBUG_UART and CONFIG_TPL_SERIAL_SUPPORT are set.

Signed-off-by <[email protected]>
---
 arch/arm/mach-rockchip/tpl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/tpl.c +1 -1
index 0ff2a197ed..5df88bddeb 100644
@@ -44,7 +44,7 @@ void board_init_f(ulong dummy)
 	struct udevice *dev;
 	int ret;
 
-#ifdef CONFIG_DEBUG_UART
+#if defined(CONFIG_DEBUG_UART) && defined(CONFIG_TPL_SERIAL_SUPPORT)
 	/*
 	 * Debug UART can be used from here if required:
 	 *
#2 lore raw

PATCH 1/2 rockchip: Fix TPL build without CONFIG_TPL_SERIAL_SUPPORT

Hi Chris,

Quoted 9 lines · Chris Webb

If CONFIG_DEBUG_UART is set but CONFIG_TPL_SERIAL_SUPPORT is not, the serial output should be available in SPL and full U-Boot, but not built in TPL. However, the rockchip tpl.c instead fails to compile with undefined references to the debug UART.

Instead, initialise the debug UART and print the TPL banner only if both CONFIG_DEBUG_UART and CONFIG_TPL_SERIAL_SUPPORT are set.

Signed-off-by <[email protected]>

Thanks,
 - Kever

Quoted 18 lines
---
  arch/arm/mach-rockchip/tpl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/tpl.c +1 -1
index 0ff2a197ed..5df88bddeb 100644
@@ -44,7 +44,7 @@ void board_init_f(ulong dummy)
  	struct udevice *dev;
  	int ret;
 
-#ifdef CONFIG_DEBUG_UART
+#if defined(CONFIG_DEBUG_UART) && defined(CONFIG_TPL_SERIAL_SUPPORT)
  	/*
  	 * Debug UART can be used from here if required:
  	 *
#3 lore raw

PATCH 1/2 rockchip: Fix TPL build without CONFIG_TPL_SERIAL_SUPPORT【请注意,邮件由[email protected]代发】

Quoted 14 lines · Kever Yang

Hi Chris,

Quoted 9 lines · Chris Webb

If CONFIG_DEBUG_UART is set but CONFIG_TPL_SERIAL_SUPPORT is not, the serial output should be available in SPL and full U-Boot, but not built in TPL. However, the rockchip tpl.c instead fails to compile with undefined references to the debug UART.

Instead, initialise the debug UART and print the TPL banner only if both CONFIG_DEBUG_UART and CONFIG_TPL_SERIAL_SUPPORT are set.

Signed-off-by <[email protected]>

Applied to u-boot-rockchip, thanks!

Quoted 27 lines

Thanks,
 - Kever

Quoted 11 lines

---
  arch/arm/mach-rockchip/tpl.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/tpl.c +0 -0
index 0ff2a197ed..5df88bddeb 100644
@@ -44,7 +44,7 @@ void board_init_f(ulong dummy)
       struct udevice *dev;
       int ret;
Quoted 6 lines

  -#ifdef CONFIG_DEBUG_UART
+#if defined(CONFIG_DEBUG_UART) && defined(CONFIG_TPL_SERIAL_SUPPORT) /*
       * Debug UART can be used from here if required:
       *

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

author
#4 lore raw

PATCH 2/2 rockchip: TPL banner should depend on CONFIG_TPL_BANNER_PRINT

In reply to Chris Webb

The generic code in common/spl/spl.c allows TPL/SPL banners to be silenced by unsetting CONFIG_TPL_BANNER_PRINT or CONFIG_SPL_BANNER_PRINT respectively. However, arch/arm/mach-rockchip/tpl.c prints this banner unconditionally.

Fix the rockchip-specific tpl.c so that the TPL banner depends on CONFIG_TPL_BANNER_PRINT in the same way as the generic code.

Signed-off-by <[email protected]>
---
 arch/arm/mach-rockchip/tpl.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-rockchip/tpl.c +2 -0
index 5df88bddeb..55f6e922d0 100644
@@ -54,8 +54,10 @@ void board_init_f(ulong dummy)
 	 * printascii("string");
 	 */
 	debug_uart_init();
+#ifdef CONFIG_TPL_BANNER_PRINT
 	printascii("\nU-Boot TPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
 				U_BOOT_TIME ")\n");
+#endif
 #endif
 	ret = spl_early_init();
 	if (ret) {
#5 lore raw

PATCH 2/2 rockchip: TPL banner should depend on CONFIG_TPL_BANNER_PRINT

Hi Chris,

Quoted 9 lines · Chris Webb

The generic code in common/spl/spl.c allows TPL/SPL banners to be silenced by unsetting CONFIG_TPL_BANNER_PRINT or CONFIG_SPL_BANNER_PRINT respectively. However, arch/arm/mach-rockchip/tpl.c prints this banner unconditionally.

Fix the rockchip-specific tpl.c so that the TPL banner depends on CONFIG_TPL_BANNER_PRINT in the same way as the generic code.

Signed-off-by <[email protected]>

Thanks,
 - Kever

Quoted 20 lines
---
  arch/arm/mach-rockchip/tpl.c | 2 ++
  1 file changed, 2 insertions(+)
arch/arm/mach-rockchip/tpl.c +2 -0
index 5df88bddeb..55f6e922d0 100644
@@ -54,8 +54,10 @@ void board_init_f(ulong dummy)
  	 * printascii("string");
  	 */
  	debug_uart_init();
+#ifdef CONFIG_TPL_BANNER_PRINT
  	printascii("\nU-Boot TPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
  				U_BOOT_TIME ")\n");
+#endif
  #endif
  	ret = spl_early_init();
  	if (ret) {
#6 lore raw

PATCH 2/2 rockchip: TPL banner should depend on CONFIG_TPL_BANNER_PRINT【请注意,邮件由[email protected]代发】

Quoted 14 lines · Kever Yang

Hi Chris,

Quoted 9 lines · Chris Webb

The generic code in common/spl/spl.c allows TPL/SPL banners to be silenced by unsetting CONFIG_TPL_BANNER_PRINT or CONFIG_SPL_BANNER_PRINT respectively. However, arch/arm/mach-rockchip/tpl.c prints this banner unconditionally.

Fix the rockchip-specific tpl.c so that the TPL banner depends on CONFIG_TPL_BANNER_PRINT in the same way as the generic code.

Signed-off-by <[email protected]>

Applied to u-boot-rockchip, thanks!

Quoted 32 lines

Thanks,
 - Kever

Quoted 10 lines

---
  arch/arm/mach-rockchip/tpl.c | 2 ++

  1 file changed, 2 insertions(+)
arch/arm/mach-rockchip/tpl.c +0 -0
index 5df88bddeb..55f6e922d0 100644

arch/arm/mach-rockchip/tpl.c void board_init_f(ulong dummy) · line 63

Quoted 10 lines
arch/arm/mach-rockchip/tpl.c +2 -0
@@ -54,8 +54,10 @@ void board_init_f(ulong dummy)
        * printascii("string");
        */
       debug_uart_init();
+#ifdef CONFIG_TPL_BANNER_PRINT
       printascii("\nU-Boot TPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
                   U_BOOT_TIME ")\n");
+#endif
   #endif
       ret = spl_early_init();
       if (ret) {

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot