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

fixup! spi: dw: Wait for idle after TX #6649

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

pelwell
Copy link
Contributor

@pelwell pelwell commented Feb 4, 2025

Relax a bit harder - transmission of the last bits may take a while.

Relax a bit harder - transmission of the last bits may take a while.

Signed-off-by: Phil Elwell <[email protected]>
@pelwell
Copy link
Contributor Author

pelwell commented Feb 4, 2025

@P33M Surprisingly, this seems to reduce the delay between the final SCLK and CS going high to around 2.6us, whereas before it was at least 4us.

@P33M
Copy link
Contributor

P33M commented Feb 4, 2025

It'll be using a more accurate guess as to when the shift register will go idle, but I'm surprised that spamming reads of the status register isn't faster. cpu_relax() compiles to yield on aarch64 which is basically a nop on non-hyperthreaded ARM cores.

That said, round-trip time is ~1.6us for RP1 register reads.

@pelwell
Copy link
Contributor Author

pelwell commented Feb 4, 2025

The test program I'm using sets SCLK to 2MHz. At that speed, a single byte is transmitted in 4us. Perhaps the more heavy-weight spi_delay_exec actually has the effect of delaying the first read of DW_SPI_SR sufficiently that it has already gone idle, meaning that a second read is not required.

@pelwell pelwell merged commit fab0093 into raspberrypi:rpi-6.6.y Feb 4, 2025
12 checks passed
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