Skip to content

Commit db86854

Browse files
tomchyrlubos
authored andcommitted
[nrf fromtree] soc: Boot matching radio slot
If the application uses slot 1 (i.e. in Direct XIP mode), boot radio slot 1 instead of slot 0. Signed-off-by: Tomasz Chyrowicz <[email protected]> (cherry picked from commit 9dd514c)
1 parent ca2646b commit db86854

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

soc/nordic/nrf54h/soc.c

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ LOG_MODULE_REGISTER(soc, CONFIG_SOC_LOG_LEVEL);
3232
#define HSFLL_NODE DT_NODELABEL(cpurad_hsfll)
3333
#endif
3434

35+
#ifdef CONFIG_USE_DT_CODE_PARTITION
36+
#define FLASH_LOAD_OFFSET DT_REG_ADDR(DT_CHOSEN(zephyr_code_partition))
37+
#elif defined(CONFIG_FLASH_LOAD_OFFSET)
38+
#define FLASH_LOAD_OFFSET CONFIG_FLASH_LOAD_OFFSET
39+
#endif
40+
41+
#define PARTITION_IS_RUNNING_APP_PARTITION(label) \
42+
(DT_REG_ADDR(DT_NODELABEL(label)) == FLASH_LOAD_OFFSET)
43+
3544
sys_snode_t soc_node;
3645

3746
#define FICR_ADDR_GET(node_id, name) \
@@ -44,8 +53,6 @@ sys_snode_t soc_node;
4453
ADDRESS_DOMAIN_Msk | \
4554
ADDRESS_BUS_Msk)))
4655

47-
#define DT_NODELABEL_CPURAD_SLOT0_PARTITION DT_NODELABEL(cpurad_slot0_partition)
48-
4956
static void power_domain_init(void)
5057
{
5158
/*
@@ -172,11 +179,26 @@ void soc_late_init_hook(void)
172179
*/
173180
uint8_t *msg = NULL;
174181
size_t msg_size = 0;
175-
176-
void *radiocore_address =
177-
(void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL_CPURAD_SLOT0_PARTITION)) +
178-
DT_REG_ADDR(DT_NODELABEL_CPURAD_SLOT0_PARTITION) +
182+
void *radiocore_address = NULL;
183+
184+
#if DT_NODE_EXISTS(DT_NODELABEL(cpurad_slot1_partition))
185+
if (PARTITION_IS_RUNNING_APP_PARTITION(slot1_partition)) {
186+
radiocore_address =
187+
(void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot1_partition))) +
188+
DT_REG_ADDR(DT_NODELABEL(cpurad_slot1_partition)) +
189+
CONFIG_ROM_START_OFFSET);
190+
} else {
191+
radiocore_address =
192+
(void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) +
193+
DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) +
194+
CONFIG_ROM_START_OFFSET);
195+
}
196+
#else
197+
radiocore_address =
198+
(void *)(DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(cpurad_slot0_partition))) +
199+
DT_REG_ADDR(DT_NODELABEL(cpurad_slot0_partition)) +
179200
CONFIG_ROM_START_OFFSET);
201+
#endif
180202

181203
/* Don't wait as this is not yet supported. */
182204
bool cpu_wait = false;

0 commit comments

Comments
 (0)