]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm64: zynqmp: Fix debug uart initialization
authorMichal Simek <michal.simek@xilinx.com>
Thu, 17 Feb 2022 13:28:42 +0000 (14:28 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 21 Feb 2022 12:20:29 +0000 (13:20 +0100)
The commit 0dba45864b2a ("arm: Init the debug UART") calls
debug_uart_init() from crt0.S but it won't work because SOC is not
configured yet. That's why create board_debug_uart_init() which calls
psu_init() via new psu_uboot_init() earlier before the first access to UART
in SPL. In full U-Boot call psu_uboot_init() only when
CONFIG_ZYNQMP_PSU_INIT_ENABLED is enabled.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/878dc2daaa8685346f889989fbfb98b2e44da7fb.1645104518.git.michal.simek@xilinx.com
arch/arm/Kconfig
arch/arm/mach-zynqmp/include/mach/psu_init_gpl.h
arch/arm/mach-zynqmp/spl.c
board/xilinx/zynqmp/zynqmp.c

index c5b21cd06e7935256797b883fe7ae4097b0abba0..5e237d86211a48c07f3fef5e64a624e78084eb9f 100644 (file)
@@ -1199,6 +1199,7 @@ config ARCH_ZYNQMP
        select ARM64
        select CLK
        select DM
+       select DEBUG_UART_BOARD_INIT if SPL && DEBUG_UART
        select DM_ETH if NET
        select DM_MAILBOX
        select DM_MMC if MMC
index e37acda2f89e7c6643eec2d194abe01b706eeee7..434a7fa20e43256d5645561e7918e5e084c2b10d 100644 (file)
@@ -22,5 +22,6 @@ void prog_reg(unsigned long addr, unsigned long mask,
 
 int psu_init(void);
 unsigned long psu_post_config_data(void);
+int psu_uboot_init(void);
 
 #endif /* _PSU_INIT_GPL_H_ */
index 6b836cbff2d75ae440f57b1c66b5eb1f1c1fc6fe..b428fd53121a576fe76471d61caf00ff1c0c1914 100644 (file)
 #include <asm/arch/psu_init_gpl.h>
 #include <asm/arch/sys_proto.h>
 
+#if defined(CONFIG_DEBUG_UART_BOARD_INIT)
+void board_debug_uart_init(void)
+{
+       psu_uboot_init();
+}
+#endif
+
 void board_init_f(ulong dummy)
 {
-       board_early_init_f();
+#if !defined(CONFIG_DEBUG_UART_BOARD_INIT)
+       psu_uboot_init();
+#endif
+
        board_early_init_r();
 #ifdef CONFIG_SPL_ZYNQMP_DRAM_ECC_INIT
        zynqmp_ecc_init();
index 3a10ed859d2c61d2f2da24cf6b3a1df8c747b233..70b3c81f128426a91e7c72c6a15980f84531078c 100644 (file)
@@ -313,10 +313,8 @@ static char *zynqmp_get_silicon_idcode_name(void)
 }
 #endif
 
-#if defined(CONFIG_BOARD_EARLY_INIT_F)
-int board_early_init_f(void)
+int __maybe_unused psu_uboot_init(void)
 {
-#if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED)
        int ret;
 
        ret = psu_init();
@@ -336,16 +334,30 @@ int board_early_init_f(void)
 
        /* Delay is required for clocks to be propagated */
        udelay(1000000);
-#endif
+       
+       return 0;
+}
 
-#ifdef CONFIG_DEBUG_UART
-       /* Uart debug for sure */
-       debug_uart_init();
-       puts("Debug uart enabled\n"); /* or printch() */
-#endif
+#if !defined(CONFIG_SPL_BUILD)
+# if defined(CONFIG_DEBUG_UART_BOARD_INIT)
+void board_debug_uart_init(void)
+{
+#  if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED)
+       psu_uboot_init();
+#  endif
+}
+# endif
 
-       return 0;
+# if defined(CONFIG_BOARD_EARLY_INIT_F)
+int board_early_init_f(void)
+{
+       int ret = 0;
+#  if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED) && !defined(CONFIG_DEBUG_UART_BOARD_INIT)
+       ret = psu_uboot_init();
+#  endif
+       return ret;
 }
+# endif
 #endif
 
 static int multi_boot(void)