blk: Make the i.MX8 mmc driver more robust to errors#206
Merged
Conversation
adbaabd to
849b1d3
Compare
69d1d63 to
8f9e561
Compare
e8bd2c3 to
870d82c
Compare
870d82c to
22aa5a6
Compare
* The in-tree code relied on a lot of assertions and would crash in the presence of any sort of errors, e.g. card removal. * This new implementation handles command errors uniformly in a new `handle_interrupt_status()` function, and returns varying error types up the call stack and to the block queues. Further/more detailed changes are: * The INT_STATUS register is now only read once on an interrupt, to prevent subtle race conditions. * Soft failures from: - Card not expecting an APP_CMD following CMD55 (incompatible) - Incompatible voltage ranges, or unsupported card types - Incorrect card check commands from CMD8 * sDDF Block queues are only ever initialised once * Indefinite busy-wait loops on Command Inhibit fields are replaced with an error return, as they never happen in usual operation. Similarly, busy wait on DAT[0] following R1b commands are handled by the IP, so it never happens. * On failed initialisation, reset (most) of the driver state, so we can try again in future. This is prep work for hotplugging support. * Add a stub `card_detected()` function which currently always returns `true`, but if implemented will correctly send "Gone" errors responses. * Add BLK_RESP_DEV_GONE error to the block queue This handles the case where the block device has been unplugged or is otherwise unavailable. * Add -MD to the example CFLAGS to track header-file dependencies Signed-off-by: julia <git.ts@trainwit.ch>
Signed-off-by: julia <git.ts@trainwit.ch>
22aa5a6 to
77fd067
Compare
Ivan-Velickovic
approved these changes
Sep 2, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 in-tree code relied on a lot of assertions and would crash in
the presence of any sort of errors, e.g. card removal.
This new implementation handles command errors uniformly in a new
handle_interrupt_status()function, and returns varying error typesup the call stack and to the block queues.
Further/more detailed changes are:
The INT_STATUS register is now only read once on an interrupt, to
prevent subtle race conditions.
Soft failures from:
sDDF Block queues are only ever initialised once
Indefinite busy-wait loops on Command Inhibit fields are replaced
with an error return, as they never happen in usual operation.
Similarly, busy wait on DAT[0] following R1b commands are handled
by the IP, so it never happens.
On failed initialisation, reset (most) of the driver state, so we can
try again in future. This is prep work for hotplugging support.
Add a stub
card_detected()function which currently always returnstrue, but if implemented will correctly send "Gone" errors responses.Add BLK_RESP_DEV_GONE error to the block queue
This handles the case where the block device has been unplugged
or is otherwise unavailable.
Add -MD to the example CFLAGS to track header-file dependencies
Split out the error-handling code from #180 to make my life easier.