Page MenuHomeFreeBSD

bcm2835_sdhci.c: exit DMA if not enough data left to avoid timeout errors
ClosedPublic

Authored by bz on May 8 2019, 10:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 16 2024, 8:04 PM
Unknown Object (File)
Dec 24 2023, 12:31 AM
Unknown Object (File)
Nov 15 2023, 3:10 AM
Unknown Object (File)
Oct 14 2023, 10:00 AM
Unknown Object (File)
Aug 7 2023, 4:22 PM
Unknown Object (File)
Aug 7 2023, 4:20 PM
Unknown Object (File)
Aug 7 2023, 4:19 PM
Unknown Object (File)
Aug 6 2023, 10:53 AM
Subscribers

Details

Summary
In the DMA case, given we disable the data interrupts, we never seem
to get DATA_END.  Given we are relying on DMA interrupts we are not
using the SDHCI state machine and hence only call into
sdhci_platform_will_handle() for the first check of data.
We do not call "will handle" for any following round trips of the same
transaction if block size * count > BCM_DMA_BLOCK_SIZE.
Manually check "left" in the DMA interrupt handler to see if we have at
least another full BCM_DMA_BLOCK_SIZE to handle.
Without this change we would DMA that and then even start a DMA with
left == 0 which would lead to a timeout and error.
Now we re-enable data interrupts and return and let the SDHCI generic
interrupt handler and state machine pick the SPACE_AVAIL up and then
find that it should punt to the pio_handler for the remaining bytes
or finish the data transaction.

With this change block mode seems to work beyond 7 * 64byte blocks
(my initial test case) which worked as it was below BCM_DMA_BLOCK_SIZE.
Test Plan
Tested a few sizes up to 511 blocks of 64bytes.
Especially tested 16 blocks which leads to 2 * BCM_DMA_BLOCK_SIZE and a straight left == 0.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I'd like to commit this the next days. Can someone please review? If not it'll go in by Sat 8 June.

This revision was not accepted when it landed; it landed in state Needs Review.Jun 8 2019, 4:15 PM
This revision was automatically updated to reflect the committed changes.