-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Add global HSFLL clock control device driver #81735
Add global HSFLL clock control device driver #81735
Conversation
Note @ppelikan-nordic |
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
I need the to update the frequencies to match the opaque |
cbea899
to
197adff
Compare
197adff
to
c71d0d0
Compare
c71d0d0
to
49f2189
Compare
49f2189
to
6b3e913
Compare
35cd442
to
5a17aca
Compare
@@ -37,6 +37,7 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RENESAS_RA_CGC clock_cont | |||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_AMBIQ clock_control_ambiq.c) | |||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_PWM clock_control_pwm.c) | |||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RPI_PICO clock_control_rpi_pico.c) | |||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL clock_control_nrf2_global_hsfll.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be below, after if(CONFIG_CLOCK_CONTROL_NRF2)
? I see that Kconfig is under if CLOCK_CONTROL_NRF2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up
5a17aca
to
5f6afbf
Compare
modules/hal_nordic/nrfs/Kconfig
Outdated
@@ -117,6 +120,11 @@ config NRFS_GDPWR_SERVICE_ENABLED | |||
depends on NRFS_HAS_GDPWR_SERVICE | |||
default y | |||
|
|||
config NRFS_GDFS_SERVICE_ENABLED | |||
bool "Global domain frequeny scaling service" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: "frequeny"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to have the name matching the actual compatible, so nordic,nrf-hsfll-local.yaml
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated name of file to match compat
@@ -48,7 +47,7 @@ static const struct clock_options { | |||
}; | |||
|
|||
struct hsfll_dev_data { | |||
STRUCT_CLOCK_CONFIG(hsfll, ARRAY_SIZE(clock_options)) clk_cfg; | |||
STRUCT_CLOCK_CONFIG(global_hsfll, ARRAY_SIZE(clock_options)) clk_cfg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Isn't this local HSFLL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rogue mistake, changed back
.frequency = MHZ(320), | ||
.accuracy = 0, | ||
.precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just:
.frequency = MHZ(320), | |
.accuracy = 0, | |
.precision = NRF_CLOCK_CONTROL_PRECISION_DEFAULT, | |
.frequency = MHZ(320), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shortened
@@ -221,7 +208,6 @@ static DEVICE_API(nrf_clock_control, hsfll_drv_api) = { | |||
.std_api = { | |||
.on = api_nosys_on_off, | |||
.off = api_nosys_on_off, | |||
.get_rate = api_get_rate_hsfll, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was wrong with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its not useful when the frequency is dynamic, it can change at any time, the only way to guarantee any frequency is to request what you need, and wait for confirmation, so there is no value in checking the freq like this at any time. Its also not possible with the global hsfll (not this clock I know) but it proves the point :) there we can't even get the freq if we wanted :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. It could be mentioned in the commit message so that the motivation is clear.
return -EINVAL; | ||
} | ||
|
||
static struct nrf_clock_control_driver_api driver_api = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static struct nrf_clock_control_driver_api driver_api = { | |
static DEVICE_API(nrf_clock_control, driver_api) = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not done for other nrf2 drivers, I think we should update them together
5a4bd73
to
30b9d0d
Compare
Adding the implementation for the GDFS service Signed-off-by: Paweł Pelikan <[email protected]>
Add specific device model for global hsfll clock and update dts tree to use specific model. The clock is not fixed, and configurable at runtime to predefined frequencies specified by the platform. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
The nrf-hsfll was previously the only supported HSFLL clock, hence it was not namespaced fully. Since we added nrf-hsfll-global, we should add the namespace to nrf-hsfll as well. Updates drivers and devicetree uses of HSFLL as well. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
30b9d0d
to
710d4db
Compare
Add device driver support for global hsfll clock. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
Extend sample to support global hsfll clock control. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
Extend test suite to test global HSFLL clock. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
The assert BUILD_ASSERT(NRF_GPD_FAST_ACTIVE1 == 0); is not correct given that NRF_GPD_FAST_ACTIVE1 is defined as 1U, and is not used in the file anyway. Remove the build assert. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
710d4db
to
8e63354
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @bjarki-andreasen
@@ -37,6 +37,7 @@ zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RENESAS_RA_CGC clock_cont | |||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_AMBIQ clock_control_ambiq.c) | |||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_PWM clock_control_pwm.c) | |||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_RPI_PICO clock_control_rpi_pico.c) | |||
zephyr_library_sources_ifdef(CONFIG_CLOCK_CONTROL_NRF2_GLOBAL_HSFLL clock_control_nrf2_global_hsfll.c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
up
{ | ||
const struct global_hsfll_dev_config *dev_config = dev->config; | ||
|
||
return dev_config->clock_frequencies[ARRAY_SIZE(dev_config->clock_frequencies) - 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be returned build-time since there are build asserts checking for supported clock frequencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this driver does have some strangeness regarding single instances / multi instance code, I wanted to make it as easy as possible to extend it if we choose to support more HSFLLs in the future
Draft for now since testing is blocked by missing firmware for the nRF54H20