Skip to content

Commit 7651c32

Browse files
committed
nrf_security: kmu: nrf7120 uses nrfx api for sicr permission
Use nrfx api for setting write permission in mram confignvr sicr block Signed-off-by: Travis Lam <[email protected]>
1 parent 69b449d commit 7651c32

File tree

1 file changed

+4
-38
lines changed
  • subsys/nrf_security/src/drivers/cracen/cracenpsa/src

1 file changed

+4
-38
lines changed

subsys/nrf_security/src/drivers/cracen/cracenpsa/src/lib_kmu.c

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
#elif defined(CONFIG_SOC_SERIES_NRF71X)
1818
#include <nrfx_mramc.h>
1919

20-
#define REG_MRAMC_CONFIGNVR_PAGE_3 (uint32_t *)((uint32_t)NRF_MRAMC + 0x58C)
21-
#define MRAM_SICR_ENABLE_WRITE_ERASE 0xFFF00022
22-
#define MRAM_SICR_DISABLE_WRITE_ERASE 0x0
23-
#endif
24-
2520
#include <cracen/lib_kmu.h>
2621

2722
#ifdef KMU_TASKS_BLOCK_ResetValue
@@ -42,35 +37,6 @@ void lib_kmu_clear_all_events(void)
4237
#endif
4338
}
4439

45-
#if defined(CONFIG_SOC_SERIES_NRF71X)
46-
static void mram_enable_kmu_write_erase_to_sicr(bool permission)
47-
{
48-
/* CONFIGNVR.PAGE[3] contain the SICR info block
49-
* setting info block write and erase permission to
50-
* allow KMU to write to SICR in MRAM.
51-
*
52-
* Register not available on hal_nordic this version, need
53-
* to update this when it is available, WZN-5799.
54-
*/
55-
static nrf_mramc_readynext_timeout_t prev_readynext_timeout;
56-
57-
if (permission) {
58-
/* Save previous readynext timeout value */
59-
nrf_mramc_readynext_timeout_get(NRF_MRAMC, &prev_readynext_timeout);
60-
nrf_mramc_readynext_timeout_t readynext_timeout = {
61-
.value = NRF_MRAMC_READYNEXTTIMEOUT_DEFAULT,
62-
.direct_write = true,
63-
};
64-
nrf_mramc_readynext_timeout_set(NRF_MRAMC, &readynext_timeout);
65-
} else {
66-
nrf_mramc_readynext_timeout_set(NRF_MRAMC, &prev_readynext_timeout);
67-
}
68-
69-
*REG_MRAMC_CONFIGNVR_PAGE_3 = permission ?
70-
MRAM_SICR_ENABLE_WRITE_ERASE : MRAM_SICR_DISABLE_WRITE_ERASE;
71-
}
72-
#endif
73-
7440
static int trigger_task_and_wait_for_event_or_error(volatile uint32_t *task,
7541
volatile uint32_t *event)
7642
{
@@ -131,7 +97,7 @@ int lib_kmu_provision_slot(int slot_id, struct kmu_src *kmu_src)
13197
#endif
13298
#elif defined(CONFIG_SOC_SERIES_NRF71X)
13399
/* Enable write and erase from KMU to SICR in MRAM */
134-
mram_enable_kmu_write_erase_to_sicr(true);
100+
nrfx_mramc_confignvr_perm_set(true, 3);
135101
#endif
136102

137103
NRF_KMU_S->KEYSLOT = slot_id;
@@ -149,7 +115,7 @@ int lib_kmu_provision_slot(int slot_id, struct kmu_src *kmu_src)
149115
#endif
150116
#elif defined(CONFIG_SOC_SERIES_NRF71X)
151117
/* Disable write and erase from KMU to SICR in MRAM */
152-
mram_enable_kmu_write_erase_to_sicr(false);
118+
nrfx_mramc_confignvr_perm_set(false, 3);
153119
#endif
154120

155121
return result;
@@ -195,7 +161,7 @@ int lib_kmu_revoke_slot(int slot_id)
195161
nrfx_rramc_write_enable_set(true, 0);
196162
#elif defined(CONFIG_SOC_SERIES_NRF71X)
197163
/* Enable write and erase from KMU to SICR in MRAM */
198-
mram_enable_kmu_write_erase_to_sicr(true);
164+
nrfx_mramc_confignvr_perm_set(true, 3);
199165
#endif
200166

201167
NRF_KMU_S->KEYSLOT = slot_id;
@@ -207,7 +173,7 @@ int lib_kmu_revoke_slot(int slot_id)
207173
nrfx_rramc_write_enable_set(false, 0);
208174
#elif defined(CONFIG_SOC_SERIES_NRF71X)
209175
/* Disable write and erase from KMU to SICR in MRAM */
210-
mram_enable_kmu_write_erase_to_sicr(false);
176+
nrfx_mramc_confignvr_perm_set(false, 3);
211177
#endif
212178

213179
return result;

0 commit comments

Comments
 (0)