All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: lan966x: fix sys_clk frequency
@ 2022-03-26 19:40 Michael Walle
  2022-04-28  8:49 ` Michael Walle
  2022-06-29 11:40 ` Kavyasree.Kotagiri
  0 siblings, 2 replies; 6+ messages in thread
From: Michael Walle @ 2022-03-26 19:40 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Nicolas Ferre, Kavyasree Kotagiri
  Cc: devicetree, linux-kernel, Michael Walle

The sys_clk frequency is 165.625MHz. The register reference of the
Generic Clock controller lists the CPU clock as 600MHz, the DDR clock as
300MHz and the SYS clock as 162.5MHz. This is wrong. It was first
noticed during the fan driver development and it was measured and
verified via the CLK_MON output of the SoC which can be configured to
output sys_clk/64.

The core PLL settings (which drives the SYS clock) seems to be as
follows:
  DIVF = 52
  DIVQ = 3
  DIVR = 1

With a refernce clock of 25MHz, this means we have a post divider clock
  Fpfd = Fref / (DIVR + 1) = 25MHz / (1 + 1) = 12.5MHz

The resulting VCO frequency is then
  Fvco = Fpfd * (DIVF + 1) * 2 = 12.5MHz * (52 + 1) * 2 = 1325MHz

And the output frequency is
  Fout = Fvco / 2^DIVQ = 1325MHz / 2^3 = 165.625Mhz

This all adds up to the constrains of the PLL:
    10MHz <= Fpfd <= 200MHz
    20MHz <= Fout <= 1000MHz
  1000MHz <= Fvco <= 2000MHz

Fixes: 290deaa10c50 ("ARM: dts: add DT for lan966 SoC and 2-port board pcb8291")
Signed-off-by: Michael Walle <michael@walle.cc>
---
 arch/arm/boot/dts/lan966x.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/lan966x.dtsi b/arch/arm/boot/dts/lan966x.dtsi
index 14c9cb3c0f3b..03045ec4aca4 100644
--- a/arch/arm/boot/dts/lan966x.dtsi
+++ b/arch/arm/boot/dts/lan966x.dtsi
@@ -38,7 +38,7 @@ clocks {
 		sys_clk: sys_clk {
 			compatible = "fixed-clock";
 			#clock-cells = <0>;
-			clock-frequency = <162500000>;
+			clock-frequency = <165625000>;
 		};
 
 		cpu_clk: cpu_clk {
-- 
2.30.2


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

* Re: [PATCH] ARM: dts: lan966x: fix sys_clk frequency
  2022-03-26 19:40 [PATCH] ARM: dts: lan966x: fix sys_clk frequency Michael Walle
@ 2022-04-28  8:49 ` Michael Walle
  2022-06-22 11:51   ` Michael Walle
  2022-06-29 11:40 ` Kavyasree.Kotagiri
  1 sibling, 1 reply; 6+ messages in thread
From: Michael Walle @ 2022-04-28  8:49 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Nicolas Ferre, Kavyasree Kotagiri
  Cc: devicetree, linux-kernel

Am 2022-03-26 20:40, schrieb Michael Walle:
> The sys_clk frequency is 165.625MHz. The register reference of the
> Generic Clock controller lists the CPU clock as 600MHz, the DDR clock 
> as
> 300MHz and the SYS clock as 162.5MHz. This is wrong. It was first
> noticed during the fan driver development and it was measured and
> verified via the CLK_MON output of the SoC which can be configured to
> output sys_clk/64.
> 
> The core PLL settings (which drives the SYS clock) seems to be as
> follows:
>   DIVF = 52
>   DIVQ = 3
>   DIVR = 1
> 
> With a refernce clock of 25MHz, this means we have a post divider clock
>   Fpfd = Fref / (DIVR + 1) = 25MHz / (1 + 1) = 12.5MHz
> 
> The resulting VCO frequency is then
>   Fvco = Fpfd * (DIVF + 1) * 2 = 12.5MHz * (52 + 1) * 2 = 1325MHz
> 
> And the output frequency is
>   Fout = Fvco / 2^DIVQ = 1325MHz / 2^3 = 165.625Mhz
> 
> This all adds up to the constrains of the PLL:
>     10MHz <= Fpfd <= 200MHz
>     20MHz <= Fout <= 1000MHz
>   1000MHz <= Fvco <= 2000MHz
> 
> Fixes: 290deaa10c50 ("ARM: dts: add DT for lan966 SoC and 2-port board 
> pcb8291")
> Signed-off-by: Michael Walle <michael@walle.cc>

Ping :)

Btw. this is also true for the new B0 silicon. I just verified it
with the CLK_MON output.

-michael

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

* Re: [PATCH] ARM: dts: lan966x: fix sys_clk frequency
  2022-04-28  8:49 ` Michael Walle
@ 2022-06-22 11:51   ` Michael Walle
  2022-07-15 18:41     ` Michael Walle
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Walle @ 2022-06-22 11:51 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Nicolas Ferre, Kavyasree Kotagiri
  Cc: devicetree, linux-kernel

Am 2022-04-28 10:49, schrieb Michael Walle:
> Am 2022-03-26 20:40, schrieb Michael Walle:
>> The sys_clk frequency is 165.625MHz. The register reference of the
>> Generic Clock controller lists the CPU clock as 600MHz, the DDR clock 
>> as
>> 300MHz and the SYS clock as 162.5MHz. This is wrong. It was first
>> noticed during the fan driver development and it was measured and
>> verified via the CLK_MON output of the SoC which can be configured to
>> output sys_clk/64.
>> 
>> The core PLL settings (which drives the SYS clock) seems to be as
>> follows:
>>   DIVF = 52
>>   DIVQ = 3
>>   DIVR = 1
>> 
>> With a refernce clock of 25MHz, this means we have a post divider 
>> clock
>>   Fpfd = Fref / (DIVR + 1) = 25MHz / (1 + 1) = 12.5MHz
>> 
>> The resulting VCO frequency is then
>>   Fvco = Fpfd * (DIVF + 1) * 2 = 12.5MHz * (52 + 1) * 2 = 1325MHz
>> 
>> And the output frequency is
>>   Fout = Fvco / 2^DIVQ = 1325MHz / 2^3 = 165.625Mhz
>> 
>> This all adds up to the constrains of the PLL:
>>     10MHz <= Fpfd <= 200MHz
>>     20MHz <= Fout <= 1000MHz
>>   1000MHz <= Fvco <= 2000MHz
>> 
>> Fixes: 290deaa10c50 ("ARM: dts: add DT for lan966 SoC and 2-port board 
>> pcb8291")
>> Signed-off-by: Michael Walle <michael@walle.cc>
> 
> Ping :)
> 
> Btw. this is also true for the new B0 silicon. I just verified it
> with the CLK_MON output.

Ping #2.

Could this please be picked up because most drivers use this property
to calculate output frequencies and so on, e.g. the PWM driver.

-michael

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

* RE: [PATCH] ARM: dts: lan966x: fix sys_clk frequency
  2022-03-26 19:40 [PATCH] ARM: dts: lan966x: fix sys_clk frequency Michael Walle
  2022-04-28  8:49 ` Michael Walle
@ 2022-06-29 11:40 ` Kavyasree.Kotagiri
  1 sibling, 0 replies; 6+ messages in thread
From: Kavyasree.Kotagiri @ 2022-06-29 11:40 UTC (permalink / raw)
  To: michael, robh+dt, krzk+dt, Nicolas.Ferre; +Cc: devicetree, linux-kernel

> The sys_clk frequency is 165.625MHz. The register reference of the
> Generic Clock controller lists the CPU clock as 600MHz, the DDR clock as
> 300MHz and the SYS clock as 162.5MHz. This is wrong. It was first
> noticed during the fan driver development and it was measured and
> verified via the CLK_MON output of the SoC which can be configured to
> output sys_clk/64.
> 
> The core PLL settings (which drives the SYS clock) seems to be as
> follows:
>   DIVF = 52
>   DIVQ = 3
>   DIVR = 1
> 
> With a refernce clock of 25MHz, this means we have a post divider clock
>   Fpfd = Fref / (DIVR + 1) = 25MHz / (1 + 1) = 12.5MHz
> 
> The resulting VCO frequency is then
>   Fvco = Fpfd * (DIVF + 1) * 2 = 12.5MHz * (52 + 1) * 2 = 1325MHz
> 
> And the output frequency is
>   Fout = Fvco / 2^DIVQ = 1325MHz / 2^3 = 165.625Mhz
> 
> This all adds up to the constrains of the PLL:
>     10MHz <= Fpfd <= 200MHz
>     20MHz <= Fout <= 1000MHz
>   1000MHz <= Fvco <= 2000MHz
> 
> Fixes: 290deaa10c50 ("ARM: dts: add DT for lan966 SoC and 2-port board
> pcb8291")
> Signed-off-by: Michael Walle <michael@walle.cc>

Reviewed-by: Kavyasree Kotagiri <kavyasree.kotagiri@microchip.com>

> ---
>  arch/arm/boot/dts/lan966x.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/lan966x.dtsi
> b/arch/arm/boot/dts/lan966x.dtsi
> index 14c9cb3c0f3b..03045ec4aca4 100644
> --- a/arch/arm/boot/dts/lan966x.dtsi
> +++ b/arch/arm/boot/dts/lan966x.dtsi
> @@ -38,7 +38,7 @@ clocks {
>                 sys_clk: sys_clk {
>                         compatible = "fixed-clock";
>                         #clock-cells = <0>;
> -                       clock-frequency = <162500000>;
> +                       clock-frequency = <165625000>;
>                 };
> 
>                 cpu_clk: cpu_clk {
> --
> 2.30.2


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

* Re: [PATCH] ARM: dts: lan966x: fix sys_clk frequency
  2022-06-22 11:51   ` Michael Walle
@ 2022-07-15 18:41     ` Michael Walle
  2022-07-18  6:36       ` Claudiu.Beznea
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Walle @ 2022-07-15 18:41 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Nicolas Ferre,
	Kavyasree Kotagiri, Claudiu.Beznea
  Cc: devicetree, linux-kernel

[+ Claudiu as he seems to pick patches for at91, too]

Am 2022-06-22 13:51, schrieb Michael Walle:
> Am 2022-04-28 10:49, schrieb Michael Walle:
>> Am 2022-03-26 20:40, schrieb Michael Walle:
>>> The sys_clk frequency is 165.625MHz. The register reference of the
>>> Generic Clock controller lists the CPU clock as 600MHz, the DDR clock 
>>> as
>>> 300MHz and the SYS clock as 162.5MHz. This is wrong. It was first
>>> noticed during the fan driver development and it was measured and
>>> verified via the CLK_MON output of the SoC which can be configured to
>>> output sys_clk/64.
>>> 
>>> The core PLL settings (which drives the SYS clock) seems to be as
>>> follows:
>>>   DIVF = 52
>>>   DIVQ = 3
>>>   DIVR = 1
>>> 
>>> With a refernce clock of 25MHz, this means we have a post divider 
>>> clock
>>>   Fpfd = Fref / (DIVR + 1) = 25MHz / (1 + 1) = 12.5MHz
>>> 
>>> The resulting VCO frequency is then
>>>   Fvco = Fpfd * (DIVF + 1) * 2 = 12.5MHz * (52 + 1) * 2 = 1325MHz
>>> 
>>> And the output frequency is
>>>   Fout = Fvco / 2^DIVQ = 1325MHz / 2^3 = 165.625Mhz
>>> 
>>> This all adds up to the constrains of the PLL:
>>>     10MHz <= Fpfd <= 200MHz
>>>     20MHz <= Fout <= 1000MHz
>>>   1000MHz <= Fvco <= 2000MHz
>>> 
>>> Fixes: 290deaa10c50 ("ARM: dts: add DT for lan966 SoC and 2-port 
>>> board pcb8291")
>>> Signed-off-by: Michael Walle <michael@walle.cc>
>> 
>> Ping :)
>> 
>> Btw. this is also true for the new B0 silicon. I just verified it
>> with the CLK_MON output.
> 
> Ping #2.
> 
> Could this please be picked up because most drivers use this property
> to calculate output frequencies and so on, e.g. the PWM driver.

Ping #3. Now it even got a Reviewed-by.

-michael

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

* Re: [PATCH] ARM: dts: lan966x: fix sys_clk frequency
  2022-07-15 18:41     ` Michael Walle
@ 2022-07-18  6:36       ` Claudiu.Beznea
  0 siblings, 0 replies; 6+ messages in thread
From: Claudiu.Beznea @ 2022-07-18  6:36 UTC (permalink / raw)
  To: michael, robh+dt, krzk+dt, Nicolas.Ferre, Kavyasree.Kotagiri
  Cc: devicetree, linux-kernel

On 15.07.2022 21:41, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the
> content is safe
> 
> [+ Claudiu as he seems to pick patches for at91, too]
> 
> Am 2022-06-22 13:51, schrieb Michael Walle:
>> Am 2022-04-28 10:49, schrieb Michael Walle:
>>> Am 2022-03-26 20:40, schrieb Michael Walle:
>>>> The sys_clk frequency is 165.625MHz. The register reference of the
>>>> Generic Clock controller lists the CPU clock as 600MHz, the DDR clock
>>>> as
>>>> 300MHz and the SYS clock as 162.5MHz. This is wrong. It was first
>>>> noticed during the fan driver development and it was measured and
>>>> verified via the CLK_MON output of the SoC which can be configured to
>>>> output sys_clk/64.
>>>>
>>>> The core PLL settings (which drives the SYS clock) seems to be as
>>>> follows:
>>>>   DIVF = 52
>>>>   DIVQ = 3
>>>>   DIVR = 1
>>>>
>>>> With a refernce clock of 25MHz, this means we have a post divider
>>>> clock
>>>>   Fpfd = Fref / (DIVR + 1) = 25MHz / (1 + 1) = 12.5MHz
>>>>
>>>> The resulting VCO frequency is then
>>>>   Fvco = Fpfd * (DIVF + 1) * 2 = 12.5MHz * (52 + 1) * 2 = 1325MHz
>>>>
>>>> And the output frequency is
>>>>   Fout = Fvco / 2^DIVQ = 1325MHz / 2^3 = 165.625Mhz
>>>>
>>>> This all adds up to the constrains of the PLL:
>>>>     10MHz <= Fpfd <= 200MHz
>>>>     20MHz <= Fout <= 1000MHz
>>>>   1000MHz <= Fvco <= 2000MHz
>>>>
>>>> Fixes: 290deaa10c50 ("ARM: dts: add DT for lan966 SoC and 2-port
>>>> board pcb8291")
>>>> Signed-off-by: Michael Walle <michael@walle.cc>

Applied to at91-fixes, thanks!

>>>
>>> Ping :)
>>>
>>> Btw. this is also true for the new B0 silicon. I just verified it
>>> with the CLK_MON output.
>>
>> Ping #2.
>>
>> Could this please be picked up because most drivers use this property
>> to calculate output frequencies and so on, e.g. the PWM driver.
> 
> Ping #3. Now it even got a Reviewed-by.
> 
> -michael


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

end of thread, other threads:[~2022-07-18  6:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-26 19:40 [PATCH] ARM: dts: lan966x: fix sys_clk frequency Michael Walle
2022-04-28  8:49 ` Michael Walle
2022-06-22 11:51   ` Michael Walle
2022-07-15 18:41     ` Michael Walle
2022-07-18  6:36       ` Claudiu.Beznea
2022-06-29 11:40 ` Kavyasree.Kotagiri

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.