Skip to contentSkip to conversation

clk: rockchip: assign correct id for pclk_ddr and hclk_sd in rk3399

PATCH In review Lin Huang 3 participants 7 messages Mar 20, 2018 – Mar 23, 2018

Subsystems (3)
lore
Share & tools
lore

Lin Huang

author
#0 lore raw

PATCH v3 1/2 clk: rockchip: assign correct id for pclk_ddr and hclk_sd in rk3399

Since hclk_sd and pclk_ddr source clock from CPLL or GPLL, and these two PLL may change their frequency. If we do not assign right id to pclk_ddr and hclk_sd, they will alway use default cur register value, and may get the frequency exceed their signed off frequency. So assign correct Id for them, then we can assign frequency for them in dts.

Change-Id I6c4d15d37ddabe4ed34e2351cf26e660672ae9ee

---
Changes in v2:
- add more detail in commit message
Changes in v3:
- None

 drivers/clk/rockchip/clk-rk3399.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/rockchip/clk-rk3399.c +2 -2
index 3e57c6e..bca10d6 100644
@@ -671,7 +671,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {
 			RK3399_CLKGATE_CON(9), 7, GFLAGS,
 			&rk3399_uart3_fracmux),
 
-	COMPOSITE(0, "pclk_ddr", mux_pll_src_cpll_gpll_p, CLK_IGNORE_UNUSED,
+	COMPOSITE(PCLK_DDR, "pclk_ddr", mux_pll_src_cpll_gpll_p, CLK_IGNORE_UNUSED,
 			RK3399_CLKSEL_CON(6), 15, 1, MFLAGS, 8, 5, DFLAGS,
 			RK3399_CLKGATE_CON(3), 4, GFLAGS),
 
@@ -887,7 +887,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {
 			RK3399_CLKGATE_CON(31), 8, GFLAGS),
 
 	/* sdio & sdmmc */
-	COMPOSITE(0, "hclk_sd", mux_pll_src_cpll_gpll_p, 0,
+	COMPOSITE(HCLK_SD, "hclk_sd", mux_pll_src_cpll_gpll_p, 0,
 			RK3399_CLKSEL_CON(13), 15, 1, MFLAGS, 8, 5, DFLAGS,
 			RK3399_CLKGATE_CON(12), 13, GFLAGS),
 	GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_sd", 0,
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v3 2/2 arm64: dts: rockchip: assign clock rate for some cpll child clock

These clocks do not assign default clock frequency, and use the default cru register value to get frequency, so if cpll increase frequency, these clocks also increase their frequency, that may exceed their signed off frequency. So assign default clock for them to avoid it.

NOTE: on none of the boards currently in mainline do we expect CPLL to be anything other than 800 MHz, but some future boards might have it. It's still good to be explicit about the clock rates to make diffing against future boards easier and also to rely less on BIOS muxing.

Change-Id If79368aeda5c51dbf2a3b6659f17052a2ae4a401

---
Changes in v2:
- None
Changes in v3:
- Update commit message

 arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi |  8 +++++++-
 arch/arm64/boot/dts/rockchip/rk3399.dtsi     | 14 ++++++++++++--
 2 files changed, 19 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +7 -1
index 18f546f..84e367b 100644
@@ -588,7 +588,10 @@
 		<&cru ACLK_PERILP0>, <&cru HCLK_PERILP0>,
 		<&cru PCLK_PERILP0>, <&cru ACLK_CCI>,
 		<&cru HCLK_PERILP1>, <&cru PCLK_PERILP1>,
-		<&cru ACLK_VIO>;
+		<&cru ACLK_VIO>,
+		<&cru ACLK_GIC_PRE>,
+		<&cru PCLK_DDR>,
+		<&cru ACLK_HDCP>;
 	assigned-clock-rates =
 		<600000000>, <800000000>,
 		<1000000000>,
@@ -597,6 +600,9 @@
 		<100000000>, <100000000>,
 		<50000000>, <800000000>,
 		<100000000>, <50000000>,
+		<400000000>,
+		<200000000>,
+		<200000000>,
 		<400000000>;
 };
 
arch/arm64/boot/dts/rockchip/rk3399.dtsi +12 -2
index 4550c0f..b358533 100644
@@ -315,6 +315,8 @@
 		clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>,
 			 <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>;
 		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+		assigned-clocks = <&cru HCLK_SD>;
+		assigned-clock-rates = <200000000>;
 		fifo-depth = <0x100>;
 		power-domains = <&power RK3399_PD_SD>;
 		resets = <&cru SRST_SDMMC>;
@@ -466,8 +468,10 @@
 		clocks = <&cru SCLK_DP_CORE>, <&cru PCLK_DP_CTRL>,
 			 <&cru SCLK_SPDIF_REC_DPTX>, <&cru PCLK_VIO_GRF>;
 		clock-names = "core-clk", "pclk", "spdif", "grf";
-		phys = <&tcphy0_dp>, <&tcphy1_dp>;
+		assigned-clocks = <&cru SCLK_DP_CORE>, <&cru SCLK_SPDIF_REC_DPTX>;
+		assigned-clock-rates = <100000000>, <200000000>;
 		power-domains = <&power RK3399_PD_HDCP>;
+		phys = <&tcphy0_dp>, <&tcphy1_dp>;
 		resets = <&cru SRST_DPTX_SPDIF_REC>, <&cru SRST_P_UPHY0_DPTX>,
 			 <&cru SRST_P_UPHY0_APB>, <&cru SRST_DP_CORE>;
 		reset-names = "spdif", "dptx", "apb", "core";
@@ -1323,7 +1327,10 @@
 			<&cru ACLK_PERILP0>, <&cru HCLK_PERILP0>,
 			<&cru PCLK_PERILP0>, <&cru ACLK_CCI>,
 			<&cru HCLK_PERILP1>, <&cru PCLK_PERILP1>,
-			<&cru ACLK_VIO>;
+			<&cru ACLK_VIO>,
+			<&cru ACLK_GIC_PRE>,
+			<&cru PCLK_DDR>,
+			<&cru ACLK_HDCP>;
 		assigned-clock-rates =
 			 <594000000>,  <800000000>,
 			<1000000000>,
@@ -1332,6 +1339,9 @@
 			 <100000000>,  <100000000>,
 			  <50000000>, <600000000>,
 			 <100000000>,   <50000000>,
+			 <400000000>,
+			 <200000000>,
+			 <200000000>,
 			 <400000000>;
 	};
 
Signature · 1 line
2.7.4
Reviewed-by on v3 2/2
#2 lore raw

Re: [PATCH v3 2/2] arm64: dts: rockchip: assign clock rate for some cpll child clock

Quoted 6 lines · Lin Huang

These clocks do not assign default clock frequency, and use the default cru register value to get frequency, so if cpll increase frequency, these clocks also increase their frequency, that may exceed their signed off frequency. So assign default clock for them to avoid it.

Quoted 7 lines

NOTE: on none of the boards currently in mainline do we expect CPLL to be anything other than 800 MHz, but some future boards might have it. It's still good to be explicit about the clock rates to make diffing against future boards easier and also to rely less on BIOS muxing.

Change-Id: If79368aeda5c51dbf2a3b6659f17052a2ae4a401

Should remove Change-Id for future patch(es), thought Heiko may help do it when applied.

Quoted 86 lines

---
Changes in v2:
- None
Changes in v3:
- Update commit message

  arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi |  8 +++++++-
  arch/arm64/boot/dts/rockchip/rk3399.dtsi     | 14 ++++++++++++--
  2 files changed, 19 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +7 -1
index 18f546f..84e367b 100644
@@ -588,7 +588,10 @@
  		<&cru ACLK_PERILP0>, <&cru HCLK_PERILP0>,
  		<&cru PCLK_PERILP0>, <&cru ACLK_CCI>,
  		<&cru HCLK_PERILP1>, <&cru PCLK_PERILP1>,
-		<&cru ACLK_VIO>;
+		<&cru ACLK_VIO>,
+		<&cru ACLK_GIC_PRE>,
+		<&cru PCLK_DDR>,
+		<&cru ACLK_HDCP>;
  	assigned-clock-rates =
  		<600000000>, <800000000>,
  		<1000000000>,
@@ -597,6 +600,9 @@
  		<100000000>, <100000000>,
  		<50000000>, <800000000>,
  		<100000000>, <50000000>,
+		<400000000>,
+		<200000000>,
+		<200000000>,
  		<400000000>;
  };
 
arch/arm64/boot/dts/rockchip/rk3399.dtsi +12 -2
index 4550c0f..b358533 100644
@@ -315,6 +315,8 @@
  		clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>,
  			 <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>;
  		clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+		assigned-clocks = <&cru HCLK_SD>;
+		assigned-clock-rates = <200000000>;
  		fifo-depth = <0x100>;
  		power-domains = <&power RK3399_PD_SD>;
  		resets = <&cru SRST_SDMMC>;
@@ -466,8 +468,10 @@
  		clocks = <&cru SCLK_DP_CORE>, <&cru PCLK_DP_CTRL>,
  			 <&cru SCLK_SPDIF_REC_DPTX>, <&cru PCLK_VIO_GRF>;
  		clock-names = "core-clk", "pclk", "spdif", "grf";
-		phys = <&tcphy0_dp>, <&tcphy1_dp>;
+		assigned-clocks = <&cru SCLK_DP_CORE>, <&cru SCLK_SPDIF_REC_DPTX>;
+		assigned-clock-rates = <100000000>, <200000000>;
  		power-domains = <&power RK3399_PD_HDCP>;
+		phys = <&tcphy0_dp>, <&tcphy1_dp>;
  		resets = <&cru SRST_DPTX_SPDIF_REC>, <&cru SRST_P_UPHY0_DPTX>,
  			 <&cru SRST_P_UPHY0_APB>, <&cru SRST_DP_CORE>;
  		reset-names = "spdif", "dptx", "apb", "core";
@@ -1323,7 +1327,10 @@
  			<&cru ACLK_PERILP0>, <&cru HCLK_PERILP0>,
  			<&cru PCLK_PERILP0>, <&cru ACLK_CCI>,
  			<&cru HCLK_PERILP1>, <&cru PCLK_PERILP1>,
-			<&cru ACLK_VIO>;
+			<&cru ACLK_VIO>,
+			<&cru ACLK_GIC_PRE>,
+			<&cru PCLK_DDR>,
+			<&cru ACLK_HDCP>;
  		assigned-clock-rates =
  			 <594000000>,  <800000000>,
  			<1000000000>,
@@ -1332,6 +1339,9 @@
  			 <100000000>,  <100000000>,
  			  <50000000>, <600000000>,
  			 <100000000>,   <50000000>,
+			 <400000000>,
+			 <200000000>,
+			 <200000000>,
  			 <400000000>;
  	};
 
author
#3 lore raw

Re: [PATCH v3 2/2] arm64: dts: rockchip: assign clock rate for some cpll child clock

Quoted 13 lines · Shawn Lin
Quoted 12 lines · Lin Huang

These clocks do not assign default clock frequency, and use the default cru register value to get frequency, so if cpll increase frequency, these clocks also increase their frequency, that may exceed their signed off frequency. So assign default clock for them to avoid it.

NOTE: on none of the boards currently in mainline do we expect CPLL to be anything other than 800 MHz, but some future boards might have it. It's still good to be explicit about the clock rates to make diffing against future boards easier and also to rely less on BIOS muxing.

Quoted 5 lines
Quoted 1 line

Change-Id: If79368aeda5c51dbf2a3b6659f17052a2ae4a401

Should remove Change-Id for future patch(es), thought Heiko may help do it when applied.

Opp, sorry for that.

Quoted 85 lines
Quoted 83 lines

---
Changes in v2:
- None
Changes in v3:
- Update commit message

  arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi |  8 +++++++- arch/arm64/boot/dts/rockchip/rk3399.dtsi     | 14 ++++++++++++--

  2 files changed, 19 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +4 -1
index 18f546f..84e367b 100644
@@ -588,7 +588,10 @@
           <&cru ACLK_PERILP0>, <&cru HCLK_PERILP0>,
           <&cru PCLK_PERILP0>, <&cru ACLK_CCI>,
           <&cru HCLK_PERILP1>, <&cru PCLK_PERILP1>,
-        <&cru ACLK_VIO>;
+        <&cru ACLK_VIO>,
+        <&cru ACLK_GIC_PRE>,
+        <&cru PCLK_DDR>,
+        <&cru ACLK_HDCP>;

      assigned-clock-rates =
          <600000000>, <800000000>,
          <1000000000>,

arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi +3 -0
@@ -597,6 +600,9 @@
           <100000000>, <100000000>,
           <50000000>, <800000000>,
           <100000000>, <50000000>,
+        <400000000>,
+        <200000000>,
+        <200000000>,
           <400000000>;
   };

  diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi index 4550c0f..b358533 100644

arch/arm64/boot/dts/rockchip/rk3399.dtsi +5 -1
@@ -315,6 +315,8 @@
           clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>,
                <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>;
           clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
+        assigned-clocks = <&cru HCLK_SD>;
+        assigned-clock-rates = <200000000>;
           fifo-depth = <0x100>;
           power-domains = <&power RK3399_PD_SD>;
           resets = <&cru SRST_SDMMC>;
@@ -466,8 +468,10 @@
           clocks = <&cru SCLK_DP_CORE>, <&cru PCLK_DP_CTRL>,
                <&cru SCLK_SPDIF_REC_DPTX>, <&cru PCLK_VIO_GRF>;
           clock-names = "core-clk", "pclk", "spdif", "grf";
-        phys = <&tcphy0_dp>, <&tcphy1_dp>;
+        assigned-clocks = <&cru SCLK_DP_CORE>, <&cru 
 SCLK_SPDIF_REC_DPTX>;
+        assigned-clock-rates = <100000000>, <200000000>;
           power-domains = <&power RK3399_PD_HDCP>;
+        phys = <&tcphy0_dp>, <&tcphy1_dp>;
           resets = <&cru SRST_DPTX_SPDIF_REC>, <&cru SRST_P_UPHY0_DPTX>,
                <&cru SRST_P_UPHY0_APB>, <&cru SRST_DP_CORE>;

          reset-names = "spdif", "dptx", "apb", "core";

arch/arm64/boot/dts/rockchip/rk3399.dtsi +4 -1
@@ -1323,7 +1327,10 @@
               <&cru ACLK_PERILP0>, <&cru HCLK_PERILP0>,
               <&cru PCLK_PERILP0>, <&cru ACLK_CCI>,
               <&cru HCLK_PERILP1>, <&cru PCLK_PERILP1>,
-            <&cru ACLK_VIO>;
+            <&cru ACLK_VIO>,
+            <&cru ACLK_GIC_PRE>,
+            <&cru PCLK_DDR>,
+            <&cru ACLK_HDCP>;

          assigned-clock-rates =
               <594000000>,  <800000000>,
              <1000000000>,

arch/arm64/boot/dts/rockchip/rk3399.dtsi +3 -0
@@ -1332,6 +1339,9 @@
                <100000000>,  <100000000>,
                 <50000000>, <600000000>,
                <100000000>,   <50000000>,
+             <400000000>,
+             <200000000>,
+             <200000000>,
                <400000000>;
Quoted 11 lines

arch/arm64/boot/dts/rockchip/rk3399.dtsi line 1347

Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +0 -0
       };
 

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

maintainer
#4 lore raw

Re: [PATCH v3 2/2] arm64: dts: rockchip: assign clock rate for some cpll child clock

Am Dienstag, 20. März 2018, 03:23:41 CET schrieb hl:

Quoted 14 lines · Shawn Lin
Quoted 13 lines · Lin Huang
Quoted 12 lines

These clocks do not assign default clock frequency, and use the default cru register value to get frequency, so if cpll increase frequency, these clocks also increase their frequency, that may exceed their signed off frequency. So assign default clock for them to avoid it.

NOTE: on none of the boards currently in mainline do we expect CPLL to be anything other than 800 MHz, but some future boards might have it. It's still good to be explicit about the clock rates to make diffing against future boards easier and also to rely less on BIOS muxing.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Change-Id: If79368aeda5c51dbf2a3b6659f17052a2ae4a401

Should remove Change-Id for future patch(es), thought Heiko may help do it when applied.

Opp, sorry for that.

Yep, I can drop the changeId when applying

maintainer
#5 lore raw

Re: [PATCH v3 2/2] arm64: dts: rockchip: assign clock rate for some cpll child clock

In reply to Lin Huang

Am Dienstag, 20. März 2018, 03:06:29 CET schrieb Lin Huang:

Quoted 12 lines

These clocks do not assign default clock frequency, and use the default cru register value to get frequency, so if cpll increase frequency, these clocks also increase their frequency, that may exceed their signed off frequency. So assign default clock for them to avoid it.

NOTE: on none of the boards currently in mainline do we expect CPLL to be anything other than 800 MHz, but some future boards might have it. It's still good to be explicit about the clock rates to make diffing against future boards easier and also to rely less on BIOS muxing.

Quoted 3 lines
Change-Id If79368aeda5c51dbf2a3b6659f17052a2ae4a401

applied for 4.17 (but will most likely move to 4.18) with some changes:
- dropped Change-Id
- fixed duplicate assigned clocks for dp node
- grouped aclk_vio and aclk_hdcp into one line in cru nodes
- moved assigned clocks

Heiko

maintainer
#6 lore raw
In reply to Lin Huang

Am Dienstag, 20. März 2018, 03:06:28 CET schrieb Lin Huang:

Quoted 11 lines

Since hclk_sd and pclk_ddr source clock from CPLL or GPLL, and these two PLL may change their frequency. If we do not assign right id to pclk_ddr and hclk_sd, they will alway use default cur register value, and may get the frequency exceed their signed off frequency. So assign correct Id for them, then we can assign frequency for them in dts.

Change-Id I6c4d15d37ddabe4ed34e2351cf26e660672ae9ee

applied for 4.17 after dropping the Change-Id

Thanks
Heiko