mmc: core: add tunable delay waiting for power to be stable
authorShawn Lin <shawn.lin@rock-chips.com>
Tue, 8 May 2018 01:04:20 +0000 (09:04 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 21 May 2018 08:38:50 +0000 (10:38 +0200)
commit6d796c68cd15234a33a4bd2ef7231125fea2dc6c
tree699e3e5d3229f6c5797085f43383d13c0998eac6
parent10a0ed7a945054c2c4951e7a938b5f5498964820
mmc: core: add tunable delay waiting for power to be stable

The hard-coded 10ms delay in mmc_power_up came from
commit 79bccc5aefb4 ("mmc: increase power up delay"), which said "The TI
controller on Toshiba Tecra M5 needs more time to power up or the cards
will init incorrectly or not at all." But it's too engineering solution
for a special board but force all platforms to wait for that long time,
especially painful for mmc_power_up for eMMC when booting.

However, it's added since 2009, and we can't tell if other platforms
benefit from it. But in practise, the modern hardware are most likely to
have a stable power supply with 1ms after setting it for no matter PMIC
or discrete power. And more importnatly, most regulators implement the
callback of ->set_voltage_time_sel() for regulator core to wait for
specific period of time for the power supply to be stable, which means
once regulator_set_voltage_* return, the power should reach the the
minimum voltage that works for initialization. Of course, if there
are some other ways for host to power the card, we should allow them
to argue a suitable delay as well.

With this patch, we could assign the delay from firmware, or we could
assigne it via ->set_ios() callback from host drivers.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/core/core.c
drivers/mmc/core/host.c
include/linux/mmc/host.h