Imx9 enable lpspi pcs manual control #17347
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a function imx9_lpspi_select_cs to assert CS at the start of an SPI transfer and keep it asserted until called again to de-assert it. This can be called by board-provided imx9_lpspi_select, in case the CS needs to be controlled via the LPSPI block and not GPIO.
The TCR register CONT (continue) bit is asserted to prevent CS toggling during the transfer, and the PCS bits are set to mark the correct CS
In addition this corrects some TCR register PCS bit definitions which are not valid for IMX9 device. I expect that this is a copy-paste error from some other i.MX platform.
Impact
Impacts only imx9 designs using LPSPI. Doesn't impact existing designs, adds a new feature, enabling to use the internal CS signal of the SPI block.
Testing
Tested on a custom IMX9 board, with icm42605 IMU sensor connected to LPSPI. Previously, had the CS signal muxed to GPIO1_IO11 (IOMUXC_PAD_SAI1_TXFS_GPIO1_IO11), and moved that to internal PCS signal (IOMUXC_PAD_SAI1_TXFS_LPSPI1_PCS0).
Tested in PX4 environment, showing that the sensor in question works: