Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: will.newton@imgtec.com, Chris Ball <cjb@laptop.org>,
	Kyungmin Park <kyungmin.park@samsung.com>
Subject: [RFC PATCH 0/1] dw_mmc: checking card busy with Status register
Date: Fri, 25 Mar 2011 15:00:34 +0900	[thread overview]
Message-ID: <4D8C2F82.2040504@samsung.com> (raw)

This RFC patch is applied checking card busy with status register.

In Status register, bit[9] indicate the card busy or not.
So, if we use this bit in status register, we can check the card busy or not.

Maybe, didn't increased the performance, but i think this approach is decreased
the CPU usage.

Anyone, let me know how think about this patch.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mmc/host/dw_mmc.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 87e1f57..882d004 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -647,9 +647,26 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 {
 	struct dw_mci_slot *slot = mmc_priv(mmc);
 	struct dw_mci *host = slot->host;
+	unsigned int timeout = 0x100;
 
 	WARN_ON(slot->mrq);
 
+	while (timeout) {
+		if ((mrq->data && (mrq->data->flags == MMC_DATA_READ)) ||
+			!(mci_readl(host, STATUS) & (1 << 9)))
+			break;
+
+		if (timeout == 0) {
+			dev_err(&host->pdev->dev, "Card is busy!!\n");
+			return;
+		}
+
+		if (!need_resched())
+			usleep_range(10, 50);
+
+		timeout--;
+	}
+
 	if (!test_bit(DW_MMC_CARD_PRESENT, &slot->flags)) {
 		mrq->cmd->error = -ENOMEDIUM;
 		mmc_request_done(mmc, mrq);

             reply	other threads:[~2011-03-25  6:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25  6:00 Jaehoon Chung [this message]
2011-03-25 10:58 ` [RFC PATCH 0/1] dw_mmc: checking card busy with Status register Will Newton

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=4D8C2F82.2040504@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=cjb@laptop.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=will.newton@imgtec.com \
    /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