-
Notifications
You must be signed in to change notification settings - Fork 7k
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: Fix some regressions #86156
base: main
Are you sure you want to change the base?
NXP LPSPI: Fix some regressions #86156
Conversation
3426ac4
to
5f99b79
Compare
while ((base->CR & LPSPI_CR_MEN_MASK) != 0U) { | ||
/* Wait until LPSPI is disabled. Datasheet: | ||
* After writing 0, MEN (Module Enable) remains set until the LPSPI has | ||
* completed the current transfer and is idle. | ||
*/ | ||
} | ||
|
||
base->CR |= LPSPI_CR_RST_MASK; | ||
base->CR |= LPSPI_CR_RRF_MASK | LPSPI_CR_RTF_MASK; |
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.
I think you can remove these lines as they have already initialized in LPSPI_MasterInit
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.
actually, I just realized, they are still in the wrong place, the purpose of this was to fix S32 silicon errata
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.
@Raymond0225 I updated the PR to do an alternative workaround but I still need to test on S32 hardware, so it will remain on draft still
The LPSPI FIFOs on this platform are 8 words long, not 16. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
5f99b79
to
3e8c52e
Compare
No need to reconfigure SPI if already configured with same configuration. This reduces latency of some transfers that re-use the same spi_cfg. Also, a slightly related change is to remove the setting of the CONTC bit in the init. This was a mistake to have because there was no intention to do a continuing command and could cause some problem, or at least cause confusion to readers of the driver code. Signed-off-by: Declan Snyder <declan.snyder@nxp.com> Co-authored-by: Raymond Lei <raymond.lei@nxp.com>
On some of the platforms, the module doesn't get clocked until the SDK Init call, causing the control register (CR) write to fault. The reason for this code in the first place was to avoid S32 chip errata that caused fifos to need internal logic reset. Since we want to avoid reconfiguring, and a module reset would require that, there is one other documented workaround which is to just read the RX fifo register to update the internal hardware pointer. For the TX fifo the fix is to wait for transfer completion which should be done by the point of starting a new one. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
3e8c52e
to
4b63265
Compare
Fixes #86148
Fixes #86145
One patch on this PR is from @Raymond0225