-
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
drivers: spi_nrfx_spim: Add clock requests for fast SPIM instances #82994
Conversation
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. |
}; | ||
|
||
static void event_handler(const nrfx_spim_evt_t *p_event, void *p_context); | ||
|
||
static inline int request_clock(const struct device *dev) |
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.
won't the compiler complain about unused dev
parameter when USE_CLOCK_REQUESTS
is undefined? same for release_clock
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.
Yes, I think it may complain, depending on the enabled warnings. I'll add ARG_UNUSED()
macro calls.
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.
Added.
ecf7509
to
7b94b4d
Compare
This is a follow-up to commit fe0e2db. If `nrf_clock_control_request_sync()` ends up with a timeout, before returning it must cancel the request that was not fulfilled on time. Otherwise, the request may actually finish successfully a bit later, but the caller will not be aware that the clock needs to be released (since the call resulted in an error). And actually even more serious problem is that because the `req` structure is placed on stack, after the function returns, the contents of this structure will be probably overwritten with some other data, so if the request finishes at that point, an attempt to execute the callback function pointed by this structure will most likely cause a crash. Signed-off-by: Andrzej Głąbek <[email protected]>
Fast SPIM instances in nRF54H20 (SPIM120 and SPIM121) are driven by the global HSFLL (HSFLL120). Add `clocks` property in these nodes to reflect this. Signed-off-by: Andrzej Głąbek <[email protected]>
7b94b4d
to
ec91a73
Compare
Rebased. |
Fast SPIM instances (SPIM120 and SPIM121) for correct operation require the highest frequency from the global HSFLL. This commit adds needed clock controller requests to the driver. When the runtime device power management is enabled, the frequency is requested as long as the SPIM is resumed, otherwise it is requested for the duration of transfers. This commit also adds a missing call to `pm_device_runtime_put()` when SPIM reconfiguration fails. Signed-off-by: Andrzej Głąbek <[email protected]>
ec91a73
to
4e01a59
Compare
Based on #75715 and #81735. Only the last three commits are actually added by this PR.drivers: clock_control_nrf2: Add missing cancelation of request
This is a follow-up to commit fe0e2db.
If
nrf_clock_control_request_sync()
ends up with a timeout, before returning it must cancel the request that was not fulfilled on time. Otherwise, the request may actually finish successfully a bit later, but the caller will not be aware that the clock needs to be released (since the call resulted in an error). And actually even more serious problem is that because thereq
structure is placed on stack, after the function returns, the contents of this structure will be probably overwritten with some other data, so if the request finishes at that point, an attempt to execute the callback function pointed by this structure will most likely cause a crash.dts: nrf54h20: Add clocks property in fast SPIM nodes
Fast SPIM instances in nRF54H20 (SPIM120 and SPIM121) are driven by the global HSFLL (HSFLL120). Add
clocks
property in these nodes to reflect this.drivers: spi_nrfx_spim: Add clock requests for fast SPIM instances
Fast SPIM instances (SPIM120 and SPIM121) for correct operation require the highest frequency from the global HSFLL. This commit adds needed clock controller requests to the driver. When the runtime device power management is enabled, the frequency is requested as long as the SPIM is resumed, otherwise it is requested for the duration of transfers.