linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend
@ 2019-04-11 23:21 Douglas Anderson
  2019-04-11 23:21 ` [PATCH 2/5] ARM: rockchip: pm: Mark init functions __init Douglas Anderson
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Douglas Anderson @ 2019-04-11 23:21 UTC (permalink / raw)
  To: Heiko Stuebner, Elaine Zhang
  Cc: dbasehore, amstan, linux-rockchip, briannorris, mka, ryandcase,
	Chris Zhong, Douglas Anderson, Michael Turquette, Stephen Boyd,
	linux-kernel, linux-clk, linux-arm-kernel

Experimentally it can be seen that going into deep sleep (specifically
setting PMU_CLR_DMA and PMU_CLR_BUS in RK3288_PMU_PWRMODE_CON1)
appears to fail unless "aclk_dmac1" is on.  The failure is that the
system never signals that it made it into suspend on the GLOBAL_PWROFF
pin and it just hangs.

NOTE that it's confirmed that it's the actual suspend that fails, not
one of the earlier calls to read/write registers.  Specifically if you
comment out the "PMU_GLOBAL_INT_DISABLE" setting in
rk3288_slp_mode_set() and then comment out the "cpu_do_idle()" call in
rockchip_lpmode_enter() then you can exercise the whole suspend path
without any crashing.

This is currently not a problem with suspend upstream because there is
no current way to exercise the deep suspend code.  However, anyone
trying to make it work will run into this issue.

This was not a problem on shipping rk3288-based Chromebooks because
those devices all ran on an old kernel based on 3.14.  On that kernel
"aclk_dmac1" appears to be left on all the time.

There are several ways to skin this problem.

A) We could add "aclk_dmac1" to the list of critical clocks and that
apperas to work, but presumably that wastes power.

B) We could keep a list of "struct clk" objects to enable at suspend
time in clk-rk3288.c and use the standard clock APIs.

C) We could make the rk3288-pmu driver keep a list of clocks to enable
at suspend time.  Presumably this would require a dts and bindings
change.

D) We could just whack the clock on in the existing syscore suspend
function where we whack a bunch of other clocks.  This is particularly
easy because we know for sure that the clock's only parent
("aclk_cpu") is a critical clock so we don't need to do anything more
than ungate it.

In this case I have chosen D) because it seemed like the least work,
but any of the other options would presumably also work fine.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/clk/rockchip/clk-rk3288.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
index 5a67b7869960..b245367393cd 100644
--- a/drivers/clk/rockchip/clk-rk3288.c
+++ b/drivers/clk/rockchip/clk-rk3288.c
@@ -859,6 +859,9 @@ static const int rk3288_saved_cru_reg_ids[] = {
 	RK3288_CLKSEL_CON(10),
 	RK3288_CLKSEL_CON(33),
 	RK3288_CLKSEL_CON(37),
+
+	/* We turn aclk_dmac1 on for suspend; this will restore it */
+	RK3288_CLKGATE_CON(10),
 };
 
 static u32 rk3288_saved_cru_regs[ARRAY_SIZE(rk3288_saved_cru_reg_ids)];
@@ -874,6 +877,14 @@ static int rk3288_clk_suspend(void)
 				readl_relaxed(rk3288_cru_base + reg_id);
 	}
 
+	/*
+	 * Going into deep sleep (specifically setting PMU_CLR_DMA in
+	 * RK3288_PMU_PWRMODE_CON1) appears to fail unless
+	 * "aclk_dmac1" is on.
+	 */
+	writel_relaxed(1 << (12 + 16),
+		       rk3288_cru_base + RK3288_CLKGATE_CON(10));
+
 	/*
 	 * Switch PLLs other than DPLL (for SDRAM) to slow mode to
 	 * avoid crashes on resume. The Mask ROM on the system will
-- 
2.21.0.392.gf8f6787159e-goog


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/5] ARM: rockchip: pm: Mark init functions __init
  2019-04-11 23:21 [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend Douglas Anderson
@ 2019-04-11 23:21 ` Douglas Anderson
  2019-04-12 11:16   ` Heiko Stübner
  2019-04-11 23:21 ` [PATCH 3/5] ARM: dts: rockchip: Add DDR retention/poweroff to rk3288-veyron hogs Douglas Anderson
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Douglas Anderson @ 2019-04-11 23:21 UTC (permalink / raw)
  To: Heiko Stuebner, Elaine Zhang
  Cc: dbasehore, amstan, linux-rockchip, briannorris, mka, ryandcase,
	Chris Zhong, Douglas Anderson, linux-arm-kernel, Russell King,
	linux-kernel

The functions rk3288_config_bootdata() and rk3288_suspend_init() are
only called in the context of rockchip_suspend_init() which is already
marked __init.  We can mark them __init too.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 arch/arm/mach-rockchip/pm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-rockchip/pm.c b/arch/arm/mach-rockchip/pm.c
index 0592534e0b88..065b09e6f1eb 100644
--- a/arch/arm/mach-rockchip/pm.c
+++ b/arch/arm/mach-rockchip/pm.c
@@ -59,7 +59,7 @@ static inline u32 rk3288_l2_config(void)
 	return l2ctlr;
 }
 
-static void rk3288_config_bootdata(void)
+static void __init rk3288_config_bootdata(void)
 {
 	rkpm_bootdata_cpusp = rk3288_bootram_phy + (SZ_4K - 8);
 	rkpm_bootdata_cpu_code = __pa_symbol(cpu_resume);
@@ -230,7 +230,7 @@ static void rk3288_suspend_finish(void)
 		pr_err("%s: Suspend finish failed\n", __func__);
 }
 
-static int rk3288_suspend_init(struct device_node *np)
+static int __init rk3288_suspend_init(struct device_node *np)
 {
 	struct device_node *sram_np;
 	struct resource res;
-- 
2.21.0.392.gf8f6787159e-goog


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/5] ARM: dts: rockchip: Add DDR retention/poweroff to rk3288-veyron hogs
  2019-04-11 23:21 [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend Douglas Anderson
  2019-04-11 23:21 ` [PATCH 2/5] ARM: rockchip: pm: Mark init functions __init Douglas Anderson
@ 2019-04-11 23:21 ` Douglas Anderson
  2019-04-12 11:16   ` Heiko Stübner
  2019-04-11 23:21 ` [PATCH 4/5] ARM: dts: rockchip: vcc33_ccd off in suspend for rk3288-veyron-chromebook Douglas Anderson
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Douglas Anderson @ 2019-04-11 23:21 UTC (permalink / raw)
  To: Heiko Stuebner, Elaine Zhang
  Cc: dbasehore, amstan, linux-rockchip, briannorris, mka, ryandcase,
	Chris Zhong, Douglas Anderson, devicetree, linux-kernel,
	Rob Herring, Mark Rutland, linux-arm-kernel

Even though upstream Linux doesn't yet go into deep enough suspend to
get DDR into self refresh, there is no harm in setting these pins up.
They'll only actually do something if we go into a deeper suspend but
leaving them configed always is fine.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi | 4 ++++
 arch/arm/boot/dts/rk3288-veyron.dtsi            | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi b/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi
index 72c4754032e9..b9cc90f0f25c 100644
--- a/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi
+++ b/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi
@@ -229,6 +229,8 @@
 &pinctrl {
 	pinctrl-0 = <
 		/* Common for sleep and wake, but no owners */
+		&ddr0_retention
+		&ddrio_pwroff
 		&global_pwroff
 
 		/* Wake only */
@@ -236,6 +238,8 @@
 	>;
 	pinctrl-1 = <
 		/* Common for sleep and wake, but no owners */
+		&ddr0_retention
+		&ddrio_pwroff
 		&global_pwroff
 
 		/* Sleep only */
diff --git a/arch/arm/boot/dts/rk3288-veyron.dtsi b/arch/arm/boot/dts/rk3288-veyron.dtsi
index 5c67acc3e6d8..279d7f4ecce0 100644
--- a/arch/arm/boot/dts/rk3288-veyron.dtsi
+++ b/arch/arm/boot/dts/rk3288-veyron.dtsi
@@ -451,10 +451,14 @@
 	pinctrl-names = "default", "sleep";
 	pinctrl-0 = <
 		/* Common for sleep and wake, but no owners */
+		&ddr0_retention
+		&ddrio_pwroff
 		&global_pwroff
 	>;
 	pinctrl-1 = <
 		/* Common for sleep and wake, but no owners */
+		&ddr0_retention
+		&ddrio_pwroff
 		&global_pwroff
 	>;
 
-- 
2.21.0.392.gf8f6787159e-goog


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/5] ARM: dts: rockchip: vcc33_ccd off in suspend for rk3288-veyron-chromebook
  2019-04-11 23:21 [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend Douglas Anderson
  2019-04-11 23:21 ` [PATCH 2/5] ARM: rockchip: pm: Mark init functions __init Douglas Anderson
  2019-04-11 23:21 ` [PATCH 3/5] ARM: dts: rockchip: Add DDR retention/poweroff to rk3288-veyron hogs Douglas Anderson
@ 2019-04-11 23:21 ` Douglas Anderson
  2019-04-12  1:53   ` elaine.zhang
  2019-04-12 11:16   ` Heiko Stübner
  2019-04-11 23:21 ` [PATCH 5/5] ARM: dts: rockchip: vdd_gpu off in suspend for rk3288-veyron Douglas Anderson
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 13+ messages in thread
From: Douglas Anderson @ 2019-04-11 23:21 UTC (permalink / raw)
  To: Heiko Stuebner, Elaine Zhang
  Cc: dbasehore, amstan, linux-rockchip, briannorris, mka, ryandcase,
	Chris Zhong, Douglas Anderson, devicetree, linux-kernel,
	Rob Herring, Mark Rutland, linux-arm-kernel

As per my comments when the device tree for rk3288-veyron-chromebook
first landed:

> Technically I think vcc33_ccd can be off since we have
> 'needs-reset-on-resume' down in the EHCI port (this regulator is for
> the USB webcam that's connected to the EHCI port).
>
>  ...but leaving it on for now seems fine until we get suspend/resume
> more solid.

It's probably about time to do it right.

[1] https://lore.kernel.org/linux-arm-kernel/CAD=FV=U37Yx8Mqk75_x05zxonvdc3qRMhqp8TyTDPWGHqSuRqg@mail.gmail.com/

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi b/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi
index b9cc90f0f25c..fbef34578100 100644
--- a/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi
+++ b/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi
@@ -176,8 +176,7 @@
 			regulator-min-microvolt = <3300000>;
 			regulator-max-microvolt = <3300000>;
 			regulator-state-mem {
-				regulator-on-in-suspend;
-				regulator-suspend-microvolt = <3300000>;
+				regulator-off-in-suspend;
 			};
 		};
 	};
-- 
2.21.0.392.gf8f6787159e-goog


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/5] ARM: dts: rockchip: vdd_gpu off in suspend for rk3288-veyron
  2019-04-11 23:21 [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend Douglas Anderson
                   ` (2 preceding siblings ...)
  2019-04-11 23:21 ` [PATCH 4/5] ARM: dts: rockchip: vcc33_ccd off in suspend for rk3288-veyron-chromebook Douglas Anderson
@ 2019-04-11 23:21 ` Douglas Anderson
  2019-04-12  1:55   ` elaine.zhang
  2019-04-12 11:17   ` Heiko Stübner
  2019-04-12  1:56 ` [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend elaine.zhang
  2019-04-12 10:06 ` Heiko Stübner
  5 siblings, 2 replies; 13+ messages in thread
From: Douglas Anderson @ 2019-04-11 23:21 UTC (permalink / raw)
  To: Heiko Stuebner, Elaine Zhang
  Cc: dbasehore, amstan, linux-rockchip, briannorris, mka, ryandcase,
	Chris Zhong, Douglas Anderson, devicetree, linux-kernel,
	Rob Herring, Mark Rutland, linux-arm-kernel

At some point long long ago the downstream GPU driver would crash if
we turned the GPU off during suspend.  For some context you can see:

https://chromium-review.googlesource.com/#/c/215780/5..6/arch/arm/boot/dts/rk3288-pinky-rev2.dts

At some point in time not too long after that got fixed.

It's unclear why the GPU is left enabled during suspend on the
mainline kernel.  Everything seems fine if I turn this off, so let's
do it.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 arch/arm/boot/dts/rk3288-veyron.dtsi | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/rk3288-veyron.dtsi b/arch/arm/boot/dts/rk3288-veyron.dtsi
index 279d7f4ecce0..1252522392c7 100644
--- a/arch/arm/boot/dts/rk3288-veyron.dtsi
+++ b/arch/arm/boot/dts/rk3288-veyron.dtsi
@@ -217,8 +217,7 @@
 				regulator-max-microvolt = <1250000>;
 				regulator-ramp-delay = <6001>;
 				regulator-state-mem {
-					regulator-on-in-suspend;
-					regulator-suspend-microvolt = <1000000>;
+					regulator-off-in-suspend;
 				};
 			};
 
-- 
2.21.0.392.gf8f6787159e-goog


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/5] ARM: dts: rockchip: vcc33_ccd off in suspend for rk3288-veyron-chromebook
  2019-04-11 23:21 ` [PATCH 4/5] ARM: dts: rockchip: vcc33_ccd off in suspend for rk3288-veyron-chromebook Douglas Anderson
@ 2019-04-12  1:53   ` elaine.zhang
  2019-04-12 11:16   ` Heiko Stübner
  1 sibling, 0 replies; 13+ messages in thread
From: elaine.zhang @ 2019-04-12  1:53 UTC (permalink / raw)
  To: Douglas Anderson, Heiko Stuebner
  Cc: dbasehore, amstan, linux-rockchip, briannorris, mka, ryandcase,
	Chris Zhong, devicetree, linux-kernel, Rob Herring, Mark Rutland,
	linux-arm-kernel

hi,

在 2019/4/12 上午7:21, Douglas Anderson 写道:
> As per my comments when the device tree for rk3288-veyron-chromebook
> first landed:
>
>> Technically I think vcc33_ccd can be off since we have
>> 'needs-reset-on-resume' down in the EHCI port (this regulator is for
>> the USB webcam that's connected to the EHCI port).
>>
>>   ...but leaving it on for now seems fine until we get suspend/resume
>> more solid.
> It's probably about time to do it right.
>
> [1] https://lore.kernel.org/linux-arm-kernel/CAD=FV=U37Yx8Mqk75_x05zxonvdc3qRMhqp8TyTDPWGHqSuRqg@mail.gmail.com/
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
>
>   arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi b/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi
> index b9cc90f0f25c..fbef34578100 100644
> --- a/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi
> +++ b/arch/arm/boot/dts/rk3288-veyron-chromebook.dtsi
> @@ -176,8 +176,7 @@
>   			regulator-min-microvolt = <3300000>;
>   			regulator-max-microvolt = <3300000>;
>   			regulator-state-mem {
> -				regulator-on-in-suspend;
> -				regulator-suspend-microvolt = <3300000>;
> +				regulator-off-in-suspend;
>   			};
>   		};
>   	};

Reviewed-by: Elaine Zhang<zhangqing@rock-chips.com>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/5] ARM: dts: rockchip: vdd_gpu off in suspend for rk3288-veyron
  2019-04-11 23:21 ` [PATCH 5/5] ARM: dts: rockchip: vdd_gpu off in suspend for rk3288-veyron Douglas Anderson
@ 2019-04-12  1:55   ` elaine.zhang
  2019-04-12 11:17   ` Heiko Stübner
  1 sibling, 0 replies; 13+ messages in thread
From: elaine.zhang @ 2019-04-12  1:55 UTC (permalink / raw)
  To: Douglas Anderson, Heiko Stuebner
  Cc: dbasehore, amstan, linux-rockchip, briannorris, mka, ryandcase,
	Chris Zhong, devicetree, linux-kernel, Rob Herring, Mark Rutland,
	linux-arm-kernel

hi,

在 2019/4/12 上午7:21, Douglas Anderson 写道:
> At some point long long ago the downstream GPU driver would crash if
> we turned the GPU off during suspend.  For some context you can see:
>
> https://chromium-review.googlesource.com/#/c/215780/5..6/arch/arm/boot/dts/rk3288-pinky-rev2.dts
>
> At some point in time not too long after that got fixed.
>
> It's unclear why the GPU is left enabled during suspend on the
> mainline kernel.  Everything seems fine if I turn this off, so let's
> do it.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
>
>   arch/arm/boot/dts/rk3288-veyron.dtsi | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/arm/boot/dts/rk3288-veyron.dtsi b/arch/arm/boot/dts/rk3288-veyron.dtsi
> index 279d7f4ecce0..1252522392c7 100644
> --- a/arch/arm/boot/dts/rk3288-veyron.dtsi
> +++ b/arch/arm/boot/dts/rk3288-veyron.dtsi
> @@ -217,8 +217,7 @@
>   				regulator-max-microvolt = <1250000>;
>   				regulator-ramp-delay = <6001>;
>   				regulator-state-mem {
> -					regulator-on-in-suspend;
> -					regulator-suspend-microvolt = <1000000>;
> +					regulator-off-in-suspend;
>   				};
>   			};
>   

Reviewed-by: Elaine Zhang<zhangqing@rock-chips.com>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend
  2019-04-11 23:21 [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend Douglas Anderson
                   ` (3 preceding siblings ...)
  2019-04-11 23:21 ` [PATCH 5/5] ARM: dts: rockchip: vdd_gpu off in suspend for rk3288-veyron Douglas Anderson
@ 2019-04-12  1:56 ` elaine.zhang
  2019-04-12 10:06 ` Heiko Stübner
  5 siblings, 0 replies; 13+ messages in thread
From: elaine.zhang @ 2019-04-12  1:56 UTC (permalink / raw)
  To: Douglas Anderson, Heiko Stuebner
  Cc: dbasehore, amstan, linux-rockchip, briannorris, mka, ryandcase,
	Chris Zhong, Michael Turquette, Stephen Boyd, linux-kernel,
	linux-clk, linux-arm-kernel

hi,

在 2019/4/12 上午7:21, Douglas Anderson 写道:
> Experimentally it can be seen that going into deep sleep (specifically
> setting PMU_CLR_DMA and PMU_CLR_BUS in RK3288_PMU_PWRMODE_CON1)
> appears to fail unless "aclk_dmac1" is on.  The failure is that the
> system never signals that it made it into suspend on the GLOBAL_PWROFF
> pin and it just hangs.
>
> NOTE that it's confirmed that it's the actual suspend that fails, not
> one of the earlier calls to read/write registers.  Specifically if you
> comment out the "PMU_GLOBAL_INT_DISABLE" setting in
> rk3288_slp_mode_set() and then comment out the "cpu_do_idle()" call in
> rockchip_lpmode_enter() then you can exercise the whole suspend path
> without any crashing.
>
> This is currently not a problem with suspend upstream because there is
> no current way to exercise the deep suspend code.  However, anyone
> trying to make it work will run into this issue.
>
> This was not a problem on shipping rk3288-based Chromebooks because
> those devices all ran on an old kernel based on 3.14.  On that kernel
> "aclk_dmac1" appears to be left on all the time.
>
> There are several ways to skin this problem.
>
> A) We could add "aclk_dmac1" to the list of critical clocks and that
> apperas to work, but presumably that wastes power.
>
> B) We could keep a list of "struct clk" objects to enable at suspend
> time in clk-rk3288.c and use the standard clock APIs.
>
> C) We could make the rk3288-pmu driver keep a list of clocks to enable
> at suspend time.  Presumably this would require a dts and bindings
> change.
>
> D) We could just whack the clock on in the existing syscore suspend
> function where we whack a bunch of other clocks.  This is particularly
> easy because we know for sure that the clock's only parent
> ("aclk_cpu") is a critical clock so we don't need to do anything more
> than ungate it.
>
> In this case I have chosen D) because it seemed like the least work,
> but any of the other options would presumably also work fine.
>
> Signed-off-by: Douglas Anderson <dianders@chromium.org>
> ---
>
>   drivers/clk/rockchip/clk-rk3288.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
>
> diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
> index 5a67b7869960..b245367393cd 100644
> --- a/drivers/clk/rockchip/clk-rk3288.c
> +++ b/drivers/clk/rockchip/clk-rk3288.c
> @@ -859,6 +859,9 @@ static const int rk3288_saved_cru_reg_ids[] = {
>   	RK3288_CLKSEL_CON(10),
>   	RK3288_CLKSEL_CON(33),
>   	RK3288_CLKSEL_CON(37),
> +
> +	/* We turn aclk_dmac1 on for suspend; this will restore it */
> +	RK3288_CLKGATE_CON(10),
>   };
>   
>   static u32 rk3288_saved_cru_regs[ARRAY_SIZE(rk3288_saved_cru_reg_ids)];
> @@ -874,6 +877,14 @@ static int rk3288_clk_suspend(void)
>   				readl_relaxed(rk3288_cru_base + reg_id);
>   	}
>   
> +	/*
> +	 * Going into deep sleep (specifically setting PMU_CLR_DMA in
> +	 * RK3288_PMU_PWRMODE_CON1) appears to fail unless
> +	 * "aclk_dmac1" is on.
> +	 */
> +	writel_relaxed(1 << (12 + 16),
> +		       rk3288_cru_base + RK3288_CLKGATE_CON(10));
> +
>   	/*
>   	 * Switch PLLs other than DPLL (for SDRAM) to slow mode to
>   	 * avoid crashes on resume. The Mask ROM on the system will

Thank you for your correction.

Reviewed-by: Elaine Zhang<zhangqing@rock-chips.com>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend
  2019-04-11 23:21 [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend Douglas Anderson
                   ` (4 preceding siblings ...)
  2019-04-12  1:56 ` [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend elaine.zhang
@ 2019-04-12 10:06 ` Heiko Stübner
  5 siblings, 0 replies; 13+ messages in thread
From: Heiko Stübner @ 2019-04-12 10:06 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Elaine Zhang, dbasehore, amstan, linux-rockchip, briannorris,
	mka, ryandcase, Chris Zhong, Michael Turquette, Stephen Boyd,
	linux-kernel, linux-clk, linux-arm-kernel

Am Freitag, 12. April 2019, 01:21:53 CEST schrieb Douglas Anderson:
> Experimentally it can be seen that going into deep sleep (specifically
> setting PMU_CLR_DMA and PMU_CLR_BUS in RK3288_PMU_PWRMODE_CON1)
> appears to fail unless "aclk_dmac1" is on.  The failure is that the
> system never signals that it made it into suspend on the GLOBAL_PWROFF
> pin and it just hangs.
> 
> NOTE that it's confirmed that it's the actual suspend that fails, not
> one of the earlier calls to read/write registers.  Specifically if you
> comment out the "PMU_GLOBAL_INT_DISABLE" setting in
> rk3288_slp_mode_set() and then comment out the "cpu_do_idle()" call in
> rockchip_lpmode_enter() then you can exercise the whole suspend path
> without any crashing.
> 
> This is currently not a problem with suspend upstream because there is
> no current way to exercise the deep suspend code.  However, anyone
> trying to make it work will run into this issue.
> 
> This was not a problem on shipping rk3288-based Chromebooks because
> those devices all ran on an old kernel based on 3.14.  On that kernel
> "aclk_dmac1" appears to be left on all the time.
> 
> There are several ways to skin this problem.
> 
> A) We could add "aclk_dmac1" to the list of critical clocks and that
> apperas to work, but presumably that wastes power.
> 
> B) We could keep a list of "struct clk" objects to enable at suspend
> time in clk-rk3288.c and use the standard clock APIs.
> 
> C) We could make the rk3288-pmu driver keep a list of clocks to enable
> at suspend time.  Presumably this would require a dts and bindings
> change.
> 
> D) We could just whack the clock on in the existing syscore suspend
> function where we whack a bunch of other clocks.  This is particularly
> easy because we know for sure that the clock's only parent
> ("aclk_cpu") is a critical clock so we don't need to do anything more
> than ungate it.
> 
> In this case I have chosen D) because it seemed like the least work,
> but any of the other options would presumably also work fine.
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

applied for 5.2 with Elaine's rb

Thanks
Heiko



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/5] ARM: rockchip: pm: Mark init functions __init
  2019-04-11 23:21 ` [PATCH 2/5] ARM: rockchip: pm: Mark init functions __init Douglas Anderson
@ 2019-04-12 11:16   ` Heiko Stübner
  0 siblings, 0 replies; 13+ messages in thread
From: Heiko Stübner @ 2019-04-12 11:16 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Elaine Zhang, dbasehore, amstan, linux-rockchip, briannorris,
	mka, ryandcase, Chris Zhong, linux-arm-kernel, Russell King,
	linux-kernel

Am Freitag, 12. April 2019, 01:21:54 CEST schrieb Douglas Anderson:
> The functions rk3288_config_bootdata() and rk3288_suspend_init() are
> only called in the context of rockchip_suspend_init() which is already
> marked __init.  We can mark them __init too.
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

applied for 5.2

Thanks
Heiko



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] ARM: dts: rockchip: Add DDR retention/poweroff to rk3288-veyron hogs
  2019-04-11 23:21 ` [PATCH 3/5] ARM: dts: rockchip: Add DDR retention/poweroff to rk3288-veyron hogs Douglas Anderson
@ 2019-04-12 11:16   ` Heiko Stübner
  0 siblings, 0 replies; 13+ messages in thread
From: Heiko Stübner @ 2019-04-12 11:16 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Elaine Zhang, dbasehore, amstan, linux-rockchip, briannorris,
	mka, ryandcase, Chris Zhong, devicetree, linux-kernel,
	Rob Herring, Mark Rutland, linux-arm-kernel

Am Freitag, 12. April 2019, 01:21:55 CEST schrieb Douglas Anderson:
> Even though upstream Linux doesn't yet go into deep enough suspend to
> get DDR into self refresh, there is no harm in setting these pins up.
> They'll only actually do something if we go into a deeper suspend but
> leaving them configed always is fine.
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

applied for 5.2

Thanks
Heiko



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/5] ARM: dts: rockchip: vcc33_ccd off in suspend for rk3288-veyron-chromebook
  2019-04-11 23:21 ` [PATCH 4/5] ARM: dts: rockchip: vcc33_ccd off in suspend for rk3288-veyron-chromebook Douglas Anderson
  2019-04-12  1:53   ` elaine.zhang
@ 2019-04-12 11:16   ` Heiko Stübner
  1 sibling, 0 replies; 13+ messages in thread
From: Heiko Stübner @ 2019-04-12 11:16 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Elaine Zhang, dbasehore, amstan, linux-rockchip, briannorris,
	mka, ryandcase, Chris Zhong, devicetree, linux-kernel,
	Rob Herring, Mark Rutland, linux-arm-kernel

Am Freitag, 12. April 2019, 01:21:56 CEST schrieb Douglas Anderson:
> As per my comments when the device tree for rk3288-veyron-chromebook
> first landed:
> 
> > Technically I think vcc33_ccd can be off since we have
> > 'needs-reset-on-resume' down in the EHCI port (this regulator is for
> > the USB webcam that's connected to the EHCI port).
> >
> >  ...but leaving it on for now seems fine until we get suspend/resume
> > more solid.
> 
> It's probably about time to do it right.
> 
> [1] https://lore.kernel.org/linux-arm-kernel/CAD=FV=U37Yx8Mqk75_x05zxonvdc3qRMhqp8TyTDPWGHqSuRqg@mail.gmail.com/
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

applied for 5.2

Thanks
Heiko



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 5/5] ARM: dts: rockchip: vdd_gpu off in suspend for rk3288-veyron
  2019-04-11 23:21 ` [PATCH 5/5] ARM: dts: rockchip: vdd_gpu off in suspend for rk3288-veyron Douglas Anderson
  2019-04-12  1:55   ` elaine.zhang
@ 2019-04-12 11:17   ` Heiko Stübner
  1 sibling, 0 replies; 13+ messages in thread
From: Heiko Stübner @ 2019-04-12 11:17 UTC (permalink / raw)
  To: Douglas Anderson
  Cc: Elaine Zhang, dbasehore, amstan, linux-rockchip, briannorris,
	mka, ryandcase, Chris Zhong, devicetree, linux-kernel,
	Rob Herring, Mark Rutland, linux-arm-kernel

Am Freitag, 12. April 2019, 01:21:57 CEST schrieb Douglas Anderson:
> At some point long long ago the downstream GPU driver would crash if
> we turned the GPU off during suspend.  For some context you can see:
> 
> https://chromium-review.googlesource.com/#/c/215780/5..6/arch/arm/boot/dts/rk3288-pinky-rev2.dts
> 
> At some point in time not too long after that got fixed.
> 
> It's unclear why the GPU is left enabled during suspend on the
> mainline kernel.  Everything seems fine if I turn this off, so let's
> do it.
> 
> Signed-off-by: Douglas Anderson <dianders@chromium.org>

applied for 5.2

Thanks
Heiko



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-04-12 11:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 23:21 [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend Douglas Anderson
2019-04-11 23:21 ` [PATCH 2/5] ARM: rockchip: pm: Mark init functions __init Douglas Anderson
2019-04-12 11:16   ` Heiko Stübner
2019-04-11 23:21 ` [PATCH 3/5] ARM: dts: rockchip: Add DDR retention/poweroff to rk3288-veyron hogs Douglas Anderson
2019-04-12 11:16   ` Heiko Stübner
2019-04-11 23:21 ` [PATCH 4/5] ARM: dts: rockchip: vcc33_ccd off in suspend for rk3288-veyron-chromebook Douglas Anderson
2019-04-12  1:53   ` elaine.zhang
2019-04-12 11:16   ` Heiko Stübner
2019-04-11 23:21 ` [PATCH 5/5] ARM: dts: rockchip: vdd_gpu off in suspend for rk3288-veyron Douglas Anderson
2019-04-12  1:55   ` elaine.zhang
2019-04-12 11:17   ` Heiko Stübner
2019-04-12  1:56 ` [PATCH 1/5] clk: rockchip: Turn on "aclk_dmac1" for suspend elaine.zhang
2019-04-12 10:06 ` Heiko Stübner

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).