Skip to content

Commit a1982ad

Browse files
committed
[nrf noup] soc: nrf54l: Disable CRACEN RAMs on system off
Configure the CRACEN internal RAMs to avoid being retained during system off. Exiting system off triggers a system level reset so there is no need for the CRACEN RAMs to be retained during that. Also don't retain the CRACEN RAMs in system on idle if CRACEN is not used at all. Noup since the upstream code is not TFM aware yet and the edited function does not exist upstream. Ref: NCSDK-27427 Signed-off-by: Georgios Vasilakis <[email protected]>
1 parent acc516b commit a1982ad

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

soc/nordic/nrf54l/soc.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
#endif
3939
#include <soc/nrfx_coredep.h>
4040

41+
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(__NRF_TFM__)
42+
#include <hal/nrf_memconf.h>
43+
#endif
44+
4145
#include <system_nrf54l.h>
4246

4347
LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
@@ -175,6 +179,22 @@ int nordicsemi_nrf54l_init(void)
175179
#if !defined(CONFIG_TRUSTED_EXECUTION_NONSECURE) || defined(__NRF_TFM__)
176180
/* Currently not supported for non-secure */
177181
SystemCoreClockUpdate();
182+
183+
/* Don't retain CRACEN RAMs during System OFF
184+
* Cracen RAMs are:
185+
* Cracen PKEcode with ID 34 which corresponds to the bit (1 << 2) in memconf[1] register
186+
* Cracen KeyRam with ID 35 which corresponds to the bit (1 << 3) in memconf[1] register
187+
* TODO: Replace these with HAL defines when these are available
188+
*/
189+
nrf_memconf_ramblock_ret_mask_enable_set(NRF_MEMCONF, 1, (1 << 2), false);
190+
nrf_memconf_ramblock_ret_mask_enable_set(NRF_MEMCONF, 1, (1 << 3), false);
191+
192+
/* Don't retain CRACEN RAMs during System ON idle when CRACEN is not used */
193+
#if !defined(CONFIG_PSA_CRYPTO_DRIVER_CRACEN)
194+
nrf_memconf_ramblock_control_mask_enable_set(NRF_MEMCONF, 1, (1 << 2), false);
195+
nrf_memconf_ramblock_control_mask_enable_set(NRF_MEMCONF, 1, (1 << 3), false);
196+
#endif
197+
178198
#endif
179199

180200
#ifdef __NRF_TFM__

0 commit comments

Comments
 (0)