mmc: tmio: fix never-detected card insertion bug
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 17 Jan 2018 16:28:13 +0000 (01:28 +0900)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 5 Mar 2018 12:03:48 +0000 (13:03 +0100)
commitc7cd630a9751b9ec8bba37edbba06a29e7d9a14b
treee2477df48b6f37621895b045cc11d3d165d93556
parent497d1f965c207f1d670066e9c87a2ffad1ce4e5e
mmc: tmio: fix never-detected card insertion bug

The TMIO mmc cannot detect the card insertion in native_hotplug mode
if the driver is probed without a card inserted.

The reason is obvious; all IRQs are disabled by tmio_mmc_host_probe(),
as follows:

  tmio_mmc_disable_mmc_irqs(_host, TMIO_MASK_ALL);

The card event IRQs are first enabled by tmio_mmc_start_command() as
follows:

  if (!host->native_hotplug)
          irq_mask &= ~(TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT);
  tmio_mmc_enable_mmc_irqs(host, irq_mask);

If the driver is probed without a card, tmio_mmc_start_command() is
never called in the first place.  So, the card is never detected.

The card event IRQs must be enabled in probe/resume functions.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
drivers/mmc/host/tmio_mmc_core.c