From patchwork Wed Sep 9 16:33:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 7147491 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8F01B9F326 for ; Wed, 9 Sep 2015 16:37:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC26E209FC for ; Wed, 9 Sep 2015 16:37:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 487A3209FF for ; Wed, 9 Sep 2015 16:37:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754525AbbIIQhw (ORCPT ); Wed, 9 Sep 2015 12:37:52 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36470 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754508AbbIIQhv (ORCPT ); Wed, 9 Sep 2015 12:37:51 -0400 Received: by padhk3 with SMTP id hk3so14880463pad.3 for ; Wed, 09 Sep 2015 09:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bJz+sx2+cVGWYgdphlzwJUq4X11NzsNHACUAL7VKrgc=; b=MKYHH1nQx9zOmO8LARcoU7DdUG1DqAWzUfMxJXYneK5u1Exn91NiGKzzUwvGchMH2G uNYJ46tavtF+oDO77UCMHcga0zLN4hGTcEWGzGCf94lxxWmhpsPXS+P4jeFXuQJieBWl FbA916x23OHxkhHckTXWNx3enOARIARSDg4BZIHWrqh03mKRJQAYhrkctkmHyNP1vHpR WBMxQfVZUO85mQu7+Q62RlnBTdIjMnvKZ9bZNAqXZlhqsXCUjb4aaThwzJ7RYz7e5Lim ygoRnJDNAUOvZhCHEc9tM13JkXebyC2J4kqesya5Vxo0PZvQn+ix1YSa7EX6isG2JQGM GjrA== X-Received: by 10.66.119.202 with SMTP id kw10mr62853550pab.38.1441816670554; Wed, 09 Sep 2015 09:37:50 -0700 (PDT) Received: from debian.corp.sankuai.com ([103.29.140.56]) by smtp.gmail.com with ESMTPSA id py6sm3229859pbb.62.2015.09.09.09.37.48 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Sep 2015 09:37:49 -0700 (PDT) From: Yousong Zhou To: Ulf Hansson Cc: Hans de Goede , Shawn Lin , linux-mmc@vger.kernel.org, Yousong Zhou Subject: [PATCH 3/3] mmc: sd: Retry switching to highspeed mode in case of error Date: Thu, 10 Sep 2015 00:33:18 +0800 Message-Id: <1441816398-4330-3-git-send-email-yszhou4tech@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1441816398-4330-1-git-send-email-yszhou4tech@gmail.com> References: <1441816398-4330-1-git-send-email-yszhou4tech@gmail.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 A SD card with sunxi-mmc can fail with the following error message (RCE for response CRC error) when trying to switch to highspeed mode. But the mode switch can almost always succeed on the second try. Dmesg before this commit. [ 1.112060] mmc0: host does not support reading read-only switch, assuming write-enable [ 1.126527] sunxi-mmc 1c0f000.mmc: smc 0 err, cmd 6, RD RCE !! [ 1.132388] sunxi-mmc 1c0f000.mmc: data error, sending stop command [ 1.139451] sunxi-mmc 1c0f000.mmc: send stop command failed [ 1.145056] mmc0: error -110 whilst initialising SD card [ 1.150424] ehci-platform 1c1c000.usb: USB 2.0 started, EHCI 1.00 [ 1.156533] sunxi-mmc 1c0f000.mmc: smc 0 err, cmd 1, RTO !! Dmesg after this commit. [ 1.062306] mmc0: host does not support reading read-only switch, assuming write-enable [ 1.070635] sunxi-mmc 1c0f000.mmc: smc 0 err, cmd 6, RD RCE !! [ 1.295939] sunxi-mmc 1c0f000.mmc: data error, sending stop command [ 1.322635] Waiting for root device /dev/mmcblk0p2... [ 1.322691] sunxi-mmc 1c0f000.mmc: send stop command failed [ 1.335686] mmc0: new high speed SD card at address 0002 [ 1.341557] mmcblk0: mmc0:0002 00000 974 MiB [ 1.347021] mmcblk0: p1 p2 Signed-off-by: Yousong Zhou --- drivers/mmc/core/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index e28ebf3..7465b16 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -364,7 +364,7 @@ int mmc_sd_switch_hs(struct mmc_card *card) return -ENOMEM; } - err = mmc_sd_switch(card, 1, 0, 1, status); + err = __mmc_sd_switch(card, 1, 0, 1, status, MMC_CMD_RETRIES); if (err) goto out;