Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1590383 > unrolled thread

[PATCH 0/4] mmc: pwrseq: post_ios power sequence

Started byRomain Perier <romain.perier@collabora.com>
First post2017-03-01 16:10 +0100
Last post2017-03-01 16:10 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] mmc: pwrseq: post_ios power sequence Romain Perier <romain.perier@collabora.com> - 2017-03-01 16:10 +0100
    [PATCH 4/4] arm: dts: rockchip: Enable post_ios_power_on and pre-power-on-delay-ms Romain Perier <romain.perier@collabora.com> - 2017-03-01 16:10 +0100
      Re: [PATCH 4/4] arm: dts: rockchip: Enable post_ios_power_on and pre-power-on-delay-ms Heiko Stuebner <heiko@sntech.de> - 2017-03-02 00:10 +0100
    [PATCH 1/4] mmc: core: Add post_ios_power_on callback for power sequences Romain Perier <romain.perier@collabora.com> - 2017-03-01 16:10 +0100
    [PATCH 3/4] mmc: pwrseq_simple: Add an optional pre-power-on-delay Romain Perier <romain.perier@collabora.com> - 2017-03-01 16:10 +0100

#1590383 — [PATCH 0/4] mmc: pwrseq: post_ios power sequence

FromRomain Perier <romain.perier@collabora.com>
Date2017-03-01 16:10 +0100
Subject[PATCH 0/4] mmc: pwrseq: post_ios power sequence
Message-ID<tge38-4N8-15@gated-at.bofh.it>
Some devices, like WiFi chipsets AP6335 require a specific power-up
sequence ordering before being used. You must enable the vqmmc power supply
and wait until it reaches its minimum voltage, gate the clock and wait
at least two cycles and then assert the reset line.

See DS 1/

Currently, there is no generic manner for doing this with pwrseq_simple.
This set of patches proposes an approach to support this use case.

It is related to the old patch 2/

1. http://www.t-firefly.com/download/firefly-rk3288/hardware/AP6335%20datasheet_V1.3_02102014.pdf
2. http://lists.infradead.org/pipermail/linux-arm-kernel/2017-March/490681.html

Romain Perier (4):
  mmc: core: Add post_ios_power_on callback for power sequences
  mmc: pwrseq-simple: Add optional op. for post_ios_power_on callback
  mmc: pwrseq_simple: Add an optional pre-power-on-delay
  arm: dts: rockchip: Enable post_ios_power_on and pre-power-on-delay-ms

 .../devicetree/bindings/mmc/mmc-pwrseq-simple.txt   |  2 ++
 arch/arm/boot/dts/rk3288-rock2-square.dts           |  2 ++
 drivers/mmc/core/core.c                             |  1 +
 drivers/mmc/core/pwrseq.c                           |  8 ++++++++
 drivers/mmc/core/pwrseq.h                           |  2 ++
 drivers/mmc/core/pwrseq_simple.c                    | 21 ++++++++++++++++++++-
 6 files changed, 35 insertions(+), 1 deletion(-)

-- 
2.9.3

[toc] | [next] | [standalone]


#1590384 — [PATCH 4/4] arm: dts: rockchip: Enable post_ios_power_on and pre-power-on-delay-ms

FromRomain Perier <romain.perier@collabora.com>
Date2017-03-01 16:10 +0100
Subject[PATCH 4/4] arm: dts: rockchip: Enable post_ios_power_on and pre-power-on-delay-ms
Message-ID<tge38-4N8-23@gated-at.bofh.it>
In reply to#1590383
This enables the property post_ios_power_on. With this property, the
driver pwrseq_simple will do its entire power sequence at the end of the
mmc_power_up() function. The property pre-power-on-delay-ms adds a delay
of 1ms between the enablement of the clk and the assertion of the reset
line.

It fixes the power-up sequence for the Wifi chipset AP6335.

Signed-off-by: Romain Perier <romain.perier@collabora.com>
---
 arch/arm/boot/dts/rk3288-rock2-square.dts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-rock2-square.dts b/arch/arm/boot/dts/rk3288-rock2-square.dts
index 818c4bf..9bf2991 100644
--- a/arch/arm/boot/dts/rk3288-rock2-square.dts
+++ b/arch/arm/boot/dts/rk3288-rock2-square.dts
@@ -106,6 +106,8 @@
 		pinctrl-names = "default";
 		pinctrl-0 = <&wifi_enable>;
 		reset-gpios = <&gpio4 28 GPIO_ACTIVE_LOW>;
+		pre-power-on-delay-ms = <1>;
+		post-ios-power-on;
 	};
 
 	vcc_usb_host: vcc-host-regulator {
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1590679 — Re: [PATCH 4/4] arm: dts: rockchip: Enable post_ios_power_on and pre-power-on-delay-ms

FromHeiko Stuebner <heiko@sntech.de>
Date2017-03-02 00:10 +0100
SubjectRe: [PATCH 4/4] arm: dts: rockchip: Enable post_ios_power_on and pre-power-on-delay-ms
Message-ID<tglxD-1Kg-5@gated-at.bofh.it>
In reply to#1590384
Hi Romain,

Am Mittwoch, 1. März 2017, 15:53:10 CET schrieb Romain Perier:
> This enables the property post_ios_power_on. With this property, the
> driver pwrseq_simple will do its entire power sequence at the end of the
> mmc_power_up() function. The property pre-power-on-delay-ms adds a delay
> of 1ms between the enablement of the clk and the assertion of the reset
> line.
> 
> It fixes the power-up sequence for the Wifi chipset AP6335.
> 
> Signed-off-by: Romain Perier <romain.perier@collabora.com>

I didn't get the other 3 patches touching the mmc subsystem, so if and when 
they get accepted, please ping this devicetree patch.


> ---
>  arch/arm/boot/dts/rk3288-rock2-square.dts | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/rk3288-rock2-square.dts
> b/arch/arm/boot/dts/rk3288-rock2-square.dts index 818c4bf..9bf2991 100644
> --- a/arch/arm/boot/dts/rk3288-rock2-square.dts
> +++ b/arch/arm/boot/dts/rk3288-rock2-square.dts
> @@ -106,6 +106,8 @@
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&wifi_enable>;
>  		reset-gpios = <&gpio4 28 GPIO_ACTIVE_LOW>;
> +		pre-power-on-delay-ms = <1>;
> +		post-ios-power-on;

If you need to resend your series, please make sure you have alphabetically 
sorted properties -> pinctrl, post-ios-..., pre-power-... and finally reset-
gpios. No need to resend just for this though, as I can reorder them myself if 
needed.


Thanks
Heiko

[toc] | [prev] | [next] | [standalone]


#1590386 — [PATCH 1/4] mmc: core: Add post_ios_power_on callback for power sequences

FromRomain Perier <romain.perier@collabora.com>
Date2017-03-01 16:10 +0100
Subject[PATCH 1/4] mmc: core: Add post_ios_power_on callback for power sequences
Message-ID<tge39-4N8-37@gated-at.bofh.it>
In reply to#1590383
Currently, ->pre_power_on() callback is called at the beginning of the
mmc_power_up() function before MMC_POWER_UP and MMC_POWER_ON sequences.
The callback ->post_power_on() is called at the end of the
mmc_power_up() function. Some SDIO Chipsets require to gate the clock
after than the vqmmc supply is powered on and then toggle the reset
line. Currently, there is no way for doing this.

This commit introduces a new callback ->post_ios_power_on(), that is
called at the end of the mmc_power_up() function after the mmc_set_ios()
operation. In this way the entire power sequences can be done from this
function after the enablement of the power supply.

Signed-off-by: Romain Perier <romain.perier@collabora.com>
---
 drivers/mmc/core/core.c   | 1 +
 drivers/mmc/core/pwrseq.c | 8 ++++++++
 drivers/mmc/core/pwrseq.h | 2 ++
 3 files changed, 11 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 1076b9d..d73a050 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1831,6 +1831,7 @@ void mmc_power_up(struct mmc_host *host, u32 ocr)
 	 * time required to reach a stable voltage.
 	 */
 	mmc_delay(10);
+	mmc_pwrseq_post_ios_power_on(host);
 }
 
 void mmc_power_off(struct mmc_host *host)
diff --git a/drivers/mmc/core/pwrseq.c b/drivers/mmc/core/pwrseq.c
index 9386c47..98f50b7 100644
--- a/drivers/mmc/core/pwrseq.c
+++ b/drivers/mmc/core/pwrseq.c
@@ -68,6 +68,14 @@ void mmc_pwrseq_post_power_on(struct mmc_host *host)
 		pwrseq->ops->post_power_on(host);
 }
 
+void mmc_pwrseq_post_ios_power_on(struct mmc_host *host)
+{
+	struct mmc_pwrseq *pwrseq = host->pwrseq;
+
+	if (pwrseq && pwrseq->ops->post_ios_power_on)
+		pwrseq->ops->post_ios_power_on(host);
+}
+
 void mmc_pwrseq_power_off(struct mmc_host *host)
 {
 	struct mmc_pwrseq *pwrseq = host->pwrseq;
diff --git a/drivers/mmc/core/pwrseq.h b/drivers/mmc/core/pwrseq.h
index d69e751..2053ebd 100644
--- a/drivers/mmc/core/pwrseq.h
+++ b/drivers/mmc/core/pwrseq.h
@@ -13,6 +13,7 @@
 struct mmc_pwrseq_ops {
 	void (*pre_power_on)(struct mmc_host *host);
 	void (*post_power_on)(struct mmc_host *host);
+	void (*post_ios_power_on)(struct mmc_host *host);
 	void (*power_off)(struct mmc_host *host);
 };
 
@@ -31,6 +32,7 @@ void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq);
 int mmc_pwrseq_alloc(struct mmc_host *host);
 void mmc_pwrseq_pre_power_on(struct mmc_host *host);
 void mmc_pwrseq_post_power_on(struct mmc_host *host);
+void mmc_pwrseq_post_ios_power_on(struct mmc_host *host);
 void mmc_pwrseq_power_off(struct mmc_host *host);
 void mmc_pwrseq_free(struct mmc_host *host);
 
-- 
2.9.3

[toc] | [prev] | [next] | [standalone]


#1590394 — [PATCH 3/4] mmc: pwrseq_simple: Add an optional pre-power-on-delay

FromRomain Perier <romain.perier@collabora.com>
Date2017-03-01 16:10 +0100
Subject[PATCH 3/4] mmc: pwrseq_simple: Add an optional pre-power-on-delay
Message-ID<tge39-4N8-47@gated-at.bofh.it>
In reply to#1590383
Some devices need a while between the enablement of its clk and the time
where the reset line is asserted. When this time happens between the
pre_power_on and the post_power_on callbacks, there is a need to do an
msleep at the end of the pre_power_on callback.

This commit adds an optional DT property for such devices.

Signed-off-by: Romain Perier <romain.perier@collabora.com>
---
 Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt | 2 ++
 drivers/mmc/core/pwrseq_simple.c                            | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt
index e254368..821feaaf 100644
--- a/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt
+++ b/Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt
@@ -18,6 +18,8 @@ Optional properties:
   "ext_clock" (External clock provided to the card).
 - post-power-on-delay-ms : Delay in ms after powering the card and
 	de-asserting the reset-gpios (if any)
+- pre-power-on-delay-ms : Delay in ms before powering the card and
+	asserting the reset-gpios (if any)
 
 Example:
 
diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/mmc/core/pwrseq_simple.c
index a9aad9a..7218675 100644
--- a/drivers/mmc/core/pwrseq_simple.c
+++ b/drivers/mmc/core/pwrseq_simple.c
@@ -27,6 +27,7 @@ struct mmc_pwrseq_simple {
 	struct mmc_pwrseq pwrseq;
 	bool clk_enabled;
 	u32 post_power_on_delay_ms;
+	u32 pre_power_on_delay_ms;
 	struct clk *ext_clk;
 	struct gpio_descs *reset_gpios;
 };
@@ -60,6 +61,9 @@ static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)
 	}
 
 	mmc_pwrseq_simple_set_gpios_value(pwrseq, 1);
+
+	if (pwrseq->pre_power_on_delay_ms)
+		msleep(pwrseq->pre_power_on_delay_ms);
 }
 
 static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host)
@@ -129,6 +133,8 @@ static int mmc_pwrseq_simple_probe(struct platform_device *pdev)
 
 	device_property_read_u32(dev, "post-power-on-delay-ms",
 				 &pwrseq->post_power_on_delay_ms);
+	device_property_read_u32(dev, "pre-power-on-delay-ms",
+				 &pwrseq->pre_power_on_delay_ms);
 
 	pwrseq->pwrseq.dev = dev;
 	if (device_property_read_bool(dev, "post-ios-power-on"))
-- 
2.9.3

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web