devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] clk: st: update to avoid DT warnings
@ 2021-12-02  7:28 Alain Volmat
  2021-12-02  7:28 ` [PATCH 1/2] clk: st: clkgen-fsyn: search reg within node or parent Alain Volmat
  2021-12-02  7:28 ` [PATCH 2/2] clk: st: clkgen-mux: " Alain Volmat
  0 siblings, 2 replies; 5+ messages in thread
From: Alain Volmat @ 2021-12-02  7:28 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Patrice Chotard
  Cc: Lee Jones, linux-clk, devicetree, linux-kernel, linux-arm-kernel,
	Alain Volmat

The serie contains 2 updates within clkgen-fsyn and clkgen-mux
in order to allow those drivers to pick up the reg property
within their parent node instead of their own node.  Such
behavior is already in place for the other st clk drivers and
to allow to not have several time the same reg value within
the device tree.
Those changes are also done in order to avoid DT warning seen
when compiling with W=1 and indicating unique-unit-address issues.

Alain Volmat (2):
  clk: st: clkgen-fsyn: search reg within node or parent
  clk: st: clkgen-mux: search reg within node or parent

 drivers/clk/st/clkgen-fsyn.c | 11 +++++++++--
 drivers/clk/st/clkgen-mux.c  | 11 +++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

-- 
2.25.1


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

* [PATCH 1/2] clk: st: clkgen-fsyn: search reg within node or parent
  2021-12-02  7:28 [PATCH 0/2] clk: st: update to avoid DT warnings Alain Volmat
@ 2021-12-02  7:28 ` Alain Volmat
  2021-12-15 10:03   ` Patrice CHOTARD
  2021-12-02  7:28 ` [PATCH 2/2] clk: st: clkgen-mux: " Alain Volmat
  1 sibling, 1 reply; 5+ messages in thread
From: Alain Volmat @ 2021-12-02  7:28 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Patrice Chotard
  Cc: Lee Jones, linux-clk, devicetree, linux-kernel, linux-arm-kernel,
	Alain Volmat

In order to avoid having duplicated addresses within the DT,
only have one unit-address per clockgen and each driver within
the clockgen should look at the parent node (overall clockgen)
to figure out the reg property.  Such behavior is already in
place in other STi platform clock drivers such as clk-flexgen
and clkgen-pll.  Keep backward compatibility by first looking
at reg within the node before looking into the parent node.

Signed-off-by: Alain Volmat <avolmat@me.com>
---
 drivers/clk/st/clkgen-fsyn.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
index 164285d6be97..0d41164f2c7f 100644
--- a/drivers/clk/st/clkgen-fsyn.c
+++ b/drivers/clk/st/clkgen-fsyn.c
@@ -988,9 +988,16 @@ static void __init st_of_quadfs_setup(struct device_node *np,
 	void __iomem *reg;
 	spinlock_t *lock;
 
+	/*
+	 * First check for reg property within the node to keep backward
+	 * compatibility, then if reg doesn't exist look at the parent node
+	 */
 	reg = of_iomap(np, 0);
-	if (!reg)
-		return;
+	if (!reg) {
+		reg = of_iomap(of_get_parent(np), 0);
+		if (!reg)
+			return;
+	}
 
 	clk_parent_name = of_clk_get_parent_name(np, 0);
 	if (!clk_parent_name)
-- 
2.25.1


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

* [PATCH 2/2] clk: st: clkgen-mux: search reg within node or parent
  2021-12-02  7:28 [PATCH 0/2] clk: st: update to avoid DT warnings Alain Volmat
  2021-12-02  7:28 ` [PATCH 1/2] clk: st: clkgen-fsyn: search reg within node or parent Alain Volmat
@ 2021-12-02  7:28 ` Alain Volmat
  1 sibling, 0 replies; 5+ messages in thread
From: Alain Volmat @ 2021-12-02  7:28 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Rob Herring, Patrice Chotard
  Cc: Lee Jones, linux-clk, devicetree, linux-kernel, linux-arm-kernel,
	Alain Volmat

In order to avoid having duplicated addresses within the DT,
only have one unit-address per clockgen and each driver within
the clockgen should look at the parent node (overall clockgen)
to figure out the reg property.  Such behavior is already in
place in other STi platform clock drivers such as clk-flexgen
and clkgen-pll.  Keep backward compatibility by first looking
at reg within the node before looking into the parent node.

Signed-off-by: Alain Volmat <avolmat@me.com>
---
 drivers/clk/st/clkgen-mux.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c
index ce583ded968a..ee39af7a0b72 100644
--- a/drivers/clk/st/clkgen-mux.c
+++ b/drivers/clk/st/clkgen-mux.c
@@ -57,10 +57,17 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np,
 	const char **parents;
 	int num_parents = 0;
 
+	/*
+	 * First check for reg property within the node to keep backward
+	 * compatibility, then if reg doesn't exist look at the parent node
+	 */
 	reg = of_iomap(np, 0);
 	if (!reg) {
-		pr_err("%s: Failed to get base address\n", __func__);
-		return;
+		reg = of_iomap(of_get_parent(np), 0);
+		if (!reg) {
+			pr_err("%s: Failed to get base address\n", __func__);
+			return;
+		}
 	}
 
 	parents = clkgen_mux_get_parents(np, &num_parents);
-- 
2.25.1


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

* Re: [PATCH 1/2] clk: st: clkgen-fsyn: search reg within node or parent
  2021-12-02  7:28 ` [PATCH 1/2] clk: st: clkgen-fsyn: search reg within node or parent Alain Volmat
@ 2021-12-15 10:03   ` Patrice CHOTARD
  2021-12-15 10:06     ` Patrice CHOTARD
  0 siblings, 1 reply; 5+ messages in thread
From: Patrice CHOTARD @ 2021-12-15 10:03 UTC (permalink / raw)
  To: Alain Volmat, Michael Turquette, Stephen Boyd, Rob Herring
  Cc: Lee Jones, linux-clk, devicetree, linux-kernel, linux-arm-kernel

Hi Alain

On 12/2/21 8:28 AM, Alain Volmat wrote:
> In order to avoid having duplicated addresses within the DT,
> only have one unit-address per clockgen and each driver within
> the clockgen should look at the parent node (overall clockgen)
> to figure out the reg property.  Such behavior is already in
> place in other STi platform clock drivers such as clk-flexgen
> and clkgen-pll.  Keep backward compatibility by first looking
> at reg within the node before looking into the parent node.
> 
> Signed-off-by: Alain Volmat <avolmat@me.com>
> ---
>  drivers/clk/st/clkgen-fsyn.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
> index 164285d6be97..0d41164f2c7f 100644
> --- a/drivers/clk/st/clkgen-fsyn.c
> +++ b/drivers/clk/st/clkgen-fsyn.c
> @@ -988,9 +988,16 @@ static void __init st_of_quadfs_setup(struct device_node *np,
>  	void __iomem *reg;
>  	spinlock_t *lock;
>  
> +	/*
> +	 * First check for reg property within the node to keep backward
> +	 * compatibility, then if reg doesn't exist look at the parent node
> +	 */
>  	reg = of_iomap(np, 0);
> -	if (!reg)
> -		return;
> +	if (!reg) {
> +		reg = of_iomap(of_get_parent(np), 0);
> +		if (!reg)
> +			return;
> +	}
>  
>  	clk_parent_name = of_clk_get_parent_name(np, 0);
>  	if (!clk_parent_name)
> 
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

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

* Re: [PATCH 1/2] clk: st: clkgen-fsyn: search reg within node or parent
  2021-12-15 10:03   ` Patrice CHOTARD
@ 2021-12-15 10:06     ` Patrice CHOTARD
  0 siblings, 0 replies; 5+ messages in thread
From: Patrice CHOTARD @ 2021-12-15 10:06 UTC (permalink / raw)
  To: Alain Volmat, Michael Turquette, Stephen Boyd, Rob Herring
  Cc: Lee Jones, linux-clk, devicetree, linux-kernel, linux-arm-kernel

Ah one remark, reviewing the patch 2, i saw you added a pr_err() in case of error, 
perhaps you can add one here also.

Patrice

On 12/15/21 11:03 AM, Patrice CHOTARD wrote:
> Hi Alain
> 
> On 12/2/21 8:28 AM, Alain Volmat wrote:
>> In order to avoid having duplicated addresses within the DT,
>> only have one unit-address per clockgen and each driver within
>> the clockgen should look at the parent node (overall clockgen)
>> to figure out the reg property.  Such behavior is already in
>> place in other STi platform clock drivers such as clk-flexgen
>> and clkgen-pll.  Keep backward compatibility by first looking
>> at reg within the node before looking into the parent node.
>>
>> Signed-off-by: Alain Volmat <avolmat@me.com>
>> ---
>>  drivers/clk/st/clkgen-fsyn.c | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
>> index 164285d6be97..0d41164f2c7f 100644
>> --- a/drivers/clk/st/clkgen-fsyn.c
>> +++ b/drivers/clk/st/clkgen-fsyn.c
>> @@ -988,9 +988,16 @@ static void __init st_of_quadfs_setup(struct device_node *np,
>>  	void __iomem *reg;
>>  	spinlock_t *lock;
>>  
>> +	/*
>> +	 * First check for reg property within the node to keep backward
>> +	 * compatibility, then if reg doesn't exist look at the parent node
>> +	 */
>>  	reg = of_iomap(np, 0);
>> -	if (!reg)
>> -		return;
>> +	if (!reg) {
>> +		reg = of_iomap(of_get_parent(np), 0);
>> +		if (!reg)
>> +			return;
>> +	}
>>  
>>  	clk_parent_name = of_clk_get_parent_name(np, 0);
>>  	if (!clk_parent_name)
>>
> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
> 
> Thanks
> Patrice
> 

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

end of thread, other threads:[~2021-12-15 10:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02  7:28 [PATCH 0/2] clk: st: update to avoid DT warnings Alain Volmat
2021-12-02  7:28 ` [PATCH 1/2] clk: st: clkgen-fsyn: search reg within node or parent Alain Volmat
2021-12-15 10:03   ` Patrice CHOTARD
2021-12-15 10:06     ` Patrice CHOTARD
2021-12-02  7:28 ` [PATCH 2/2] clk: st: clkgen-mux: " Alain Volmat

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