From patchwork Thu Apr 5 20:19:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 132890 Delivered-To: patches@linaro.org Received: by 10.46.84.29 with SMTP id i29csp6712596ljb; Thu, 5 Apr 2018 13:20:15 -0700 (PDT) X-Received: by 10.46.47.7 with SMTP id v7mr7652295ljv.56.1522959615491; Thu, 05 Apr 2018 13:20:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522959615; cv=none; d=google.com; s=arc-20160816; b=hV4ljJcus2+6yafbt4nM477pIcbFJAmDqjyMHT0Rmj84WQRYrRMIYlmnbwQgltgpK4 R2Lynzbqf+CRHC0B8po4iQmgipxqVZlegfKVDQurLCsmVQn5YeC9HPvgBXCRDqgq7XsZ 8GtPcttUOuBfSHYshWBK7J2s2qOjJKW7mQJsP0Zx7FABfVGY+lFfCxm18gKWXDy1Pf4H A72xMvBvT+Cb0LCVSh7bKODf3Yl2UI5yKg30oNIEPGARfV8hFbNGpKJ54/6RjZ3A678l sWfBvp780XufnJ4akkOHTCARcaXqEwls9hrehbDreWjRA4o5PDbLB2kVkNYDLBWNFMSY 56UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=OptpziPx683JCkBELj69jcOaQsaEaXsSXtIDSRFYKv8=; b=Q+MfwPeZwnpgsT/4N0cMMXgWRyD8NZnGQNeS/9MnR/Y8+zlfS+2tcDG+mXdWInPLbF yrhP3DdB5ajVmU/c5g4lVIL29Fc7Iwg4POj2O+HINXDIb9rh2LvZP8oEIepefQXeXwHQ zv4JKSNJBv7j66hPCZhZwhIk0zHd51hfFw6bx8he4yIrtHBBYiD14mMDi18buc09f5yt 3j5+Qln99kkxA83U5segwyQYunLvxXGBYNxk/E46Nn4qBn20B8H82j+jtUVMjX/tpvoB v9KkJUGv9VkaE5UVtVhTh+pogEVkR2RzHYyWTE66YnV3xJT+z0ZL0rhn65G91CSNb/Qz IGpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FGq4/Oce; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id j20sor2083386lje.7.2018.04.05.13.20.15 for (Google Transport Security); Thu, 05 Apr 2018 13:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FGq4/Oce; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OptpziPx683JCkBELj69jcOaQsaEaXsSXtIDSRFYKv8=; b=FGq4/OceCapwNBfCG3tLro4C9wUKqM754Od6RRCmRLiWQ7yfTdWlKr3mE+pzZ3V7nV HjeFDNY+I7KY7le+COHVlvmW7JrTbSEt7tstD3K16oKA6vxBMcekegBKyYJQ5z4xgz5w sGf33amqrZuc8z3XB6MU8mh0Nq9hkLzcS4k0s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OptpziPx683JCkBELj69jcOaQsaEaXsSXtIDSRFYKv8=; b=mW0+LAvQCo1B2c6F4UY2XodsFKwdCmvXv6ob0/WJKvdcHaTBhRa7EijUPcs7/zi7ym UMl/Df1IVNSJ9Yt/JToP6XLo2+rYP5zYQ+ob6wnnl5OPk4JH4SAIhlnrgI4mw6fWIiHR 4e8XtY3g9YvWHJe3J4QFo6pHCiPw/6BXIpGcYM+Edu37WDqSmn2IGTwqR9KTb20Cs7Pa UWDBTvd5iXqvCwR327wZBlCplw/GTg8r1/gK0ltOGOOS7oHAOFtLQ2Ql/Wx+f4BGTMFS dU69pEzSz4IAXUm5Sg5ma4fkCjak7Npw/zK/H4mkp/28XoROiGeGVCvUiK3DzGx8/SJ3 IP2Q== X-Gm-Message-State: ALQs6tAl8yTlx2X8p4SvkUwqN9lUG4QmWd3YOkMKVVj7lgih1X8QPvgs tNSoTbig2FkVz9EU7aQxwRtaK9zD X-Google-Smtp-Source: AIpwx48knCDBybONJ+i1uI3Wogb72v4Ma/hkpzivkCj8prv8a85xMofbjPR+Prxn4H3FRJu0EynYBg== X-Received: by 10.46.152.203 with SMTP id s11mr1380616ljj.92.1522959615159; Thu, 05 Apr 2018 13:20:15 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id h66-v6sm1687533lfi.89.2018.04.05.13.20.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Apr 2018 13:20:14 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Adrian Hunter , Brian Norris , Shawn Lin , Doug Anderson , Hans de Goede , Quentin Schulz Subject: [PATCH 4/5] mmc: core: Share internal function to set initial signal voltage Date: Thu, 5 Apr 2018 22:19:53 +0200 Message-Id: <1522959594-3411-5-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522959594-3411-1-git-send-email-ulf.hansson@linaro.org> References: <1522959594-3411-1-git-send-email-ulf.hansson@linaro.org> Move the corresponding code for setting the initial signal voltage, from mmc_power_up() into a new function, mmc_set_initial_signal_voltage(). Make the function internally available to the mmc core, as to allow the following changes to make use of it. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 19 ++++++++++++------- drivers/mmc/core/core.h | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 7a79dc1..2c1a220 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1484,6 +1484,17 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage) } +void mmc_set_initial_signal_voltage(struct mmc_host *host) +{ + /* Try to set signal voltage to 3.3V but fall back to 1.8v or 1.2v */ + if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330)) + dev_dbg(mmc_dev(host), "Initial signal voltage of 3.3v\n"); + else if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) + dev_dbg(mmc_dev(host), "Initial signal voltage of 1.8v\n"); + else if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120)) + dev_dbg(mmc_dev(host), "Initial signal voltage of 1.2v\n"); +} + int mmc_host_set_uhs_voltage(struct mmc_host *host) { u32 clock; @@ -1646,13 +1657,7 @@ void mmc_power_up(struct mmc_host *host, u32 ocr) /* Set initial state and call mmc_set_ios */ mmc_set_initial_state(host); - /* Try to set signal voltage to 3.3V but fall back to 1.8v or 1.2v */ - if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330)) - dev_dbg(mmc_dev(host), "Initial signal voltage of 3.3v\n"); - else if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180)) - dev_dbg(mmc_dev(host), "Initial signal voltage of 1.8v\n"); - else if (!mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_120)) - dev_dbg(mmc_dev(host), "Initial signal voltage of 1.2v\n"); + mmc_set_initial_signal_voltage(host); /* * This delay should be sufficient to allow the power supply diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index a141ec0..9d8f09a 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -52,6 +52,7 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr); int mmc_set_uhs_voltage(struct mmc_host *host, u32 ocr); int mmc_host_set_uhs_voltage(struct mmc_host *host); int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage); +void mmc_set_initial_signal_voltage(struct mmc_host *host); void mmc_set_timing(struct mmc_host *host, unsigned int timing); void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type); int mmc_select_drive_strength(struct mmc_card *card, unsigned int max_dtr,