All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuanxiao Dong <chuanxiao.dong@intel.com>
To: linux-mmc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	cjb@laptop.org, kmpark@infradead.org, leonard.mai@intel.com
Subject: [PATCH v5 4/4]do HW reset after each read/write/erase if need
Date: Thu, 9 Dec 2010 20:25:03 +0800	[thread overview]
Message-ID: <20101209122503.GE13236@intel.com> (raw)

Driver can do a HW reset for eMMC card if read/write/erase
occurs timeout error.

Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
---
 drivers/mmc/card/block.c |   10 ++++++++++
 drivers/mmc/core/core.c  |    2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 217f820..c50f94b 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -424,6 +424,16 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
 
 		mmc_wait_for_req(card->host, &brq.mrq);
 
+		/*
+		 * Check if need to do HW reset.
+		 */
+		if (brq.cmd.error)
+			mmc_handle_timeout_error(card->host, brq.cmd.error);
+		else if (brq.data.error)
+			mmc_handle_timeout_error(card->host, brq.data.error);
+		else if (brq.stop.error)
+			mmc_handle_timeout_error(card->host, brq.stop.error);
+
 		mmc_queue_bounce_post(mq);
 
 		/*
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 530fc35..731399e 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1385,6 +1385,8 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from,
 	if (err) {
 		printk(KERN_ERR "mmc_erase: erase error %d, status %#x\n",
 		       err, cmd.resp[0]);
+		/* Before return, check whether can do a HW reset */
+		mmc_handle_timeout_error(card->host, cmd.error);
 		err = -EIO;
 		goto out;
 	}
-- 
1.6.6.1


                 reply	other threads:[~2010-12-09 12:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20101209122503.GE13236@intel.com \
    --to=chuanxiao.dong@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=cjb@laptop.org \
    --cc=kmpark@infradead.org \
    --cc=leonard.mai@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.