Skip to contentSkip to conversation

AM57/DRA7 Clock Tree DTSI Fix-ups

PATCH Superseded J.D. Schroeder 6 participants 29 messages Apr 26, 2016 – May 4, 2016 Device tree bindings

lore
Share & tools
lore
#0 lore raw

cover AM57/DRA7 Clock Tree DTSI Fix-ups

This series of patches fixes several discrepancies between the AM57/DRA7 clock tree description and the actual hardware behavior and frequencies. With these changes a more complete picture of the clock tree is represented for a few of the clocks and their resulting frequencies.

#1 lore raw

PATCH 1/3 DRA7: Fix clock data for gmac_gmii_ref_clk_div

From: "J.D. Schroeder" <[email protected]>

This commit fixes the clock data inside the DRA7xx clocks device tree structure for the gmac_gmii_ref_clk_div clock. This clock is actually the GMAC_MAIN_CLK and has nothing to do with the register at address 0x4a0093d0. If CLKSEL_REF bit 24 inside of CM_GMAC_GMAC_CLKCTRL, is set to 1 in order to use the GMAC_RMII_CLK instead of the GMAC_RMII_HS_CLK, the kernel generates a clock divider warning:

    WARNING: CPU: 0 PID: 0 at drivers/clk/clk-divider.c:129 clk_divider_recalc_rate+0xa8/0xe0()
    gmac_gmii_ref_clk_div: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set

By properly configuring the gmac_gmii_ref_clk_div (GMAC_MAIN_CLK) to have the parent of dpll_gmac_m2_ck always divided by 2 the warning is resolved and the clock tree is fixed up.

Additionally, a new clock called rmii_50mhz_clk_mux is defined that does utilize CM_GMAC_GMAC_CLKCTRL[24] CLKSEL_REF to configure the source clock for the RMII_50MHZ_CLK.

---
 arch/arm/boot/dts/dra7xx-clocks.dtsi | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +11 -4
index d0bae06..9d1a583 100644
@@ -1710,13 +1710,20 @@
 		reg = <0x0c00>;
 	};
 
-	gmac_gmii_ref_clk_div: gmac_gmii_ref_clk_div {
+	rmii_50mhz_clk_mux: rmii_50mhz_clk_mux {
 		#clock-cells = <0>;
-		compatible = "ti,divider-clock";
-		clocks = <&dpll_gmac_m2_ck>;
+		compatible = "ti,mux-clock";
+		clocks = <&dpll_gmac_h11x2_ck>, <&rmii_clk_ck>;
 		ti,bit-shift = <24>;
 		reg = <0x13d0>;
-		ti,dividers = <2>;
+	};
+
+	gmac_gmii_ref_clk_div: gmac_gmii_ref_clk_div {
+		#clock-cells = <0>;
+		compatible = "fixed-factor-clock";
+		clocks = <&dpll_gmac_m2_ck>;
+		clock-mult = <1>;
+		clock-div = <2>;
 	};
 
 	gmac_rft_clk_mux: gmac_rft_clk_mux {
Signature · 1 line
1.9.1
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] DRA7: Fix clock data for gmac_gmii_ref_clk_div

Quoted 15 lines · J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit fixes the clock data inside the DRA7xx clocks device tree structure for the gmac_gmii_ref_clk_div clock. This clock is actually the GMAC_MAIN_CLK and has nothing to do with the register at address 0x4a0093d0. If CLKSEL_REF bit 24 inside of CM_GMAC_GMAC_CLKCTRL, is set to 1 in order to use the GMAC_RMII_CLK instead of the GMAC_RMII_HS_CLK, the kernel generates a clock divider warning:

     WARNING: CPU: 0 PID: 0 at drivers/clk/clk-divider.c:129 clk_divider_recalc_rate+0xa8/0xe0()
     gmac_gmii_ref_clk_div: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set

By properly configuring the gmac_gmii_ref_clk_div (GMAC_MAIN_CLK) to have the parent of dpll_gmac_m2_ck always divided by 2 the warning is resolved and the clock tree is fixed up.

Quoted 6 lines

Additionally, a new clock called rmii_50mhz_clk_mux is defined that does utilize CM_GMAC_GMAC_CLKCTRL[24] CLKSEL_REF to configure the source clock for the RMII_50MHZ_CLK.

Looks like something weird happened with the clock data conversion tool with this specific clock. Seems to be the only buggy instance in our clock data across SoCs. Good catch.

Quoted 34 lines
---
  arch/arm/boot/dts/dra7xx-clocks.dtsi | 15 +++++++++++----
  1 file changed, 11 insertions(+), 4 deletions(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +11 -4
index d0bae06..9d1a583 100644
@@ -1710,13 +1710,20 @@
  		reg = <0x0c00>;
  	};
 
-	gmac_gmii_ref_clk_div: gmac_gmii_ref_clk_div {
+	rmii_50mhz_clk_mux: rmii_50mhz_clk_mux {
  		#clock-cells = <0>;
-		compatible = "ti,divider-clock";
-		clocks = <&dpll_gmac_m2_ck>;
+		compatible = "ti,mux-clock";
+		clocks = <&dpll_gmac_h11x2_ck>, <&rmii_clk_ck>;
  		ti,bit-shift = <24>;
  		reg = <0x13d0>;
-		ti,dividers = <2>;
+	};
+
+	gmac_gmii_ref_clk_div: gmac_gmii_ref_clk_div {
+		#clock-cells = <0>;
+		compatible = "fixed-factor-clock";
+		clocks = <&dpll_gmac_m2_ck>;
+		clock-mult = <1>;
+		clock-div = <2>;
  	};
 
  	gmac_rft_clk_mux: gmac_rft_clk_mux {
#3 lore raw

Re: [PATCH 1/3] DRA7: Fix clock data for gmac_gmii_ref_clk_div

Quoted 20 lines · Tero Kristo
Quoted 19 lines · J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit fixes the clock data inside the DRA7xx clocks device tree structure for the gmac_gmii_ref_clk_div clock. This clock is actually the GMAC_MAIN_CLK and has nothing to do with the register at address 0x4a0093d0. If CLKSEL_REF bit 24 inside of CM_GMAC_GMAC_CLKCTRL, is set to 1 in order to use the GMAC_RMII_CLK instead of the GMAC_RMII_HS_CLK, the kernel generates a clock divider warning:

    WARNING: CPU: 0 PID: 0 at drivers/clk/clk-divider.c:129 clk_divider_recalc_rate+0xa8/0xe0()
    gmac_gmii_ref_clk_div: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set

By properly configuring the gmac_gmii_ref_clk_div (GMAC_MAIN_CLK) to have the parent of dpll_gmac_m2_ck always divided by 2 the warning is resolved and the clock tree is fixed up.

Additionally, a new clock called rmii_50mhz_clk_mux is defined that does utilize CM_GMAC_GMAC_CLKCTRL[24] CLKSEL_REF to configure the source clock for the RMII_50MHZ_CLK.

Quoted 8 lines
Quoted 2 lines

Looks like something weird happened with the clock data conversion tool with this specific clock. Seems to be the only buggy instance in our clock data across SoCs. Good catch.

Applying into omap-for-v4.6/fixes thanks.

Tony

#4 lore raw

Re: [PATCH 1/3] DRA7: Fix clock data for gmac_gmii_ref_clk_div

Quoted 24 lines · Tony Lindgren
Quoted 23 lines · Tero Kristo
Quoted 21 lines · J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit fixes the clock data inside the DRA7xx clocks device tree structure for the gmac_gmii_ref_clk_div clock. This clock is actually the GMAC_MAIN_CLK and has nothing to do with the register at address 0x4a0093d0. If CLKSEL_REF bit 24 inside of CM_GMAC_GMAC_CLKCTRL, is set to 1 in order to use the GMAC_RMII_CLK instead of the GMAC_RMII_HS_CLK, the kernel generates a clock divider warning:

    WARNING: CPU: 0 PID: 0 at drivers/clk/clk-divider.c:129 clk_divider_recalc_rate+0xa8/0xe0()
    gmac_gmii_ref_clk_div: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set

By properly configuring the gmac_gmii_ref_clk_div (GMAC_MAIN_CLK) to have the parent of dpll_gmac_m2_ck always divided by 2 the warning is resolved and the clock tree is fixed up.

Additionally, a new clock called rmii_50mhz_clk_mux is defined that does utilize CM_GMAC_GMAC_CLKCTRL[24] CLKSEL_REF to configure the source clock for the RMII_50MHZ_CLK.

Quoted 7 lines
Quoted 5 lines

Looks like something weird happened with the clock data conversion tool with this specific clock. Seems to be the only buggy instance in our clock data across SoCs. Good catch.

Applying into omap-for-v4.6/fixes thanks.

Actually then we end up creating self-inflicted merge conflict here with next. So let's wait a bit on this one as it's harmless.

J.D. can you please rebase this against current Linux next?

Note the recent unit name and unit address fixes for warnings with make W=1 dtbs.

Regards,

Tony

#5 lore raw

v2 cover AM57/DRA7 Clock Tree DTSI Fix-ups

This series of patches fixes several discrepancies between the AM57/DRA7 clock tree description and the actual hardware behavior and frequencies. With these changes a more complete picture of the clock tree is represented for a few of the clocks and their resulting frequencies.

v2 Changes:
* Rebased on linux-next as requested by Tony Lindgren
* Eliminated previous patch 2 as another change fixing the same thing was merged in eea08802f586acd6aef377d1b4a541821013cc0b
* Added to the commit message in patch 2 to clarify the source of the clock being internal to the processor
* Added a new patch 3 to fix a new warning introduced by eea08802f586acd6aef377d1b4a541821013cc0b

#6 lore raw

PATCH v2 1/3 DRA7: Fix clock data for gmac_gmii_ref_clk_div

From: "J.D. Schroeder" <[email protected]>

This commit fixes the clock data inside the DRA7xx clocks device tree structure for the gmac_gmii_ref_clk_div clock. This clock is actually the GMAC_MAIN_CLK and has nothing to do with the register at address 0x4a0093d0. If CLKSEL_REF bit 24 inside of CM_GMAC_GMAC_CLKCTRL, is set to 1 in order to use the GMAC_RMII_CLK instead of the GMAC_RMII_HS_CLK, the kernel generates a clock divider warning:

    WARNING: CPU: 0 PID: 0 at drivers/clk/clk-divider.c:129 clk_divider_recalc_rate+0xa8/0xe0()
    gmac_gmii_ref_clk_div: Zero divisor and CLK_DIVIDER_ALLOW_ZERO not set

By properly configuring the gmac_gmii_ref_clk_div (GMAC_MAIN_CLK) to have the parent of dpll_gmac_m2_ck always divided by 2 the warning is resolved and the clock tree is fixed up.

Additionally, a new clock called rmii_50mhz_clk_mux is defined that does utilize CM_GMAC_GMAC_CLKCTRL[24] CLKSEL_REF to configure the source clock for the RMII_50MHZ_CLK.

---
 arch/arm/boot/dts/dra7xx-clocks.dtsi | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +11 -4
index 8378b44..3f0c61d 100644
@@ -1718,13 +1718,20 @@
 		reg = <0x0c00>;
 	};
 
-	gmac_gmii_ref_clk_div: gmac_gmii_ref_clk_div at 13d0 {
+	rmii_50mhz_clk_mux: rmii_50mhz_clk_mux at 13d0 {
 		#clock-cells = <0>;
-		compatible = "ti,divider-clock";
-		clocks = <&dpll_gmac_m2_ck>;
+		compatible = "ti,mux-clock";
+		clocks = <&dpll_gmac_h11x2_ck>, <&rmii_clk_ck>;
 		ti,bit-shift = <24>;
 		reg = <0x13d0>;
-		ti,dividers = <2>;
+	};
+
+	gmac_gmii_ref_clk_div: gmac_gmii_ref_clk_div {
+		#clock-cells = <0>;
+		compatible = "fixed-factor-clock";
+		clocks = <&dpll_gmac_m2_ck>;
+		clock-mult = <1>;
+		clock-div = <2>;
 	};
 
 	gmac_rft_clk_mux: gmac_rft_clk_mux at 13d0 {
Signature · 1 line
1.9.1
#7 lore raw

PATCH v2 2/3 ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

In reply to J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit updates the OSC_32K_CLK (secure_32k_clk_src_ck) frequency from the precise 32kHz frequency (i.e., 32.768 kHz) to a more accurate frequency of ~34.6 kHz. Actual measured frequencies of the clock vary from processor to processor anywhere from 34.4 kHz up to 34.8 kHz. Note that the ~34 kHz frequency clock is generated internally by the processor, not an input to the processor. This change makes it more clear that the consumer of the secure_32k_clk_src_ck will not get a precise 32.768 kHz frequency output.

---
 arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +1 -1
index 3f0c61d..f7ec976 100644
@@ -95,7 +95,7 @@
 	secure_32k_clk_src_ck: secure_32k_clk_src_ck {
 		#clock-cells = <0>;
 		compatible = "fixed-clock";
-		clock-frequency = <32768>;
+		clock-frequency = <34600>; /* approximate frequency */
 	};
 
 	sys_clk32_crystal_ck: sys_clk32_crystal_ck {
Signature · 1 line
1.9.1
#8 lore raw

Re: [PATCH v2 2/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

Quoted 24 lines · J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit updates the OSC_32K_CLK (secure_32k_clk_src_ck) frequency from the precise 32kHz frequency (i.e., 32.768 kHz) to a more accurate frequency of ~34.6 kHz. Actual measured frequencies of the clock vary from processor to processor anywhere from 34.4 kHz up to 34.8 kHz. Note that the ~34 kHz frequency clock is generated internally by the processor, not an input to the processor. This change makes it more clear that the consumer of the secure_32k_clk_src_ck will not get a precise 32.768 kHz frequency output.

---
  arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +0 -0
index 3f0c61d..f7ec976 100644

arch/arm/boot/dts/dra7xx-clocks.dtsi line 101

Quoted 8 lines
arch/arm/boot/dts/dra7xx-clocks.dtsi +1 -1
@@ -95,7 +95,7 @@
  	secure_32k_clk_src_ck: secure_32k_clk_src_ck {
  		#clock-cells = <0>;
  		compatible = "fixed-clock";
-		clock-frequency = <32768>;
+		clock-frequency = <34600>; /* approximate frequency */
  	};
 
  	sys_clk32_crystal_ck: sys_clk32_crystal_ck {

I still don't agree with this patch. The actual frequency can drift much more, you are just seeing this number at your setup. There is some internal discussion going on in TI about this, but I can't share any data on this yet.

-Tero

#9 lore raw

Re: [PATCH v2 2/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

Quoted 32 lines · Tero Kristo
Quoted 31 lines · J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit updates the OSC_32K_CLK (secure_32k_clk_src_ck) frequency from the precise 32kHz frequency (i.e., 32.768 kHz) to a more accurate frequency of ~34.6 kHz. Actual measured frequencies of the clock vary from processor to processor anywhere from 34.4 kHz up to 34.8 kHz. Note that the ~34 kHz frequency clock is generated internally by the processor, not an input to the processor. This change makes it more clear that the consumer of the secure_32k_clk_src_ck will not get a precise 32.768 kHz frequency output.

---
  arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +1 -1
index 3f0c61d..f7ec976 100644
@@ -95,7 +95,7 @@
      secure_32k_clk_src_ck: secure_32k_clk_src_ck {
          #clock-cells = <0>;
          compatible = "fixed-clock";
-        clock-frequency = <32768>;
+        clock-frequency = <34600>; /* approximate frequency */
      };
 
Quoted 5 lines

arch/arm/boot/dts/dra7xx-clocks.dtsi line 101

Quoted 2 lines
arch/arm/boot/dts/dra7xx-clocks.dtsi +0 -0
      sys_clk32_crystal_ck: sys_clk32_crystal_ck {

I still don't agree with this patch. The actual frequency can drift much more, you are just seeing this number at your setup.

Yes, it can drift significantly from processor to processor. Do you agree that this frequency is closer to what can be expected than 32768 Hz?

Like I said, I would have renamed the clock also but I opted to go the less obtrusive route while still helping others that might think they can reasonably use this clock in their design as a 32768 Hz clock source. Perhaps my comment and selection of the approximate frequency is not the best (I'm open for suggestions). However, I do think this change is an improvement and clarifying change to what is currently present in the clock description.

-JD

#10 lore raw

Re: [PATCH v2 2/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

Quoted 42 lines · J.D. Schroeder
Quoted 32 lines · Tero Kristo
Quoted 31 lines · J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit updates the OSC_32K_CLK (secure_32k_clk_src_ck) frequency from the precise 32kHz frequency (i.e., 32.768 kHz) to a more accurate frequency of ~34.6 kHz. Actual measured frequencies of the clock vary from processor to processor anywhere from 34.4 kHz up to 34.8 kHz. Note that the ~34 kHz frequency clock is generated internally by the processor, not an input to the processor. This change makes it more clear that the consumer of the secure_32k_clk_src_ck will not get a precise 32.768 kHz frequency output.

---
  arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +1 -1
index 3f0c61d..f7ec976 100644
@@ -95,7 +95,7 @@
      secure_32k_clk_src_ck: secure_32k_clk_src_ck {
          #clock-cells = <0>;
          compatible = "fixed-clock";
-        clock-frequency = <32768>;
+        clock-frequency = <34600>; /* approximate frequency */
      };
 
Quoted 5 lines

arch/arm/boot/dts/dra7xx-clocks.dtsi line 101

Quoted 2 lines
arch/arm/boot/dts/dra7xx-clocks.dtsi +0 -0
      sys_clk32_crystal_ck: sys_clk32_crystal_ck {

I still don't agree with this patch. The actual frequency can drift much more, you are just seeing this number at your setup.

Yes, it can drift significantly from processor to processor. Do you agree that this frequency is closer to what can be expected than 32768 Hz?

Quoted 6 lines

Like I said, I would have renamed the clock also but I opted to go the less obtrusive route while still helping others that might think they can reasonably use this clock in their design as a 32768 Hz clock source. Perhaps my comment and selection of the approximate frequency is not the best (I'm open for suggestions). However, I do think this change is an improvement and clarifying change to what is currently present in the clock description.

Does a fixed divider calculation of input * (32768 / 0x27e6) make sense here too as pointed out earlier by Matthijs for the ti81xx?

Regards,

Tony

#11 lore raw

Re: [PATCH v2 2/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

Quoted 50 lines · Tony Lindgren
Quoted 42 lines · J.D. Schroeder
Quoted 32 lines · Tero Kristo
Quoted 31 lines · J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit updates the OSC_32K_CLK (secure_32k_clk_src_ck) frequency from the precise 32kHz frequency (i.e., 32.768 kHz) to a more accurate frequency of ~34.6 kHz. Actual measured frequencies of the clock vary from processor to processor anywhere from 34.4 kHz up to 34.8 kHz. Note that the ~34 kHz frequency clock is generated internally by the processor, not an input to the processor. This change makes it more clear that the consumer of the secure_32k_clk_src_ck will not get a precise 32.768 kHz frequency output.

---
   arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +1 -1
index 3f0c61d..f7ec976 100644
@@ -95,7 +95,7 @@
       secure_32k_clk_src_ck: secure_32k_clk_src_ck {
           #clock-cells = <0>;
           compatible = "fixed-clock";
-        clock-frequency = <32768>;
+        clock-frequency = <34600>; /* approximate frequency */
       };
 
Quoted 5 lines

arch/arm/boot/dts/dra7xx-clocks.dtsi line 101

Quoted 2 lines
arch/arm/boot/dts/dra7xx-clocks.dtsi +0 -0
       sys_clk32_crystal_ck: sys_clk32_crystal_ck {

I still don't agree with this patch. The actual frequency can drift much more, you are just seeing this number at your setup.

Yes, it can drift significantly from processor to processor. Do you agree that this frequency is closer to what can be expected than 32768 Hz?

Quoted 6 lines

Like I said, I would have renamed the clock also but I opted to go the less obtrusive route while still helping others that might think they can reasonably use this clock in their design as a 32768 Hz clock source. Perhaps my comment and selection of the approximate frequency is not the best (I'm open for suggestions). However, I do think this change is an improvement and clarifying change to what is currently present in the clock description.

Quoted 2 lines

Does a fixed divider calculation of input * (32768 / 0x27e6) make sense here too as pointed out earlier by Matthijs for the ti81xx?

Not really, the hardware setup for this clock is not like that. Also, as it is security related, this is kind of sensitive area to discuss publicly. Personally I would not recommend using this clock for any timing sensitive applications. May I ask why you are interested in the exact clock rate of this clock anyway?

-Tero

Quoted 5 lines

Regards,

Tony

#12 lore raw

Re: [PATCH v2 2/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

Quoted 3 lines · Tero Kristo

Personally I would not recommend using this clock for any timing sensitive applications. May I ask why you are interested in the exact clock rate of this clock anyway?

I'm not interested in using this clock and I'm not sure how anyone would use this clock outside of the processor. See the inline comment that is part of the change and the commit message for the change. There is no hint in my change that this is an exact clock rate. It is a clarifying change to help others avoid using this clock as a 32 kHz clock (which the current clock name and frequency imply) and it more accurately represents the actual hardware behavior.

#13 lore raw

Re: [PATCH v2 2/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

Quoted 5 lines · J.D. Schroeder
Quoted 3 lines · Tero Kristo

Personally I would not recommend using this clock for any timing sensitive applications. May I ask why you are interested in the exact clock rate of this clock anyway?

Quoted 7 lines

I'm not interested in using this clock and I'm not sure how anyone would use this clock outside of the processor. See the inline comment that is part of the change and the commit message for the change. There is no hint in my change that this is an exact clock rate. It is a clarifying change to help others avoid using this clock as a 32 kHz clock (which the current clock name and frequency imply) and it more accurately represents the actual hardware behavior.

Well if it's inaccurate, how about we just add comments to the clock?

Tony

#14 lore raw

Re: [PATCH v2 2/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

In reply to J.D. Schroeder
Quoted 5 lines · J.D. Schroeder
Quoted 3 lines · Tero Kristo

Personally I would not recommend using this clock for any timing sensitive applications. May I ask why you are interested in the exact clock rate of this clock anyway?

Quoted 8 lines

I'm not interested in using this clock and I'm not sure how anyone would use this clock outside of the processor. See the inline comment that is part of the change and the commit message for the change. There is no hint in my change that this is an exact clock rate. It is a clarifying change to help others avoid using this clock as a 32 kHz clock (which the current clock name and frequency imply) and it more accurately represents the actual hardware behavior.

Imo, if you want to clarify things up, the whole secure_32k_ck should be removed from linux kernel.

-Tero

#15 lore raw

Re: [PATCH v2 2/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

Quoted 15 lines · Tero Kristo
Quoted 5 lines · J.D. Schroeder
Quoted 3 lines · Tero Kristo

Personally I would not recommend using this clock for any timing sensitive applications. May I ask why you are interested in the exact clock rate of this clock anyway?

Quoted 8 lines

I'm not interested in using this clock and I'm not sure how anyone would use this clock outside of the processor. See the inline comment that is part of the change and the commit message for the change. There is no hint in my change that this is an exact clock rate. It is a clarifying change to help others avoid using this clock as a 32 kHz clock (which the current clock name and frequency imply) and it more accurately represents the actual hardware behavior.

Quoted 2 lines

Imo, if you want to clarify things up, the whole secure_32k_ck should be removed from linux kernel.

This is actually the RC oscillator clock[1] which also happens to source the secure_32k_clk. Jay is right that this is not an accurate 32k clock, however the actual range of this internal clock source is pretty wide (I am trying to get that information into public domain TRM - but that will take some time - since this patch just started the internal thread on the topic). since it is infact an accurate clock source from inside the SoC, how do we model that (a clock with a frequency range with nominal frequency expected to be around 32k - but not exactly 32k?). I think having a rename makes sense and modelling it as an in-accurate clock source is probably the need.

[1] Search for "On-die 32K RC Osc" in http://www.ti.com/lit/pdf/spruhz6

Signature · 2 lines
Regards,
Nishanth Menon
#16 lore raw

Re: [PATCH v2 2/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

In reply to Tero Kristo
Quoted 2 lines · Tony Lindgren

Does a fixed divider calculation of input * (32768 / 27e6) make sense here too as pointed out earlier by Matthijs for the ti81xx?

That was an actual fractional divider, i.e. the output clock would be exactly that ratio of the input clock, which would therefore yield 32768 Hz if the default crystal is used for the main osc.

It makes no sense to use it to describe a wobbly RC osc.

Quoted 1 line · Tero Kristo

Also, as it is security related, this is kind of sensitive area to discuss publicly.

Don't be silly. The only sense in which this clock is "security related" is because it's used for the secure watchdog, and the reason to use it despite its inaccuracy is completely obvious: an internal rc osc can't be easily manipulated by an external attacker. I see no reason to act all cloak-and-dagger about this.

(This seems to be a general theme to conceal "security related" things from public documentation. If I were an HS customer I'd actually be concerned about such behaviour since it would seem to indicate a lack of confidence in one's security architecture.)

Matthijs

#17 lore raw

PATCH v2 3/3 ARM: dts: dra7: fix clock node definition to avoid build warning

In reply to J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This patch fixes the following warning for the DRA7 clock node:
Warning (unit_address_vs_reg): Node
/ocp/l4 at 4a000000/scm at 2000/scm_conf at 0/clocks/sys_32k_ck has a reg or ranges property, but no unit name

---
 arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +1 -1
index f7ec976..34cda4b 100644
@@ -2186,7 +2186,7 @@
 		reg = <0x0558>;
 	};
 
-	sys_32k_ck: sys_32k_ck {
+	sys_32k_ck: sys_32k_ck at 6c4 {
 		#clock-cells = <0>;
 		compatible = "ti,mux-clock";
 		clocks = <&sys_clk32_crystal_ck>, <&sys_clk32_pseudo_ck>, <&sys_clk32_pseudo_ck>, <&sys_clk32_pseudo_ck>;
Signature · 1 line
1.9.1
Tested-by on the v2 series
#18 lore raw
In reply to J.D. Schroeder
Quoted 5 lines · J.D. Schroeder

This series of patches fixes several discrepancies between the AM57/DRA7 clock tree description and the actual hardware behavior and frequencies. With these changes a more complete picture of the clock tree is represented for a few of the clocks and their resulting frequencies.

Tested on my DRA74-evm.

Thanks and regards,
Lokesh

Quoted 15 lines

v2 Changes:
* Rebased on linux-next as requested by Tony Lindgren
* Eliminated previous patch 2 as another change fixing the same thing was merged in eea08802f586acd6aef377d1b4a541821013cc0b
* Added to the commit message in patch 2 to clarify the source of the clock being internal to the processor
* Added a new patch 3 to fix a new warning introduced by eea08802f586acd6aef377d1b4a541821013cc0b

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#19 lore raw

PATCH 2/3 ARM: DRA7x: dts: Fix the 32kHz clock calculation

In reply to J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit fixes the 32kHz clock (sys_32k_ck) calculation to be correctly based on the SYS_CLK1 (sys_clkin1) frequency. Based on the TRM CTRL_CORE_BOOTSTRAP[9:8] SPEEDSELECT, set by the SYSBOOT[9:8] board jumpers according to the SYS_CLK1 frequency, the frequency of the 32kHz FUNC_32K_CLK is set to SYS_CLK1/610. The following sys_32k_ck frequencies get used for different SYS_CLK1 frequencies:

        0b00: Unknown  -> 32768 Hz crystal from CLKIN_32K pin
        0b01: 20   MHz -> 32787 Hz clock (SYS_CLK1/610)
        0b10: 27   MHz -> 44262 Hz clock (SYS_CLK1/610)
        0b11: 19.2 MHz -> 31475 Hz clock (SYS_CLK1/610)
---
 arch/arm/boot/dts/dra7xx-clocks.dtsi | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +22 -6
index 9d1a583..a514fc3 100644
@@ -98,12 +98,6 @@
 		clock-frequency = <32768>;
 	};
 
-	sys_32k_ck: sys_32k_ck {
-		#clock-cells = <0>;
-		compatible = "fixed-clock";
-		clock-frequency = <32768>;
-	};
-
 	virt_12000000_ck: virt_12000000_ck {
 		#clock-cells = <0>;
 		compatible = "fixed-clock";
@@ -2177,4 +2171,26 @@
 		ti,bit-shift = <22>;
 		reg = <0x0558>;
 	};
+
+	sys_32kin: sys_32kin {
+		#clock-cells = <0>;
+		compatible = "fixed-clock";
+		clock-frequency = <32768>;
+	};
+
+	sys_clkin1_32k_div: sys_clkin1_32k_div {
+		#clock-cells = <0>;
+		compatible = "fixed-factor-clock";
+		clocks = <&sys_clkin1>;
+		clock-mult = <1>;
+		clock-div = <610>;
+	};
+
+	sys_32k_ck: sys_32k_ck {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_32kin>, <&sys_clkin1_32k_div>, <&sys_clkin1_32k_div>, <&sys_clkin1_32k_div>;
+		ti,bit-shift = <8>;
+		reg = <0x06c4>;
+	};
 };
Signature · 1 line
1.9.1
#20 lore raw

Re: [PATCH 2/3] ARM: DRA7x: dts: Fix the 32kHz clock calculation

Quoted 8 lines · J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit fixes the 32kHz clock (sys_32k_ck) calculation to be correctly based on the SYS_CLK1 (sys_clkin1) frequency. Based on the TRM CTRL_CORE_BOOTSTRAP[9:8] SPEEDSELECT, set by the SYSBOOT[9:8] board jumpers according to the SYS_CLK1 frequency, the frequency of the 32kHz FUNC_32K_CLK is set to SYS_CLK1/610. The following sys_32k_ck frequencies get used for different SYS_CLK1 frequencies:

Quoted 7 lines
         0b00: Unknown  -> 32768 Hz crystal from CLKIN_32K pin
         0b01: 20   MHz -> 32787 Hz clock (SYS_CLK1/610)
         0b10: 27   MHz -> 44262 Hz clock (SYS_CLK1/610)
         0b11: 19.2 MHz -> 31475 Hz clock (SYS_CLK1/610)

A patch doing the same thing is already in mainline, see:

commit eea08802f586acd6aef377d1b4a541821013cc0b

Author: Keerthy <[email protected]>
Date:   Mon Apr 4 11:07:15 2016 +0530

ARM: dts: dra7: Correct clock tree for sys_32k_ck

So, this one can be ignored.

-Tero

Quoted 49 lines
---
  arch/arm/boot/dts/dra7xx-clocks.dtsi | 28 ++++++++++++++++++++++------
  1 file changed, 22 insertions(+), 6 deletions(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +22 -6
index 9d1a583..a514fc3 100644
@@ -98,12 +98,6 @@
  		clock-frequency = <32768>;
  	};
 
-	sys_32k_ck: sys_32k_ck {
-		#clock-cells = <0>;
-		compatible = "fixed-clock";
-		clock-frequency = <32768>;
-	};
-
  	virt_12000000_ck: virt_12000000_ck {
  		#clock-cells = <0>;
  		compatible = "fixed-clock";
@@ -2177,4 +2171,26 @@
  		ti,bit-shift = <22>;
  		reg = <0x0558>;
  	};
+
+	sys_32kin: sys_32kin {
+		#clock-cells = <0>;
+		compatible = "fixed-clock";
+		clock-frequency = <32768>;
+	};
+
+	sys_clkin1_32k_div: sys_clkin1_32k_div {
+		#clock-cells = <0>;
+		compatible = "fixed-factor-clock";
+		clocks = <&sys_clkin1>;
+		clock-mult = <1>;
+		clock-div = <610>;
+	};
+
+	sys_32k_ck: sys_32k_ck {
+		#clock-cells = <0>;
+		compatible = "ti,mux-clock";
+		clocks = <&sys_32kin>, <&sys_clkin1_32k_div>, <&sys_clkin1_32k_div>, <&sys_clkin1_32k_div>;
+		ti,bit-shift = <8>;
+		reg = <0x06c4>;
+	};
  };
#21 lore raw

Re: [PATCH 2/3] ARM: DRA7x: dts: Fix the 32kHz clock calculation

Quoted 14 lines · Tero Kristo
Quoted 10 lines · J.D. Schroeder

This commit fixes the 32kHz clock (sys_32k_ck) calculation to be correctly based on the SYS_CLK1 (sys_clkin1) frequency. Based on the TRM CTRL_CORE_BOOTSTRAP[9:8] SPEEDSELECT, set by the SYSBOOT[9:8] board jumpers according to the SYS_CLK1 frequency, the frequency of the 32kHz FUNC_32K_CLK is set to SYS_CLK1/610. The following sys_32k_ck frequencies get used for different SYS_CLK1 frequencies:

         0b00: Unknown  -> 32768 Hz crystal from CLKIN_32K pin
         0b01: 20   MHz -> 32787 Hz clock (SYS_CLK1/610)
         0b10: 27   MHz -> 44262 Hz clock (SYS_CLK1/610)
         0b11: 19.2 MHz -> 31475 Hz clock (SYS_CLK1/610)

A patch doing the same thing is already in mainline, see:

Quoted 7 lines

commit eea08802f586acd6aef377d1b4a541821013cc0b

Author: Keerthy <[email protected]>
Date:   Mon Apr 4 11:07:15 2016 +0530

ARM: dts: dra7: Correct clock tree for sys_32k_ck

So, this one can be ignored.

My change had no issue when applying to the tip of master and I'm not seeing that SHA1 in mainline. Are you saying it is in another repo ready to be sent to mainline for the next release cycle?

#22 lore raw

Re: [PATCH 2/3] ARM: DRA7x: dts: Fix the 32kHz clock calculation

Quoted 19 lines · J.D. Schroeder
Quoted 18 lines · Tero Kristo
Quoted 10 lines · J.D. Schroeder

This commit fixes the 32kHz clock (sys_32k_ck) calculation to be correctly based on the SYS_CLK1 (sys_clkin1) frequency. Based on the TRM CTRL_CORE_BOOTSTRAP[9:8] SPEEDSELECT, set by the SYSBOOT[9:8] board jumpers according to the SYS_CLK1 frequency, the frequency of the 32kHz FUNC_32K_CLK is set to SYS_CLK1/610. The following sys_32k_ck frequencies get used for different SYS_CLK1 frequencies:

          0b00: Unknown  -> 32768 Hz crystal from CLKIN_32K pin
          0b01: 20   MHz -> 32787 Hz clock (SYS_CLK1/610)
          0b10: 27   MHz -> 44262 Hz clock (SYS_CLK1/610)
          0b11: 19.2 MHz -> 31475 Hz clock (SYS_CLK1/610)

A patch doing the same thing is already in mainline, see:

commit eea08802f586acd6aef377d1b4a541821013cc0b

Author: Keerthy <[email protected]>
Date:   Mon Apr 4 11:07:15 2016 +0530
Quoted 8 lines
Quoted 3 lines

ARM: dts: dra7: Correct clock tree for sys_32k_ck

So, this one can be ignored.

My change had no issue when applying to the tip of master and I'm not seeing that SHA1 in mainline. Are you saying it is in another repo ready to be sent to mainline for the next release cycle?

The patch is merged already in 4.6-rc3.

Which repo / version are you using as baseline?

-Tero

#23 lore raw

Re: [PATCH 2/3] ARM: DRA7x: dts: Fix the 32kHz clock calculation

Quoted 3 lines · Tero Kristo

The patch is merged already in 4.6-rc3.

Which repo / version are you using as baseline?

I'm using git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git. I can see eea08802f586acd6aef377d1b4a541821013cc0b as of now. However, I don't think it was included in -rc3 or even -rc5 which is what I was basing my changes on. It looks like it got merged in late last night in Linus tree. No big deal. The change is nearly identical to my solution so no need to pursue mine.

Please disregard this patch.

Thanks,
JD

#24 lore raw

PATCH 3/3 ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

In reply to J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit updates the OSC_32K_CLK (secure_32k_clk_src_ck) frequency from the precise 32kHz frequency (i.e., 32.768 kHz) to the more accurate frequency of ~34.6 kHz. Actual measured frequencies of the clock vary from board to board anywhere from 34.4 kHz up to 34.8 kHz.

---
 arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +1 -1
index a514fc3..4501140 100644
@@ -95,7 +95,7 @@
 	secure_32k_clk_src_ck: secure_32k_clk_src_ck {
 		#clock-cells = <0>;
 		compatible = "fixed-clock";
-		clock-frequency = <32768>;
+		clock-frequency = <34600>; /* approximate frequency */
 	};
 
 	virt_12000000_ck: virt_12000000_ck {
Signature · 1 line
1.9.1
#25 lore raw

Re: [PATCH 3/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

Quoted 6 lines · J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit updates the OSC_32K_CLK (secure_32k_clk_src_ck) frequency from the precise 32kHz frequency (i.e., 32.768 kHz) to the more accurate frequency of ~34.6 kHz. Actual measured frequencies of the clock vary from board to board anywhere from 34.4 kHz up to 34.8 kHz.

Uhm, if you have a board specific, accurate value for this clock, you should update it in the board file itself. This definition is going to be used across all the DRA7 / AM57xx boards, which can very likely have different crystal accuracies.

So, NAK.

-Tero

Quoted 21 lines
---
  arch/arm/boot/dts/dra7xx-clocks.dtsi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/dra7xx-clocks.dtsi +1 -1
index a514fc3..4501140 100644
@@ -95,7 +95,7 @@
  	secure_32k_clk_src_ck: secure_32k_clk_src_ck {
  		#clock-cells = <0>;
  		compatible = "fixed-clock";
-		clock-frequency = <32768>;
+		clock-frequency = <34600>; /* approximate frequency */
  	};
 
  	virt_12000000_ck: virt_12000000_ck {
#26 lore raw

Re: [PATCH 3/3] ARM: DRA7x: dts: Update the OSC_32K_CLK frequency

Quoted 8 lines · Tero Kristo
Quoted 6 lines · J.D. Schroeder

From: "J.D. Schroeder" <[email protected]>

This commit updates the OSC_32K_CLK (secure_32k_clk_src_ck) frequency from the precise 32kHz frequency (i.e., 32.768 kHz) to the more accurate frequency of ~34.6 kHz. Actual measured frequencies of the clock vary from board to board anywhere from 34.4 kHz up to 34.8 kHz.

Quoted 6 lines

Uhm, if you have a board specific, accurate value for this clock, you should update it in the board file itself. This definition is going to be used across all the DRA7 / AM57xx boards, which can very likely have different crystal accuracies.

So, NAK.

The source of this clock is internal to the processor and not specific to how the processor is configured or what clocks are coming in. The approximate frequency of 34.4-34.8 kHz is generated internal to the processor through some type of oscillator, not external. The problem is that the clock tree gives the impression that this is a 32.768 kHz clock source, when in fact it is *not* that. Both the name and the frequency are misleading. My change is an attempt to clarify the actual behavior of the clock and keep someone else from using the clock as a true 32.768 kHz clock when it is more than 5% off that particular frequency. I would even consider changing the name of the clock as that too is misleading, but opted not to since that would be more disruptive.

If you are seeing 32.768 kHz come out of this clock source then I must have an issue with my silicon and we can discuss off line. However, if you configure this as one of the clock out sources and see something in the range of ~34 kHz, I still think the change is a valid change as it clarifies the true behavior of the hardware. Am I missing something?

#27 lore raw
In reply to J.D. Schroeder

Hi,

Quoted 5 lines · J.D. Schroeder

This series of patches fixes several discrepancies between the AM57/DRA7 clock tree description and the actual hardware behavior and frequencies. With these changes a more complete picture of the clock tree is represented for a few of the clocks and their resulting frequencies.

Are any of these needed for the v4.6-rc cycle?

Adding Tero to Cc so he can review the changes.

Regards,

Tony

#28 lore raw
Quoted 1 line · Tony Lindgren

Are any of these needed for the v4.6-rc cycle?

I understand that these are arriving a little late especially if we don't get to rc7. However, it would be great if these could get in the v4.6 kernel release. They shouldn't be too risky to anyone, but I understand if the logistics prevent that from happening.

Thanks,
JD