[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1452155155-16232-7-git-send-email-wxt@rock-chips.com>
Date: Thu, 7 Jan 2016 16:25:49 +0800
From: Caesar Wang <wxt@...k-chips.com>
To: Heiko Stuebner <heiko@...ech.de>,
Ulf Hansson <ulf.hansson@...aro.org>
Cc: linux-rockchip@...ts.infradead.org, leecam@...gle.com,
leozwang@...gle.com, keescook@...gle.com,
Caesar Wang <wxt@...k-chips.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org,
Alexandre Courbot <acourbot@...dia.com>,
Javier Martinez Canillas <javier@....samsung.com>,
NeilBrown <neil@...wn.name>
Subject: [PATCH v2 06/12] mmc: pwrseq: add support for power-on sequencing through DT
This patch enables support for power-on sequencing of SDIO
peripherals through DT.
In general, it's quite common that wifi modules and other similar
peripherals have several signals in addition to the SDIO interface that
needs wiggling before the module will power on.
For example:
we need enable wifi module power to via the WL_REG_ON
pin, we need enable it as the regulator if this pin is connected to
the gpio of cpu.
Maybe, someone will say that can pull up/down from dts.
Unfortunately some SoCs can't support pinctrl pull up/down in
internal.
Anyway, we can add this patch to supprt the power-on sequencing for
sdio.
Signed-off-by: Caesar Wang <wxt@...k-chips.com>
---
Changes in v2:
- This fix inmmc-power-sequences, as Heiko comment on
https://patchwork.kernel.org/patch/7903161/
drivers/mmc/core/pwrseq_simple.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index d10538b..455dd0c 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -14,6 +14,7 @@
#include <linux/err.h>
#include <linux/of_gpio.h>
#include <linux/gpio/consumer.h>
+#include <linux/regulator/consumer.h>
#include <linux/mmc/host.h>
@@ -24,6 +25,7 @@ struct mmc_pwrseq_simple {
bool clk_enabled;
struct clk *ext_clk;
struct gpio_descs *reset_gpios;
+ struct regulator *regulator;
};
static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq,
@@ -45,6 +47,13 @@ static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)
struct mmc_pwrseq_simple *pwrseq = container_of(host->pwrseq,
struct mmc_pwrseq_simple, pwrseq);
+ if (!IS_ERR(pwrseq->regulator)) {
+ dev_dbg(host->parent, "Enabling external regulator\n");
+ if (regulator_enable(pwrseq->regulator))
+ dev_err(host->parent,
+ "Failed to enable external regulator\n");
+ }
+
if (!IS_ERR(pwrseq->ext_clk) && !pwrseq->clk_enabled) {
clk_prepare_enable(pwrseq->ext_clk);
pwrseq->clk_enabled = true;
@@ -117,6 +126,13 @@ struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host,
goto clk_put;
}
+ pwrseq->regulator = devm_regulator_get(dev, "ext-vcc");
+ if (IS_ERR(pwrseq->regulator) &&
+ PTR_ERR(pwrseq->regulator) != -EPROBE_DEFER) {
+ ret = PTR_ERR(pwrseq->regulator);
+ goto clk_put;
+ }
+
pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops;
return &pwrseq->pwrseq;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists