All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk/samsung: Clear OF_POPULATED flag from clkout node in init callback
       [not found] <CGME20161025123519eucas1p1f8d2efba82ebd101e8fa0697a5708a28@eucas1p1.samsung.com>
@ 2016-10-25 12:34 ` Marek Szyprowski
  2016-10-25 14:16   ` Javier Martinez Canillas
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marek Szyprowski @ 2016-10-25 12:34 UTC (permalink / raw)
  To: linux-clk, linux-samsung-soc
  Cc: Marek Szyprowski, Stephen Boyd, Michael Turquette,
	Sylwester Nawrocki, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Javier Martinez Canillas

The Exynos PMU node is an interrupt, clock and PMU (Power Management Unit)
controller, and these functionalities are supported by different drivers
that matches the same compatible strings.

Since commit 989eafd0b609 ("clk: core: Avoid double initialization of
clocks") the OF core flags clock controllers registered with the
CLK_OF_DECLARE() macro as OF_POPULATED, so platform devices with the same
compatible string as the interrupt controller will not be registered.

This prevents the PMU platform device to be registered so the Exynos PMU
driver is never probed. This breaks (among other things) Suspend-to-RAM.

Fix this by clearing the OF_POPULATED flag in the clkout driver init
callback, to allow the Exynos PMU platform driver to be probed. The patch
is based on similar patch from Javier Martinez Canillas: b030485220ca
"ARM: EXYNOS: Clear OF_POPULATED flag from PMU node in IRQ init callback".

Fixes: 989eafd0b609 ("clk: core: Avoid double initialization of clocks")
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/clk/samsung/clk-exynos-clkout.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c
index 96fab6cfb202..57303cfec7d4 100644
--- a/drivers/clk/samsung/clk-exynos-clkout.c
+++ b/drivers/clk/samsung/clk-exynos-clkout.c
@@ -116,6 +116,12 @@ static void __init exynos_clkout_init(struct device_node *node, u32 mux_mask)
 
 	register_syscore_ops(&exynos_clkout_syscore_ops);
 
+	/*
+	 * Clear the OF_POPULATED flag set in of_irq_init so that
+	 * later the Exynos PMU platform device won't be skipped.
+	 */
+	of_node_clear_flag(node, OF_POPULATED);
+
 	return;
 
 err_clk_unreg:
-- 
1.9.1

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

* Re: [PATCH] clk/samsung: Clear OF_POPULATED flag from clkout node in init callback
  2016-10-25 12:34 ` [PATCH] clk/samsung: Clear OF_POPULATED flag from clkout node in init callback Marek Szyprowski
@ 2016-10-25 14:16   ` Javier Martinez Canillas
  2016-10-25 16:07   ` Krzysztof Kozlowski
  2016-10-25 20:30   ` Stephen Boyd
  2 siblings, 0 replies; 4+ messages in thread
From: Javier Martinez Canillas @ 2016-10-25 14:16 UTC (permalink / raw)
  To: Marek Szyprowski, linux-clk, linux-samsung-soc
  Cc: Stephen Boyd, Michael Turquette, Sylwester Nawrocki,
	Chanwoo Choi, Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

Hello Marek,

On 10/25/2016 09:34 AM, Marek Szyprowski wrote:
> The Exynos PMU node is an interrupt, clock and PMU (Power Management Unit)
> controller, and these functionalities are supported by different drivers
> that matches the same compatible strings.
> 
> Since commit 989eafd0b609 ("clk: core: Avoid double initialization of
> clocks") the OF core flags clock controllers registered with the
> CLK_OF_DECLARE() macro as OF_POPULATED, so platform devices with the same
> compatible string as the interrupt controller will not be registered.
> 
> This prevents the PMU platform device to be registered so the Exynos PMU
> driver is never probed. This breaks (among other things) Suspend-to-RAM.
> 
> Fix this by clearing the OF_POPULATED flag in the clkout driver init
> callback, to allow the Exynos PMU platform driver to be probed. The patch
> is based on similar patch from Javier Martinez Canillas: b030485220ca
> "ARM: EXYNOS: Clear OF_POPULATED flag from PMU node in IRQ init callback".
> 
> Fixes: 989eafd0b609 ("clk: core: Avoid double initialization of clocks")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---

The patch looks good to me:

Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>

I've also tested it on an Exynos5800 Peach Pi, the PMU driver is probed
and S2R works correctly:

Tested-by: Javier Martinez Canillas <javier@osg.samsung.com>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

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

* Re: [PATCH] clk/samsung: Clear OF_POPULATED flag from clkout node in init callback
  2016-10-25 12:34 ` [PATCH] clk/samsung: Clear OF_POPULATED flag from clkout node in init callback Marek Szyprowski
  2016-10-25 14:16   ` Javier Martinez Canillas
@ 2016-10-25 16:07   ` Krzysztof Kozlowski
  2016-10-25 20:30   ` Stephen Boyd
  2 siblings, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2016-10-25 16:07 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-clk, linux-samsung-soc, Stephen Boyd, Michael Turquette,
	Sylwester Nawrocki, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Javier Martinez Canillas

On Tue, Oct 25, 2016 at 02:34:21PM +0200, Marek Szyprowski wrote:
> The Exynos PMU node is an interrupt, clock and PMU (Power Management Unit)
> controller, and these functionalities are supported by different drivers
> that matches the same compatible strings.
> 
> Since commit 989eafd0b609 ("clk: core: Avoid double initialization of
> clocks") the OF core flags clock controllers registered with the
> CLK_OF_DECLARE() macro as OF_POPULATED, so platform devices with the same
> compatible string as the interrupt controller will not be registered.
> 
> This prevents the PMU platform device to be registered so the Exynos PMU
> driver is never probed. This breaks (among other things) Suspend-to-RAM.
> 
> Fix this by clearing the OF_POPULATED flag in the clkout driver init
> callback, to allow the Exynos PMU platform driver to be probed. The patch
> is based on similar patch from Javier Martinez Canillas: b030485220ca
> "ARM: EXYNOS: Clear OF_POPULATED flag from PMU node in IRQ init callback".
> 
> Fixes: 989eafd0b609 ("clk: core: Avoid double initialization of clocks")
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  drivers/clk/samsung/clk-exynos-clkout.c | 6 ++++++
>  1 file changed, 6 insertions(+)

Yes, one could expect this sooner or later...
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

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

* Re: [PATCH] clk/samsung: Clear OF_POPULATED flag from clkout node in init callback
  2016-10-25 12:34 ` [PATCH] clk/samsung: Clear OF_POPULATED flag from clkout node in init callback Marek Szyprowski
  2016-10-25 14:16   ` Javier Martinez Canillas
  2016-10-25 16:07   ` Krzysztof Kozlowski
@ 2016-10-25 20:30   ` Stephen Boyd
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2016-10-25 20:30 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-clk, linux-samsung-soc, Michael Turquette,
	Sylwester Nawrocki, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Javier Martinez Canillas

On 10/25, Marek Szyprowski wrote:
> diff --git a/drivers/clk/samsung/clk-exynos-clkout.c b/drivers/clk/samsung/clk-exynos-clkout.c
> index 96fab6cfb202..57303cfec7d4 100644
> --- a/drivers/clk/samsung/clk-exynos-clkout.c
> +++ b/drivers/clk/samsung/clk-exynos-clkout.c
> @@ -116,6 +116,12 @@ static void __init exynos_clkout_init(struct device_node *node, u32 mux_mask)
>  
>  	register_syscore_ops(&exynos_clkout_syscore_ops);
>  
> +	/*
> +	 * Clear the OF_POPULATED flag set in of_irq_init so that

This comment is incorrect. This code is clearing the flag set in
of_clk_init() right?

> +	 * later the Exynos PMU platform device won't be skipped.
> +	 */
> +	of_node_clear_flag(node, OF_POPULATED);
> +
>  	return;
>  

We have a macro for this in clk land. CLK_OF_DECLARE_DRIVER. Can
you use that instead please? It makes things like grep much
easier.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2016-10-25 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20161025123519eucas1p1f8d2efba82ebd101e8fa0697a5708a28@eucas1p1.samsung.com>
2016-10-25 12:34 ` [PATCH] clk/samsung: Clear OF_POPULATED flag from clkout node in init callback Marek Szyprowski
2016-10-25 14:16   ` Javier Martinez Canillas
2016-10-25 16:07   ` Krzysztof Kozlowski
2016-10-25 20:30   ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.