mmc/bcm2835-sdhost: Recover from MMC_SEND_EXT_CSD
authorPhil Elwell <phil@raspberrypi.org>
Fri, 26 Oct 2018 16:29:51 +0000 (17:29 +0100)
committerpopcornmix <popcornmix@gmail.com>
Mon, 13 May 2019 23:08:06 +0000 (00:08 +0100)
commitda070cf562fb310c3e5714693ba13cbdde981983
treed0ceabcbacb54345a856990e5df09b86c3d828be
parenta4a0a8afd6eb32cc422acf03cd023ae526394b52
mmc/bcm2835-sdhost: Recover from MMC_SEND_EXT_CSD

If the user issues an "mmc extcsd read", the SD controller receives
what it thinks is a SEND_IF_COND command with an unexpected data block.
The resulting operations leave the FSM stuck in READWAIT, a state which
persists until the MMC framework resets the controller, by which point
the root filesystem is likely to have been unmounted.

A less heavyweight solution is to detect the condition and nudge the
FSM by asserting the (self-clearing) FORCE_DATA_MODE bit.

N.B. This workaround was essentially discovered by accident and without
a full understanding the inner workings of the controller, so it is
fortunate that the "fix" only modifies error paths.

See: https://github.com/raspberrypi/linux/issues/2728

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
drivers/mmc/host/bcm2835-sdhost.c