From patchwork Mon Sep 16 14:17:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 20339 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 993F424694 for ; Mon, 16 Sep 2013 14:18:01 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id lf12sf909290vcb.6 for ; Mon, 16 Sep 2013 07:18:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=ZIJcMcjG4/LvSSibjsvnpva06uN8cQZnro8yrfcQ15g=; b=R1uPY7XPNs42ZEWIU8qudjf3RbuZqtXYmToVxb65WDCuA9yPuJ1lOeOQ+6OKWW1/xz Q1C6DJ0TprTtTyIGKuaRFXe6I7L48qbF13zsiITibKPJH9hCDTi7LhXCzC7hlrOv503N tBaqfZkcYJ6dkvoLi4kDtx0A+uWyj7DhqCrGss5BbTF830AxOj7HfmLEbPXt+jTJ//AA vijkzWyqHkhGoUSRMY3NDEr/1NW5bY1n8f9lmfpaLCRlRUf41ud3Dc2pY6HdPZAOFIL2 HFh4060Wy5MpBGWEfwH/9C8+/HAwgpz045C9We0Dvp2edphmTZsPJ6ai0dRKF+7ySl5M /pZg== X-Gm-Message-State: ALoCoQlPo602G2voF5UrfXxEHivEpIQPFXsFxRNdmv/cAuwBB5o1YyEPIXGlSStfPNuML/2m82M2 X-Received: by 10.236.163.67 with SMTP id z43mr10465385yhk.27.1379341081236; Mon, 16 Sep 2013 07:18:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.104.84 with SMTP id gc20ls2284232qeb.96.gmail; Mon, 16 Sep 2013 07:18:01 -0700 (PDT) X-Received: by 10.52.232.165 with SMTP id tp5mr22772377vdc.11.1379341081140; Mon, 16 Sep 2013 07:18:01 -0700 (PDT) Received: from mail-vb0-f43.google.com (mail-vb0-f43.google.com [209.85.212.43]) by mx.google.com with ESMTPS id xt2si7144245vcb.108.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 07:18:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.43 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.43; Received: by mail-vb0-f43.google.com with SMTP id h11so2915462vbh.16 for ; Mon, 16 Sep 2013 07:18:01 -0700 (PDT) X-Received: by 10.52.164.16 with SMTP id ym16mr331881vdb.39.1379341081035; Mon, 16 Sep 2013 07:18:01 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp99342vcz; Mon, 16 Sep 2013 07:18:00 -0700 (PDT) X-Received: by 10.152.36.98 with SMTP id p2mr25143017laj.14.1379341079591; Mon, 16 Sep 2013 07:17:59 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by mx.google.com with ESMTPS id l7si12004353lbd.125.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 07:17:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.175 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id y6so4216354lbh.34 for ; Mon, 16 Sep 2013 07:17:59 -0700 (PDT) X-Received: by 10.112.0.173 with SMTP id 13mr25184881lbf.8.1379341079030; Mon, 16 Sep 2013 07:17:59 -0700 (PDT) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id ur6sm13161703lbc.5.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Sep 2013 07:17:58 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Prasanna NAVARATNA , Ulf Hansson Subject: [PATCH 1/7] mmc: core: Let mmc_power_up|cycle take ocr as parameter Date: Mon, 16 Sep 2013 16:17:42 +0200 Message-Id: <1379341068-27097-2-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1379341068-27097-1-git-send-email-ulf.hansson@linaro.org> References: <1379341068-27097-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.43 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , As a step to fixup the setup of the negotiated ocr mask, we need the mmc_power_up|cycle functions to take the ocr as a parameter. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 24 ++++++++---------------- drivers/mmc/core/core.h | 4 ++-- drivers/mmc/core/mmc.c | 4 ++-- drivers/mmc/core/sd.c | 4 ++-- drivers/mmc/core/sdio.c | 4 ++-- 5 files changed, 16 insertions(+), 24 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index b9b9fb6..07e83c5 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1504,7 +1504,7 @@ power_cycle: if (err) { pr_debug("%s: Signal voltage switch failed, " "power cycling card\n", mmc_hostname(host)); - mmc_power_cycle(host); + mmc_power_cycle(host, host->ocr); } mmc_host_clk_release(host); @@ -1545,22 +1545,14 @@ void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type) * If a host does all the power sequencing itself, ignore the * initial MMC_POWER_UP stage. */ -void mmc_power_up(struct mmc_host *host) +void mmc_power_up(struct mmc_host *host, u32 ocr) { - int bit; - if (host->ios.power_mode == MMC_POWER_ON) return; mmc_host_clk_hold(host); - /* If ocr is set, we use it */ - if (host->ocr) - bit = ffs(host->ocr) - 1; - else - bit = fls(host->ocr_avail) - 1; - - host->ios.vdd = bit; + host->ios.vdd = fls(ocr) - 1; if (mmc_host_is_spi(host)) host->ios.chip_select = MMC_CS_HIGH; else @@ -1630,12 +1622,12 @@ void mmc_power_off(struct mmc_host *host) mmc_host_clk_release(host); } -void mmc_power_cycle(struct mmc_host *host) +void mmc_power_cycle(struct mmc_host *host, u32 ocr) { mmc_power_off(host); /* Wait at least 1 ms according to SD spec */ mmc_delay(1); - mmc_power_up(host); + mmc_power_up(host, ocr); } /* @@ -2334,7 +2326,7 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq) pr_info("%s: %s: trying to init card at %u Hz\n", mmc_hostname(host), __func__, host->f_init); #endif - mmc_power_up(host); + mmc_power_up(host, host->ocr_avail); /* * Some eMMCs (with VCCQ always on) may not be reset after power up, so @@ -2504,7 +2496,7 @@ void mmc_start_host(struct mmc_host *host) if (host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP) mmc_power_off(host); else - mmc_power_up(host); + mmc_power_up(host, host->ocr_avail); mmc_detect_change(host, 0); } @@ -2583,7 +2575,7 @@ int mmc_power_restore_host(struct mmc_host *host) return -EINVAL; } - mmc_power_up(host); + mmc_power_up(host, host->ocr); ret = host->bus_ops->power_restore(host); mmc_bus_put(host); diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 5345d15..502769a 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -46,9 +46,9 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage); int __mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage); void mmc_set_timing(struct mmc_host *host, unsigned int timing); void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type); -void mmc_power_up(struct mmc_host *host); +void mmc_power_up(struct mmc_host *host, u32 ocr); void mmc_power_off(struct mmc_host *host); -void mmc_power_cycle(struct mmc_host *host); +void mmc_power_cycle(struct mmc_host *host, u32 ocr); static inline void mmc_delay(unsigned int ms) { diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 6d02012..56e1b04 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1533,7 +1533,7 @@ static int mmc_resume(struct mmc_host *host) BUG_ON(!host->card); mmc_claim_host(host); - mmc_power_up(host); + mmc_power_up(host, host->ocr); mmc_select_voltage(host, host->ocr); err = mmc_init_card(host, host->ocr, host->card); mmc_release_host(host); @@ -1579,7 +1579,7 @@ static int mmc_runtime_resume(struct mmc_host *host) mmc_claim_host(host); - mmc_power_up(host); + mmc_power_up(host, host->ocr); err = mmc_resume(host); if (err) pr_err("%s: error %d doing aggessive resume\n", diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 5e8823d..af55e9e 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1099,7 +1099,7 @@ static int mmc_sd_resume(struct mmc_host *host) BUG_ON(!host->card); mmc_claim_host(host); - mmc_power_up(host); + mmc_power_up(host, host->ocr); mmc_select_voltage(host, host->ocr); err = mmc_sd_init_card(host, host->ocr, host->card); mmc_release_host(host); @@ -1144,7 +1144,7 @@ static int mmc_sd_runtime_resume(struct mmc_host *host) mmc_claim_host(host); - mmc_power_up(host); + mmc_power_up(host, host->ocr); err = mmc_sd_resume(host); if (err) pr_err("%s: error %d doing aggessive resume\n", diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 80d89cff..355c952 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -981,7 +981,7 @@ static int mmc_sdio_resume(struct mmc_host *host) /* Restore power if needed */ if (!mmc_card_keep_power(host)) { - mmc_power_up(host); + mmc_power_up(host, host->ocr); mmc_select_voltage(host, host->ocr); /* * Tell runtime PM core we just powered up the card, @@ -1108,7 +1108,7 @@ static int mmc_sdio_runtime_suspend(struct mmc_host *host) static int mmc_sdio_runtime_resume(struct mmc_host *host) { /* Restore power and re-initialize. */ - mmc_power_up(host); + mmc_power_up(host, host->ocr); return mmc_sdio_power_restore(host); }