Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soc: nordic: nrf54h: gpd: align GPD domain names #82216

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/zephyr/dt-bindings/power/nordic-nrf-gpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
#define ZEPHYR_INCLUDE_DT_BINDINGS_POWER_NORDIC_NRF_GLOBAL_PD

/* numbers aligned to nrfs service identifiers */
#define NRF_GPD_SLOW_MAIN 2U
#define NRF_GPD_SLOW_ACTIVE 1U
#define NRF_GPD_FAST_MAIN 3U
#define NRF_GPD_FAST_ACTIVE1 0U
#define NRF_GPD_FAST_ACTIVE0 4U
#define NRF_GPD_FAST_ACTIVE0 0U
#define NRF_GPD_FAST_ACTIVE1 1U
#define NRF_GPD_FAST_MAIN 2U
#define NRF_GPD_SLOW_ACTIVE 3U
#define NRF_GPD_SLOW_MAIN 4U

#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_POWER_NORDIC_NRF_GLOBAL_PD */
42 changes: 39 additions & 3 deletions soc/nordic/nrf54h/gpd/gpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
LOG_MODULE_REGISTER(gpd, CONFIG_SOC_LOG_LEVEL);

/* enforce alignment between DT<->nrfs */
BUILD_ASSERT(GDPWR_POWER_DOMAIN_ACTIVE_FAST == NRF_GPD_FAST_ACTIVE1);
BUILD_ASSERT(GDPWR_POWER_DOMAIN_ACTIVE_SLOW == NRF_GPD_SLOW_ACTIVE);
BUILD_ASSERT(GDPWR_POWER_DOMAIN_MAIN_SLOW == NRF_GPD_SLOW_MAIN);
BUILD_ASSERT(GDPWR_GD_FAST_ACTIVE_0 == NRF_GPD_FAST_ACTIVE0);
BUILD_ASSERT(GDPWR_GD_FAST_ACTIVE_1 == NRF_GPD_FAST_ACTIVE1);
BUILD_ASSERT(GDPWR_GD_FAST_MAIN == NRF_GPD_FAST_MAIN);
BUILD_ASSERT(GDPWR_GD_SLOW_ACTIVE == NRF_GPD_SLOW_ACTIVE);
BUILD_ASSERT(GDPWR_GD_SLOW_MAIN == NRF_GPD_SLOW_MAIN);

struct gpd_onoff_manager {
struct onoff_manager mgr;
Expand All @@ -44,11 +46,21 @@ static void stop(struct onoff_manager *mgr, onoff_notify_fn notify);
#define GPD_SERVICE_REQ_ERR BIT(3)
static atomic_t gpd_service_status = ATOMIC_INIT(0);

static struct gpd_onoff_manager fast_active0 = {
.id = NRF_GPD_FAST_ACTIVE0,
.lock = Z_MUTEX_INITIALIZER(fast_active0.lock),
.sem = Z_SEM_INITIALIZER(fast_active0.sem, 0, 1),
};
static struct gpd_onoff_manager fast_active1 = {
.id = NRF_GPD_FAST_ACTIVE1,
.lock = Z_MUTEX_INITIALIZER(fast_active1.lock),
.sem = Z_SEM_INITIALIZER(fast_active1.sem, 0, 1),
};
static struct gpd_onoff_manager fast_main = {
.id = NRF_GPD_FAST_MAIN,
.lock = Z_MUTEX_INITIALIZER(fast_main.lock),
.sem = Z_SEM_INITIALIZER(fast_main.sem, 0, 1),
};
static struct gpd_onoff_manager slow_active = {
.id = NRF_GPD_SLOW_ACTIVE,
.lock = Z_MUTEX_INITIALIZER(slow_active.lock),
Expand All @@ -66,8 +78,12 @@ static const struct onoff_transitions transitions =
static struct gpd_onoff_manager *get_mgr(uint8_t id)
{
switch (id) {
case NRF_GPD_FAST_ACTIVE0:
return &fast_active0;
case NRF_GPD_FAST_ACTIVE1:
return &fast_active1;
case NRF_GPD_FAST_MAIN:
return &fast_main;
case NRF_GPD_SLOW_ACTIVE:
return &slow_active;
case NRF_GPD_SLOW_MAIN:
Expand Down Expand Up @@ -285,11 +301,21 @@ static int nrf_gpd_pre_init(void)
{
int ret;

ret = onoff_manager_init(&fast_active0.mgr, &transitions);
if (ret < 0) {
return ret;
}

ret = onoff_manager_init(&fast_active1.mgr, &transitions);
if (ret < 0) {
return ret;
}

ret = onoff_manager_init(&fast_main.mgr, &transitions);
if (ret < 0) {
return ret;
}

ret = onoff_manager_init(&slow_active.mgr, &transitions);
if (ret < 0) {
return ret;
Expand Down Expand Up @@ -321,11 +347,21 @@ static int nrf_gpd_post_init(void)
}

/* submit GD requests now to align collected statuses */
ret = nrf_gpd_sync(&fast_active0);
if (ret < 0) {
goto err;
}

ret = nrf_gpd_sync(&fast_active1);
if (ret < 0) {
goto err;
}

ret = nrf_gpd_sync(&fast_main);
if (ret < 0) {
goto err;
}

ret = nrf_gpd_sync(&slow_active);
if (ret < 0) {
goto err;
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ manifest:
groups:
- hal
- name: hal_nordic
revision: ce87268bb5610b7e90acce3efa5c511e95aeeeae
revision: pull/261/head
path: modules/hal/nordic
groups:
- hal
Expand Down
Loading