clk/samsung: Clear OF_POPULATED flag from clkout node in init callback

Message ID 1477398861-2270-1-git-send-email-m.szyprowski@samsung.com
State New
Headers show

Commit Message

Marek Szyprowski Oct. 25, 2016, 12:34 p.m.
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(+)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Javier Martinez Canillas Oct. 25, 2016, 2:16 p.m. | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Krzysztof Kozlowski Oct. 25, 2016, 4:07 p.m. | #2
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

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Boyd Oct. 25, 2016, 8:30 p.m. | #3
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
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

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: