From patchwork Tue May 12 21:46:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 6391861 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C79ACBEEE1 for ; Tue, 12 May 2015 21:49:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DFCDF20306 for ; Tue, 12 May 2015 21:49:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 08AEC202EC for ; Tue, 12 May 2015 21:49:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YsI11-0002I4-8B; Tue, 12 May 2015 21:47:03 +0000 Received: from mail-ig0-x22d.google.com ([2607:f8b0:4001:c05::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YsI0x-00029K-11 for linux-arm-kernel@lists.infradead.org; Tue, 12 May 2015 21:46:59 +0000 Received: by igbsb11 with SMTP id sb11so27931989igb.0 for ; Tue, 12 May 2015 14:46:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=MrLkQWbOamhz3IUVn+FgAxcy/3RSFgj13v4gcHwVIaY=; b=VmgNlZWdeepKb8HMLKkC7Xt7VWvKBAAJYJJ2lCNRLjNU9+aZr46Ezs+iXKJw9cdoUG gv015bz11bIQJJrg1nOmc9Qh5tShg0gEcNc8xRa0G0MkPgV4M7UfUgCEklC+W3YbxyiE nDYu05iafShEdBlm8YBWZDrDqMn0mroItkBpE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MrLkQWbOamhz3IUVn+FgAxcy/3RSFgj13v4gcHwVIaY=; b=SrsCZJPKPEK0HzkYexYiRlhr/p84AVWdaO+PJIJkQ690NMP0nhBYRCFqjtIvsdZUZw xck02/gBFhKAMN1cCdrSnEL1h41S+MzLBW7abjo1w/JXA32/rVuPuZq1Oz1LjCNfkg3D gF3ERiXCgUXu6OVJiWBhFWd1KfR/chv3XTiO+TN55ZK3MlhD9n7pby83rHwUtkDehDTv /AGgewfRGGoY1S+kYgFxhD6kp/hwcIiOm+VZuQ5nQkwYpvpWPiWe72qd0hw7AibsB8Pn XYoQozXxTCDhde0kL3mB7Z2D8vseqIh/ogrk2eGmmmHvp1RXSR5/tmc6Xi8jnXr1o9qz l20A== X-Gm-Message-State: ALoCoQns+OhcVg5Oa9LgM4QnQNGG61TjKphtZcAt+8pVPQOJ9BIrRs7/8+AWxPxvqw0jbvDGlwrJ X-Received: by 10.50.78.199 with SMTP id d7mr6667765igx.18.1431467193639; Tue, 12 May 2015 14:46:33 -0700 (PDT) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by mx.google.com with ESMTPSA id hx3sm2096586igb.5.2015.05.12.14.46.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 May 2015 14:46:32 -0700 (PDT) From: Doug Anderson To: Ulf Hansson Subject: [PATCH] RFC: mmc: core: Increase delay for voltage to stabilize from 3.3V to 1.8V Date: Tue, 12 May 2015 14:46:11 -0700 Message-Id: <1431467171-12937-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150512_144659_111339_3872C88C X-CRM114-Status: GOOD ( 15.24 ) X-Spam-Score: -0.8 (/) Cc: javier.martinez@collabora.co.uk, andrew_gabbasov@mentor.com, linux-kernel@vger.kernel.org, s.hauer@pengutronix.de, linux-mmc@vger.kernel.org, adrian.hunter@intel.com, Doug Anderson , Mark Brown , tim.kryger@gmail.com, johan.rudholm@axis.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_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 Since the regulator used for the SDMMC IO voltage is not expected to draw a lot of current, most systems will probably use an inexpensive LDO for it. LDO regulators apparently have the feature that they don't actively drive the voltage down--they wait for other components in the system to drag the voltage down. Thus they will transition faster under heavy loads and slower under light loads. During an SDMMC voltage change from 3.3V to 1.8V, we are almost certainly under a light load. To be specific: * The regulator is hooked through pulls to CMD0-3 and DAT. Probably the CMD pulls are something like 47K and the DAT is something like 10K. * The card is supposed to be driving DAT0-3 low during voltage change which will draw _some_ current, but not a lot. * The regulator is also provided to the SDMMC host controller, but the SDMMC host controller is in open drain mode during the voltage change and so shouldn't be drawing much current. In order to keep the SDMMC host working properly (or for noise reasons), there might also be a capacitor attached to the SDMMC IO regulator. This also will have the effect of slowing down transitions of the regulator, especially under light loads. From experimental evidence, we've seen the voltage change fail if the card doesn't detect that the voltage fell to less than about 2.3V when we turn on the clock. On one device (that admittedly had a 47K CMD pullup instead of a 10K CMD pullup) we saw that the voltage was just about 2.3V after 5ms and thus the voltage change would sometimes fail. Doubling the delay gave margin and made the voltage change work 100% of the time, despite the slightly weaker CMD pull. At the moment submitting this as an RFC patch since my problem _could_ be fixed by increasing the pull strength (or using a smaller capacitor). However being a little bit more lenient to strange hardware could also be a good thing. Signed-off-by: Doug Anderson --- 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 92e7671..a7e6110 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1551,8 +1551,8 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, u32 ocr) goto power_cycle; } - /* Keep clock gated for at least 5 ms */ - mmc_delay(5); + /* Keep clock gated for at least 10 ms, though spec only says 5 ms */ + mmc_delay(10); host->ios.clock = clock; mmc_set_ios(host);