From patchwork Wed Dec 1 12:49:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chuanxiao.Dong" X-Patchwork-Id: 371101 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB1Crsg0010706 for ; Wed, 1 Dec 2010 12:53:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755127Ab0LAMxG (ORCPT ); Wed, 1 Dec 2010 07:53:06 -0500 Received: from mga11.intel.com ([192.55.52.93]:50167 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755122Ab0LAMxF convert rfc822-to-8bit (ORCPT ); Wed, 1 Dec 2010 07:53:05 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 01 Dec 2010 04:52:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.59,283,1288594800"; d="scan'208,223";a="631973319" Received: from unknown (HELO intel.com) ([172.16.120.128]) by fmsmga002.fm.intel.com with ESMTP; 01 Dec 2010 04:52:55 -0800 Date: Wed, 1 Dec 2010 20:49:52 +0800 From: Chuanxiao Dong To: linux-mmc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, cjb@laptop.org, arjan@linux.intel.com, alan@linux.intel.com, akpm@linux-foundation.org Subject: [PATCH v4 4/4]do HW reset after each reading/writing/erasing Message-ID: <20101201124952.GE5421@intel.com> Reply-To: Chuanxiao Dong MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Dec 2010 12:53:56 +0000 (UTC) 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..559ff1c 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1382,6 +1382,8 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from, cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; mmc_set_erase_timeout(card, &cmd, arg, qty); err = mmc_wait_for_cmd(card->host, &cmd, 0); + /* Before return, check whether can do a HW reset */ + mmc_handle_timeout_error(card->host, cmd.error); if (err) { printk(KERN_ERR "mmc_erase: erase error %d, status %#x\n", err, cmd.resp[0]);