diff mbox

[2/3] MMC/SD: add callback function to detect card

Message ID 1305876914-23714-2-git-send-email-r66093@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Huang Changming-R66093 May 20, 2011, 7:35 a.m. UTC
From: Jerry Huang <r66093@freescale.com>

Add callback function to check if the card has been removed.

in order to check if the card has been removed, the function mmc_send_status
will send commad CMD13 to card and ask the card to send its status register
to sdhc driver, which will generate interrupt repeatly and make the performance
of the system bad.
Therefore, get_cd callback is used to detect the card if the driver has.

Signed-off-by: Jerry Huang <r66093@freescale.com>
---
 drivers/mmc/core/mmc.c |    5 ++++-
 drivers/mmc/core/sd.c  |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 772d0d0..137d529 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -713,7 +713,10 @@  static void mmc_detect(struct mmc_host *host)
 	/*
 	 * Just check if our card has been removed.
 	 */
-	err = mmc_send_status(host->card, NULL);
+	if (host->ops->get_cd)
+		err = !host->ops->get_cd(host);
+	else
+		err = mmc_send_status(host->card, NULL);
 
 	mmc_release_host(host);
 
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 6dac89f..b85df32 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -673,7 +673,10 @@  static void mmc_sd_detect(struct mmc_host *host)
 	/*
 	 * Just check if our card has been removed.
 	 */
-	err = mmc_send_status(host->card, NULL);
+	if (host->ops->get_cd)
+		err = !host->ops->get_cd(host);
+	else
+		err = mmc_send_status(host->card, NULL);
 
 	mmc_release_host(host);