Skip to contentSkip to conversation

clk: renesas: rzg2l: Fix FOUTPOSTDIV clk

PATCH Prabhakar Mahadev Lad 3 participants 5 messages Dec 18, 2024 – Dec 19, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 22 lines

From: [email protected] <[email protected]> On Behalf Of Lad Prabhakar via lists.cip-project.org
Sent: 11 December 2024 18:15
To: [email protected]; Nobuhiro Iwamatsu <[email protected]>; Pavel Machek <[email protected]>
Cc: Biju Das <[email protected]>
Subject: [cip-dev] [PATCH 5.10.y-cip] clk: renesas: rzg2l: Fix FOUTPOSTDIV clk

From: Biju Das <[email protected]>

commit dabf72b85f298970e86891b5218459c17b57b26a upstream.

While computing foutpostdiv_rate, the value of params->pl5_fracin is discarded, which results in the wrong refresh rate. Fix the formula for computing foutpostdiv_rate.

Fixes 1561380ee72f ("clk: renesas: rzg2l: Add FOUTPOSTDIV clk support")
Quoted 7 lines

[email protected]

---
 drivers/clk/renesas/rzg2l-cpg.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Gentle ping for review.

Cheers,
Prabhakar

Quoted 34 lines
drivers/clk/renesas/rzg2l- renamed from drivers/clk/renesas/rzg2l-cpg.c +0 -0

cpg.c index b1952d2ee8c2..379292eb6fb1 100644

drivers/clk/renesas/rzg2l-cpg.c +1 -1
@@ -556,7 +556,7 @@ static unsigned long
 rzg2l_cpg_get_foutpostdiv_rate(struct rzg2l_pll5_param *params,
 			       unsigned long rate)
 {
-	unsigned long foutpostdiv_rate;
+	unsigned long foutpostdiv_rate, foutvco_rate;
 
 	params->pl5_intin = rate / MEGA;
 	params->pl5_fracin = div_u64(((u64)rate % MEGA) << 24, MEGA); @@ -

565,10 +565,11 @@ rzg2l_cpg_get_foutpostdiv_rate(struct rzg2l_pll5_param *params,

drivers/clk/renesas/rzg2l-cpg.c +2 -4
 	params->pl5_postdiv2 = 1;
 	params->pl5_spread = 0x16;
 
-	foutpostdiv_rate =
-		EXTAL_FREQ_IN_MEGA_HZ * MEGA / params->pl5_refdiv *
-		((((params->pl5_intin << 24) + params->pl5_fracin)) >> 24) /
-		(params->pl5_postdiv1 * params->pl5_postdiv2);
+	foutvco_rate = div_u64(mul_u32_u32(EXTAL_FREQ_IN_MEGA_HZ * MEGA,
+					   (params->pl5_intin << 24) + params-
Quoted 1 line

pl5_fracin),

drivers/clk/renesas/rzg2l-cpg.c +3 -0
+			       params->pl5_refdiv) >> 24;
+	foutpostdiv_rate = DIV_ROUND_CLOSEST_ULL(foutvco_rate,
+						 params->pl5_postdiv1 * params-
Quoted 1 line

pl5_postdiv2);

return foutpostdiv_rate;
}
--
2.43.0

#2 lore raw

Hi!

Quoted 16 lines
Quoted 9 lines

While computing foutpostdiv_rate, the value of params->pl5_fracin is discarded, which results in the wrong refresh rate. Fix the formula for computing foutpostdiv_rate.

Fixes 1561380ee72f ("clk: renesas: rzg2l: Add FOUTPOSTDIV clk support")
Quoted 7 lines

[email protected]

---
 drivers/clk/renesas/rzg2l-cpg.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
Quoted 1 line

Gentle ping for review.

Again, sorry for the delay. Should we have similar patch for 6.1? I can't seem to find that in my mailbox...

Best regards,
Pavel

Signature · 2 lines
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

Hi all,

Quoted 30 lines

-----Original Message-----
From: Pavel Machek <[email protected]>
Sent: Thursday, December 19, 2024 12:53 AM
To: Prabhakar Mahadev Lad <[email protected]>
Cc: [email protected]; iwamatsu nobuhiro(岩松 信洋 ○DITC□ DIT○OST) <[email protected]>; Pavel Machek <[email protected]>; Biju Das <[email protected]>
Subject: Re: [cip-dev] [PATCH 5.10.y-cip] clk: renesas: rzg2l: Fix FOUTPOSTDIV clk

Hi!

Quoted 18 lines
Quoted 18 lines

While computing foutpostdiv_rate, the value of params->pl5_fracin is discarded, which results in the wrong refresh rate. Fix the formula for computing foutpostdiv_rate.

Fixes 1561380ee72f ("clk: renesas: rzg2l: Add FOUTPOSTDIV clk

support")

[email protected]

Signed-off-by Lad Prabhakar

<[email protected]>

---
 drivers/clk/renesas/rzg2l-cpg.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
Quoted 5 lines
Quoted 1 line

Gentle ping for review.

Again, sorry for the delay. Should we have similar patch for 6.1? I can't seem to find that in my mailbox...

I could not find it either from mailbox and patchwork. Perhaps a patch for 6.1.y-cip has not been posted.

Prabhakar, If we need this patch to 6.1.y-cip, could you send it ?

Best regards,
Nobuhiro

#4 lore raw
In reply to Pavel Machek

Hi Pavel,

Quoted 29 lines

From: Pavel Machek <[email protected]>
Sent: 18 December 2024 15:53
To: Prabhakar Mahadev Lad <[email protected]>
Cc: [email protected]; Nobuhiro Iwamatsu <[email protected]>; Pavel Machek <[email protected]>; Biju Das <[email protected]>
Subject: Re: [cip-dev] [PATCH 5.10.y-cip] clk: renesas: rzg2l: Fix FOUTPOSTDIV clk

Hi!

Quoted 18 lines
Quoted 18 lines

While computing foutpostdiv_rate, the value of params->pl5_fracin is discarded, which results in the wrong refresh rate. Fix the formula for computing foutpostdiv_rate.

Fixes 1561380ee72f ("clk: renesas: rzg2l: Add FOUTPOSTDIV clk

support")

[email protected]

Signed-off-by Lad Prabhakar

<[email protected]>

---
 drivers/clk/renesas/rzg2l-cpg.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
Quoted 5 lines
Quoted 1 line

Gentle ping for review.

Again, sorry for the delay. Should we have similar patch for 6.1? I can't seem to find that in my mailbox...

Thank you for the review. For 6.1 this patch should automatically land into CIP via stable due to fixes tag.

Cheers,
Prabhakar

#5 lore raw

Hi!

Quoted 5 lines
Quoted 3 lines

Again, sorry for the delay. Should we have similar patch for 6.1? I can't seem to find that in my mailbox...

Thank you for the review. For 6.1 this patch should automatically land into CIP via stable due to fixes tag.

Ok, thanks for the info. Unless it is urgent, I believe it will be better to wait for patch to land to 6.1 before merging 5.10 versions, in future.

Best regards,
Pavel

Signature · 2 lines
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany