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 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
Split out the error-handling code from #180 to make my life easier.
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:
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.