arm64: zynqmp: Fix debug uart initialization

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
This commit is contained in:
Michal Simek 2022-02-17 14:28:42 +01:00
parent 05f0f269b7
commit 11381fba99
4 changed files with 36 additions and 12 deletions

View File

@ -1199,6 +1199,7 @@ config ARCH_ZYNQMP
select ARM64 select ARM64
select CLK select CLK
select DM select DM
select DEBUG_UART_BOARD_INIT if SPL && DEBUG_UART
select DM_ETH if NET select DM_ETH if NET
select DM_MAILBOX select DM_MAILBOX
select DM_MMC if MMC select DM_MMC if MMC

View File

@ -22,5 +22,6 @@ void prog_reg(unsigned long addr, unsigned long mask,
int psu_init(void); int psu_init(void);
unsigned long psu_post_config_data(void); unsigned long psu_post_config_data(void);
int psu_uboot_init(void);
#endif /* _PSU_INIT_GPL_H_ */ #endif /* _PSU_INIT_GPL_H_ */

View File

@ -19,9 +19,19 @@
#include <asm/arch/psu_init_gpl.h> #include <asm/arch/psu_init_gpl.h>
#include <asm/arch/sys_proto.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) 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(); board_early_init_r();
#ifdef CONFIG_SPL_ZYNQMP_DRAM_ECC_INIT #ifdef CONFIG_SPL_ZYNQMP_DRAM_ECC_INIT
zynqmp_ecc_init(); zynqmp_ecc_init();

View File

@ -313,10 +313,8 @@ static char *zynqmp_get_silicon_idcode_name(void)
} }
#endif #endif
#if defined(CONFIG_BOARD_EARLY_INIT_F) int __maybe_unused psu_uboot_init(void)
int board_early_init_f(void)
{ {
#if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED)
int ret; int ret;
ret = psu_init(); ret = psu_init();
@ -336,16 +334,30 @@ int board_early_init_f(void)
/* Delay is required for clocks to be propagated */ /* Delay is required for clocks to be propagated */
udelay(1000000); udelay(1000000);
#endif
#ifdef CONFIG_DEBUG_UART
/* Uart debug for sure */
debug_uart_init();
puts("Debug uart enabled\n"); /* or printch() */
#endif
return 0; return 0;
} }
#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
# 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 #endif
static int multi_boot(void) static int multi_boot(void)