-
Notifications
You must be signed in to change notification settings - Fork 630
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nrf fromlist] soc: nordic: nrf54h20: restrict global hsfll freq
Introduce feature which restricts the minimum global hsfll frequency. This feature is selected by default to preserve the behavior of the global hsfll before the clock control driver for it was introduced, which configured it as a fixed clock at 320MHz. Upstream PR #: 81735 Signed-off-by: Bjarki Arge Andreasen <[email protected]>
- Loading branch information
1 parent
54d4a3b
commit 4b49be5
Showing
3 changed files
with
98 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/drivers/clock_control/nrf_clock_control.h> | ||
#include <zephyr/kernel.h> | ||
#include <zephyr/logging/log.h> | ||
|
||
LOG_MODULE_DECLARE(soc, CONFIG_SOC_LOG_LEVEL); | ||
|
||
#if CONFIG_SOC_NRF54H20_GLOBAL_HSFLL_MIN_FREQ_64_MHZ | ||
#define GLOBAL_HSFLL_MIN_FREQ_HZ 64000000 | ||
#elif CONFIG_SOC_NRF54H20_GLOBAL_HSFLL_MIN_FREQ_128_MHZ | ||
#define GLOBAL_HSFLL_MIN_FREQ_HZ 128000000 | ||
#elif CONFIG_SOC_NRF54H20_GLOBAL_HSFLL_MIN_FREQ_256_MHZ | ||
#define GLOBAL_HSFLL_MIN_FREQ_HZ 256000000 | ||
#else | ||
#define GLOBAL_HSFLL_MIN_FREQ_HZ 320000000 | ||
#endif | ||
|
||
#define GLOBAL_HSFLL_REQUEST_TIMEOUT_US \ | ||
(CONFIG_SOC_NRF54H20_GLOBAL_HSFLL_TIMEOUT_MS * USEC_PER_SEC) | ||
|
||
Check notice on line 25 in soc/nordic/nrf54h/global_hsfll.c GitHub Actions / Run compliance checks on patch series (PR)You may want to run clang-format on this change
Check notice on line 25 in soc/nordic/nrf54h/global_hsfll.c GitHub Actions / Run compliance checks on patch series (PR)You may want to run clang-format on this change
|
||
static struct onoff_client cli; | ||
static const struct device *global_hsfll = DEVICE_DT_GET(DT_NODELABEL(hsfll120)); | ||
static const struct nrf_clock_spec spec = { | ||
.frequency = GLOBAL_HSFLL_MIN_FREQ_HZ, | ||
}; | ||
|
||
static int nordicsemi_nrf54h_global_hsfll_init(void) | ||
{ | ||
int ret; | ||
int res; | ||
bool completed; | ||
|
||
sys_notify_init_spinwait(&cli.notify); | ||
|
||
ret = nrf_clock_control_request(global_hsfll, &spec, &cli); | ||
if (ret) { | ||
return ret; | ||
} | ||
|
||
res = -EIO; | ||
completed = WAIT_FOR(sys_notify_fetch_result(&cli.notify, &res) == 0, | ||
GLOBAL_HSFLL_REQUEST_TIMEOUT_US, | ||
k_msleep(1)); | ||
|
||
Check notice on line 49 in soc/nordic/nrf54h/global_hsfll.c GitHub Actions / Run compliance checks on patch series (PR)You may want to run clang-format on this change
Check notice on line 49 in soc/nordic/nrf54h/global_hsfll.c GitHub Actions / Run compliance checks on patch series (PR)You may want to run clang-format on this change
|
||
if (!completed) { | ||
LOG_ERR("%s request timed out", "Restrict global HSFLL"); | ||
return -EIO; | ||
} | ||
|
||
if (res) { | ||
LOG_ERR("%s request failed: (res=%i)", "Restrict global HSFLL", res); | ||
return res; | ||
} | ||
|
||
LOG_INF("%s to %uHz", "Restrict global HSFLL", GLOBAL_HSFLL_MIN_FREQ_HZ); | ||
return 0; | ||
} | ||
|
||
SYS_INIT(nordicsemi_nrf54h_global_hsfll_init, POST_KERNEL, 99); |