Skip to content

Commit 67f181d

Browse files
committed
[nrf noup] drivers: rram: Mirror dts support from NVMC
Add missing support for non-Partition Manager builds. Mirrors the already existing solution in soc_flash_nrf.c Signed-off-by: Dag Erik Gjørvad <dag.erik.gjorvad@nordicsemi.no>
1 parent 542443e commit 67f181d

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/flash/soc_flash_nrf_rram.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ LOG_MODULE_REGISTER(flash_nrf_rram, CONFIG_FLASH_LOG_LEVEL);
5454
#define WRITE_BLOCK_SIZE_FROM_DT DT_PROP(RRAM, write_block_size)
5555
#define ERASE_VALUE 0xFF
5656

57-
#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER
57+
#if CONFIG_TRUSTED_EXECUTION_NONSECURE
5858
#include <soc_secure.h>
59+
#if USE_PARTITION_MANAGER
5960
#include <pm_config.h>
60-
#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER */
61+
#endif /* USE_PARTITION_MANAGER */
62+
#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE */
6163

6264
#ifdef CONFIG_MULTITHREADING
6365
static struct k_sem sem_lock;
@@ -297,11 +299,17 @@ static int nrf_rram_read(const struct device *dev, off_t addr, void *data, size_
297299
}
298300
addr += RRAM_START;
299301

300-
#if CONFIG_TRUSTED_EXECUTION_NONSECURE && USE_PARTITION_MANAGER && PM_APP_ADDRESS
302+
#if CONFIG_TRUSTED_EXECUTION_NONSECURE
303+
#if USE_PARTITION_MANAGER && PM_APP_ADDRESS
301304
if (addr < PM_APP_ADDRESS) {
302305
return soc_secure_mem_read(data, (void *)addr, len);
303306
}
307+
#elif !USE_PARTITION_MANAGER && DT_NODE_EXISTS(DT_NODELABEL(slot0_ns_partition))
308+
if ((uintptr_t)addr < DT_REG_ADDR(DT_NODELABEL(slot0_ns_partition))) {
309+
return soc_secure_mem_read(data, (void *)addr, len);
310+
}
304311
#endif
312+
#endif /* CONFIG_TRUSTED_EXECUTION_NONSECURE */
305313

306314
memcpy(data, (void *)addr, len);
307315

0 commit comments

Comments
 (0)