mmc: core: Fixup busy detection for mmc switch operations
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 28 Jan 2014 13:15:34 +0000 (14:15 +0100)
committerChris Ball <chris@printf.net>
Sun, 23 Feb 2014 15:40:38 +0000 (10:40 -0500)
commitb9ec26160f998493509b782be999ff59e4372971
tree06c0af48fe14643e4252a50d153eef81461c5a25
parent636bd13c12d2331ad835b89681428eccb4cf102e
mmc: core: Fixup busy detection for mmc switch operations

If the host controller supports busy detection in HW, we expect the
MMC_CAP_WAIT_WHILE_BUSY to be set. Likewise the corresponding
host->max_busy_timeout should reflect the maximum busy detection
timeout supported by the host.

Previously we expected a host that supported MMC_CAP_WAIT_WHILE_BUSY to
cope with any timeout, which just isn't feasible due to HW limitations.

For most switch operations, R1B responses are expected and thus we need
to check for busy detection completion. To cope with cases where the
requested busy detection timeout is greater than what the host are able
to support, we fallback to use a R1 response instead. This will prevent
the host from doing HW busy detection.

In those cases, busy detection completion is handled by polling the for
the card's status using CMD13. This is the same mechanism used when the
host doesn't support MMC_CAP_WAIT_WHILE_BUSY.

Do note, a host->max_busy_timeout set to zero, is interpreted by the
mmc core as it don't know what the host supports. It will then provide
the host with whatever timeout the mmc core finds suitable.

For some cases the mmc core has unfurtunate no clue of what timeout to
use. In these cases we provide the host with a timeout value of zero,
which the host may interpret as use whatever timeout it finds suitable.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
drivers/mmc/core/mmc_ops.c