From patchwork Fri Jun 20 09:35:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Yang X-Patchwork-Id: 4387581 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 CDE3ABEEAA for ; Fri, 20 Jun 2014 09:35:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0735E203B6 for ; Fri, 20 Jun 2014 09:35:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 25F0E203B5 for ; Fri, 20 Jun 2014 09:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934324AbaFTJft (ORCPT ); Fri, 20 Jun 2014 05:35:49 -0400 Received: from mail-pb0-f41.google.com ([209.85.160.41]:40505 "EHLO mail-pb0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933582AbaFTJfs (ORCPT ); Fri, 20 Jun 2014 05:35:48 -0400 Received: by mail-pb0-f41.google.com with SMTP id ma3so2922738pbc.14 for ; Fri, 20 Jun 2014 02:35:48 -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=8jJYDZhZ3FPXjmxi7aDnrtpd2G5+pHtB578OOjzXJMY=; b=ZlgyQuxuzx0TQH73reQxU1MLqUaBmsfoWQaEEUQMrCP4WWx8Bgf0crSvHaVGAfaX6y bfyTJOFA1dq/Exy0DzI3Z4nVvZ5XJsy9yxQ1l4jIUIyEXuaPJEp5cR8393MCgoSSocTu 44ML0qEWGr4DzG7XKet2NiTUrTrPjR4gC6hWKVYNpqavpe1tllwhav0UPkZXnLkr+vBj 7Vu27UYM23hL0fgVdQTHM9mtbr2+/z+ixBmf0bBvcmey/wtF8zGkgfNk5+AP3EHxm+d6 hijOD62MuuO31/N77hiK3gJX5Hyf2eVAkw98e3yY6hdEN/Xsz1PCD8jlnjfQ4nCSeaSU crBA== X-Received: by 10.69.25.105 with SMTP id ip9mr3052520pbd.145.1403256948251; Fri, 20 Jun 2014 02:35:48 -0700 (PDT) Received: from localhost.localdomain ([124.219.7.128]) by mx.google.com with ESMTPSA id si8sm40661499pab.27.2014.06.20.02.35.46 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Jun 2014 02:35:47 -0700 (PDT) From: Vincent Yang X-Google-Original-From: Vincent Yang To: chris@printf.net, linux-mmc@vger.kernel.org Cc: anton@enomsg.org, linuxppc-dev@lists.ozlabs.org, patches@linaro.org, andy.green@linaro.org, Vincent.Yang@tw.fujitsu.com Subject: [RFC PATCH 6/7] mmc: core: hold SD Clock before CMD11 during Signal Voltage Switch Procedure Date: Fri, 20 Jun 2014 17:35:27 +0800 Message-Id: <1403256928-11359-7-git-send-email-Vincent.Yang@tw.fujitsu.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1403256928-11359-1-git-send-email-Vincent.Yang@tw.fujitsu.com> References: <1403256928-11359-1-git-send-email-Vincent.Yang@tw.fujitsu.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 This patch is to fix an issue found on mb86s7x platforms. [symptom] There are some UHS-1 SD memory cards sometimes cannot be detected correctly, e.g., Transcend 600x SDXC 64GB UHS-1 memory card. During Signal Voltage Switch Procedure, failure to switch is indicated by the card holding DAT[3:0] low. [analysis] According to SD Host Controller Simplified Specification Version 3.00 chapter 3.6.1, the Signal Voltage Switch Procedure should be: (1) Check S18A; (2) Issue CMD11; (3) Check CMD 11 response; (4) Stop providing SD clock; (5) Check DAT[3:0] should be 0000b; (6) Set 1.8V Signal Enable; (7) Wait 5ms; (8) Check 1.8V Signal Enable; (9) Provide SD Clock; (10) Wait 1ms; (11) Check DAT[3:0] should be 1111b; (12) error handling With CONFIG_MMC_CLKGATE=y, sometimes there is one more gating/un-gating SD clock between (2) and (3). In this case, some UHS-1 SD cards will hold DAT[3:0] 0000b at (11) and thus fails Signal Voltage Switch Procedure. [solution] By mmc_host_clk_hold() before CMD11, the additional gating/un-gating SD clock between (2) and (3) can be prevented and thus no failure at (11). It has been verified with many UHS-1 SD cards on mb86s7x platforms and works correctly. Signed-off-by: Vincent Yang --- drivers/mmc/core/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 7dc0c85..764af63 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1428,6 +1428,8 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr) pr_warning("%s: cannot verify signal voltage switch\n", mmc_hostname(host)); + mmc_host_clk_hold(host); + cmd.opcode = SD_SWITCH_VOLTAGE; cmd.arg = 0; cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; @@ -1438,8 +1440,6 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr) if (!mmc_host_is_spi(host) && (cmd.resp[0] & R1_ERROR)) return -EIO; - - mmc_host_clk_hold(host); /* * The card should drive cmd and dat[0:3] low immediately * after the response of cmd11, but wait 1 ms to be sure