* [PATCH] clk: rockchip: use separate compatibles for rk3288w-cru
@ 2020-07-03 15:28 Heiko Stuebner
2020-07-03 15:38 ` Ezequiel Garcia
0 siblings, 1 reply; 3+ messages in thread
From: Heiko Stuebner @ 2020-07-03 15:28 UTC (permalink / raw)
To: linux-rockchip
Cc: mylene.josserand, mturquette, sboyd, jagan, linux-kernel, heiko,
ezequiel, linux-clk, Heiko Stuebner
From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Commit 1627f683636d ("clk: rockchip: Handle clock tree for rk3288w variant")
added the check for rk3288w-specific clock-tree changes but in turn would
require a double-compatible due to re-using the main rockchip,rk3288-cru
compatible as entry point.
The binding change actually describes the compatibles as one or the other
so adapt the code accordingly and add a real second entry-point for the
clock controller.
Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
---
drivers/clk/rockchip/clk-rk3288.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
index 204976e2d0cb..a39ca9809cc3 100644
--- a/drivers/clk/rockchip/clk-rk3288.c
+++ b/drivers/clk/rockchip/clk-rk3288.c
@@ -922,7 +922,7 @@ static struct syscore_ops rk3288_clk_syscore_ops = {
.resume = rk3288_clk_resume,
};
-static void __init rk3288_clk_init(struct device_node *np)
+static void __init rk3288_common_init(struct device_node *np, bool is_w)
{
struct rockchip_clk_provider *ctx;
@@ -945,7 +945,7 @@ static void __init rk3288_clk_init(struct device_node *np)
rockchip_clk_register_branches(ctx, rk3288_clk_branches,
ARRAY_SIZE(rk3288_clk_branches));
- if (of_device_is_compatible(np, "rockchip,rk3288w-cru"))
+ if (is_w)
rockchip_clk_register_branches(ctx, rk3288w_hclkvio_branch,
ARRAY_SIZE(rk3288w_hclkvio_branch));
else
@@ -970,4 +970,15 @@ static void __init rk3288_clk_init(struct device_node *np)
rockchip_clk_of_add_provider(np, ctx);
}
+
+static void __init rk3288_clk_init(struct device_node *np)
+{
+ rk3288_common_init(np, false);
+}
CLK_OF_DECLARE(rk3288_cru, "rockchip,rk3288-cru", rk3288_clk_init);
+
+static void __init rk3288w_clk_init(struct device_node *np)
+{
+ rk3288_common_init(np, true);
+}
+CLK_OF_DECLARE(rk3288w_cru, "rockchip,rk3288w-cru", rk3288w_clk_init);
--
2.26.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: rockchip: use separate compatibles for rk3288w-cru
2020-07-03 15:28 [PATCH] clk: rockchip: use separate compatibles for rk3288w-cru Heiko Stuebner
@ 2020-07-03 15:38 ` Ezequiel Garcia
2020-07-03 16:19 ` Robin Murphy
0 siblings, 1 reply; 3+ messages in thread
From: Ezequiel Garcia @ 2020-07-03 15:38 UTC (permalink / raw)
To: Heiko Stuebner, linux-rockchip
Cc: mylene.josserand, mturquette, sboyd, jagan, linux-kernel,
linux-clk, Heiko Stuebner
On Fri, 2020-07-03 at 17:28 +0200, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>
> Commit 1627f683636d ("clk: rockchip: Handle clock tree for rk3288w variant")
> added the check for rk3288w-specific clock-tree changes but in turn would
> require a double-compatible due to re-using the main rockchip,rk3288-cru
> compatible as entry point.
>
> The binding change actually describes the compatibles as one or the other
> so adapt the code accordingly and add a real second entry-point for the
> clock controller.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
> ---
> drivers/clk/rockchip/clk-rk3288.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
> index 204976e2d0cb..a39ca9809cc3 100644
> --- a/drivers/clk/rockchip/clk-rk3288.c
> +++ b/drivers/clk/rockchip/clk-rk3288.c
> @@ -922,7 +922,7 @@ static struct syscore_ops rk3288_clk_syscore_ops = {
> .resume = rk3288_clk_resume,
> };
>
> -static void __init rk3288_clk_init(struct device_node *np)
> +static void __init rk3288_common_init(struct device_node *np, bool is_w)
From an API standpoint, avoid boolean arguments
in favor of a simple enum.
This case is trivial, but I think it's useful to avoid
the anti pattern.
Thanks for quickly working on this :)
Ezequiel
> {
> struct rockchip_clk_provider *ctx;
>
> @@ -945,7 +945,7 @@ static void __init rk3288_clk_init(struct device_node *np)
> rockchip_clk_register_branches(ctx, rk3288_clk_branches,
> ARRAY_SIZE(rk3288_clk_branches));
>
> - if (of_device_is_compatible(np, "rockchip,rk3288w-cru"))
> + if (is_w)
> rockchip_clk_register_branches(ctx, rk3288w_hclkvio_branch,
> ARRAY_SIZE(rk3288w_hclkvio_branch));
> else
> @@ -970,4 +970,15 @@ static void __init rk3288_clk_init(struct device_node *np)
>
> rockchip_clk_of_add_provider(np, ctx);
> }
> +
> +static void __init rk3288_clk_init(struct device_node *np)
> +{
> + rk3288_common_init(np, false);
> +}
> CLK_OF_DECLARE(rk3288_cru, "rockchip,rk3288-cru", rk3288_clk_init);
> +
> +static void __init rk3288w_clk_init(struct device_node *np)
> +{
> + rk3288_common_init(np, true);
> +}
> +CLK_OF_DECLARE(rk3288w_cru, "rockchip,rk3288w-cru", rk3288w_clk_init);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: rockchip: use separate compatibles for rk3288w-cru
2020-07-03 15:38 ` Ezequiel Garcia
@ 2020-07-03 16:19 ` Robin Murphy
0 siblings, 0 replies; 3+ messages in thread
From: Robin Murphy @ 2020-07-03 16:19 UTC (permalink / raw)
To: Ezequiel Garcia, Heiko Stuebner, linux-rockchip
Cc: mylene.josserand, sboyd, Heiko Stuebner, mturquette,
linux-kernel, jagan, linux-clk
On 2020-07-03 16:38, Ezequiel Garcia wrote:
> On Fri, 2020-07-03 at 17:28 +0200, Heiko Stuebner wrote:
>> From: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>>
>> Commit 1627f683636d ("clk: rockchip: Handle clock tree for rk3288w variant")
>> added the check for rk3288w-specific clock-tree changes but in turn would
>> require a double-compatible due to re-using the main rockchip,rk3288-cru
>> compatible as entry point.
>>
>> The binding change actually describes the compatibles as one or the other
>> so adapt the code accordingly and add a real second entry-point for the
>> clock controller.
>>
>> Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
>> ---
>> drivers/clk/rockchip/clk-rk3288.c | 15 +++++++++++++--
>> 1 file changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c
>> index 204976e2d0cb..a39ca9809cc3 100644
>> --- a/drivers/clk/rockchip/clk-rk3288.c
>> +++ b/drivers/clk/rockchip/clk-rk3288.c
>> @@ -922,7 +922,7 @@ static struct syscore_ops rk3288_clk_syscore_ops = {
>> .resume = rk3288_clk_resume,
>> };
>>
>> -static void __init rk3288_clk_init(struct device_node *np)
>> +static void __init rk3288_common_init(struct device_node *np, bool is_w)
>
> From an API standpoint, avoid boolean arguments
> in favor of a simple enum.
And if the enum's just a selector between different data, consider
simply passing the data directly ;)
Robin.
>
> This case is trivial, but I think it's useful to avoid
> the anti pattern.
>
> Thanks for quickly working on this :)
>
> Ezequiel
>
>> {
>> struct rockchip_clk_provider *ctx;
>>
>> @@ -945,7 +945,7 @@ static void __init rk3288_clk_init(struct device_node *np)
>> rockchip_clk_register_branches(ctx, rk3288_clk_branches,
>> ARRAY_SIZE(rk3288_clk_branches));
>>
>> - if (of_device_is_compatible(np, "rockchip,rk3288w-cru"))
>> + if (is_w)
>> rockchip_clk_register_branches(ctx, rk3288w_hclkvio_branch,
>> ARRAY_SIZE(rk3288w_hclkvio_branch));
>> else
>> @@ -970,4 +970,15 @@ static void __init rk3288_clk_init(struct device_node *np)
>>
>> rockchip_clk_of_add_provider(np, ctx);
>> }
>> +
>> +static void __init rk3288_clk_init(struct device_node *np)
>> +{
>> + rk3288_common_init(np, false);
>> +}
>> CLK_OF_DECLARE(rk3288_cru, "rockchip,rk3288-cru", rk3288_clk_init);
>> +
>> +static void __init rk3288w_clk_init(struct device_node *np)
>> +{
>> + rk3288_common_init(np, true);
>> +}
>> +CLK_OF_DECLARE(rk3288w_cru, "rockchip,rk3288w-cru", rk3288w_clk_init);
>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-03 16:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-03 15:28 [PATCH] clk: rockchip: use separate compatibles for rk3288w-cru Heiko Stuebner
2020-07-03 15:38 ` Ezequiel Garcia
2020-07-03 16:19 ` Robin Murphy
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).