Skip to content

Commit

Permalink
soc: nordic: nrf54h20: Disable USBHS core cache
Browse files Browse the repository at this point in the history
Configure USBHS core registers as non-cachable to prevent D-Cache from
inhibiting volatile accesses to the USBHS core registers.

Signed-off-by: Tomasz Moń <[email protected]>
  • Loading branch information
tmon-nordic authored and fabiobaltieri committed May 7, 2024
1 parent d77dc62 commit 149df6b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions soc/nordic/nrf54h/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ if(CONFIG_ARM)
zephyr_library_sources(soc.c)
endif()

zephyr_library_sources_ifdef(CONFIG_CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS mpu_regions.c)

zephyr_include_directories(.)

# Ensure that image size aligns with 16 bytes so that MRAMC finalizes all writes
Expand Down
2 changes: 2 additions & 0 deletions soc/nordic/nrf54h/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ config SOC_NRF54H20_CPUAPP
select CPU_HAS_DCACHE
select CPU_HAS_ICACHE
select CPU_HAS_FPU
select CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS
select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE

config SOC_NRF54H20_CPURAD
Expand All @@ -27,6 +28,7 @@ config SOC_NRF54H20_CPURAD
select CPU_HAS_DCACHE
select CPU_HAS_ICACHE
select CPU_HAS_FPU
select CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS
select HAS_SEGGER_RTT if ZEPHYR_SEGGER_MODULE

config SOC_NRF54H20_CPUPPR
Expand Down
23 changes: 23 additions & 0 deletions soc/nordic/nrf54h/mpu_regions.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2024 Nordic Semiconductor ASA.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/devicetree.h>
#include <zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h>

#define USBHS_BASE DT_REG_ADDR_BY_NAME(DT_NODELABEL(usbhs), core)
#define USBHS_SIZE DT_REG_SIZE_BY_NAME(DT_NODELABEL(usbhs), core)

static struct arm_mpu_region mpu_regions[] = {
#if DT_NODE_HAS_STATUS(DT_NODELABEL(usbhs), okay)
MPU_REGION_ENTRY("USBHS_CORE", USBHS_BASE,
REGION_RAM_NOCACHE_ATTR(USBHS_BASE, USBHS_SIZE)),
#endif
};

const struct arm_mpu_config mpu_config = {
.num_regions = ARRAY_SIZE(mpu_regions),
.mpu_regions = mpu_regions,
};

0 comments on commit 149df6b

Please sign in to comment.