Skip to content

spi_nxp_lpspi: Fix chip select bug when using RTIO and reduce maintenance overhead #84931

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

Conversation

decsny
Copy link
Member

@decsny decsny commented Jan 30, 2025

For the CPU-based drivers, delete the old MCUX based RTIO driver and use
the default RTIO submit implementation instead.

Rationale:

  • 300 LOC -> 1 LOC to maintain.
  • MCUX SDK based driver cannot control the chip select for the transfer
    properly, but the new spi_nxp_lpspi.c driver can. So this fixes the
    bug with the PCS when using RTIO.

In the future a custom DMA based RTIO driver with custom implementation can be
designed, but for CPU based transfers, which is already not optimal
performance, code maintenance is more important. Only requirement is
asynchronous submit, which is accomplished by p4wq in rtio workq.

Also enables default RTIO submit for SPI with DMA driver now that refactor was done.

Depends on #82877

For the CPU-based drivers, delete the old MCUX based RTIO driver and use
the default RTIO submit implementation instead.

Rationale:
- 300 LOC -> 1 LOC to maintain.
- MCUX SDK based driver cannot control the chip select for the transfer
  properly, but the new spi_nxp_lpspi.c driver can. So this fixes the
  bug with the PCS when using RTIO.

Also enable the default RTIO implementation for DMA based driver.
In the future a DMA based RTIO driver with custom implementation can be
designed, but for CPU based transfer, which is already not optimal
performance, code maintenance is more important. Only requirement is
asynchronous submit, which is accomplished by p4wq in rtio workq.

Signed-off-by: Declan Snyder <[email protected]>
@Raymond0225
Copy link
Collaborator

"MCUX SDK based driver cannot control the chip select for the transfer
properly, but the new spi_nxp_lpspi.c driver can."
Do we need to fix this issue on SDK repo?

@decsny
Copy link
Member Author

decsny commented Feb 3, 2025

"MCUX SDK based driver cannot control the chip select for the transfer properly, but the new spi_nxp_lpspi.c driver can." Do we need to fix this issue on SDK repo?

no, the SDK driver is just made for single buffer transfer, so it works when doing that, but we can't use that API with zephyr

@kartben kartben merged commit 30b9463 into zephyrproject-rtos:main Feb 4, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: SPI SPI bus platform: NXP Drivers NXP Semiconductors, drivers platform: NXP MPU platform: NXP S32 NXP Semiconductors, S32 platform: NXP NXP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants