]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: zynq: Fix debug uart initialization
authorMichal Simek <michal.simek@xilinx.com>
Thu, 17 Feb 2022 13:28:41 +0000 (14:28 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 21 Feb 2022 12:20:24 +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
ps7_init() earlier before the first access to UART.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/18e67e02a0c7190839a1ef3a11f3fd6babcf34cc.1645104518.git.michal.simek@xilinx.com
arch/arm/Kconfig
arch/arm/mach-zynq/spl.c
board/xilinx/zynq/board.c

index ae5002c9e4d1d5b4de0b15ec480c404c6326dbb7..c5b21cd06e7935256797b883fe7ae4097b0abba0 100644 (file)
@@ -1157,6 +1157,7 @@ config ARCH_ZYNQ
        select CLK
        select CLK_ZYNQ
        select CPU_V7A
+       select DEBUG_UART_BOARD_INIT if SPL && DEBUG_UART
        select DM
        select DM_ETH if NET
        select DM_MMC if MMC
index b1a5184b689859729997a3c6be141ed2b525c482..fea1c9b12ad16c9b6c1385a9657d7580d7078f31 100644 (file)
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/ps7_init_gpl.h>
 
+#if defined(CONFIG_DEBUG_UART_BOARD_INIT)
+void board_debug_uart_init(void)
+{
+       ps7_init();
+}
+#endif
+
 void board_init_f(ulong dummy)
 {
+#if !defined(CONFIG_DEBUG_UART_BOARD_INIT)
        ps7_init();
+#endif
 
        arch_cpu_init();
-
-#ifdef CONFIG_DEBUG_UART
-       /* Uart debug for sure */
-       debug_uart_init();
-       puts("Debug uart enabled\n"); /* or printch() */
-#endif
 }
 
 #ifdef CONFIG_SPL_BOARD_INIT
index 1111ad6fca9c4ea5c29c0b317595c9018dd351d4..26ef0488358dcca5572a4bd50478097712a344d2 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DEBUG_UART_BOARD_INIT)
+void board_debug_uart_init(void)
+{
+       /* Add initialization sequence if UART is not configured */
+}
+#endif
+
 int board_init(void)
 {
        if (IS_ENABLED(CONFIG_SPL_BUILD))