-
Notifications
You must be signed in to change notification settings - Fork 7.6k
NXP LPSPI: Refactoring to remove dependency of HAL in XFER drivers #86939
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
NXP LPSPI: Refactoring to remove dependency of HAL in XFER drivers #86939
Conversation
Can you rebase? Afaik CI if failing due to external issues from this PR |
yeah, the issue I am having in general right now is that there is a lot of work that needs done on this LPSPI and I am making many different PRs to try to satisfy all the people clamoring for what features they want ASAP while also making the PRs reviewable, it's kind of chaos as far as all the git branches I have right now. This PR I need to probably sequence with some other things, so I haven't updated it yet |
@decsny I can imagine the pressure. No worries, ping me (if I am again lost in /dev/null) once you'll had time to rebase. |
6fc6900
to
77dc96c
Compare
I updated the PR to remove a commit that already merged in another PR, |
48ebd6f
to
9a24cdc
Compare
@hakehuang can you regress test this on our HW range and give a +1 if clean. |
Awaiting @hakehuang test results. |
There is already multiple regressions on the main branch, and new test case added that don't pass on LPSPI while the hard fault was on main, the test results almost for sure won't pass, this PR is fixing the main hard fault |
running, will feedback once done |
If there are HAL definitions available, do these two things: Ungate the clock for the device from the zephyr driver. Eventually it would be better to have a clocks property in the LPSPI DT node and get the resources from there rather than the HAL. Some platforms require the peripheral to be reset at system level, add code to do this. Eventually it would be more ideal to have Zephyr reset drivers for all of the NXP platforms and use DT to describe the reset resources, but for now we can just do this to get the LPSPI supported. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Stop the transfer with error if at any point there is some execution reached where transfer is being set up for 0 length, this can cause problems where for example eDMA set up with this nonsense 0 length channels can get an infinite error interrupt. And this is probably an erroneously crafted transfer request anyways. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
We should not release context until transfer ends. The code previously would return from wait_for_completion and then release the context. This is only supposed to be done in the dma callback except for the case of error in the transceive call. For async transfer this was most likely always happening wrong and probably broken for multi threads trying to access the bus due to this premature release of the context. Also we should not enable CS and leave enabled in case of error, move CS enable to after the error check. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Convert the DMA-based LPSPI driver to native code. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Convert the CPU-based lpspi driver to native code. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Minor refactor to make a separate function to validate configuration arguments. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Remove SDK types and defines from header file. And since now the common file is the only consumer of SDK header, move that include there. Also rename the tristate boolean to be more clean about what it does rather than trying to be similar to the SDK config name. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
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>
9a24cdc
to
37e45cf
Compare
I cherry-picked the commits from ##87789 which fix the other issues to pass the current test on the platforms reported, now test should pass on all configuration and platform |
I restart the testing, will feedback once done |
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.
board testing pass for v4.1.0-1894-g37e45cf692f9 on all tests/drivers/spi/spi_loopback/drivers.spi.loopback
This PR contains some of the changes from #85010 that are split into separate commits to make them more reviewable.
These changes are particularly important so that people can contribute to the main transfer driver files without having conflicts with #85010.