Skip to content

[nrf fromtree] drivers: spi: spi_nrfx_spi: remove multithreading dependency #2907

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

Merged
merged 2 commits into from
Jun 2, 2025

Conversation

nordic-mik7
Copy link
Contributor

Replace semaphores with proper atomic flags when used without multithreading enabled.

Related: NCSDK-33699

@nordic-mik7 nordic-mik7 requested review from anangl and ahasztag May 23, 2025 15:11
@nordic-mik7 nordic-mik7 removed the DNM label May 23, 2025
@nordic-mik7 nordic-mik7 force-pushed the dev/spi_single_thread branch from f0b527a to 57435f3 Compare May 23, 2025 15:15
@nordic-mik7 nordic-mik7 force-pushed the dev/spi_single_thread branch from 57435f3 to bc69e4b Compare May 29, 2025 11:45
@nordic-mik7 nordic-mik7 changed the title [nrf noup] drivers: spi: spi_nrfx_spi: remove multithreading dependency [nrf fromlist] drivers: spi: spi_nrfx_spi: remove multithreading dependency May 29, 2025
@nordic-mik7 nordic-mik7 removed the DNM label May 29, 2025
@nordic-mik7 nordic-mik7 force-pushed the dev/spi_single_thread branch 3 times, most recently from 8304257 to 9e44861 Compare May 29, 2025 12:15
@nordic-mik7 nordic-mik7 force-pushed the dev/spi_single_thread branch 2 times, most recently from 2405a6c to 124e29f Compare May 30, 2025 13:33
This dependency was always there but not explicitly defined.
By adding the explicit dependency it becomes more obvious
what is wrong when SPI is enabled but GPIO disabled.

This was found when building `samples/bluetooth/peripheral`
for `nrf54l15dk/nrf54l15/cpuapp` with `CONFIG_GPIO=n`.

Before we got:
 - A linker error in `spi_nrfx_common.c` failing
   to reference some nrfx_gpiote APIs.
 - A linker error in `spi_nrfx_spim.c` failing to reference
   the GPIO dts entry.

Now we will get a warning of that GPIO is not enabled
With this it becomes more obvious that SPI driver is enabled by
default because of the external flash mounted on the DK.

Signed-off-by: Rubin Gerritsen <[email protected]>
(cherry picked from commit 577a004)
@nordic-mik7 nordic-mik7 force-pushed the dev/spi_single_thread branch from 124e29f to 8c97a70 Compare May 30, 2025 13:44
@nordic-mik7
Copy link
Contributor Author

nordic-mik7 commented May 30, 2025

@anangl @ahasztag Please review and approve if you find time; upstream PR already reviewed and pending merge:
zephyrproject-rtos/zephyr#90647

@anangl
Copy link
Contributor

anangl commented Jun 2, 2025

Please change the second commit to fromtree.

const uint32_t tms = k_uptime_get_32();

while (!atomic_get(&ctx->ready) && (k_uptime_get_32() - tms < timeout_ms)) {
k_busy_wait(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why k_busy_wait(1) is needed here? I'd rather say this should be an empty while loop, this does only add unnecessary code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unnecessary indeed... Already merged to upstream though

@ahasztag ahasztag self-requested a review June 2, 2025 07:29
Copy link
Contributor

@ahasztag ahasztag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving in advance, just one non-blocking suggestion

…endency

Replace semaphores with proper atomic flags when used without
multithreading enabled.

Related: NCSDK-33699

Signed-off-by: Michal Kozikowski <[email protected]>
(cherry picked from commit df65918)
@nordic-mik7 nordic-mik7 force-pushed the dev/spi_single_thread branch from 8c97a70 to 5350c72 Compare June 2, 2025 07:37
@nordic-mik7 nordic-mik7 changed the title [nrf fromlist] drivers: spi: spi_nrfx_spi: remove multithreading dependency [nrf fromtree] drivers: spi: spi_nrfx_spi: remove multithreading dependency Jun 2, 2025
Copy link

sonarqubecloud bot commented Jun 2, 2025

@nordicjm nordicjm merged commit 6ed2a05 into nrfconnect:main Jun 2, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants