Skip to content

Conversation

@decsny
Copy link
Member

@decsny decsny commented Jul 1, 2025

This is something like, rewrite # 8 of this ISR. I will admit though, that the current IRQ handling is evidentially non-deterministic, so this is needed. I think this should finally nail down these race conditions on the older LPSPI due to that stalling errata. Although, I have said that many times now.

Also as a result of this PR, we can not longer (pretend to?) support the SPI_HOLD_ON_CS flag on LPSPI v1.

Fixes #90614 and maybe some others, pending investigations.

decsny added 2 commits July 1, 2025 10:41
This early exit section is only reached if there is an error.
In the case of not supported, the ret variable will be 0 and zassert
won't happen. This is because the test was meant to be skipped, not
passed or failed, in this case. So add the skip call.

Signed-off-by: Declan Snyder <[email protected]>
The interrupt handling was not deterministic before because it relied
on "guessing" if the lpspi was a v1 type that was stalling due to design
errata. This obviously ended up being wrong in some cases. So we really
need to fix this so that it is deterministic, and my idea to do that is
to explicitly count how many words we have written to the TX fifo
throughout the whole transfer.

As a side effect of making the IRQ more deterministic, we can't support
the SPI_HOLD_ON_CS flag for v1 LPSPI anymore. It is fundamentally
impossible due to the fact that the transfer can only complete in
hardware as a result of CS deasserting. If this is absolutely a
requirement to support this flag in the future, my recommendation is to
update the driver so that it muxes the pin to a gpio before ending the
transfer, but that would kind of defeat the point of having a native CS,
at least at the end of the xfer.

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

sonarqubecloud bot commented Jul 1, 2025

@bperseghetti bperseghetti added the Hotfix Fix for issues blocking development, i.e. upstream CI issues, tests failing in upstream CI , etc. label Jul 1, 2025
@bperseghetti
Copy link
Member

I added hotfix as this is needed to get sensor PRs in that currently are failing on main. This has been tested on the VMU_RT1170 and fixes the icm42688 driver failure.

@dkalowsk dkalowsk merged commit 2e0357c into zephyrproject-rtos:main Jul 1, 2025
33 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 Hotfix Fix for issues blocking development, i.e. upstream CI issues, tests failing in upstream CI , etc. platform: NXP Drivers NXP Semiconductors, drivers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MIMXRT1062: LPSPI: spi_transceive clocks one word more than requested

5 participants