aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@linaro.org>2013-06-09 07:49:24 -0400
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:00:38 -0400
commit221d8dd47e16858a33eb467fd1e6a55bcf835bb8 (patch)
tree5eda321ffd35f63310106ba0b4b6785e255c89ec
parentea7dc16376be8eb55fb4c70c08576c3ec47fcf7d (diff)
mmc: sdhci: improve card removal check in sdhci_card_event()
Commit 9668d765eab78d58e656177db2acb57c249b9c01 upstream. The following error randomly appears on an imx6q board where gpio is used to implement card-detection when mounting EXT4 rootfs during boot. mmc1: Card removed during transfer! mmc1: Resetting controller. mmcblk0: unknown error -123 sending read/write command, card status 0x900 end_request: I/O error, dev mmcblk0, sector 106744 EXT4-fs error (device mmcblk0p2): ext4_find_entry:1312: inode #5011: comm swapper/0: reading directory lblock 0 It turns out that the error message comes from the card removal check in function sdhci_card_event(). While we have a well implemented function sdhci_do_get_cd() handling all the possible cases of CD, the current code only checks controller internal CD case. That causes problem for other CD cases like gpio on above imx6q board. Improve the check by using sdhci_do_get_cd() to cover all possible CD cases, so that above error on the imx6q board gets fixed. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
-rw-r--r--drivers/mmc/host/sdhci.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index a821b7157b51..a69f773710b6 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2049,8 +2049,7 @@ static void sdhci_card_event(struct mmc_host *mmc)
2049 spin_lock_irqsave(&host->lock, flags); 2049 spin_lock_irqsave(&host->lock, flags);
2050 2050
2051 /* Check host->mrq first in case we are runtime suspended */ 2051 /* Check host->mrq first in case we are runtime suspended */
2052 if (host->mrq && 2052 if (host->mrq && !sdhci_do_get_cd(host)) {
2053 !(sdhci_readl(host, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT)) {
2054 pr_err("%s: Card removed during transfer!\n", 2053 pr_err("%s: Card removed during transfer!\n",
2055 mmc_hostname(host->mmc)); 2054 mmc_hostname(host->mmc));
2056 pr_err("%s: Resetting controller.\n", 2055 pr_err("%s: Resetting controller.\n",