Skip to contentSkip to conversation

clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

PATCH In review Adam Ford 3 participants 8 messages Mar 13, 2022 – Mar 21, 2022

Subsystems (2)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

The 5p49v6965 has a reference clock frequency doubler. Enabling it adds versaclock_som.dbl to the clock tree, but the output frequency remains correct.

drivers/clk/clk-versaclock5.c +1 -1
index e7be3e54b9be..4d190579e874 100644
@@ -1211,7 +1211,7 @@ static const struct vc5_chip_info idt_5p49v6965_info = {
 	.model = IDT_VC6_5P49V6965,
 	.clk_fod_cnt = 4,
 	.clk_out_cnt = 5,
-	.flags = VC5_HAS_BYPASS_SYNC_BIT,
+	.flags = VC5_HAS_BYPASS_SYNC_BIT | VC5_HAS_PFD_FREQ_DBL,
 };
 
 static const struct i2c_device_id vc5_id[] = {
Signature · 1 line
2.34.1
maintainer
#1 lore raw

Hi Adam, Claude,

thanks for your patch.

Quoted 12 lines · Adam Ford

The 5p49v6965 has a reference clock frequency doubler. Enabling it adds versaclock_som.dbl to the clock tree, but the output frequency remains correct.

drivers/clk/clk-versaclock5.c +0 -0
index e7be3e54b9be..4d190579e874 100644

drivers/clk/clk-versaclock5.c static const struct vc5_chip_info idt_5p49v6965_info = { · line 1214

Quoted 5 lines
drivers/clk/clk-versaclock5.c +1 -1
@@ -1211,7 +1211,7 @@ static const struct vc5_chip_info idt_5p49v6965_info = {
 	.model = IDT_VC6_5P49V6965,
 	.clk_fod_cnt = 4,
 	.clk_out_cnt = 5,
-	.flags = VC5_HAS_BYPASS_SYNC_BIT,
+	.flags = VC5_HAS_BYPASS_SYNC_BIT | VC5_HAS_PFD_FREQ_DBL,

If my understanding is correct, the doubler is not mentioned by the datasheet, but it exists. Maybe it's worth a line of comment to help future readers not waste their time in finding out:
/* Frequency doubler not mentioned on datasheet */

Can you confirm that:
- the en_ref_doubler bit value defaults to zero when reading it, as the register guide says?
- if set to 1 the frequencies double?

With that confirmed, the patch looks good.

Thanks,

Signature · 1 line
Luca
#2 lore raw

Hello Luca,

I will defer to Adam, but a few comments:

Quoted 35 lines

-----Original Message-----
From: Luca Ceresoli <[email protected]>
Sent: Tuesday, March 15, 2022 4:55 AM
To: Adam Ford <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Fillion, Claude <[email protected]>; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; linux- [email protected]
Subject: [EXTERNAL] Re: [PATCH] clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

This email originated outside of MKS. Use caution when sharing information or opening attachments and links.

----------------------------------------------------------------------------------------------
----------------------------------------------
Hi Adam, Claude,

thanks for your patch.

drivers/clk/clk-versaclock5.c static const struct vc5_chip_info

Quoted 13 lines · Adam Ford

The 5p49v6965 has a reference clock frequency doubler. Enabling it adds versaclock_som.dbl to the clock tree, but the output frequency remains correct.

(quoted diff) +0 -0

b/drivers/clk/clk-versaclock5.c index e7be3e54b9be..4d190579e874 100644

drivers/clk/clk-versaclock5.c +0 -0
@@ -1211,7 +1211,7 @@ static const struct vc5_chip_info

idt_5p49v6965_info = {

Quoted 12 lines

drivers/clk/clk-versaclock5.c static const struct vc5_chip_info idt_5p49v6965_info = { · line 1214

Quoted 5 lines
drivers/clk/clk-versaclock5.c +1 -1
 	.model = IDT_VC6_5P49V6965,
 	.clk_fod_cnt = 4,
 	.clk_out_cnt = 5,
-	.flags = VC5_HAS_BYPASS_SYNC_BIT,
+	.flags = VC5_HAS_BYPASS_SYNC_BIT | VC5_HAS_PFD_FREQ_DBL,

If my understanding is correct, the doubler is not mentioned by the datasheet, but it exists. Maybe it's worth a line of comment to help future readers not waste their time in finding out:
/* Frequency doubler not mentioned on datasheet */

I see the doubler bit mentioned in Table 25 of both v6 and v6e specs. It is named differently, but appears to have the same purpose.

Quoted 10 lines

Can you confirm that:
- the en_ref_doubler bit value defaults to zero when reading it, as the register guide says?
- if set to 1 the frequencies double?

With that confirmed, the patch looks good.

Thanks,
--
Luca

I played around a bit with the programming board today and did not see what I expected to see.

Using i2cget I see that the register in question (0x10) has a default value of 0xA0 for both 6901 and 6965. Thus it seems disabled by default for both parts.

Starting at my base frequency of 46.8MHz, setting the bit to 1 (i2cset) changes the output frequency to 59.04MHz for the 6901 part, and to 47.7MHz for the 6965 part. So setting the 'doubler' bit changes output frequency for both parts, but not the same amount.

Not sure of the meaning, just want to pass the information along.

-Claude

======================================================================
This message and any attachments are intended only for the designated recipient(s) and may contain confidential or proprietary information and be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message or any attachments. If you received this email in error, please notify the sender by reply e-mail and permanently delete the original and any copies of this message and any attachments thereto. Thank you.

maintainer
#3 lore raw

Hi Claude,

[adding Marek in Cc:, the original author of the driver and also of the frequency doubler]

Quoted 52 lines · Claude

Hello Luca,

I will defer to Adam, but a few comments:

Quoted 35 lines

-----Original Message-----
From: Luca Ceresoli <[email protected]>
Sent: Tuesday, March 15, 2022 4:55 AM
To: Adam Ford <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Fillion, Claude <[email protected]>; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; linux- [email protected]
Subject: [EXTERNAL] Re: [PATCH] clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

This email originated outside of MKS. Use caution when sharing information or opening attachments and links.

----------------------------------------------------------------------------------------------
----------------------------------------------
Hi Adam, Claude,

thanks for your patch.

drivers/clk/clk-versaclock5.c static const struct vc5_chip_info

Quoted 13 lines · Adam Ford

The 5p49v6965 has a reference clock frequency doubler. Enabling it adds versaclock_som.dbl to the clock tree, but the output frequency remains correct.

(quoted diff) +0 -0

b/drivers/clk/clk-versaclock5.c index e7be3e54b9be..4d190579e874 100644

drivers/clk/clk-versaclock5.c +0 -0
@@ -1211,7 +1211,7 @@ static const struct vc5_chip_info

idt_5p49v6965_info = {

Quoted 12 lines

drivers/clk/clk-versaclock5.c static const struct vc5_chip_info idt_5p49v6965_info = { · line 1214

Quoted 5 lines
drivers/clk/clk-versaclock5.c +1 -1
 	.model = IDT_VC6_5P49V6965,
 	.clk_fod_cnt = 4,
 	.clk_out_cnt = 5,
-	.flags = VC5_HAS_BYPASS_SYNC_BIT,
+	.flags = VC5_HAS_BYPASS_SYNC_BIT | VC5_HAS_PFD_FREQ_DBL,

If my understanding is correct, the doubler is not mentioned by the datasheet, but it exists. Maybe it's worth a line of comment to help future readers not waste their time in finding out:
/* Frequency doubler not mentioned on datasheet */

Quoted 1 line

I see the doubler bit mentioned in Table 25 of both v6 and v6e specs. It is named differently, but appears to have the same purpose.

Well, literally speaking what I wrote is correct: the _datasheet_ does not mention the doubler. Table 25 you mention is on the "Register Description and Programming Guide".

Practically speaking I would expect the datasheet to mention the hardware blocks including the doubler, but apparently Renesas has a different opinion and perhaps they are not alone.

So I think you can forget about my proposal to add a comment.

Quoted 7 lines
Quoted 7 lines

Can you confirm that:
- the en_ref_doubler bit value defaults to zero when reading it, as the register guide says?
- if set to 1 the frequencies double?

With that confirmed, the patch looks good.

Quoted 7 lines
Quoted 3 lines

Thanks,
--
Luca

I played around a bit with the programming board today and did not see what I expected to see.

Using i2cget I see that the register in question (0x10) has a default value of 0xA0 for both 6901 and 6965. Thus it seems disabled by default for both parts.

Coherently with the Register guide. OK.

Quoted 3 lines

Starting at my base frequency of 46.8MHz, setting the bit to 1 (i2cset) changes the output frequency to 59.04MHz for the 6901 part, and to 47.7MHz for the 6965 part. So setting the 'doubler' bit changes output frequency for both parts, but not the same amount.

Not sure of the meaning, just want to pass the information along.

Me neither.

I have no clever idea, only this one that I consider unlikely: by enabling the doubler you may have increased some internal frequency above its allowed range and thus the chip is not working properly anymore. Can you use a lower base frequency or check the PLL settings to ensure you are not exceeding some range?

What output frequency are you measuring? OUT0 or another one? What frequency do you measure with en_ref_doubler = 0?

Signature · 1 line
Luca
#4 lore raw

Hello Luca,

Quoted 121 lines

-----Original Message-----
From: Luca Ceresoli <[email protected]>
Sent: Tuesday, March 15, 2022 6:53 PM
To: Fillion, Claude <[email protected]>; Adam Ford <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Subject: Re: [EXTERNAL] Re: [PATCH] clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

Hi Claude,

[adding Marek in Cc:, the original author of the driver and also of the frequency doubler]

Quoted 9 lines · Claude

Hello Luca,

I will defer to Adam, but a few comments:

Quoted 5 lines

-----Original Message-----
From: Luca Ceresoli <[email protected]>
Sent: Tuesday, March 15, 2022 4:55 AM
To: Adam Ford <[email protected]>; [email protected]
Cc: [email protected]; [email protected];

Fillion,

Quoted 4 lines
Quoted 4 lines

Claude <[email protected]>; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; linux- [email protected]
Subject: [EXTERNAL] Re: [PATCH] clk: vc5: Enable

VC5_HAS_PFD_FREQ_DBL

Quoted 40 lines
Quoted 27 lines

on 5p49v6965

This email originated outside of MKS. Use caution when sharing information or opening attachments and links.

---------------------------------------------------------------------
-------------------------
----------------------------------------------
Hi Adam, Claude,

thanks for your patch.

drivers/clk/clk-versaclock5.c static const struct vc5_chip_info

Quoted 13 lines · Adam Ford

The 5p49v6965 has a reference clock frequency doubler. Enabling it adds versaclock_som.dbl to the clock tree, but the output frequency remains correct.

(quoted diff) +0 -0

b/drivers/clk/clk-versaclock5.c index e7be3e54b9be..4d190579e874 100644

drivers/clk/clk-versaclock5.c +0 -0
@@ -1211,7 +1211,7 @@ static const struct vc5_chip_info

idt_5p49v6965_info = {

Quoted 12 lines

drivers/clk/clk-versaclock5.c static const struct vc5_chip_info idt_5p49v6965_info = { · line 1214

Quoted 5 lines
drivers/clk/clk-versaclock5.c +1 -1
 	.model = IDT_VC6_5P49V6965,
 	.clk_fod_cnt = 4,
 	.clk_out_cnt = 5,
-	.flags = VC5_HAS_BYPASS_SYNC_BIT,
+	.flags = VC5_HAS_BYPASS_SYNC_BIT | VC5_HAS_PFD_FREQ_DBL,

If my understanding is correct, the doubler is not mentioned by the datasheet, but it exists. Maybe it's worth a line of comment to help future readers not waste their time in finding out:
/* Frequency doubler not mentioned on datasheet */

Quoted 1 line

I see the doubler bit mentioned in Table 25 of both v6 and v6e specs. It is

named differently, but appears to have the same purpose.

Well, literally speaking what I wrote is correct: the _datasheet_ does not mention the doubler. Table 25 you mention is on the "Register Description and Programming Guide".

Practically speaking I would expect the datasheet to mention the hardware blocks including the doubler, but apparently Renesas has a different opinion and perhaps they are not alone.

So I think you can forget about my proposal to add a comment.

Quoted 5 lines
Quoted 5 lines

Can you confirm that:
- the en_ref_doubler bit value defaults to zero when reading it, as the register guide says?
- if set to 1 the frequencies double?

Quoted 7 lines
Quoted 5 lines

With that confirmed, the patch looks good.

Thanks,
--
Luca

I played around a bit with the programming board today and did not see

what I expected to see.

Quoted 2 lines

Using i2cget I see that the register in question (0x10) has a default value of

0xA0 for both 6901 and 6965. Thus it seems disabled by default for both parts.

Coherently with the Register guide. OK.

Quoted 1 line

Starting at my base frequency of 46.8MHz, setting the bit to 1 (i2cset)

changes the output frequency to 59.04MHz for the 6901 part, and to 47.7MHz for the 6965 part. So setting the 'doubler' bit changes output frequency for both parts, but not the same amount.

Quoted 2 lines

Not sure of the meaning, just want to pass the information along.

Me neither.

I have no clever idea, only this one that I consider unlikely: by enabling the doubler you may have increased some internal frequency above its allowed range and thus the chip is not working properly anymore. Can you use a lower base frequency or check the PLL settings to ensure you are not exceeding some range?

Quoted 5 lines

What output frequency are you measuring? OUT0 or another one? What frequency do you measure with en_ref_doubler = 0?

--
Luca

Not sure what I did wrong with my earlier testing, but I am now seeing both parts respond similarly to the doubler bit being set.

With doubler bit disabled (register 0x10, value 0xa0), I set the output frequencies to 1, 10, 100, and 46.8MHz.

After setting doubler bit (0xa8), I saw frequencies of 1.260, 12.60, 126.0, and 58.9 Mhz for both 6901 and 6965 parts.

So from my testing the doubler bit seems to behave similarly for both parts.

At this point I will leave my unofficial testing and move on to writing a consumer driver.

Regards,
Claude

======================================================================
This message and any attachments are intended only for the designated recipient(s) and may contain confidential or proprietary information and be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message or any attachments. If you received this email in error, please notify the sender by reply e-mail and permanently delete the original and any copies of this message and any attachments thereto. Thank you.

author
#5 lore raw
Quoted 132 lines · Claude

Hello Luca,

Quoted 121 lines

-----Original Message-----
From: Luca Ceresoli <[email protected]>
Sent: Tuesday, March 15, 2022 6:53 PM
To: Fillion, Claude <[email protected]>; Adam Ford <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Subject: Re: [EXTERNAL] Re: [PATCH] clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

Hi Claude,

[adding Marek in Cc:, the original author of the driver and also of the frequency doubler]

Quoted 9 lines · Claude

Hello Luca,

I will defer to Adam, but a few comments:

Quoted 5 lines

-----Original Message-----
From: Luca Ceresoli <[email protected]>
Sent: Tuesday, March 15, 2022 4:55 AM
To: Adam Ford <[email protected]>; [email protected]
Cc: [email protected]; [email protected];

Fillion,

Quoted 4 lines
Quoted 4 lines

Claude <[email protected]>; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; linux- [email protected]
Subject: [EXTERNAL] Re: [PATCH] clk: vc5: Enable

VC5_HAS_PFD_FREQ_DBL

Quoted 34 lines
Quoted 34 lines

on 5p49v6965

This email originated outside of MKS. Use caution when sharing information or opening attachments and links.

---------------------------------------------------------------------
-------------------------
----------------------------------------------
Hi Adam, Claude,

thanks for your patch.

drivers/clk/clk-versaclock5.c static const struct vc5_chip_info

Quoted 13 lines · Adam Ford

The 5p49v6965 has a reference clock frequency doubler. Enabling it adds versaclock_som.dbl to the clock tree, but the output frequency remains correct.

(quoted diff) +0 -0

b/drivers/clk/clk-versaclock5.c index e7be3e54b9be..4d190579e874 100644

drivers/clk/clk-versaclock5.c +0 -0
@@ -1211,7 +1211,7 @@ static const struct vc5_chip_info

idt_5p49v6965_info = {

Quoted 5 lines
drivers/clk/clk-versaclock5.c +1 -1
  .model = IDT_VC6_5P49V6965,
  .clk_fod_cnt = 4,
  .clk_out_cnt = 5,
- .flags = VC5_HAS_BYPASS_SYNC_BIT,
+ .flags = VC5_HAS_BYPASS_SYNC_BIT | VC5_HAS_PFD_FREQ_DBL,
Quoted 7 lines
Quoted 5 lines

If my understanding is correct, the doubler is not mentioned by the datasheet, but it exists. Maybe it's worth a line of comment to help future readers not waste their time in finding out:
/* Frequency doubler not mentioned on datasheet */

I see the doubler bit mentioned in Table 25 of both v6 and v6e specs. It is

named differently, but appears to have the same purpose.

Well, literally speaking what I wrote is correct: the _datasheet_ does not mention the doubler. Table 25 you mention is on the "Register Description and Programming Guide".

Practically speaking I would expect the datasheet to mention the hardware blocks including the doubler, but apparently Renesas has a different opinion and perhaps they are not alone.

So I think you can forget about my proposal to add a comment.

Quoted 5 lines
Quoted 5 lines

Can you confirm that:
- the en_ref_doubler bit value defaults to zero when reading it, as the register guide says?
- if set to 1 the frequencies double?

Quoted 7 lines
Quoted 5 lines

With that confirmed, the patch looks good.

Thanks,
--
Luca

I played around a bit with the programming board today and did not see

what I expected to see.

Quoted 2 lines

Using i2cget I see that the register in question (0x10) has a default value of

0xA0 for both 6901 and 6965. Thus it seems disabled by default for both parts.

Coherently with the Register guide. OK.

Quoted 1 line

Starting at my base frequency of 46.8MHz, setting the bit to 1 (i2cset)

changes the output frequency to 59.04MHz for the 6901 part, and to 47.7MHz for the 6965 part. So setting the 'doubler' bit changes output frequency for both parts, but not the same amount.

Quoted 2 lines

Not sure of the meaning, just want to pass the information along.

Me neither.

I have no clever idea, only this one that I consider unlikely: by enabling the doubler you may have increased some internal frequency above its allowed range and thus the chip is not working properly anymore. Can you use a lower base frequency or check the PLL settings to ensure you are not exceeding some range?

Quoted 5 lines

What output frequency are you measuring? OUT0 or another one? What frequency do you measure with en_ref_doubler = 0?

--
Luca

Not sure what I did wrong with my earlier testing, but I am now seeing both parts respond similarly to the doubler bit being set.

Quoted 7 lines

With doubler bit disabled (register 0x10, value 0xa0), I set the output frequencies to 1, 10, 100, and 46.8MHz.

After setting doubler bit (0xa8), I saw frequencies of 1.260, 12.60, 126.0, and 58.9 Mhz for both 6901 and 6965 parts.

So from my testing the doubler bit seems to behave similarly for both parts.

At this point I will leave my unofficial testing and move on to writing a consumer driver.

I don't have a scope to measure the exact frequencies, but I was able to test it with both USB and Ethernet, which are clock from the versaclock, and I can check the output frequencies against the clk_summary in debugfs.

Without this patch:

clock-controller.mux 1 1 0 25000000
0 0 50000 Y
clock-controller.out0_sel_i2cb 0 0 0
25000000 0 0 50000 Y

       clock-controller.pfd           1        1        0    25000000
        0     0  50000         Y
          clock-controller.pll        1        1        0  2800000000
        0     0  50000         Y
             clock-controller.fod3       1        1        0
24576000          0     0  50000         Y
                clock-controller.out4       1        1        0
24576000          0     0  50000         Y
             clock-controller.fod2       0        0        0
24000000          0     0  50000         Y
                clock-controller.out3       0        0        0
24000000          0     0  50000         Y
             clock-controller.fod1       0        0        0
24000000          0     0  50000         Y
                clock-controller.out2       0        0        0
24000000          0     0  50000         Y
             clock-controller.fod0       0        0        0
24000000          0     0  50000         Y

clock-controller.out1 0 0 0
24000000 0 0 50000 Y

With this patch:

clock-controller.mux 1 1 0 25000000
0 0 50000 Y
clock-controller.out0_sel_i2cb 0 0 0
25000000 0 0 50000 Y
clock-controller.dbl 1 1 0 25000000
0 0 50000 Y
clock-controller.pfd 1 1 0 25000000
0 0 50000 Y
clock-controller.pll 1 1 0
2800000000 0 0 50000 Y
clock-controller.fod3 1 1 0
24576000 0 0 50000 Y
clock-controller.out4 1 1 0
24576000 0 0 50000 Y
clock-controller.fod2 0 0 0
24000000 0 0 50000 Y
clock-controller.out3 0 0 0
24000000 0 0 50000 Y
clock-controller.fod1 0 0 0
24000000 0 0 50000 Y
clock-controller.out2 0 0 0
24000000 0 0 50000 Y
clock-controller.fod0 0 0 0
24000000 0 0 50000 Y
clock-controller.out1 0 0 0
24000000 0 0 50000 Y

From what I can tell, the only thing that changes is the introduction of clock-controller.dbl into the clock dump.
In my interpretation of reading the programmer's manual, the frequency that is doubled is the reference frequency, but based on looking at the clock dump, it's not obvious what's happening.

Having said that, if Claude is measuring incorrect frequencies, I am fine with abandoning this patch.

adam

Quoted 6 lines

Regards,
Claude

======================================================================
This message and any attachments are intended only for the designated recipient(s) and may contain confidential or proprietary information and be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message or any attachments. If you received this email in error, please notify the sender by reply e-mail and permanently delete the original and any copies of this message and any attachments thereto. Thank you.

#6 lore raw

Hello Adam and Luca,

Quoted 227 lines

-----Original Message-----
From: Adam Ford <[email protected]>
Sent: Saturday, March 19, 2022 5:24 PM
To: Fillion, Claude <[email protected]>
Cc: Luca Ceresoli <[email protected]>; [email protected]; [email protected]; [email protected]; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Subject: Re: [EXTERNAL] Re: [PATCH] clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

Quoted 9 lines · Claude

Hello Luca,

Quoted 6 lines

-----Original Message-----
From: Luca Ceresoli <[email protected]>
Sent: Tuesday, March 15, 2022 6:53 PM
To: Fillion, Claude <[email protected]>; Adam Ford <[email protected]>; [email protected]
Cc: [email protected]; [email protected];

Michael

Quoted 14 lines
Quoted 14 lines

Turquette <[email protected]>; Stephen Boyd <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Subject: Re: [EXTERNAL] Re: [PATCH] clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

Hi Claude,

[adding Marek in Cc:, the original author of the driver and also of the frequency doubler]

Quoted 2 lines · Claude

Hello Luca,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I will defer to Adam, but a few comments:

Quoted 5 lines

-----Original Message-----
From: Luca Ceresoli <[email protected]>
Sent: Tuesday, March 15, 2022 4:55 AM
To: Adam Ford <[email protected]>; [email protected]
Cc: [email protected];

[email protected];

Quoted 99 lines
Quoted 99 lines

Fillion,

Quoted 4 lines
Quoted 4 lines

Claude <[email protected]>; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; linux- [email protected]
Subject: [EXTERNAL] Re: [PATCH] clk: vc5: Enable

VC5_HAS_PFD_FREQ_DBL

Quoted 35 lines
Quoted 35 lines

on 5p49v6965

This email originated outside of MKS. Use caution when sharing information or opening attachments and links.

-----------------------------------------------------------------
----
-------------------------
----------------------------------------------
Hi Adam, Claude,

thanks for your patch.

drivers/clk/clk-versaclock5.c static const struct vc5_chip_info

Quoted 13 lines · Adam Ford

The 5p49v6965 has a reference clock frequency doubler. Enabling it adds versaclock_som.dbl to the clock tree, but the output frequency remains correct.

(quoted diff) +0 -0

b/drivers/clk/clk-versaclock5.c index e7be3e54b9be..4d190579e874 100644

drivers/clk/clk-versaclock5.c +0 -0
@@ -1211,7 +1211,7 @@ static const struct vc5_chip_info

idt_5p49v6965_info = {

Quoted 5 lines
drivers/clk/clk-versaclock5.c +1 -1
  .model = IDT_VC6_5P49V6965,
  .clk_fod_cnt = 4,
  .clk_out_cnt = 5,
- .flags = VC5_HAS_BYPASS_SYNC_BIT,
+ .flags = VC5_HAS_BYPASS_SYNC_BIT | VC5_HAS_PFD_FREQ_DBL,
Quoted 8 lines
Quoted 5 lines

If my understanding is correct, the doubler is not mentioned by the datasheet, but it exists. Maybe it's worth a line of comment to help future readers not waste their time in finding out:
/* Frequency doubler not mentioned on datasheet */

I see the doubler bit mentioned in Table 25 of both v6 and v6e specs. It is

named differently, but appears to have the same purpose.

Well, literally speaking what I wrote is correct: the _datasheet_ does not mention the doubler. Table 25 you mention is on the "Register Description and Programming Guide".

Practically speaking I would expect the datasheet to mention the hardware blocks including the doubler, but apparently Renesas has a different opinion and perhaps they are not alone.

So I think you can forget about my proposal to add a comment.

Quoted 5 lines
Quoted 5 lines

Can you confirm that:
- the en_ref_doubler bit value defaults to zero when reading it, as the register guide says?
- if set to 1 the frequencies double?

Quoted 8 lines
Quoted 5 lines

With that confirmed, the patch looks good.

Thanks,
--
Luca

I played around a bit with the programming board today and did not see

what I expected to see.

Quoted 3 lines

Using i2cget I see that the register in question (0x10) has a default value of

0xA0 for both 6901 and 6965. Thus it seems disabled by default for both parts.

Coherently with the Register guide. OK.

Quoted 2 lines

Starting at my base frequency of 46.8MHz, setting the bit to 1 (i2cset)

changes the output frequency to 59.04MHz for the 6901 part, and to 47.7MHz for the 6965 part. So setting the 'doubler' bit changes output frequency for both parts, but not the same amount.

Quoted 2 lines

Not sure of the meaning, just want to pass the information along.

Me neither.

I have no clever idea, only this one that I consider unlikely: by enabling the doubler you may have increased some internal frequency above its allowed range and thus the chip is not working properly anymore. Can you use a lower base frequency or check the PLL settings to ensure you are not exceeding some range?

Quoted 7 lines
Quoted 5 lines

What output frequency are you measuring? OUT0 or another one? What frequency do you measure with en_ref_doubler = 0?

--
Luca

Not sure what I did wrong with my earlier testing, but I am now seeing both

parts respond similarly to the doubler bit being set.

Quoted 2 lines

With doubler bit disabled (register 0x10, value 0xa0), I set the output

frequencies to 1, 10, 100, and 46.8MHz.

Quoted 2 lines

After setting doubler bit (0xa8), I saw frequencies of 1.260, 12.60, 126.0,

and 58.9 Mhz for both 6901 and 6965 parts.

Quoted 2 lines

So from my testing the doubler bit seems to behave similarly for both

parts.

Quoted 2 lines

At this point I will leave my unofficial testing and move on to writing a

consumer driver.

I don't have a scope to measure the exact frequencies, but I was able to test it with both USB and Ethernet, which are clock from the versaclock, and I can check the output frequencies against the clk_summary in debugfs.

Without this patch:

clock-controller.mux 1 1 0 25000000
0 0 50000 Y
clock-controller.out0_sel_i2cb 0 0 0
25000000 0 0 50000 Y

       clock-controller.pfd           1        1        0    25000000
        0     0  50000         Y
          clock-controller.pll        1        1        0  2800000000
        0     0  50000         Y
             clock-controller.fod3       1        1        0
24576000          0     0  50000         Y
                clock-controller.out4       1        1        0
24576000          0     0  50000         Y
             clock-controller.fod2       0        0        0
24000000          0     0  50000         Y
                clock-controller.out3       0        0        0
24000000          0     0  50000         Y
             clock-controller.fod1       0        0        0
24000000          0     0  50000         Y
                clock-controller.out2       0        0        0
24000000          0     0  50000         Y
             clock-controller.fod0       0        0        0
24000000          0     0  50000         Y

clock-controller.out1 0 0 0
24000000 0 0 50000 Y

With this patch:

clock-controller.mux 1 1 0 25000000
0 0 50000 Y
clock-controller.out0_sel_i2cb 0 0 0
25000000 0 0 50000 Y
clock-controller.dbl 1 1 0 25000000
0 0 50000 Y
clock-controller.pfd 1 1 0 25000000
0 0 50000 Y
clock-controller.pll 1 1 0
2800000000 0 0 50000 Y
clock-controller.fod3 1 1 0
24576000 0 0 50000 Y
clock-controller.out4 1 1 0
24576000 0 0 50000 Y
clock-controller.fod2 0 0 0
24000000 0 0 50000 Y
clock-controller.out3 0 0 0
24000000 0 0 50000 Y
clock-controller.fod1 0 0 0
24000000 0 0 50000 Y
clock-controller.out2 0 0 0
24000000 0 0 50000 Y
clock-controller.fod0 0 0 0
24000000 0 0 50000 Y
clock-controller.out1 0 0 0
24000000 0 0 50000 Y

Quoted 8 lines

From what I can tell, the only thing that changes is the introduction of clock- controller.dbl into the clock dump.
In my interpretation of reading the programmer's manual, the frequency that is doubled is the reference frequency, but based on looking at the clock dump, it's not obvious what's happening.

Having said that, if Claude is measuring incorrect frequencies, I am fine with abandoning this patch.

For what it's worth, I went back and tested output frequencies with patch removed.

Here is what I observed(starting with frequencies of 1, 10, 100, 46.8MHz and changing register 0x10 from 0xa0 to 0xa8).

6901: 1.260, 12.60, 126.0, 58.9
6965 with patch: 1.260, 12.60, 126.0, 58.9
6965 without patch: 1.019, 10.19, 101.9, 47.68

From my limited testing (and knowledge for sure) it seems that in this test the patch has some benefit.

-Claude

Quoted 10 lines

adam

Quoted 5 lines

Regards,
Claude

==========================================================
============

Quoted 8 lines
Quoted 1 line

This message and any attachments are intended only for the designated

recipient(s) and may contain confidential or proprietary information and be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message or any attachments. If you received this email in error, please notify the sender by reply e-mail and permanently delete the original and any copies of this message and any attachments thereto. Thank you.

======================================================================
This message and any attachments are intended only for the designated recipient(s) and may contain confidential or proprietary information and be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message or any attachments. If you received this email in error, please notify the sender by reply e-mail and permanently delete the original and any copies of this message and any attachments thereto. Thank you.

#7 lore raw
Quoted 270 lines

-----Original Message-----
From: Fillion, Claude
Sent: Monday, March 21, 2022 5:12 PM
To: Adam Ford <[email protected]>
Cc: Luca Ceresoli <[email protected]>; [email protected]; [email protected]; [email protected]; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Subject: RE: [EXTERNAL] Re: [PATCH] clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

Hello Adam and Luca,

Quoted 6 lines

-----Original Message-----
From: Adam Ford <[email protected]>
Sent: Saturday, March 19, 2022 5:24 PM
To: Fillion, Claude <[email protected]>
Cc: Luca Ceresoli <[email protected]>; [email protected]; [email protected]; [email protected];

Michael

Quoted 1 line

Turquette <[email protected]>; Stephen Boyd

<[email protected]>;

Quoted 30 lines

[email protected]; Marek Vasut <[email protected]>
Subject: Re: [EXTERNAL] Re: [PATCH] clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

Quoted 9 lines · Claude

Hello Luca,

Quoted 6 lines

-----Original Message-----
From: Luca Ceresoli <[email protected]>
Sent: Tuesday, March 15, 2022 6:53 PM
To: Fillion, Claude <[email protected]>; Adam Ford <[email protected]>; [email protected]
Cc: [email protected]; [email protected];

Michael

Quoted 14 lines
Quoted 14 lines

Turquette <[email protected]>; Stephen Boyd <[email protected]>; [email protected]; Marek Vasut <[email protected]>
Subject: Re: [EXTERNAL] Re: [PATCH] clk: vc5: Enable VC5_HAS_PFD_FREQ_DBL on 5p49v6965

Hi Claude,

[adding Marek in Cc:, the original author of the driver and also of the frequency doubler]

Quoted 2 lines · Claude

Hello Luca,

Quoted 49 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I will defer to Adam, but a few comments:

Quoted 5 lines

-----Original Message-----
From: Luca Ceresoli <[email protected]>
Sent: Tuesday, March 15, 2022 4:55 AM
To: Adam Ford <[email protected]>; [email protected]
Cc: [email protected];

[email protected];

Quoted 41 lines
Quoted 41 lines

Fillion,

Quoted 4 lines
Quoted 4 lines

Claude <[email protected]>; Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; linux- [email protected]
Subject: [EXTERNAL] Re: [PATCH] clk: vc5: Enable

VC5_HAS_PFD_FREQ_DBL

Quoted 35 lines
Quoted 35 lines

on 5p49v6965

This email originated outside of MKS. Use caution when sharing information or opening attachments and links.

---------------------------------------------------------------
--
----
-------------------------
----------------------------------------------
Hi Adam, Claude,

thanks for your patch.

drivers/clk/clk-versaclock5.c static const struct vc5_chip_info

Quoted 14 lines · Adam Ford

The 5p49v6965 has a reference clock frequency doubler. Enabling it adds versaclock_som.dbl to the clock tree, but the output frequency remains correct.

(quoted diff) +0 -0

b/drivers/clk/clk-versaclock5.c index
e7be3e54b9be..4d190579e874
100644

drivers/clk/clk-versaclock5.c +0 -0
@@ -1211,7 +1211,7 @@ static const struct vc5_chip_info

idt_5p49v6965_info = {

Quoted 5 lines
drivers/clk/clk-versaclock5.c +1 -1
  .model = IDT_VC6_5P49V6965,
  .clk_fod_cnt = 4,
  .clk_out_cnt = 5,
- .flags = VC5_HAS_BYPASS_SYNC_BIT,
+ .flags = VC5_HAS_BYPASS_SYNC_BIT |

VC5_HAS_PFD_FREQ_DBL,

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 10 lines
Quoted 7 lines

If my understanding is correct, the doubler is not mentioned by the datasheet, but it exists. Maybe it's worth a line of comment to help future readers not waste their time in finding out:
/* Frequency doubler not mentioned on datasheet */

I see the doubler bit mentioned in Table 25 of both v6 and v6e specs. It is

named differently, but appears to have the same purpose.

Well, literally speaking what I wrote is correct: the _datasheet_ does not mention the doubler. Table 25 you mention is on the "Register Description and Programming Guide".

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Practically speaking I would expect the datasheet to mention the hardware blocks including the doubler, but apparently Renesas has a different opinion and perhaps they are not alone.

So I think you can forget about my proposal to add a comment.

Quoted 2 lines
Quoted 2 lines

Can you confirm that:
- the en_ref_doubler bit value defaults to zero when reading it, as

the

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 11 lines
Quoted 8 lines

register guide says?
- if set to 1 the frequencies double?

With that confirmed, the patch looks good.

Thanks,
--
Luca

I played around a bit with the programming board today and did not see

what I expected to see.

Quoted 3 lines

Using i2cget I see that the register in question (0x10) has a default value of

0xA0 for both 6901 and 6965. Thus it seems disabled by default for both parts.

Coherently with the Register guide. OK.

Quoted 2 lines

Starting at my base frequency of 46.8MHz, setting the bit to 1 (i2cset)

changes the output frequency to 59.04MHz for the 6901 part, and to 47.7MHz for the 6965 part. So setting the 'doubler' bit changes output frequency for both parts, but not the same amount.

Quoted 2 lines

Not sure of the meaning, just want to pass the information along.

Me neither.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

I have no clever idea, only this one that I consider unlikely: by enabling the doubler you may have increased some internal frequency above its allowed range and thus the chip is not working properly anymore. Can you use a lower base frequency or check the PLL settings to ensure you are not exceeding some range?

What output frequency are you measuring? OUT0 or another one?

What

Quoted 21 lines
Quoted 7 lines
Quoted 4 lines

frequency do you measure with en_ref_doubler = 0?

--
Luca

Not sure what I did wrong with my earlier testing, but I am now seeing both

parts respond similarly to the doubler bit being set.

Quoted 3 lines

With doubler bit disabled (register 0x10, value 0xa0), I set the output

frequencies to 1, 10, 100, and 46.8MHz.

Quoted 3 lines

After setting doubler bit (0xa8), I saw frequencies of 1.260, 12.60, 126.0,

and 58.9 Mhz for both 6901 and 6965 parts.

Quoted 3 lines

So from my testing the doubler bit seems to behave similarly for both

parts.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

At this point I will leave my unofficial testing and move on to writing a

consumer driver.

I don't have a scope to measure the exact frequencies, but I was able to test it with both USB and Ethernet, which are clock from the versaclock, and I can check the output frequencies against the

clk_summary in debugfs.

Quoted 58 lines

Without this patch:

clock-controller.mux 1 1 0 25000000
0 0 50000 Y
clock-controller.out0_sel_i2cb 0 0 0
25000000 0 0 50000 Y

       clock-controller.pfd           1        1        0    25000000
        0     0  50000         Y
          clock-controller.pll        1        1        0  2800000000
        0     0  50000         Y
             clock-controller.fod3       1        1        0
24576000          0     0  50000         Y
                clock-controller.out4       1        1        0
24576000          0     0  50000         Y
             clock-controller.fod2       0        0        0
24000000          0     0  50000         Y
                clock-controller.out3       0        0        0
24000000          0     0  50000         Y
             clock-controller.fod1       0        0        0
24000000          0     0  50000         Y
                clock-controller.out2       0        0        0
24000000          0     0  50000         Y
             clock-controller.fod0       0        0        0
24000000          0     0  50000         Y

clock-controller.out1 0 0 0
24000000 0 0 50000 Y

With this patch:

clock-controller.mux 1 1 0 25000000
0 0 50000 Y
clock-controller.out0_sel_i2cb 0 0 0
25000000 0 0 50000 Y
clock-controller.dbl 1 1 0 25000000
0 0 50000 Y
clock-controller.pfd 1 1 0 25000000
0 0 50000 Y
clock-controller.pll 1 1 0
2800000000 0 0 50000 Y
clock-controller.fod3 1 1 0
24576000 0 0 50000 Y
clock-controller.out4 1 1 0
24576000 0 0 50000 Y
clock-controller.fod2 0 0 0
24000000 0 0 50000 Y
clock-controller.out3 0 0 0
24000000 0 0 50000 Y
clock-controller.fod1 0 0 0
24000000 0 0 50000 Y
clock-controller.out2 0 0 0
24000000 0 0 50000 Y
clock-controller.fod0 0 0 0
24000000 0 0 50000 Y
clock-controller.out1 0 0 0
24000000 0 0 50000 Y

Quoted 8 lines

From what I can tell, the only thing that changes is the introduction of clock- controller.dbl into the clock dump.
In my interpretation of reading the programmer's manual, the frequency that is doubled is the reference frequency, but based on looking at the clock dump, it's not obvious what's happening.

Having said that, if Claude is measuring incorrect frequencies, I am fine with abandoning this patch.

For what it's worth, I went back and tested output frequencies with patch removed.

Here is what I observed(starting with frequencies of 1, 10, 100, 46.8MHz and changing register 0x10 from 0xa0 to 0xa8).

Quoted 9 lines

6901: 1.260, 12.60, 126.0, 58.9
6965 with patch: 1.260, 12.60, 126.0, 58.9
6965 without patch: 1.019, 10.19, 101.9, 47.68

From my limited testing (and knowledge for sure) it seems that in this test the patch has some benefit.

-Claude

I am really sorry but there appears to be something going on with my setup that is causing spurious results. After sending this email I re-enabled the 6965 patch and am seeing same results I had without the patch (1.019, 10.19, 101.9, 47.68 MHz).

Please disregard my earlier email.

-Claude

Quoted 4 lines
Quoted 4 lines

adam

Quoted 1 line
Quoted 16 lines
Quoted 5 lines
Quoted 4 lines

Regards,
Claude

==========================================================

Quoted 10 lines

============

Quoted 2 lines

This message and any attachments are intended only for the designated

recipient(s) and may contain confidential or proprietary information and be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message or any attachments. If you received this email in error, please notify the sender by reply e-mail and permanently delete the original and any copies of this message and any attachments thereto. Thank you.

======================================================================
This message and any attachments are intended only for the designated recipient(s) and may contain confidential or proprietary information and be subject to the attorney-client privilege or other confidentiality protections. If you are not a designated recipient, you may not review, use, copy or distribute this message or any attachments. If you received this email in error, please notify the sender by reply e-mail and permanently delete the original and any copies of this message and any attachments thereto. Thank you.