Skip to content

Commit bb1ffba

Browse files
committed
[nrf fromlist] soc: nordic: nrf54h: Add support for local cpurad GPPI
Add support for handling connections within the radio domain using the new GPPI helper. Upstream PR #: 100437 Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 54ee1a6 commit bb1ffba

File tree

5 files changed

+132
-1
lines changed

5 files changed

+132
-1
lines changed

soc/nordic/common/Kconfig.peripherals

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ config HAS_HW_NRF_DCNF
4242
def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_DCNF))
4343

4444
config HAS_HW_NRF_DPPIC
45-
def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_DPPIC))
45+
def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_DPPIC)) || \
46+
$(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_DPPIC_LOCAL))
4647

4748
config HAS_HW_NRF_ECB
4849
def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_ECB))

soc/nordic/common/gppi_init.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <helpers/nrfx_gppi.h>
88
#if defined(NRFX_GPPI_MULTI_DOMAIN) && !defined(NRFX_GPPI_FIXED_CONNECTIONS)
99
#include <soc/interconnect/nrfx_gppi_lumos.h>
10+
#elif defined(CONFIG_SOC_NRF54H20_CPURAD)
11+
#include <nrfx_gppi_cpurad.h>
1012
#endif
1113

1214
static int gppi_init(void)
@@ -47,6 +49,21 @@ static int gppi_init(void)
4749
NRFX_BIT_MASK(DPPIC20_GROUP_NUM_SIZE) & ~NRFX_DPPI20_GROUPS_USED);
4850
nrfx_gppi_groups_init(NRFX_GPPI_NODE_DPPIC30,
4951
NRFX_BIT_MASK(DPPIC30_GROUP_NUM_SIZE) & ~NRFX_DPPI30_GROUPS_USED);
52+
#elif defined(CONFIG_SOC_NRF54H20_CPURAD)
53+
gppi_instance.routes = nrfx_gppi_routes_get();
54+
gppi_instance.route_map = nrfx_gppi_route_map_get();
55+
gppi_instance.nodes = nrfx_gppi_nodes_get();
56+
57+
nrfx_gppi_channel_init(NRFX_GPPI_NODE_DPPIC020,
58+
NRFX_BIT_MASK(DPPIC020_CH_NUM_SIZE) & ~NRFX_DPPI020_CHANNELS_USED);
59+
nrfx_gppi_channel_init(NRFX_GPPI_NODE_DPPIC030,
60+
NRFX_BIT_MASK(DPPIC030_CH_NUM_SIZE) & ~NRFX_DPPI030_CHANNELS_USED);
61+
nrfx_gppi_channel_init(NRFX_GPPI_NODE_PPIB020_030,
62+
NRFX_BIT_MASK(PPIB020_NTASKSEVENTS_SIZE));
63+
nrfx_gppi_groups_init(NRFX_GPPI_NODE_DPPIC020,
64+
NRFX_BIT_MASK(DPPIC020_GROUP_NUM_SIZE) & ~NRFX_DPPI020_GROUPS_USED);
65+
nrfx_gppi_groups_init(NRFX_GPPI_NODE_DPPIC030,
66+
NRFX_BIT_MASK(DPPIC030_GROUP_NUM_SIZE) & ~NRFX_DPPI030_GROUPS_USED);
5067
#else
5168
#error "Not supported"
5269
#endif

soc/nordic/nrf54h/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ if(NOT CONFIG_SOC_NRF54H20_PM_S2RAM_OVERRIDE)
1717
zephyr_library_sources_ifdef(CONFIG_PM_S2RAM pm_s2ram.c)
1818
endif()
1919

20+
if(CONFIG_NRFX_GPPI AND NOT CONFIG_NRFX_GPPI_V1)
21+
zephyr_library_sources_ifdef(CONFIG_SOC_NRF54H20_CPURAD nrfx_gppi_cpurad.c)
22+
endif()
23+
2024
zephyr_include_directories(.)
2125

2226
# Ensure that image size aligns with 16 bytes so that MRAMC finalizes all writes
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
#include "nrfx_gppi_cpurad.h"
7+
8+
static nrfx_atomic_t channels[NRFX_GPPI_NODE_COUNT];
9+
static nrfx_atomic_t group_channels[NRFX_GPPI_NODE_DPPI_COUNT];
10+
11+
static const nrfx_gppi_node_t nodes[] = {
12+
NRFX_GPPI_DPPI_NODE_DEFINE(020, NRFX_GPPI_NODE_DPPIC020),
13+
NRFX_GPPI_DPPI_NODE_DEFINE(030, NRFX_GPPI_NODE_DPPIC030),
14+
NRFX_GPPI_PPIB_NODE_DEFINE(020, 030),
15+
};
16+
17+
static const nrfx_gppi_route_t dppi_routes[] = {
18+
NRFX_GPPI_ROUTE_DEFINE("slow_rad", (&nodes[NRFX_GPPI_NODE_DPPIC020])),
19+
NRFX_GPPI_ROUTE_DEFINE("fast_rad", (&nodes[NRFX_GPPI_NODE_DPPIC030])),
20+
NRFX_GPPI_ROUTE_DEFINE("slow_fast_rad",
21+
(&nodes[NRFX_GPPI_NODE_DPPIC020],
22+
&nodes[NRFX_GPPI_NODE_PPIB020_030],
23+
&nodes[NRFX_GPPI_NODE_DPPIC030])),
24+
};
25+
26+
static const nrfx_gppi_route_t *slow_rad_routes[] = {
27+
&dppi_routes[0], &dppi_routes[2]
28+
};
29+
30+
static const nrfx_gppi_route_t *fast_rad_routes[] = {
31+
&dppi_routes[1]
32+
};
33+
34+
static const nrfx_gppi_route_t **dppi_route_map[] = {
35+
slow_rad_routes, fast_rad_routes
36+
};
37+
38+
uint32_t nrfx_gppi_domain_id_get(uint32_t addr)
39+
{
40+
uint32_t domain = (addr >> 24) & BIT_MASK(3);
41+
uint32_t bus = (addr >> 16) & BIT_MASK(8);
42+
43+
(void)domain;
44+
__ASSERT_NO_MSG(domain == 3);
45+
switch (bus) {
46+
case 2:
47+
return NRFX_GPPI_NODE_DPPIC020;
48+
case 3:
49+
return NRFX_GPPI_NODE_DPPIC030;
50+
default:
51+
__ASSERT_NO_MSG(0);
52+
return 0;
53+
}
54+
}
55+
56+
const nrfx_gppi_route_t ***nrfx_gppi_route_map_get(void)
57+
{
58+
return dppi_route_map;
59+
}
60+
61+
const nrfx_gppi_route_t *nrfx_gppi_routes_get(void)
62+
{
63+
return dppi_routes;
64+
}
65+
66+
const nrfx_gppi_node_t *nrfx_gppi_nodes_get(void)
67+
{
68+
return nodes;
69+
}
70+
71+
void nrfx_gppi_channel_init(nrfx_gppi_node_id_t node_id, uint32_t ch_mask)
72+
{
73+
NRFX_ASSERT(node_id < NRFX_GPPI_NODE_COUNT);
74+
75+
*nodes[node_id].generic.p_channels = ch_mask;
76+
}
77+
78+
void nrfx_gppi_groups_init(nrfx_gppi_node_id_t node_id, uint32_t group_mask)
79+
{
80+
NRFX_ASSERT(node_id < NRFX_GPPI_NODE_DPPI_COUNT);
81+
82+
*nodes[node_id].dppi.p_group_channels = group_mask;
83+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef SOC_NORDIC_NRF54H_NRFX_GPPI_CPURAD_H_
8+
#define SOC_NORDIC_NRF54H_NRFX_GPPI_CPURAD_H_
9+
10+
#include <helpers/nrfx_gppi_routes.h>
11+
12+
typedef enum {
13+
NRFX_GPPI_NODE_DPPIC020,
14+
NRFX_GPPI_NODE_DPPIC030,
15+
NRFX_GPPI_NODE_DPPI_COUNT,
16+
NRFX_GPPI_NODE_PPIB020_030 = NRFX_GPPI_NODE_DPPI_COUNT,
17+
NRFX_GPPI_NODE_COUNT
18+
} nrfx_gppi_node_id_t;
19+
20+
const nrfx_gppi_route_t ***nrfx_gppi_route_map_get(void);
21+
const nrfx_gppi_route_t *nrfx_gppi_routes_get(void);
22+
const nrfx_gppi_node_t *nrfx_gppi_nodes_get(void);
23+
void nrfx_gppi_channel_init(nrfx_gppi_node_id_t node_id, uint32_t ch_mask);
24+
void nrfx_gppi_groups_init(nrfx_gppi_node_id_t node_id, uint32_t group_mask);
25+
26+
#endif /* SOC_NORDIC_NRF54H_NRFX_GPPI_CPURAD_H_ */

0 commit comments

Comments
 (0)