Commit graph

8 commits

Author SHA1 Message Date
Declan Snyder
c0e3ec7f08 spi_nxp_lpspi: Add maximum wait time of fifo empty
Instead of waiting forever and potentially allowing infinite loop on
ISR, wait some arbitrary amount of cycles to error out if it isn't
happening. Still make this configurable for debugging purposes.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-06-18 17:51:19 -04:00
Declan Snyder
0875499664 spi_nxp_lpspi: Remove mcux branding from tokens
Since these drivers mainly do not use MCUX except for the configure
function (which will soon also be changed), change namespace prefix to
lpspi_ instead of spi_mcux_ to avoid confusion.

Also improve descriptions of kconfigs to clarify what they are for.
Not changing the kconfig names for now since they are user-facing.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-04-04 18:17:19 +02:00
Declan Snyder
d67e705d0b spi_nxp_lpspi: Fix DMA Async API
Fix the ASYNC DMA API on the lpspi driver and actually make the entire
driver go through that path. Rather than having an orthogonal
internally synchronous path we can just have both APIs go through the
same asynchronous path and just use wait_for_completion from spi context
to implement either sync or async.

Also make DMA driver default y if dependency (an lpspi having dmas
property) is met.

And lpspi_wait_tx_fifo_empty can be shared between drivers.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-03-14 17:53:24 +01:00
Declan Snyder
a718b84454 spi_nxp_lpspi: Fix Kconfig description
The Kconfig description is wrong, this driver can be used with or
without RTIO. Also, rename the kconfig to be less confusing, as _NORMAL
is meaningless, this is the CPU/interrupt based driver.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-02-20 21:07:23 +01:00
Declan Snyder
30b9463539 spi_nxp_lpspi: Use default RTIO submit
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 <declan.snyder@nxp.com>
2025-02-04 09:17:22 +01:00
Declan Snyder
6cbe52b23c spi_nxp_lpspi: Move DMA-based code to own file
The DMA-based path of the lpspi driver is basically
almost a driver of it's own, move it to it's own file.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-14 15:39:04 +01:00
Declan Snyder
1d5cd0308c spi_nxp_lpspi: Move RTIO driver into own file
There is (almost) a whole separate driver for RTIO,
move this code to its own file and move shared code
and definitions to a common file.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-14 15:39:04 +01:00
Declan Snyder
b8a6e0b457 spi_mcux_lpspi: Move to own subfolder
Move this driver to its own subfolder to organize it
since there will be new files added for this hardware.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2025-01-14 15:39:04 +01:00
Renamed from drivers/spi/Kconfig.mcux_lpspi (Browse further)