@@ -61,6 +61,26 @@ sys_snode_t soc_node;
6161 ADDRESS_DOMAIN_Msk | \
6262 ADDRESS_BUS_Msk)))
6363
64+ void nrf_soc_memconf_retain_set (bool enable )
65+ {
66+ uint32_t ret_mask = BIT (RAMBLOCK_RET_BIT_ICACHE ) | BIT (RAMBLOCK_RET_BIT_DCACHE );
67+
68+ nrf_memconf_ramblock_ret_mask_enable_set (NRF_MEMCONF , 0 , ret_mask , enable );
69+ nrf_memconf_ramblock_ret_mask_enable_set (NRF_MEMCONF , 1 , ret_mask , enable );
70+
71+ #if defined(RAMBLOCK_RET2_MASK )
72+ ret_mask = 0 ;
73+ #if defined(RAMBLOCK_RET2_BIT_ICACHE )
74+ ret_mask |= BIT (RAMBLOCK_RET2_BIT_ICACHE );
75+ #endif
76+ #if defined(RAMBLOCK_RET2_BIT_DCACHE )
77+ ret_mask |= BIT (RAMBLOCK_RET2_BIT_DCACHE );
78+ #endif
79+ nrf_memconf_ramblock_ret2_mask_enable_set (NRF_MEMCONF , 0 , ret_mask , enable );
80+ nrf_memconf_ramblock_ret2_mask_enable_set (NRF_MEMCONF , 1 , ret_mask , enable );
81+ #endif /* defined(RAMBLOCK_RET2_MASK) */
82+ }
83+
6484static void power_domain_init (void )
6585{
6686 /*
@@ -76,28 +96,12 @@ static void power_domain_init(void)
7696
7797 soc_lrcconf_poweron_request (& soc_node , NRF_LRCCONF_POWER_DOMAIN_0 );
7898 nrf_lrcconf_poweron_force_set (NRF_LRCCONF010 , NRF_LRCCONF_POWER_MAIN , false);
79-
80- nrf_memconf_ramblock_ret_enable_set (NRF_MEMCONF , 0 , RAMBLOCK_RET_BIT_ICACHE , false);
81- nrf_memconf_ramblock_ret_enable_set (NRF_MEMCONF , 0 , RAMBLOCK_RET_BIT_DCACHE , false);
82- nrf_memconf_ramblock_ret_enable_set (NRF_MEMCONF , 1 , RAMBLOCK_RET_BIT_ICACHE , false);
83- nrf_memconf_ramblock_ret_enable_set (NRF_MEMCONF , 1 , RAMBLOCK_RET_BIT_DCACHE , false);
84- #if defined(RAMBLOCK_RET2_BIT_ICACHE )
85- nrf_memconf_ramblock_ret2_enable_set (NRF_MEMCONF , 0 , RAMBLOCK_RET2_BIT_ICACHE , false);
86- nrf_memconf_ramblock_ret2_enable_set (NRF_MEMCONF , 1 , RAMBLOCK_RET2_BIT_ICACHE , false);
87- #endif
88- #if defined(RAMBLOCK_RET2_BIT_DCACHE )
89- nrf_memconf_ramblock_ret2_enable_set (NRF_MEMCONF , 0 , RAMBLOCK_RET2_BIT_DCACHE , false);
90- nrf_memconf_ramblock_ret2_enable_set (NRF_MEMCONF , 1 , RAMBLOCK_RET2_BIT_DCACHE , false);
91- #endif
99+ nrf_soc_memconf_retain_set (false);
92100 nrf_memconf_ramblock_ret_mask_enable_set (NRF_MEMCONF , 0 , RAMBLOCK_RET_MASK , true);
93101 nrf_memconf_ramblock_ret_mask_enable_set (NRF_MEMCONF , 1 , RAMBLOCK_RET_MASK , true);
94102#if defined(RAMBLOCK_RET2_MASK )
95- /*
96- * TODO: Use nrf_memconf_ramblock_ret2_mask_enable_set() function
97- * when will be provided by HAL.
98- */
99- NRF_MEMCONF -> POWER [0 ].RET2 = RAMBLOCK_RET2_MASK ;
100- NRF_MEMCONF -> POWER [1 ].RET2 = RAMBLOCK_RET2_MASK ;
103+ nrf_memconf_ramblock_ret2_mask_enable_set (NRF_MEMCONF , 0 , RAMBLOCK_RET2_MASK , true);
104+ nrf_memconf_ramblock_ret2_mask_enable_set (NRF_MEMCONF , 1 , RAMBLOCK_RET2_MASK , true);
101105#endif
102106}
103107
0 commit comments