From patchwork Wed Aug 2 07:28:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 9876115 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7449160390 for ; Wed, 2 Aug 2017 07:37:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 666A1286BE for ; Wed, 2 Aug 2017 07:37:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5AD382875F; Wed, 2 Aug 2017 07:37:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EC87286BE for ; Wed, 2 Aug 2017 07:37:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751177AbdHBHhg (ORCPT ); Wed, 2 Aug 2017 03:37:36 -0400 Received: from mga06.intel.com ([134.134.136.31]:3904 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbdHBHhg (ORCPT ); Wed, 2 Aug 2017 03:37:36 -0400 Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 02 Aug 2017 00:37:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,310,1498546800"; d="scan'208";a="294566932" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.168]) ([10.237.72.168]) by fmsmga004.fm.intel.com with ESMTP; 02 Aug 2017 00:34:42 -0700 Subject: Re: [PATCH] mmc: sdhci: ignore 3.3v voltage switch if ios.vdd is 0 To: Zhoujie Wu , ulf.hansson@linaro.org, linux-mmc@vger.kernel.org Cc: zmxu@marvell.com, jszhang@marvell.com, nadavh@marvell.com, xigu@marvell.com, dingwei@marvell.com, kostap@marvell.com, hannah@marvell.com, hongd@marvell.com, dougj@marvell.com, ygao@marvell.com, liuw@marvell.com, gregory.clement@free-electrons.com, thomas.petazzoni@free-electrons.com References: <1501631901-1304-1-git-send-email-zjwu@marvell.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <9bae1ec1-9c40-d496-d6c9-b874844995fc@intel.com> Date: Wed, 2 Aug 2017 10:28:23 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1501631901-1304-1-git-send-email-zjwu@marvell.com> Content-Language: en-US Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 02/08/17 02:58, Zhoujie Wu wrote: > One issue was found on a removable high speed sd card with > runtime pm enabled. > When SD card is unplugged, it keep printing "Switching to 3.3V > signalling voltage failed". > And found below sequence triggers the error. > > mmc_rescan > -> mmc_sd_detect > -> mmc_power_off -- mmc->ios.vdd is update to 0. > -> mmc_claim_host > -> sdhci_runtime_resume_host > -> sdhci_start_signal_voltage_switch We ought to be able to skip restoring the I/O state when the power is off i.e.: > -> mmc_regulator_set_vqmmc > -> mmc_ocrbitnum_to_vdd > > When mmc_ocrbitnum_to_vdd is called, the mmc->ios.vdd is 0, so it > always return -EINVAL. The signal switch will always fail and > print out warning. > > Signed-off-by: Zhoujie Wu > --- > Hi Ulf, > Not sure if this is the best way to fix it. Please help to suggest. Thanks. > > drivers/mmc/host/sdhci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index ecd0d43..011ebbe 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -1878,7 +1878,7 @@ int sdhci_start_signal_voltage_switch(struct mmc_host *mmc, > ctrl &= ~SDHCI_CTRL_VDD_180; > sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2); > > - if (!IS_ERR(mmc->supply.vqmmc)) { > + if ((!IS_ERR(mmc->supply.vqmmc)) && mmc->ios.vdd) { > ret = mmc_regulator_set_vqmmc(mmc, ios); > if (ret) { > pr_warn("%s: Switching to 3.3V signalling voltage failed\n", > --- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index cf2166e4190d..4a70f2f765b6 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2934,7 +2934,8 @@ int sdhci_runtime_resume_host(struct sdhci_host *host) sdhci_init(host, 0); - if (mmc->ios.power_mode != MMC_POWER_UNDEFINED) { + if (mmc->ios.power_mode != MMC_POWER_UNDEFINED && + mmc->ios.power_mode != MMC_POWER_OFF) { /* Force clock and power re-program */ host->pwr = 0; host->clock = 0;