Skip to content

Commit

Permalink
soc: fvp_aemv8r_aarch32: enable caches at init
Browse files Browse the repository at this point in the history
Enable at SoC boot time when enabled through Kconfig. Cache management
API is not used since it could be built without its support enabled.

Signed-off-by: Manuel Argüelles <[email protected]>
  • Loading branch information
manuargue committed Mar 28, 2023
1 parent a9539cf commit fb0a4d3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions soc/arm/arm/fvp_aemv8r_aarch32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library_sources_ifdef(CONFIG_ARM_MPU arm_mpu_regions.c)
zephyr_library_sources(soc.c)
1 change: 1 addition & 0 deletions soc/arm/arm/fvp_aemv8r_aarch32/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ config SOC_FVP_AEMV8R_AARCH32
select CPU_HAS_MPU
select GIC_V3
select GIC_SINGLE_SECURITY_STATE
select PLATFORM_SPECIFIC_INIT

endchoice
27 changes: 27 additions & 0 deletions soc/arm/arm/fvp_aemv8r_aarch32/soc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2023 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/kernel.h>
#include <zephyr/arch/arm/aarch32/cortex_a_r/cmsis.h>

void z_arm_platform_init(void)
{
if (IS_ENABLED(CONFIG_ICACHE)) {
if (!(__get_SCTLR() & SCTLR_I_Msk)) {
L1C_InvalidateICacheAll();
__set_SCTLR(__get_SCTLR() | SCTLR_I_Msk);
__ISB();
}
}

if (IS_ENABLED(CONFIG_DCACHE)) {
if (!(__get_SCTLR() & SCTLR_C_Msk)) {
L1C_InvalidateDCacheAll();
__set_SCTLR(__get_SCTLR() | SCTLR_C_Msk);
__DSB();
}
}
}

0 comments on commit fb0a4d3

Please sign in to comment.