[PATCH] arm64: zynqmp: fix tcm initialization for mini u-boot

Michal Simek michal.simek at amd.com
Wed Oct 23 09:29:48 CEST 2024



On 10/11/24 13:34, Padmarao Begari wrote:
> Fix the issue introduced by commit fed064477c2c
> ("arm64: zynqmp: Print an error for split to lock mode switch").
> The mini u-boot is hanging, because of the tcm is not initialized.
> The mini u-boot is using the tcm to reserve the mmu table and
> currently it is not initialized, so allowing u-boot to initialize
> the tcm.
> 
> Signed-off-by: Padmarao Begari <padmarao.begari at amd.com>
> ---
>   arch/arm/mach-zynqmp/cpu.c                    | 7 +++++--
>   arch/arm/mach-zynqmp/include/mach/sys_proto.h | 2 +-
>   2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-zynqmp/cpu.c b/arch/arm/mach-zynqmp/cpu.c
> index b24c1631479..6c43063bf23 100644
> --- a/arch/arm/mach-zynqmp/cpu.c
> +++ b/arch/arm/mach-zynqmp/cpu.c
> @@ -112,7 +112,7 @@ u64 get_page_table_size(void)
>   	return 0x14000;
>   }
>   
> -#if defined(CONFIG_SYS_MEM_RSVD_FOR_MMU) || defined(CONFIG_DEFINE_TCM_OCM_MMAP)
> +#if defined(CONFIG_DEFINE_TCM_OCM_MMAP)
>   void tcm_init(u8 mode)
>   {
>   	int ret;
> @@ -134,7 +134,10 @@ void tcm_init(u8 mode)
>   #ifdef CONFIG_SYS_MEM_RSVD_FOR_MMU
>   int arm_reserve_mmu(void)
>   {
> -	tcm_init(TCM_LOCK);
> +	puts("WARNING: Initializing TCM overwrites TCM content\n");
> +	initialize_tcm(TCM_LOCK);
> +	memset((void *)ZYNQMP_TCM_BASE_ADDR, 0, ZYNQMP_TCM_SIZE);
> +
>   	gd->arch.tlb_size = PGTABLE_SIZE;
>   	gd->arch.tlb_addr = ZYNQMP_TCM_BASE_ADDR;
>   
> diff --git a/arch/arm/mach-zynqmp/include/mach/sys_proto.h b/arch/arm/mach-zynqmp/include/mach/sys_proto.h
> index b3396db28f0..9af3ab5d6b6 100644
> --- a/arch/arm/mach-zynqmp/include/mach/sys_proto.h
> +++ b/arch/arm/mach-zynqmp/include/mach/sys_proto.h
> @@ -51,7 +51,7 @@ unsigned int zynqmp_get_silicon_version(void);
>   int check_tcm_mode(bool mode);
>   void initialize_tcm(bool mode);
>   void mem_map_fill(void);
> -#if defined(CONFIG_SYS_MEM_RSVD_FOR_MMU) || defined(CONFIG_DEFINE_TCM_OCM_MMAP)
> +#if defined(CONFIG_DEFINE_TCM_OCM_MMAP)
>   void tcm_init(u8 mode);
>   #endif
>   

Applied.
M


More information about the U-Boot mailing list