Received: by 10.213.65.68 with SMTP id h4csp417153imn; Wed, 28 Mar 2018 06:11:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/3sB/ZVboewcpYetq7gXYLIrkETjtuO4ymmf5UprVbjQTJXKbxXaPtTz2VLDHm6SOmH9ix X-Received: by 2002:a17:902:9045:: with SMTP id w5-v6mr3801553plz.287.1522242669440; Wed, 28 Mar 2018 06:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522242669; cv=none; d=google.com; s=arc-20160816; b=axFiEUpM6waS46fS7cVsddj3UEk+Y1boWPwATjRuqknsCfMBNNOB5UJWyefQrQSNkk Bt3Qx/BkTwhNUK/8oLs69X7Sp9kxCzMgqkGrjjGYQRjEq/hVummlKXM4MKrWEwAPdduo xb8Q/5ieABvq9gwXjXnhEoWEvCGr1x4iZKBqV55T49X2O6T8j08N6hQ4R121BwWR4DHt 8D4yIZj2gftj8pyFWSDNG+UYpMBslA91UELxV0C7umKMpQ+k9wS4EE00O8DVu6AR52CH 4W0kNLs1teG9GELbqTKoqATjzjnAjzThaUmYTo7pYbkDcD3juzN5vegd7bfA+NeN9EMG 9RBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=JlvBXOIN5qcYGqnOA+WalBs99lrw4Bpg/RjEXyT8vEc=; b=kff7ePjWhMSiRD3siLsLpy0Gp1NYWvJS2DLRZUR4XhGzQNjLT5Byimgw190MHEyDra kMZp6TGgSFYlKCnPz1utTlv89F6+mksbGGssrY2NbOgD7rkNiy6FgqqjMg4li4TKjjIv Hd8IRTeL0oObEkw7ls6uPwxH+DGVgT/N/1sEMYD2oIAPY4DeWxnsb/dcgcwrGg+MlcQX Fe0a+wJNHOsEXOj57mHpkGW7d98j2hg+MXpQV5lGvDX545Syp4zaGFavNX7nbB4sqJ3i h+fhb4H0AO9uNE3THvr1qH+GNxSKite+WVHjkdAsK7NbW0RwEb4Q0jnRn+rzg7sjBuor GVxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=j0GiYVbz; dkim=pass header.i=@codeaurora.org header.s=default header.b=AE4cu8uP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l185si2448962pgd.108.2018.03.28.06.10.54; Wed, 28 Mar 2018 06:11:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=j0GiYVbz; dkim=pass header.i=@codeaurora.org header.s=default header.b=AE4cu8uP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753380AbeC1NIn (ORCPT + 99 others); Wed, 28 Mar 2018 09:08:43 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59462 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753280AbeC1NIj (ORCPT ); Wed, 28 Mar 2018 09:08:39 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 35F1960FEC; Wed, 28 Mar 2018 13:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522242518; bh=YnN3nVzE/E7KT4Raw28r57REBGe1d5vTm5vndO/PRCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j0GiYVbz1v50QVTKEN4bVyDmlDybvnv09ASBfv6JRq4g4fYu6UeY4hi9NYbPke1Dh DxyZrcMJ3Oo6bNw2pEC4dX8Kt+YHyfSqxVxHTAUX6TkL+foi/5iLBHUkMYYHZAeYcb NOFUkbxnOUoqi7KFmZxxxyD5+j4XjVISM+MXsENI= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from hydcbspbld03.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vviswana@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id D737B60FEC; Wed, 28 Mar 2018 13:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522242517; bh=YnN3nVzE/E7KT4Raw28r57REBGe1d5vTm5vndO/PRCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AE4cu8uP1b9u+P6LQpAqE/BGsl2cKaychi5oyVCo2ypwgEs/qolrpfHachbA7jiny ehtbLYaK2Ra4YE1nRDVNJSsEFBQVZOpwzDRdBaRapUbJQ4kFCBod+/eOIHLBD870R0 IVtOwOABff/PboANnng+IPzPvadnsO6jg6yN9gRA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D737B60FEC Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vviswana@codeaurora.org From: Vijay Viswanath To: adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, shawn.lin@rock-chips.com, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org, asutoshd@codeaurora.org, stummala@codeaurora.org, venkatg@codeaurora.org, pramod.gurav@linaro.org, jeremymc@redhat.com, vviswana@codeaurora.org, bjorn.andersson@linaro.org, riteshh@codeaurora.org Subject: [PATCH V4 1/2] mmc: sdhci-msm: Add support to store supported vdd-io voltages Date: Wed, 28 Mar 2018 18:38:19 +0530 Message-Id: <1522242500-10556-2-git-send-email-vviswana@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1522242500-10556-1-git-send-email-vviswana@codeaurora.org> References: <1522242500-10556-1-git-send-email-vviswana@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org During probe check whether the vdd-io regulator of sdhc platform device can support 1.8V and 3V and store this information as a capability of platform device. Signed-off-by: Vijay Viswanath --- drivers/mmc/host/sdhci-msm.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index c283291..2fcd9010 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "sdhci-pltfm.h" @@ -81,6 +82,9 @@ #define CORE_HC_SELECT_IN_HS400 (6 << 19) #define CORE_HC_SELECT_IN_MASK (7 << 19) +#define CORE_3_0V_SUPPORT (1 << 25) +#define CORE_1_8V_SUPPORT (1 << 26) + #define CORE_CSR_CDC_CTLR_CFG0 0x130 #define CORE_SW_TRIG_FULL_CALIB BIT(16) #define CORE_HW_AUTOCAL_ENA BIT(17) @@ -148,6 +152,7 @@ struct sdhci_msm_host { u32 curr_io_level; wait_queue_head_t pwr_irq_wait; bool pwr_irq_flag; + u32 caps_0; }; static unsigned int msm_get_clock_rate_for_bus_mode(struct sdhci_host *host, @@ -1103,7 +1108,7 @@ static void sdhci_msm_handle_pwr_irq(struct sdhci_host *host, int irq) struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); u32 irq_status, irq_ack = 0; int retry = 10; - int pwr_state = 0, io_level = 0; + u32 pwr_state = 0, io_level = 0; irq_status = readl_relaxed(msm_host->core_mem + CORE_PWRCTL_STATUS); @@ -1313,6 +1318,30 @@ static void sdhci_msm_writeb(struct sdhci_host *host, u8 val, int reg) sdhci_msm_check_power_status(host, req_type); } +static int sdhci_msm_set_regulator_caps(struct sdhci_msm_host *msm_host) +{ + struct mmc_host *mmc = msm_host->mmc; + struct regulator *supply = mmc->supply.vqmmc; + u32 caps = 0; + + if (!IS_ERR(mmc->supply.vqmmc)) { + if (regulator_is_supported_voltage(supply, 1700000, 1950000)) + caps |= CORE_1_8V_SUPPORT; + if (regulator_is_supported_voltage(supply, 2700000, 3600000)) + caps |= CORE_3_0V_SUPPORT; + + if (!caps) + pr_warn("%s: %s: 1.8/3V not supported for vqmmc\n", + mmc_hostname(mmc), __func__); + } + + msm_host->caps_0 |= caps; + pr_debug("%s: %s: supported caps: 0x%08x\n", mmc_hostname(mmc), + __func__, caps); + + return 0; +} + static const struct of_device_id sdhci_msm_dt_match[] = { { .compatible = "qcom,sdhci-msm-v4" }, {}, @@ -1530,6 +1559,10 @@ static int sdhci_msm_probe(struct platform_device *pdev) ret = sdhci_add_host(host); if (ret) goto pm_runtime_disable; + ret = sdhci_msm_set_regulator_caps(msm_host); + if (ret) + dev_err(&pdev->dev, "Failed to set regulator caps: %d\n", + ret); pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.