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

nRFs exposes now all power domains, following their actual name in the
specification. Add support for all of them in the GPD service. Note that
this is a breaking change: running this code requires a new SCFW as IDs
have changed in nRFs and so SCFW.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2024-11-28 09:49:42 +01:00 committed by Benjamin Cabé
commit 0dc18e1236
2 changed files with 44 additions and 8 deletions

View file

@ -8,10 +8,10 @@
#define ZEPHYR_INCLUDE_DT_BINDINGS_POWER_NORDIC_NRF_GLOBAL_PD #define ZEPHYR_INCLUDE_DT_BINDINGS_POWER_NORDIC_NRF_GLOBAL_PD
/* numbers aligned to nrfs service identifiers */ /* numbers aligned to nrfs service identifiers */
#define NRF_GPD_SLOW_MAIN 2U #define NRF_GPD_FAST_ACTIVE0 0U
#define NRF_GPD_SLOW_ACTIVE 1U #define NRF_GPD_FAST_ACTIVE1 1U
#define NRF_GPD_FAST_MAIN 3U #define NRF_GPD_FAST_MAIN 2U
#define NRF_GPD_FAST_ACTIVE1 0U #define NRF_GPD_SLOW_ACTIVE 3U
#define NRF_GPD_FAST_ACTIVE0 4U #define NRF_GPD_SLOW_MAIN 4U
#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_POWER_NORDIC_NRF_GLOBAL_PD */ #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_POWER_NORDIC_NRF_GLOBAL_PD */

View file

@ -20,9 +20,11 @@
LOG_MODULE_REGISTER(gpd, CONFIG_SOC_LOG_LEVEL); LOG_MODULE_REGISTER(gpd, CONFIG_SOC_LOG_LEVEL);
/* enforce alignment between DT<->nrfs */ /* enforce alignment between DT<->nrfs */
BUILD_ASSERT(GDPWR_POWER_DOMAIN_ACTIVE_FAST == NRF_GPD_FAST_ACTIVE1); BUILD_ASSERT(GDPWR_GD_FAST_ACTIVE_0 == NRF_GPD_FAST_ACTIVE0);
BUILD_ASSERT(GDPWR_POWER_DOMAIN_ACTIVE_SLOW == NRF_GPD_SLOW_ACTIVE); BUILD_ASSERT(GDPWR_GD_FAST_ACTIVE_1 == NRF_GPD_FAST_ACTIVE1);
BUILD_ASSERT(GDPWR_POWER_DOMAIN_MAIN_SLOW == NRF_GPD_SLOW_MAIN); 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 gpd_onoff_manager {
struct onoff_manager mgr; struct onoff_manager mgr;
@ -44,11 +46,21 @@ static void stop(struct onoff_manager *mgr, onoff_notify_fn notify);
#define GPD_SERVICE_REQ_ERR BIT(3) #define GPD_SERVICE_REQ_ERR BIT(3)
static atomic_t gpd_service_status = ATOMIC_INIT(0); 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 = { static struct gpd_onoff_manager fast_active1 = {
.id = NRF_GPD_FAST_ACTIVE1, .id = NRF_GPD_FAST_ACTIVE1,
.lock = Z_MUTEX_INITIALIZER(fast_active1.lock), .lock = Z_MUTEX_INITIALIZER(fast_active1.lock),
.sem = Z_SEM_INITIALIZER(fast_active1.sem, 0, 1), .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 = { static struct gpd_onoff_manager slow_active = {
.id = NRF_GPD_SLOW_ACTIVE, .id = NRF_GPD_SLOW_ACTIVE,
.lock = Z_MUTEX_INITIALIZER(slow_active.lock), .lock = Z_MUTEX_INITIALIZER(slow_active.lock),
@ -66,8 +78,12 @@ static const struct onoff_transitions transitions =
static struct gpd_onoff_manager *get_mgr(uint8_t id) static struct gpd_onoff_manager *get_mgr(uint8_t id)
{ {
switch (id) { switch (id) {
case NRF_GPD_FAST_ACTIVE0:
return &fast_active0;
case NRF_GPD_FAST_ACTIVE1: case NRF_GPD_FAST_ACTIVE1:
return &fast_active1; return &fast_active1;
case NRF_GPD_FAST_MAIN:
return &fast_main;
case NRF_GPD_SLOW_ACTIVE: case NRF_GPD_SLOW_ACTIVE:
return &slow_active; return &slow_active;
case NRF_GPD_SLOW_MAIN: case NRF_GPD_SLOW_MAIN:
@ -285,11 +301,21 @@ static int nrf_gpd_pre_init(void)
{ {
int ret; int ret;
ret = onoff_manager_init(&fast_active0.mgr, &transitions);
if (ret < 0) {
return ret;
}
ret = onoff_manager_init(&fast_active1.mgr, &transitions); ret = onoff_manager_init(&fast_active1.mgr, &transitions);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
ret = onoff_manager_init(&fast_main.mgr, &transitions);
if (ret < 0) {
return ret;
}
ret = onoff_manager_init(&slow_active.mgr, &transitions); ret = onoff_manager_init(&slow_active.mgr, &transitions);
if (ret < 0) { if (ret < 0) {
return ret; return ret;
@ -321,11 +347,21 @@ static int nrf_gpd_post_init(void)
} }
/* submit GD requests now to align collected statuses */ /* 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); ret = nrf_gpd_sync(&fast_active1);
if (ret < 0) { if (ret < 0) {
goto err; goto err;
} }
ret = nrf_gpd_sync(&fast_main);
if (ret < 0) {
goto err;
}
ret = nrf_gpd_sync(&slow_active); ret = nrf_gpd_sync(&slow_active);
if (ret < 0) { if (ret < 0) {
goto err; goto err;