u-boot/arch/arm/mach-stm32mp/stm32mp2/cpu.c
Tom Rini be0724601a Introduce STM32MP2 SoCs family support
Add STM32MP257F-EV1 board
 -----BEGIN PGP SIGNATURE-----
 
 iQJQBAABCgA6FiEEXyrViUccKBz9c35Jysd4L3sz/6YFAmVR87YcHHBhdHJpY2Uu
 Y2hvdGFyZEBmb3NzLnN0LmNvbQAKCRDKx3gvezP/ph+cD/0YFWkURt5TASxw49MB
 EE8PHjuWFPRVhR/lBX0vUxJRfltbmbJOKeGSZZeRW7LGApDVKVxKdrk2gGeLekJk
 L4i5KHBCDts35v3xfFhfxBYMYgXN7KiCo5Cv49b6ibxNeAUt/zKM1+CmLQWW+O8J
 60LhATQduTHE9/QYiZYJusO4ma+HOSlCgbE+4jwj19Y3DaridBZ0/P+yVarjB6Mo
 j/cpGkQ9YQekx0gD6OJjd13kU8LJ5/qaKpMhLhU5HwnxvSuosy1JX8r9gNA2x5yt
 EqscRJBnQE2pKCIekzETX347Es/vhcYM6YFIGyY40bDT83on2cgxFm4xKAZ4RdNb
 uT4G24AueIiyT3Rpd4vGv9cWuSksSiSxcAa4ouMGAxnNyDwJaJ7HYGqnQ4yA8doR
 VbtwK1bT6LutgMn7ymFAiDEYaeplhF4ybxvXZJT9/qjeMXfwhBGF9UYqQNDUCDah
 8ljbA0jIIV1SIVgYL4jPCwby9D53GGVtQ06SVXiJRhHgVJnkQaojByYU7xS8xrqS
 1j1Ccy9rmpixS4pt589Q1dKoPGiUVgh9Z58PpR9yrCWzIokIL0WTMttG0PkSUJYJ
 VpNuQbsKK3LZ01xbhVpZWauOoKTfK2Fe6XsF04WCP+cK8rM+uV6DeE+bqhnadj/M
 CHJscGOKvhIR3jkF10F5mMJ1RA==
 =E2zX
 -----END PGP SIGNATURE-----

Merge tag 'u-boot-stm32-20231113' of https://source.denx.de/u-boot/custodians/u-boot-stm into next

Introduce STM32MP2 SoCs family support
Add STM32MP257F-EV1 board

[trini: Adjust some includes]
Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-13 13:35:57 -05:00

107 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 <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();
}