mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-17 00:33:06 +00:00
01a701994b
Add initial support for STM32MP2 SoCs family. SoCs information are available here : https://www.st.com/content/st_com/en/campaigns/microprocessor-stm32mp2.html Migrate all MP1 related code into stm32mp1/ directory Create stm32mp2 directory dedicated for STM32MP2 SoCs. Common code to MP1, MP13 and MP25 is kept into arch/arm/mach-stm32/mach-stm32mp directory : - boot_params.c - bsec - cmd_stm32key - cmd_stm32prog - dram_init.c - syscon.c - ecdsa_romapi.c For STM32MP2, it also : - adds memory region description needed for ARMv8 MMU. - enables early data cache before relocation. During the transition before/after relocation, the MMU, initially setup at the beginning of DDR, must be setup again at a correct address after relocation. This is done in enables_caches() by disabling cache, force arch.tlb_fillptr to NULL which will force the MMU to be setup again but with a new value for gd->arch.tlb_addr. gd->arch.tlb_addr has been updated after relocation in arm_reserve_mmu(). Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
108 lines
2.2 KiB
C
108 lines
2.2 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
|
|
/*
|
|
* Copyright (C) 2023, STMicroelectronics - All Rights Reserved
|
|
*/
|
|
|
|
#define LOG_CATEGORY LOGC_ARCH
|
|
|
|
#include <common.h>
|
|
#include <clk.h>
|
|
#include <cpu_func.h>
|
|
#include <debug_uart.h>
|
|
#include <env_internal.h>
|
|
#include <init.h>
|
|
#include <misc.h>
|
|
#include <wdt.h>
|
|
#include <asm/io.h>
|
|
#include <asm/arch/stm32.h>
|
|
#include <asm/arch/sys_proto.h>
|
|
#include <asm/system.h>
|
|
#include <dm/device.h>
|
|
#include <dm/lists.h>
|
|
#include <dm/uclass.h>
|
|
|
|
/*
|
|
* early TLB into the .data section so that it not get cleared
|
|
* with 16kB alignment
|
|
*/
|
|
#define EARLY_TLB_SIZE 0xA000
|
|
u8 early_tlb[EARLY_TLB_SIZE] __section(".data") __aligned(0x4000);
|
|
|
|
/*
|
|
* initialize the MMU and activate cache in U-Boot pre-reloc stage
|
|
* MMU/TLB is updated in enable_caches() for U-Boot after relocation
|
|
*/
|
|
static void early_enable_caches(void)
|
|
{
|
|
if (CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
|
|
return;
|
|
|
|
if (!(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))) {
|
|
gd->arch.tlb_size = EARLY_TLB_SIZE;
|
|
gd->arch.tlb_addr = (unsigned long)&early_tlb;
|
|
}
|
|
/* enable MMU (default configuration) */
|
|
dcache_enable();
|
|
}
|
|
|
|
/*
|
|
* Early system init
|
|
*/
|
|
int arch_cpu_init(void)
|
|
{
|
|
icache_enable();
|
|
early_enable_caches();
|
|
|
|
return 0;
|
|
}
|
|
|
|
void enable_caches(void)
|
|
{
|
|
/* deactivate the data cache, early enabled in arch_cpu_init() */
|
|
dcache_disable();
|
|
/*
|
|
* Force the call of setup_all_pgtables() in mmu_setup() by clearing tlb_fillptr
|
|
* to update the TLB location udpated in board_f.c::reserve_mmu
|
|
*/
|
|
gd->arch.tlb_fillptr = 0;
|
|
dcache_enable();
|
|
}
|
|
|
|
/* used when CONFIG_DISPLAY_CPUINFO is activated */
|
|
int print_cpuinfo(void)
|
|
{
|
|
char name[SOC_NAME_SIZE];
|
|
|
|
get_soc_name(name);
|
|
printf("CPU: %s\n", name);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int arch_misc_init(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Force data-section, as .bss will not be valid
|
|
* when save_boot_params is invoked.
|
|
*/
|
|
static uintptr_t nt_fw_dtb __section(".data");
|
|
|
|
uintptr_t get_stm32mp_bl2_dtb(void)
|
|
{
|
|
return nt_fw_dtb;
|
|
}
|
|
|
|
/*
|
|
* Save the FDT address provided by TF-A in r2 at boot time
|
|
* This function is called from start.S
|
|
*/
|
|
void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2,
|
|
unsigned long r3)
|
|
{
|
|
nt_fw_dtb = r2;
|
|
|
|
save_boot_params_ret();
|
|
}
|