drivers: spi: stm32h7: avoid unnecessary suspend #79050
Open
+5
−15
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.
The stm32 H7 driver always suspends the transmission at the end of a transceive operation. However, according to the H7 datasheet, this is only needed when SPI is configured as receive-only. The driver never does this, as
LL_SPI_SetTransferDirection(spi, LL_SPI_FULL_DUPLEX);
is always called inspi_stm32_configure
.Unless there is a reason to still suspend the transaction, it should not be done. Thus, remove the unnecessary suspension to follow the datasheet instructions and to potentially reduce the minimum time between SPI transactions. However, this is not causing problems at the moment as far as I know; this should be taken into consideration before approving this PR.
Here is the explanation about what receive-only mode is and how to set it:
And here is the disabling procedure stated by the H7's datasheet:
Test plan
Run all the spi_loppback tests, with and without DMA/IRQs enabled, and with and without enabling the FIFO usage. That is:
Connect an STM32H7 board to the PC with pins D11 and D12 connected.
Open a minicom or equivalent terminal to read the test report.
Execute the following commands:
Execute the commands above, this time with the SPI fifo enabled. To do this, add
fifo-enable;
to thespi1
node intests/drivers/spi/spi_loopback/overlay-stm32-spi-16bits.overlay
and intests/drivers/spi/spi_loopback/boards/nucleo_h753zi.overlay