OSDN Git Service

mmc: core: Enable eMMC sleep commands to use HW busy polling
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 4 May 2021 16:12:16 +0000 (18:12 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 14 Jun 2021 11:57:36 +0000 (13:57 +0200)
commit6fa79651cc808f68db6f6f297be5a950ccd5dffb
tree1b4d50b9b06ff256928ccb186628a9ae81d8d89e
parent04f967ad28c836815f6894b618643dd23670c6e5
mmc: core: Enable eMMC sleep commands to use HW busy polling

After the eMMC sleep command (CMD5) has been sent, the card start signals
busy on the DAT0 line, which can be monitored to understand when it's
allowed to proceed to power off the VCC regulator.

When MMC_CAP_WAIT_WHILE_BUSY isn't supported by the host the DAT0 line
isn't being monitored for busy completion, but instead we are waiting a
fixed period of time. The time corresponds to the sleep timeout that is
specified in the EXT_CSD register of the eMMC card. This is many cases
suboptimal, as the timeout corresponds to the worst case scenario.

To improve the situation add support for HW busy polling through the
->card_busy() host ops, when the host supports this.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Acked-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20210504161222.101536-6-ulf.hansson@linaro.org
drivers/mmc/core/mmc.c