-
Notifications
You must be signed in to change notification settings - Fork 7.4k
NXP LPSPI: Add support for Peripheral (slave) mode #87144
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
base: main
Are you sure you want to change the base?
Conversation
67f58c1
to
8ee79a0
Compare
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>
Optimize the TX fill algorithm to have less interrupts by filling the TX fifo as much as possible during each interrupt handle. Before, the algorithm was just a very simple, fill the TX fifo with as much from only the current buffer as possible, then send it and wait for the next interrupt. Now the algorithm is to fill the TX fifo as much as possible, even if it means reading from multiple buffers during the interrupt. This has the advantage from master mode of having less interrupts. And it is very important for slave mode because the slave mode does not control the pacing of the transfer and so therefore should fill as much as possible whenever possible in order not to miss a deadline. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add basic support for basic peripheral mode operation. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add overlay for a reworked board that breaks out LPSPI1 to the arduino header. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add an overlay to the spi_controller_peripheral test for the frdm_mcxa156. Since this IP has multiple CS, need to introduce a way to configure the correct CS to the test; just going to use zephyr,user for now instead of refactoring to be less nordic-specific, keeping the usage optional. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
8ee79a0
to
513dc46
Compare
@@ -9,6 +9,49 @@ LOG_MODULE_REGISTER(spi_mcux_lpspi_common, CONFIG_SPI_LOG_LEVEL); | |||
|
|||
#include "spi_nxp_lpspi_priv.h" | |||
|
|||
#if defined(LPSPI_RSTS) || defined(LPSPI_CLOCKS) |
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.
What file would these be defined in?
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.
in fsl_clock.h and fsl_reset.h in the HAL, eventually long term want to use DT instead of HAL driver definitions
put DNM because there are some timing issues with CPHA=0, need to debug |
peripheral-cs = <1>; | ||
}; | ||
}; | ||
|
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.
It would be useful for testing if you could include the connection setup in a comment here.
This PR adds support for Peripheral mode into the NXP LPSPI interrupt-based driver.
So far, it is only tested on MCXA156, but this is a great start because due to the small fifo, it is probably the most difficult to enable on.