From: Kishon Vijay Abraham I <kishon@ti.com>
To: tony@atomide.com, ulf.hansson@linaro.org, afenkart@gmail.com,
linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org
Cc: nsekhar@ti.com, kishon@ti.com, mugunthanvnm@ti.com
Subject: [PATCH 01/11] mmc: host: omap_hsmmc: Support vmmc_aux to switch to 1.8v
Date: Thu, 30 Jul 2015 13:16:24 +0530 [thread overview]
Message-ID: <1438242394-25599-2-git-send-email-kishon@ti.com> (raw)
In-Reply-To: <1438242394-25599-1-git-send-email-kishon@ti.com>
Add support for vmmc_aux to switch to 1.8v. Also use "iov" instead of
"vdd" to indicate io voltage. This is in preparation for adding support
for io signal voltage switch.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/mmc/host/omap_hsmmc.c | 47 +++++++++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 16 deletions(-)
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 6d52873..09e949f 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -243,10 +243,11 @@ static int omap_hsmmc_get_cover_state(struct device *dev)
return mmc_gpio_get_cd(host->mmc);
}
-static int omap_hsmmc_enable_supply(struct mmc_host *mmc)
+static int omap_hsmmc_enable_supply(struct mmc_host *mmc, int iov)
{
int ret;
struct mmc_ios *ios = &mmc->ios;
+ int uvoltage;
if (mmc->supply.vmmc) {
ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
@@ -255,7 +256,24 @@ static int omap_hsmmc_enable_supply(struct mmc_host *mmc)
}
/* Enable interface voltage rail, if needed */
- if (mmc->supply.vqmmc && !regulator_is_enabled(mmc->supply.vqmmc)) {
+ if (mmc->supply.vqmmc) {
+ if (regulator_is_enabled(mmc->supply.vqmmc)) {
+ ret = regulator_disable(mmc->supply.vqmmc);
+ if (ret) {
+ dev_err(mmc_dev(mmc),
+ "vmmc_aux reg disable failed\n");
+ goto err_vqmmc;
+ }
+ }
+
+ uvoltage = (iov == VDD_165_195) ? VDD_1V8 : VDD_3V0;
+ ret = regulator_set_voltage(mmc->supply.vqmmc, uvoltage,
+ uvoltage);
+ if (ret) {
+ dev_err(mmc_dev(mmc), "vmmc_aux set voltage failed\n");
+ goto err_vqmmc;
+ }
+
ret = regulator_enable(mmc->supply.vqmmc);
if (ret) {
dev_err(mmc_dev(mmc), "vmmc_aux reg enable failed\n");
@@ -304,22 +322,19 @@ err_set_ocr:
}
static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
- int vdd)
+ int iov)
{
int ret;
+ int uvoltage;
if (!host->pbias)
return 0;
if (power_on) {
- if (vdd <= VDD_165_195)
- ret = regulator_set_voltage(host->pbias, VDD_1V8,
- VDD_1V8);
- else
- ret = regulator_set_voltage(host->pbias, VDD_3V0,
- VDD_3V0);
- if (ret < 0) {
- dev_err(host->dev, "pbias set voltage fail\n");
+ uvoltage = (iov <= VDD_165_195) ? VDD_1V8 : VDD_3V0;
+ ret = regulator_set_voltage(host->pbias, uvoltage, uvoltage);
+ if (ret) {
+ dev_err(host->dev, "pbias set voltage failed\n");
return ret;
}
@@ -343,7 +358,7 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
return 0;
}
-static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
+static int omap_hsmmc_set_power(struct device *dev, int power_on, int iov)
{
struct omap_hsmmc_host *host =
platform_get_drvdata(to_platform_device(dev));
@@ -358,7 +373,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
return 0;
if (mmc_pdata(host)->before_set_reg)
- mmc_pdata(host)->before_set_reg(dev, power_on, vdd);
+ mmc_pdata(host)->before_set_reg(dev, power_on, iov);
ret = omap_hsmmc_set_pbias(host, false, 0);
if (ret)
@@ -378,11 +393,11 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
* chips/cards need an interface voltage rail too.
*/
if (power_on) {
- ret = omap_hsmmc_enable_supply(mmc);
+ ret = omap_hsmmc_enable_supply(mmc, iov);
if (ret)
return ret;
- ret = omap_hsmmc_set_pbias(host, true, vdd);
+ ret = omap_hsmmc_set_pbias(host, true, iov);
if (ret)
goto err_set_voltage;
} else {
@@ -392,7 +407,7 @@ static int omap_hsmmc_set_power(struct device *dev, int power_on, int vdd)
}
if (mmc_pdata(host)->after_set_reg)
- mmc_pdata(host)->after_set_reg(dev, power_on, vdd);
+ mmc_pdata(host)->after_set_reg(dev, power_on, iov);
return 0;
--
1.7.9.5
next prev parent reply other threads:[~2015-07-30 7:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-30 7:46 [PATCH 00/11] omap_hsmmc: voltage switching and tuning Kishon Vijay Abraham I
2015-07-30 7:46 ` Kishon Vijay Abraham I [this message]
2015-07-30 7:46 ` [PATCH 02/11] mmc: host: omap_hsmmc: separate setting voltage capabilities from bus power Kishon Vijay Abraham I
2015-07-30 7:46 ` [PATCH 03/11] mmc: host: omap_hsmmc: program HCTL based on signal_voltage set by mmc core Kishon Vijay Abraham I
2015-07-30 7:46 ` [PATCH 04/11] mmc: host: omap_hsmmc: add voltage switch support for UHS SD card Kishon Vijay Abraham I
2015-07-30 7:46 ` [PATCH 05/11] mmc: host: omap_hsmmc: set clk rate to the max frequency Kishon Vijay Abraham I
2015-07-30 7:46 ` [PATCH 06/11] mmc: host: omap_hsmmc: set timing in the UHSMS field Kishon Vijay Abraham I
2015-07-30 7:46 ` [PATCH 07/11] mmc: host: omap_hsmmc: add tuning support Kishon Vijay Abraham I
2015-07-30 7:46 ` [PATCH 08/11] mmc: host: omap_hsmmc: Workaround for errata id i802 Kishon Vijay Abraham I
2015-07-30 7:46 ` [PATCH 09/11] mmc: host: omap_hsmmc: Allow io voltage switch even for fixed vdd Kishon Vijay Abraham I
2015-07-30 7:46 ` [PATCH 10/11] mmc: host: omap_hsmmc: remove incorrect voltage switch sequence Kishon Vijay Abraham I
2015-07-30 7:46 ` [PATCH 11/11] mmc: host: omap_hsmmc: add software timer when timeout greater than hardware capablility Kishon Vijay Abraham I
2015-08-05 10:43 ` [PATCH 00/11] omap_hsmmc: voltage switching and tuning Tony Lindgren
2015-08-05 15:00 ` Kishon Vijay Abraham I
2015-08-06 6:48 ` Tony Lindgren
2015-08-07 14:45 ` Kishon Vijay Abraham I
2015-08-11 10:40 ` Tony Lindgren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1438242394-25599-2-git-send-email-kishon@ti.com \
--to=kishon@ti.com \
--cc=afenkart@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=mugunthanvnm@ti.com \
--cc=nsekhar@ti.com \
--cc=tony@atomide.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).