linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Chang-Ming.Huang@freescale.com>
To: linux-mmc@vger.kernel.org
Cc: linuxppc-dev@linux.freescale.net,
	Jerry Huang <Chang-Ming.Huang@freescale.com>
Subject: [PATCH 2/3] MMC/SD: add callback function to detect card
Date: Wed, 11 May 2011 17:32:10 +0800	[thread overview]
Message-ID: <1305106331-21280-2-git-send-email-Chang-Ming.Huang@freescale.com> (raw)
In-Reply-To: <1305106331-21280-1-git-send-email-Chang-Ming.Huang@freescale.com>

From: Jerry Huang <Chang-Ming.Huang@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 system bad.
Therefore, get_cd callback is used to detect the card if the driver has.

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

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);
 
-- 
1.7.4.1



  reply	other threads:[~2011-05-11 15:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-11  9:32 [PATCH 1/3] SDHCI: add sdhci_get_cd callback to detect the card Chang-Ming.Huang
2011-05-11  9:32 ` Chang-Ming.Huang [this message]
2011-05-11  9:32   ` [PATCH 3/3] SDHC/MMC: add f_min to mmc_power_on Chang-Ming.Huang
  -- strict thread matches above, loose matches on Subject: below --
2011-05-12  5:24 [PATCH 1/3] SDHCI: add sdhci_get_cd callback to detect the card r66093
2011-05-12  5:24 ` [PATCH 2/3] MMC/SD: add callback function to detect card r66093
2011-05-20  7:35 [PATCH 1/3] SDHCI: add sdhci_get_cd callback to detect the card r66093
2011-05-20  7:35 ` [PATCH 2/3] MMC/SD: add callback function to detect card r66093

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305106331-21280-2-git-send-email-Chang-Ming.Huang@freescale.com \
    --to=chang-ming.huang@freescale.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linuxppc-dev@linux.freescale.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).