Skip to content
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

spi: dw: Wait for idle after TX #6646

Merged
merged 1 commit into from
Feb 4, 2025
Merged

Conversation

pelwell
Copy link
Contributor

@pelwell pelwell commented Feb 3, 2025

This is probably part 1 of a fix for TX only transfers. Part 2 is likely to change dw_spi_dma_transfer to not call dw_spi_wait_tx_done in the event that there is an RX buffer.

Link: https://forums.raspberrypi.com/viewtopic.php?t=383027

@pelwell
Copy link
Contributor Author

pelwell commented Feb 3, 2025

Updated with a more complete solution, which needs retesting in its current form. Restructuring dw_spi_dma_transfer to potentially only call dw_spi_wait_rx_done is not an option given that dw_spi_wait_rx_done assumes that dw_spi_wait_tx_done has already completed.

If this is a DMA transfer, and if there is no simultaneous RX transfer,
wait for the interface to go idle before reporting that TX is done.

Link: https://forums.raspberrypi.com/viewtopic.php?t=383027

Signed-off-by: Phil Elwell <[email protected]>
@pelwell pelwell marked this pull request as ready for review February 4, 2025 12:07
@pelwell pelwell merged commit 54a442d into raspberrypi:rpi-6.6.y Feb 4, 2025
12 checks passed
@P33M
Copy link
Contributor

P33M commented Feb 4, 2025

The maximum time between the tx_busy check passing (==txfifo empty) and the SR_BUSY check passing is one complete wordsize. I think the cpu_relax() should be another invocation of spi_delay_exec() but with delay.value set to just n_bytes * BITS_PER_BYTE - in the case where you have a slow SPI SCLK and a large wordsize, the driver could be spinning for a nontrivial amount of time.

popcornmix added a commit to raspberrypi/firmware that referenced this pull request Feb 4, 2025
See: raspberrypi/linux#6636

kernel: misc: rp1-pio: SM_CONFIG_XFER32 = larger DMA bufs
See: raspberrypi/linux#6640

kernel: Handle probe dependencies and hard errors better
See: raspberrypi/linux#6645

kernel: spi: dw: Wait for idle after TX
See: raspberrypi/linux#6646
See: raspberrypi/linux#6649
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Feb 4, 2025
See: raspberrypi/linux#6636

kernel: misc: rp1-pio: SM_CONFIG_XFER32 = larger DMA bufs
See: raspberrypi/linux#6640

kernel: Handle probe dependencies and hard errors better
See: raspberrypi/linux#6645

kernel: spi: dw: Wait for idle after TX
See: raspberrypi/linux#6646
See: raspberrypi/linux#6649
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants