-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nrf noup] soc: nordic: Add LRCCONF management
Due to the possibility of simultaneous accesess to LRCCONF registers, additional management is required. Signed-off-by: Adam Kondraciuk <adam.kondraciuk@nordicsemi.no>
- Loading branch information
1 parent
95eb6bd
commit 3c6199f
Showing
12 changed files
with
173 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <soc_lrcconf.h> | ||
#include <zephyr/kernel.h> | ||
|
||
static struct k_spinlock lock; | ||
sys_slist_t poweron_main_list; | ||
sys_slist_t poweron_active_list; | ||
|
||
void soc_lrcconf_poweron_request(sys_snode_t *node, nrf_lrcconf_power_domain_mask_t domain) | ||
{ | ||
__ASSERT(is_power_of_two(domain), | ||
"Only one bit can be set for the domain parameter"); | ||
|
||
sys_slist_t *poweron_list; | ||
|
||
if (domain == NRF_LRCCONF_POWER_MAIN) { | ||
poweron_list = &poweron_main_list; | ||
} else if (domain == NRF_LRCCONF_POWER_DOMAIN_0) { | ||
poweron_list = &poweron_active_list; | ||
} else { | ||
return; | ||
} | ||
K_SPINLOCK(&lock) { | ||
if (sys_slist_len(poweron_list) == 0) { | ||
nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, domain, true); | ||
} | ||
|
||
sys_slist_find_and_remove(poweron_list, node); | ||
sys_slist_append(poweron_list, node); | ||
} | ||
} | ||
|
||
void soc_lrcconf_poweron_release(sys_snode_t *node, nrf_lrcconf_power_domain_mask_t domain) | ||
{ | ||
__ASSERT(is_power_of_two(domain), | ||
"Only one bit can be set for the domain parameter"); | ||
|
||
sys_slist_t *poweron_list; | ||
|
||
if (domain == NRF_LRCCONF_POWER_MAIN) { | ||
poweron_list = &poweron_main_list; | ||
} else if (domain == NRF_LRCCONF_POWER_DOMAIN_0) { | ||
poweron_list = &poweron_active_list; | ||
} else { | ||
return; | ||
} | ||
|
||
K_SPINLOCK(&lock) { | ||
if (!sys_slist_find_and_remove(poweron_list, node)) { | ||
K_SPINLOCK_BREAK; | ||
} | ||
|
||
if (sys_slist_len(poweron_list) > 0) { | ||
K_SPINLOCK_BREAK; | ||
} | ||
nrf_lrcconf_poweron_force_set(NRF_LRCCONF010, domain, false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/** | ||
* @file nRF SoC specific helpers for lrcconf management | ||
*/ | ||
|
||
#ifndef ZEPHYR_SOC_NORDIC_COMMON_LRCCONF_H_ | ||
#define ZEPHYR_SOC_NORDIC_COMMON_LRCCONF_H_ | ||
|
||
#include <hal/nrf_lrcconf.h> | ||
|
||
/** | ||
* @brief Request lrcconf power domain | ||
* | ||
* @param node Pointer to the @ref sys_snode_t structure which is the ID of the | ||
* requesting module. | ||
* @param domain The mask that represents the power domain ID. | ||
*/ | ||
void soc_lrcconf_poweron_request(sys_snode_t *node, nrf_lrcconf_power_domain_mask_t domain); | ||
|
||
/** | ||
* @brief Release lrcconf power domain | ||
* | ||
* @param node Pointer to the @ref sys_snode_t structure which is the ID of the | ||
* requesting module. | ||
* @param domain The mask that represents the power domain ID. | ||
*/ | ||
void soc_lrcconf_poweron_release(sys_snode_t *node, nrf_lrcconf_power_domain_mask_t domain); | ||
|
||
#endif /* ZEPHYR_SOC_NORDIC_COMMON_LRCCONF_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
config SOC_NRF54H20 | ||
bool | ||
select SOC_SERIES_NRF54HX | ||
select ARM_ON_ENTER_CPU_IDLE_HOOK | ||
help | ||
nRF54H20 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.