From patchwork Wed Aug 21 12:42:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seungwon Jeon X-Patchwork-Id: 2847705 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6D03EBF546 for ; Wed, 21 Aug 2013 12:42:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1886C204FE for ; Wed, 21 Aug 2013 12:42:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BDE1F20363 for ; Wed, 21 Aug 2013 12:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751992Ab3HUMmf (ORCPT ); Wed, 21 Aug 2013 08:42:35 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:32382 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751688Ab3HUMme (ORCPT ); Wed, 21 Aug 2013 08:42:34 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MRV003H2SMEHRQ0@mailout1.samsung.com> for linux-mmc@vger.kernel.org; Wed, 21 Aug 2013 21:42:32 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.49]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 0D.E1.03969.8B5B4125; Wed, 21 Aug 2013 21:42:32 +0900 (KST) X-AuditID: cbfee68f-b7f436d000000f81-59-5214b5b80e56 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id DE.D0.32250.8B5B4125; Wed, 21 Aug 2013 21:42:32 +0900 (KST) Received: from DOTGIHJUN01 ([12.23.118.161]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MRV00COQSMV7970@mmp1.samsung.com>; Wed, 21 Aug 2013 21:42:31 +0900 (KST) From: Seungwon Jeon To: linux-mmc@vger.kernel.org Cc: 'Chris Ball' References: In-reply-to: Subject: [PATCH 2/3] mmc: core: add ignorance case for CMD13 CRC error Date: Wed, 21 Aug 2013 21:42:31 +0900 Message-id: <002301ce9e6b$e72da2a0$b588e7e0$%jun@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac03z3aCvVFr8FaITt2vKVQKst76fw3Ogf7QC4iI1hAADVzV0BBOVxiAARu2RyAu11s2MA== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsVy+t8zQ90dW0WCDG4sUrDY/nojm8WR//2M Dkweh66sZfT4vEkugCmKyyYlNSezLLVI3y6BK2PHYYWCo6IVS+acZmlgnC/YxcjJISFgIvF8 610WCFtM4sK99WxdjFwcQgLLGCU2/LnADFP04M8MMFtIYBGjxMWr6RBFfxglerfPYAJJsAlo Sfx98wasSERAVuLnnwtsIDazgKLEj99r2bsYOYAauCVWNweBhDkFeCTW/ekEKxcWcJO4+nYh mM0ioCrx51A3WCuvgK3ErE87WCBsQYkfk++xgIxhFlCXmDIlF2K6vMTmNW+ZQcISQOFHf3Uh DoiQaPmygx2iRERi34t3jCAXSwisY5dYMvEMC8QqAYlvkw+xQPTKSmw6APWtpMTBFTdYJjBK zEKyeBbC4llIFs9CsmEBI8sqRtHUguSC4qT0ImO94sTc4tK8dL3k/NxNjJAo69/BePeA9SHG ZKDtE5mlRJPzgVGaVxJvaGxmZGFqYmpsZG5p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umv+lXYb5+eBW+8//vb/7UYzRpNL/1Xr0sQ+9q3IndFQdGu24Q2fSRxKLMUZiYZa zEXFiQBCDUwfJQMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While speed mode is changed, CMD13 cannot be guaranteed. According to the spec., it is not recommended to use CMD13 to check the busy completion of the timing change. If CMD13 is used in this case, CRC error must be ignored. Signed-off-by: Seungwon Jeon --- drivers/mmc/core/mmc_ops.c | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 837fc73..f5dfa9c 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -23,6 +23,9 @@ #define MMC_OPS_TIMEOUT_MS (10 * 60 * 1000) /* 10 minute timeout */ +static inline int __mmc_send_status(struct mmc_card *card, u32 *status, + bool ignore_crc); + static int _mmc_select_card(struct mmc_host *host, struct mmc_card *card) { int err; @@ -380,6 +383,7 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, struct mmc_command cmd = {0}; unsigned long timeout; u32 status; + bool ignore_crc; BUG_ON(!card); BUG_ON(!card->host); @@ -408,10 +412,15 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, if (!use_busy_signal) return 0; - /* Must check status to be sure of no errors */ + /* + * Must check status to be sure of no errors + * If CMD13 is to check the busy completion of the timing change, + * disable the check of CRC error. + */ + ignore_crc = (index == EXT_CSD_HS_TIMING) ? true : false; timeout = jiffies + msecs_to_jiffies(MMC_OPS_TIMEOUT_MS); do { - err = mmc_send_status(card, &status); + err = __mmc_send_status(card, &status, ignore_crc); if (err) return err; if (card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) @@ -449,7 +458,8 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, } EXPORT_SYMBOL_GPL(mmc_switch); -int mmc_send_status(struct mmc_card *card, u32 *status) +static inline int __mmc_send_status(struct mmc_card *card, u32 *status, + bool ignore_crc) { int err; struct mmc_command cmd = {0}; @@ -461,6 +471,8 @@ int mmc_send_status(struct mmc_card *card, u32 *status) if (!mmc_host_is_spi(card->host)) cmd.arg = card->rca << 16; cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; + if (ignore_crc) + cmd.flags &= ~MMC_RSP_CRC; err = mmc_wait_for_cmd(card->host, &cmd, MMC_CMD_RETRIES); if (err) @@ -475,6 +487,11 @@ int mmc_send_status(struct mmc_card *card, u32 *status) return 0; } +int mmc_send_status(struct mmc_card *card, u32 *status) +{ + return __mmc_send_status(card, status, false); +} + static int mmc_send_bus_test(struct mmc_card *card, struct mmc_host *host, u8 opcode, u8 len)