mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] clk: zynq: eval ps-clock-frequency from DT
@ 2023-05-08  7:24 Steffen Trumtrar
  2023-05-08 11:17 ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: Steffen Trumtrar @ 2023-05-08  7:24 UTC (permalink / raw)
  To: Barebox List; +Cc: Kai Assman

From: Kai Assman <kai.assmann@de.bosch.com>

Currently the ps_clk_rate is locked to 33.3MHz. The devicetree
provides a property "ps-clock-frequency" that specifies this clock.

If the property is found, overwrite ps_clk_rate otherwise stay at the
default 33.3MHz

Signed-off-by: Kai Assmann <kai.assmann@de.bosch.com>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 drivers/clk/zynq/clkc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
index 8e4beda295..37a0fbadb5 100644
--- a/drivers/clk/zynq/clkc.c
+++ b/drivers/clk/zynq/clkc.c
@@ -388,6 +388,9 @@ static int zynq_clock_probe(struct device *dev)
 			return PTR_ERR(parent_res);
 
 		slcr_offset = parent_res->start;
+
+		of_property_read_u32(dev->device_node, "ps-clock-frequency",
+				     (u32 *)&ps_clk_rate);
 	}
 
 	iores = request_iomem_region(dev_name(dev), iores->start + slcr_offset,
-- 
2.39.0




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

* Re: [PATCH] clk: zynq: eval ps-clock-frequency from DT
  2023-05-08  7:24 [PATCH] clk: zynq: eval ps-clock-frequency from DT Steffen Trumtrar
@ 2023-05-08 11:17 ` Ahmad Fatoum
  2023-05-09  6:09   ` Steffen Trumtrar
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2023-05-08 11:17 UTC (permalink / raw)
  To: Steffen Trumtrar, Barebox List; +Cc: Kai Assman

On 08.05.23 09:24, Steffen Trumtrar wrote:
> From: Kai Assman <kai.assmann@de.bosch.com>
> 
> Currently the ps_clk_rate is locked to 33.3MHz. The devicetree
> provides a property "ps-clock-frequency" that specifies this clock.
> 
> If the property is found, overwrite ps_clk_rate otherwise stay at the
> default 33.3MHz

The commit message reads as is this is an upstream binding, but I find no
usage, documentation or driver code parsing it in Linux v6.4-rc1.

Is this a new barebox-specific binding? If so, the commit message should be
reworded to make this clear. You can also drop a short .rst file into
Documentation/devicetree/bindings/clocks to describe your new property.

> Signed-off-by: Kai Assmann <kai.assmann@de.bosch.com>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
>  drivers/clk/zynq/clkc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
> index 8e4beda295..37a0fbadb5 100644
> --- a/drivers/clk/zynq/clkc.c
> +++ b/drivers/clk/zynq/clkc.c
> @@ -388,6 +388,9 @@ static int zynq_clock_probe(struct device *dev)
>  			return PTR_ERR(parent_res);
>  
>  		slcr_offset = parent_res->start;
> +
> +		of_property_read_u32(dev->device_node, "ps-clock-frequency",
> +				     (u32 *)&ps_clk_rate);

Please do not cast compiler warnings away. You should change the type of
ps_clk_rate instead to u32, so this code is 64-bit-safe.

Cheers,
Ahmad

>  	}
>  
>  	iores = request_iomem_region(dev_name(dev), iores->start + slcr_offset,

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




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

* Re: [PATCH] clk: zynq: eval ps-clock-frequency from DT
  2023-05-08 11:17 ` Ahmad Fatoum
@ 2023-05-09  6:09   ` Steffen Trumtrar
  0 siblings, 0 replies; 3+ messages in thread
From: Steffen Trumtrar @ 2023-05-09  6:09 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: Kai Assman, barebox


On 2023-05-08 at 13:17 +02, Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:

> On 08.05.23 09:24, Steffen Trumtrar wrote:
>> From: Kai Assman <kai.assmann@de.bosch.com>
>>
>> Currently the ps_clk_rate is locked to 33.3MHz. The devicetree
>> provides a property "ps-clock-frequency" that specifies this clock.
>>
>> If the property is found, overwrite ps_clk_rate otherwise stay at the
>> default 33.3MHz
>
> The commit message reads as is this is an upstream binding, but I find no
> usage, documentation or driver code parsing it in Linux v6.4-rc1.
>
> Is this a new barebox-specific binding? If so, the commit message should be
> reworded to make this clear. You can also drop a short .rst file into
> Documentation/devicetree/bindings/clocks to describe your new property.
>

Ha, you are right. I could have sworn to have seen this binding already
and didn't check :(

I'll change that.

>> Signed-off-by: Kai Assmann <kai.assmann@de.bosch.com>
>> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
>> ---
>>  drivers/clk/zynq/clkc.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
>> index 8e4beda295..37a0fbadb5 100644
>> --- a/drivers/clk/zynq/clkc.c
>> +++ b/drivers/clk/zynq/clkc.c
>> @@ -388,6 +388,9 @@ static int zynq_clock_probe(struct device *dev)
>>  			return PTR_ERR(parent_res);
>>
>>  		slcr_offset = parent_res->start;
>> +
>> +		of_property_read_u32(dev->device_node, "ps-clock-frequency",
>> +				     (u32 *)&ps_clk_rate);
>
> Please do not cast compiler warnings away. You should change the type of
> ps_clk_rate instead to u32, so this code is 64-bit-safe.

Ack.


Thanks,
Steffen

--
Pengutronix e.K.                | Dipl.-Inform. Steffen Trumtrar |
Steuerwalder Str. 21            | https://www.pengutronix.de/    |
31137 Hildesheim, Germany       | Phone: +49-5121-206917-0       |
Amtsgericht Hildesheim, HRA 2686| Fax:   +49-5121-206917-5555    |



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

end of thread, other threads:[~2023-05-09  6:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-08  7:24 [PATCH] clk: zynq: eval ps-clock-frequency from DT Steffen Trumtrar
2023-05-08 11:17 ` Ahmad Fatoum
2023-05-09  6:09   ` Steffen Trumtrar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox