[PATCH 0/5] xilinx: Fix issues in v2022.04-rc1/2

Hi,
I found that two commits which were recently merged to u-boot are breaking especially Xilinx ZynqMP boards. The commit 985503439762 ("fdt: Don't call board_fdt_blob_setup() and commit 0dba45864b2a ("arm: Init the debug UART") requires changes in platform to get u-boot work as worked before.
Thanks, Michal
Michal Simek (5): xilinx: Enable OF_BOARD for zynq and zynqmp boards arm64: zynqmp: Build psu_spl_init for SPL all the time arm64: zynqmp: Fix dependencies around ZYNQMP_PSU_INIT_ENABLED ARM: zynq: Fix debug uart initialization arm64: zynqmp: Fix debug uart initialization
arch/arm/Kconfig | 2 ++ arch/arm/mach-zynq/spl.c | 15 +++++---- arch/arm/mach-zynqmp/Kconfig | 1 + arch/arm/mach-zynqmp/Makefile | 2 +- .../mach-zynqmp/include/mach/psu_init_gpl.h | 1 + arch/arm/mach-zynqmp/spl.c | 12 ++++++- board/xilinx/common/board.c | 3 +- board/xilinx/zynq/board.c | 7 ++++ board/xilinx/zynqmp/zynqmp.c | 32 +++++++++++++------ configs/xilinx_zynq_virt_defconfig | 1 + configs/xilinx_zynqmp_virt_defconfig | 3 +- 11 files changed, 59 insertions(+), 20 deletions(-)

The commit 985503439762 ("fdt: Don't call board_fdt_blob_setup() without OF_BOARD") forced to enable OF_BOARD for platforms which provide DT externally. Zynq/ZynqMP boards are using this feature for a long time that's why there is a need to enable it by default.
Also code expects to return error in case of error that's why also fill it.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
board/xilinx/common/board.c | 3 ++- configs/xilinx_zynq_virt_defconfig | 1 + configs/xilinx_zynqmp_virt_defconfig | 1 + 3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 6fce23197a48..0068cb879263 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -319,7 +319,7 @@ __maybe_unused int xilinx_read_eeprom(void) return 0; }
-#if defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE) +#if defined(CONFIG_OF_BOARD) void *board_fdt_blob_setup(int *err) { void *fdt_blob; @@ -355,6 +355,7 @@ void *board_fdt_blob_setup(int *err)
debug("DTB is also not passed via %p\n", fdt_blob);
+ *err = -EINVAL; return NULL; } #endif diff --git a/configs/xilinx_zynq_virt_defconfig b/configs/xilinx_zynq_virt_defconfig index b19a7884ef47..5d180455f8d5 100644 --- a/configs/xilinx_zynq_virt_defconfig +++ b/configs/xilinx_zynq_virt_defconfig @@ -59,6 +59,7 @@ CONFIG_CMD_MTDPARTS=y CONFIG_CMD_MTDPARTS_SPREAD=y CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y CONFIG_CMD_UBI=y +CONFIG_OF_BOARD=y CONFIG_OF_LIST="zynq-zc702 zynq-zc706 zynq-zc770-xm010 zynq-zc770-xm011 zynq-zc770-xm011-x16 zynq-zc770-xm012 zynq-zc770-xm013 zynq-cc108 zynq-microzed zynq-minized zynq-picozed zynq-zed zynq-zturn zynq-zturn-v5 zynq-zybo zynq-zybo-z7 zynq-dlc20-rev1.0" CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_FAT=y diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig index dfe65cb401e7..9b1880867867 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -84,6 +84,7 @@ CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y CONFIG_CMD_UBI=y CONFIG_PARTITION_TYPE_GUID=y CONFIG_SPL_OF_CONTROL=y +CONFIG_OF_BOARD=y CONFIG_OF_LIST="avnet-ultra96-rev1 zynqmp-a2197-revA zynqmp-e-a2197-00-revA zynqmp-g-a2197-00-revA zynqmp-m-a2197-01-revA zynqmp-m-a2197-02-revA zynqmp-m-a2197-03-revA zynqmp-p-a2197-00-revA zynqmp-zc1232-revA zynqmp-zc1254-revA zynqmp-zc1751-xm015-dc1 zynqmp-zc1751-xm016-dc2 zynqmp-zc1751-xm017-dc3 zynqmp-zc1751-xm018-dc4 zynqmp-zc1751-xm019-dc5 zynqmp-zcu100-revC zynqmp-zcu102-rev1.1 zynqmp-zcu102-rev1.0 zynqmp-zcu102-revA zynqmp-zcu102-revB zynqmp-zcu104-revA zynqmp-zcu104-revC zynqmp-zcu106-revA zynqmp-zcu111-revA zynqmp-zcu1275-revA zynqmp-zcu1275-revB zynqmp-zcu1285-revA zynqmp-zcu208-revA zynqmp-zcu216-revA zynqmp-topic-miamimp-xilinx-xdp-v1r1 zynqmp-sm-k26-revA zynqmp-smk-k26-revA zynqmp-dlc21-revA" CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names interrupt-parent interrupts iommus power-domains" CONFIG_ENV_IS_NOWHERE=y

ZYNQMP_PSU_INIT_ENABLED specifically saying that has connection to full U-Boot not SPL that's why build psu_spl_init for SPL all the time.
Also disable ZYNQMP_PSU_INIT_ENABLED because it ends up in situation that psu_init() is called twice which is wrong. By default only SPL should call it.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
arch/arm/mach-zynqmp/Makefile | 2 +- configs/xilinx_zynqmp_virt_defconfig | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/mach-zynqmp/Makefile b/arch/arm/mach-zynqmp/Makefile index eb6c5112b375..4f9f6b56a98a 100644 --- a/arch/arm/mach-zynqmp/Makefile +++ b/arch/arm/mach-zynqmp/Makefile @@ -6,6 +6,6 @@ obj-y += clk.o obj-y += cpu.o obj-$(CONFIG_MP) += mp.o -obj-$(CONFIG_SPL_BUILD) += spl.o handoff.o +obj-$(CONFIG_SPL_BUILD) += spl.o handoff.o psu_spl_init.o obj-$(CONFIG_SPL_ZYNQMP_DRAM_ECC_INIT) += ecc_spl_init.o obj-$(CONFIG_ZYNQMP_PSU_INIT_ENABLED) += psu_spl_init.o diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig index 9b1880867867..def7696b3d34 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -20,7 +20,6 @@ CONFIG_CMD_FRU=y CONFIG_PMUFW_INIT_FILE="/mnt/disk/som/pmufw.bin" CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE="/mnt/disk/u-boot/pmu_obj.bin" CONFIG_ZYNQMP_USB=y -CONFIG_ZYNQMP_PSU_INIT_ENABLED=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y CONFIG_SYS_LOAD_ADDR=0x8000000

ZYNQMP_PSU_INIT_ENABLED is called only when BOARD_EARLY_INIT_F is defined that's why cover this dependency in Kconfig. board_early_init_f() is only part related to CONFIG_ZYNQMP_PSU_INIT_ENABLED which is disabled now that's why disable BOARD_EARLY_INIT_F and also build board_early_init_f() only when CONFIG_BOARD_EARLY_INIT_F is enabled.
Signed-off-by: Michal Simek michal.simek@xilinx.com ---
arch/arm/mach-zynqmp/Kconfig | 1 + board/xilinx/zynqmp/zynqmp.c | 2 ++ configs/xilinx_zynqmp_virt_defconfig | 1 - 3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig index f8b5906039d1..66045067d2fe 100644 --- a/arch/arm/mach-zynqmp/Kconfig +++ b/arch/arm/mach-zynqmp/Kconfig @@ -140,6 +140,7 @@ config DEFINE_TCM_OCM_MMAP
config ZYNQMP_PSU_INIT_ENABLED bool "Include psu_init" + select BOARD_EARLY_INIT_F help Include psu_init to full u-boot. SPL include psu_init by default.
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 242e143cbfd7..3a10ed859d2c 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -313,6 +313,7 @@ static char *zynqmp_get_silicon_idcode_name(void) } #endif
+#if defined(CONFIG_BOARD_EARLY_INIT_F) int board_early_init_f(void) { #if defined(CONFIG_ZYNQMP_PSU_INIT_ENABLED) @@ -345,6 +346,7 @@ int board_early_init_f(void)
return 0; } +#endif
static int multi_boot(void) { diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig index def7696b3d34..3bb54c86ca00 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -30,7 +30,6 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x10000000 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set CONFIG_USE_PREBOOT=y CONFIG_PREBOOT="run scsi_init;usb start" -CONFIG_BOARD_EARLY_INIT_F=y CONFIG_BOARD_EARLY_INIT_R=y CONFIG_SPL_STACK_R=y CONFIG_SPL_FPGA=y

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 ---
arch/arm/Kconfig | 1 + arch/arm/mach-zynq/spl.c | 15 +++++++++------ board/xilinx/zynq/board.c | 7 +++++++ 3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index ae5002c9e4d1..c5b21cd06e79 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -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 diff --git a/arch/arm/mach-zynq/spl.c b/arch/arm/mach-zynq/spl.c index b1a5184b6898..fea1c9b12ad1 100644 --- a/arch/arm/mach-zynq/spl.c +++ b/arch/arm/mach-zynq/spl.c @@ -16,17 +16,20 @@ #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 diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 1111ad6fca9c..26ef0488358d 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -25,6 +25,13 @@
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))

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 ---
arch/arm/Kconfig | 1 + .../mach-zynqmp/include/mach/psu_init_gpl.h | 1 + arch/arm/mach-zynqmp/spl.c | 12 ++++++- board/xilinx/zynqmp/zynqmp.c | 32 +++++++++++++------ 4 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c5b21cd06e79..5e237d86211a 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -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 diff --git a/arch/arm/mach-zynqmp/include/mach/psu_init_gpl.h b/arch/arm/mach-zynqmp/include/mach/psu_init_gpl.h index e37acda2f89e..434a7fa20e43 100644 --- a/arch/arm/mach-zynqmp/include/mach/psu_init_gpl.h +++ b/arch/arm/mach-zynqmp/include/mach/psu_init_gpl.h @@ -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_ */ diff --git a/arch/arm/mach-zynqmp/spl.c b/arch/arm/mach-zynqmp/spl.c index 6b836cbff2d7..b428fd53121a 100644 --- a/arch/arm/mach-zynqmp/spl.c +++ b/arch/arm/mach-zynqmp/spl.c @@ -19,9 +19,19 @@ #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(); diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 3a10ed859d2c..70b3c81f1284 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -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)

čt 17. 2. 2022 v 14:28 odesílatel Michal Simek michal.simek@xilinx.com napsal:
Hi,
I found that two commits which were recently merged to u-boot are breaking especially Xilinx ZynqMP boards. The commit 985503439762 ("fdt: Don't call board_fdt_blob_setup() and commit 0dba45864b2a ("arm: Init the debug UART") requires changes in platform to get u-boot work as worked before.
Thanks, Michal
Michal Simek (5): xilinx: Enable OF_BOARD for zynq and zynqmp boards arm64: zynqmp: Build psu_spl_init for SPL all the time arm64: zynqmp: Fix dependencies around ZYNQMP_PSU_INIT_ENABLED ARM: zynq: Fix debug uart initialization arm64: zynqmp: Fix debug uart initialization
arch/arm/Kconfig | 2 ++ arch/arm/mach-zynq/spl.c | 15 +++++---- arch/arm/mach-zynqmp/Kconfig | 1 + arch/arm/mach-zynqmp/Makefile | 2 +- .../mach-zynqmp/include/mach/psu_init_gpl.h | 1 + arch/arm/mach-zynqmp/spl.c | 12 ++++++- board/xilinx/common/board.c | 3 +- board/xilinx/zynq/board.c | 7 ++++ board/xilinx/zynqmp/zynqmp.c | 32 +++++++++++++------ configs/xilinx_zynq_virt_defconfig | 1 + configs/xilinx_zynqmp_virt_defconfig | 3 +- 11 files changed, 59 insertions(+), 20 deletions(-)
-- 2.35.0
Applied. M
participants (2)
-
Michal Simek
-
Michal Simek