mmc: am654_sdhci: Implement workaround for card detect
authorFaiz Abbas <faiz_abbas@ti.com>
Wed, 26 Feb 2020 08:14:34 +0000 (13:44 +0530)
committerPeng Fan <peng.fan@nxp.com>
Mon, 9 Mar 2020 00:33:16 +0000 (08:33 +0800)
commita85121392015e30bd12302ea2986b7ca662d198d
tree167dd48c999a37c6468712fe6b31291e142704e6
parentc7d106b4eb3fef78cd05a51b3b6950f152d93c06
mmc: am654_sdhci: Implement workaround for card detect

The 4 bit MMC controllers have an internal debounce for the SDCD line
with a debounce delay of 1 second. Therefore, after clocks to the IP are
enabled, software has to wait for this time before it can power on the
controller.

Add a deferred_probe() callback which polls on sdcd for a maximum of 2 seconds
before switching on power to the controller or (in the case of no card)
returning a ENOMEDIUM. This pushes the 1 second wait time to when the
card is actually needed rather than at every probe() making sure that
users who don't insert an SD card in the slot don't have to wait such a
long time.

Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
drivers/mmc/am654_sdhci.c