Skip to contentSkip to conversation

clk: rockchip: add a cpu clock-type

PATCH Superseded Heiko Stuebner 5 participants 21 messages Sep 5, 2014 – Sep 16, 2014

Subsystems (5)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

cover clk: rockchip: add a cpu clock-type

This series implements cpu frequency-scaling for Rockchip SoCs. The whole handling of the armclk frequency changes and therefore the implementention is very similar to the recent series for Samsung SoCs from Thomas Abraham.

Tested on a
- rk3066 Marsboard
- rk3188 Radxa Rock
- rk3288 Evaluation board

If applicable, a good split would be patch 6 in a pullable branch of the clock tree so that arm-soc can pull it in, patches 8-11 through arm-soc and the rest through the clock tree.

Heiko Stuebner (10):
clk: rockchip: fix rk3066 pll status register location
clk: rockchip: reparent aclk_cpu_pre to the gpll
clk: rockchip: make tightly bound armclk child-clocks read-only
clk: rockchip: add new clock-type for the cpuclk
clk: rockchip: add binding id for ARMCLK
clk: rockchip: switch to using the new cpuclk type for armclk
ARM: dts: rockchip: add operating points and armclk references
ARM: dts: rockchip: add cpu supplies to boards
ARM: rockchip: enable cpufreq-related options
ARM: rockchip: add a cpufreq-cpu0 device

Jianqun (1):
clk: rockchip: fix rk3288 pll status register location

 arch/arm/boot/dts/rk3066a-bqcurie2.dts        |   4 +
 arch/arm/boot/dts/rk3066a.dtsi                |  12 +-
 arch/arm/boot/dts/rk3188-radxarock.dts        |   6 +-
 arch/arm/boot/dts/rk3188.dtsi                 |  15 +-
 arch/arm/boot/dts/rk3288.dtsi                 |  17 +-
 arch/arm/mach-rockchip/Kconfig                |   2 +
 arch/arm/mach-rockchip/rockchip.c             |   7 +
 drivers/clk/rockchip/Makefile                 |   1 +
 drivers/clk/rockchip/clk-cpu.c                | 313 ++++++++++++++++++++++++++
 drivers/clk/rockchip/clk-rk3188.c             | 159 +++++++++++--
 drivers/clk/rockchip/clk-rk3288.c             |  86 ++++++-
 drivers/clk/rockchip/clk.c                    |  18 ++
 drivers/clk/rockchip/clk.h                    |  36 +++
 include/dt-bindings/clock/rk3188-cru-common.h |   1 +
 include/dt-bindings/clock/rk3288-cru.h        |   1 +
 15 files changed, 647 insertions(+), 31 deletions(-)
 create mode 100644 drivers/clk/rockchip/clk-cpu.c
Signature · 1 line
2.0.1
author maintainer
#1 lore raw

PATCH 1/11 clk: rockchip: fix rk3066 pll status register location

The register providing the pll lock status is at a different address on the rk3066. The error became apparent while working on cpufreq support for the rockchip SoCs.

---
 drivers/clk/rockchip/clk-rk3188.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/clk/rockchip/clk-rk3188.c +7 -3
index 732118e..b8c5ada 100644
@@ -19,6 +19,7 @@
 #include <dt-bindings/clock/rk3188-cru-common.h>
 #include "clk.h"
 
+#define RK3066_GRF_SOC_STATUS	0x15c
 #define RK3188_GRF_SOC_STATUS	0xac
 
 enum rk3188_plls {
@@ -628,9 +629,6 @@ static void __init rk3188_common_clk_init(struct device_node *np)
 		pr_warn("%s: could not register clock usb480m: %ld\n",
 			__func__, PTR_ERR(clk));
 
-	rockchip_clk_register_plls(rk3188_pll_clks,
-				   ARRAY_SIZE(rk3188_pll_clks),
-				   RK3188_GRF_SOC_STATUS);
 	rockchip_clk_register_branches(common_clk_branches,
 				  ARRAY_SIZE(common_clk_branches));
 	rockchip_clk_protect_critical(rk3188_critical_clocks,
@@ -643,6 +641,9 @@ static void __init rk3188_common_clk_init(struct device_node *np)
 static void __init rk3066a_clk_init(struct device_node *np)
 {
 	rk3188_common_clk_init(np);
+	rockchip_clk_register_plls(rk3188_pll_clks,
+				   ARRAY_SIZE(rk3188_pll_clks),
+				   RK3066_GRF_SOC_STATUS);
 	rockchip_clk_register_branches(rk3066a_clk_branches,
 				  ARRAY_SIZE(rk3066a_clk_branches));
 }
@@ -651,6 +652,9 @@ CLK_OF_DECLARE(rk3066a_cru, "rockchip,rk3066a-cru", rk3066a_clk_init);
 static void __init rk3188a_clk_init(struct device_node *np)
 {
 	rk3188_common_clk_init(np);
+	rockchip_clk_register_plls(rk3188_pll_clks,
+				   ARRAY_SIZE(rk3188_pll_clks),
+				   RK3188_GRF_SOC_STATUS);
 	rockchip_clk_register_branches(rk3188_clk_branches,
 				  ARRAY_SIZE(rk3188_clk_branches));
 }
Signature · 1 line
2.0.1
author maintainer
#2 lore raw

PATCH 2/11 clk: rockchip: fix rk3288 pll status register location

In reply to Heiko Stuebner

From: Jianqun <[email protected]>

In RK3288, APLL lock status bit is in GRF_SOC_STATUS1, but in RK3188, is GRFSOC_STATUS0.

---
 drivers/clk/rockchip/clk-rk3288.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3288.c +1 -1
index 038b1aa..4586578 100644
@@ -20,7 +20,7 @@
 #include "clk.h"
 
 #define RK3288_GRF_SOC_CON(x)	(0x244 + x * 4)
-#define RK3288_GRF_SOC_STATUS	0x280
+#define RK3288_GRF_SOC_STATUS	0x284
 
 enum rk3288_plls {
 	apll, dpll, cpll, gpll, npll,
Signature · 1 line
2.0.1
#3 lore raw

PATCH 2/11 clk: rockchip: fix rk3288 pll status register location

Hi,

Quoted 17 lines · Heiko Stuebner

From: Jianqun <[email protected]>

In RK3288, APLL lock status bit is in GRF_SOC_STATUS1, but in RK3188, is GRFSOC_STATUS0.

---
 drivers/clk/rockchip/clk-rk3288.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3288.c +0 -0
index 038b1aa..4586578 100644

drivers/clk/rockchip/clk-rk3288.c line 23

Quoted 5 lines
drivers/clk/rockchip/clk-rk3288.c +1 -1
@@ -20,7 +20,7 @@
 #include "clk.h"
 
 #define RK3288_GRF_SOC_CON(x)  (0x244 + x * 4)
-#define RK3288_GRF_SOC_STATUS  0x280
+#define RK3288_GRF_SOC_STATUS  0x284

I probably would have also given this a rename to GRF_SOC_STATUS1 to make it a little clearer. Mind doing that?

-Doug

author maintainer
#4 lore raw

PATCH 3/11 clk: rockchip: reparent aclk_cpu_pre to the gpll

In reply to Heiko Stuebner

aclk_cpu_pre on the rk3188 can either be sourced from the armclk or the gpll. To reduce complexity on apll changes caused by cpufreq, reparent it always to the gpll source.

If really necessary it could be reparented back on a per board level using the assigned-clocks mechanism.

---
 drivers/clk/rockchip/clk-rk3188.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/clk/rockchip/clk-rk3188.c +19 -0
index b8c5ada..2b893da 100644
@@ -651,12 +651,31 @@ CLK_OF_DECLARE(rk3066a_cru, "rockchip,rk3066a-cru", rk3066a_clk_init);
 
 static void __init rk3188a_clk_init(struct device_node *np)
 {
+	struct clk *clk1, *clk2;
+	unsigned long rate;
+	int ret;
+
 	rk3188_common_clk_init(np);
 	rockchip_clk_register_plls(rk3188_pll_clks,
 				   ARRAY_SIZE(rk3188_pll_clks),
 				   RK3188_GRF_SOC_STATUS);
 	rockchip_clk_register_branches(rk3188_clk_branches,
 				  ARRAY_SIZE(rk3188_clk_branches));
+
+	/* reparent aclk_cpu_pre from apll */
+	clk1 = __clk_lookup("aclk_cpu_pre");
+	clk2 = __clk_lookup("gpll");
+	if (clk1 && clk2) {
+		rate = clk_get_rate(clk1);
+
+		ret = clk_set_parent(clk1, clk2);
+		if (ret < 0)
+			pr_warn("%s: could not reparent aclk_cpu_pre to gpll\n", __func__);
+
+		clk_set_rate(clk1, rate);
+	} else {
+		pr_warn("%s: missing clocks to reparent aclk_cpu_pre to gpll\n", __func__);
+	}
 }
 CLK_OF_DECLARE(rk3188a_cru, "rockchip,rk3188a-cru", rk3188a_clk_init);
 
Signature · 1 line
2.0.1
author maintainer
#5 lore raw

PATCH 4/11 clk: rockchip: make tightly bound armclk child-clocks read-only

In reply to Heiko Stuebner

Rockchip SoCs contain clocks tightly bound to the armclk, where the best rate / divider is supplied by the vendor after careful measuring. Often this ideal rate may be greater than the current rate.

Therefore prevent the ccf from trying to set these dividers itself by setting them to read-only.

In the case of the rk3066, this also includes the aclk_cpu, which makes it necessary to also split its direct child-clocks (pclk_cpu, hclk_cpu, ...) into individual definitions for rk3066 and rk3188.

---
 drivers/clk/rockchip/clk-rk3188.c | 26 ++++++++++++++++++--------
 drivers/clk/rockchip/clk-rk3288.c | 18 +++++++++---------
 2 files changed, 27 insertions(+), 17 deletions(-)
drivers/clk/rockchip/clk-rk3188.c +18 -8
index 2b893da..f6e3a70 100644
@@ -174,17 +174,10 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {
 	GATE(0, "aclk_cpu", "aclk_cpu_pre", 0,
 			RK2928_CLKGATE_CON(0), 3, GFLAGS),
 
-	DIV(0, "pclk_cpu_pre", "aclk_cpu_pre", 0,
-			RK2928_CLKSEL_CON(1), 12, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO),
 	GATE(0, "atclk_cpu", "pclk_cpu_pre", 0,
 			RK2928_CLKGATE_CON(0), 6, GFLAGS),
 	GATE(0, "pclk_cpu", "pclk_cpu_pre", 0,
 			RK2928_CLKGATE_CON(0), 5, GFLAGS),
-	DIV(0, "hclk_cpu_pre", "aclk_cpu_pre", 0,
-			RK2928_CLKSEL_CON(1), 8, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO),
-	COMPOSITE_NOMUX(0, "hclk_ahb2apb", "hclk_cpu_pre", 0,
-			RK2928_CLKSEL_CON(1), 14, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
-			RK2928_CLKGATE_CON(4), 9, GFLAGS),
 	GATE(0, "hclk_cpu", "hclk_cpu_pre", 0,
 			RK2928_CLKGATE_CON(0), 4, GFLAGS),
 
@@ -416,7 +409,17 @@ static struct rockchip_clk_branch rk3066a_clk_branches[] __initdata = {
 	COMPOSITE_NOGATE(0, "armclk", mux_armclk_p, 0,
 			RK2928_CLKSEL_CON(0), 8, 1, MFLAGS, 0, 5, DFLAGS),
 	DIVTBL(0, "aclk_cpu_pre", "armclk", 0,
-			RK2928_CLKSEL_CON(1), 0, 3, DFLAGS, div_aclk_cpu_t),
+			RK2928_CLKSEL_CON(1), 0, 3, DFLAGS | CLK_DIVIDER_READ_ONLY, div_aclk_cpu_t),
+	DIV(0, "pclk_cpu_pre", "aclk_cpu_pre", 0,
+			RK2928_CLKSEL_CON(1), 12, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO
+							    | CLK_DIVIDER_READ_ONLY),
+	DIV(0, "hclk_cpu_pre", "aclk_cpu_pre", 0,
+			RK2928_CLKSEL_CON(1), 8, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO
+							   | CLK_DIVIDER_READ_ONLY),
+	COMPOSITE_NOMUX(0, "hclk_ahb2apb", "hclk_cpu_pre", 0,
+			RK2928_CLKSEL_CON(1), 14, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO
+							    | CLK_DIVIDER_READ_ONLY,
+			RK2928_CLKGATE_CON(4), 9, GFLAGS),
 
 	GATE(CORE_L2C, "core_l2c", "aclk_cpu", 0,
 			RK2928_CLKGATE_CON(9), 4, GFLAGS),
@@ -534,6 +537,13 @@ static struct rockchip_clk_branch rk3188_clk_branches[] __initdata = {
 	/* do not source aclk_cpu_pre from the apll, to keep complexity down */
 	COMPOSITE_NOGATE(0, "aclk_cpu_pre", mux_aclk_cpu_p, CLK_SET_RATE_NO_REPARENT,
 			RK2928_CLKSEL_CON(0), 5, 1, MFLAGS, 0, 5, DFLAGS),
+	DIV(0, "pclk_cpu_pre", "aclk_cpu_pre", 0,
+			RK2928_CLKSEL_CON(1), 12, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO),
+	DIV(0, "hclk_cpu_pre", "aclk_cpu_pre", 0,
+			RK2928_CLKSEL_CON(1), 8, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO),
+	COMPOSITE_NOMUX(0, "hclk_ahb2apb", "hclk_cpu_pre", 0,
+			RK2928_CLKSEL_CON(1), 14, 2, DFLAGS | CLK_DIVIDER_POWER_OF_TWO,
+			RK2928_CLKGATE_CON(4), 9, GFLAGS),
 
 	GATE(CORE_L2C, "core_l2c", "armclk", 0,
 			RK2928_CLKGATE_CON(9), 4, GFLAGS),
drivers/clk/rockchip/clk-rk3288.c +9 -9
index 4586578..f0a23a0 100644
@@ -170,31 +170,31 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = {
 			RK3288_CLKSEL_CON(0), 15, 1, MFLAGS, 8, 5, DFLAGS),
 
 	COMPOSITE_NOMUX(0, "armcore0", "armclk", 0,
-			RK3288_CLKSEL_CON(36), 0, 3, DFLAGS,
+			RK3288_CLKSEL_CON(36), 0, 3, DFLAGS | CLK_DIVIDER_READ_ONLY,
 			RK3288_CLKGATE_CON(12), 0, GFLAGS),
 	COMPOSITE_NOMUX(0, "armcore1", "armclk", 0,
-			RK3288_CLKSEL_CON(36), 4, 3, DFLAGS,
+			RK3288_CLKSEL_CON(36), 4, 3, DFLAGS | CLK_DIVIDER_READ_ONLY,
 			RK3288_CLKGATE_CON(12), 1, GFLAGS),
 	COMPOSITE_NOMUX(0, "armcore2", "armclk", 0,
-			RK3288_CLKSEL_CON(36), 8, 3, DFLAGS,
+			RK3288_CLKSEL_CON(36), 8, 3, DFLAGS | CLK_DIVIDER_READ_ONLY,
 			RK3288_CLKGATE_CON(12), 2, GFLAGS),
 	COMPOSITE_NOMUX(0, "armcore3", "armclk", 0,
-			RK3288_CLKSEL_CON(36), 12, 3, DFLAGS,
+			RK3288_CLKSEL_CON(36), 12, 3, DFLAGS | CLK_DIVIDER_READ_ONLY,
 			RK3288_CLKGATE_CON(12), 3, GFLAGS),
 	COMPOSITE_NOMUX(0, "l2ram", "armclk", 0,
-			RK3288_CLKSEL_CON(37), 0, 3, DFLAGS,
+			RK3288_CLKSEL_CON(37), 0, 3, DFLAGS | CLK_DIVIDER_READ_ONLY,
 			RK3288_CLKGATE_CON(12), 4, GFLAGS),
 	COMPOSITE_NOMUX(0, "aclk_core_m0", "armclk", 0,
-			RK3288_CLKSEL_CON(0), 0, 4, DFLAGS,
+			RK3288_CLKSEL_CON(0), 0, 4, DFLAGS | CLK_DIVIDER_READ_ONLY,
 			RK3288_CLKGATE_CON(12), 5, GFLAGS),
 	COMPOSITE_NOMUX(0, "aclk_core_mp", "armclk", 0,
-			RK3288_CLKSEL_CON(0), 4, 4, DFLAGS,
+			RK3288_CLKSEL_CON(0), 4, 4, DFLAGS | CLK_DIVIDER_READ_ONLY,
 			RK3288_CLKGATE_CON(12), 6, GFLAGS),
 	COMPOSITE_NOMUX(0, "atclk", "armclk", 0,
-			RK3288_CLKSEL_CON(37), 4, 5, DFLAGS,
+			RK3288_CLKSEL_CON(37), 4, 5, DFLAGS | CLK_DIVIDER_READ_ONLY,
 			RK3288_CLKGATE_CON(12), 7, GFLAGS),
 	COMPOSITE_NOMUX(0, "pclk_dbg_pre", "armclk", 0,
-			RK3288_CLKSEL_CON(37), 9, 5, DFLAGS,
+			RK3288_CLKSEL_CON(37), 9, 5, DFLAGS | CLK_DIVIDER_READ_ONLY,
 			RK3288_CLKGATE_CON(12), 8, GFLAGS),
 	GATE(0, "pclk_dbg", "pclk_dbg_pre", 0,
 			RK3288_CLKGATE_CON(12), 9, GFLAGS),
Signature · 1 line
2.0.1
author maintainer
#6 lore raw

PATCH 5/11 clk: rockchip: add new clock-type for the cpuclk

In reply to Heiko Stuebner

When changing the armclk on Rockchip SoCs it is supposed to be reparented to an alternate parent before changing the underlying pll and back after the change. Additionally there exist clocks that are very tightly bound to the armclk whose divider values are set according to the armclk rate.

Add a special clock-type to handle all that. The rate table and divider values will be supplied from the soc-specific clock controllers.

---
 drivers/clk/rockchip/Makefile  |   1 +
 drivers/clk/rockchip/clk-cpu.c | 313 +++++++++++++++++++++++++++++++++++++++++
 drivers/clk/rockchip/clk.c     |  18 +++
 drivers/clk/rockchip/clk.h     |  36 +++++
 4 files changed, 368 insertions(+)
 create mode 100644 drivers/clk/rockchip/clk-cpu.c
drivers/clk/rockchip/Makefile +1 -0
index ee6b077..bd8514d 100644
@@ -5,6 +5,7 @@
 obj-y	+= clk-rockchip.o
 obj-y	+= clk.o
 obj-y	+= clk-pll.o
+obj-y	+= clk-cpu.o
 obj-$(CONFIG_RESET_CONTROLLER)	+= softrst.o
 
 obj-y	+= clk-rk3188.o
drivers/clk/rockchip/clk-cpu.c new file +313 -0

313 lines not on this page · raw message

drivers/clk/rockchip/clk.c +18 -0
index d9c6db2..7496cf7 100644
@@ -297,6 +297,24 @@ void __init rockchip_clk_register_branches(
 	}
 }
 
+void __init rockchip_clk_register_armclk(unsigned int lookup_id, const char *name,
+			const char **parent_names, u8 num_parents,
+			const struct rockchip_cpuclk_reg_data *reg_data,
+			struct rockchip_cpuclk_rate_table *rate_table)
+{
+	struct clk *clk;
+
+	clk = rockchip_clk_register_cpuclk(name, parent_names, num_parents, reg_data,
+					   rate_table, reg_base, &clk_lock);
+	if (IS_ERR(clk)) {
+		pr_err("%s: failed to register clock %s: %ld\n",
+		       __func__, name, PTR_ERR(clk));
+		return;
+	}
+
+	rockchip_clk_add_lookup(clk, lookup_id);
+}
+
 void __init rockchip_clk_protect_critical(const char *clocks[], int nclocks)
 {
 	int i;
drivers/clk/rockchip/clk.h +36 -0
index 2b0bca1..e0ea61e 100644
@@ -120,6 +120,38 @@ struct clk *rockchip_clk_register_pll(enum rockchip_pll_type pll_type,
 		struct rockchip_pll_rate_table *rate_table,
 		spinlock_t *lock);
 
+struct rockchip_cpuclk_clksel {
+	int reg;
+	u32 val;
+};
+
+#define ROCKCHIP_CPUCLK_NUM_DIVIDERS	2
+struct rockchip_cpuclk_rate_table {
+	unsigned long prate;
+	struct rockchip_cpuclk_clksel divs[ROCKCHIP_CPUCLK_NUM_DIVIDERS];
+};
+
+/**
+ * struct rockchip_cpuclk_reg_data: describes register offsets and masks of the cpuclock
+ * @core_reg:		register offset of the core settings register
+ * @div_core_shift:	core divider offset used to divide the pll value
+ * @div_core_mask:	core divider mask
+ * @mux_core_shift:	offset of the core multiplexer
+ */
+struct rockchip_cpuclk_reg_data {
+	int		core_reg;
+	u8		div_core_shift;
+	u32		div_core_mask;
+	int		mux_core_reg;
+	u8		mux_core_shift;
+};
+
+struct clk *rockchip_clk_register_cpuclk(const char *name,
+			const char **parent_names, u8 num_parents,
+			const struct rockchip_cpuclk_reg_data *reg_data,
+			struct rockchip_cpuclk_rate_table *rate_table,
+			void __iomem *reg_base, spinlock_t *lock);
+
 #define PNAME(x) static const char *x[] __initconst
 
 enum rockchip_clk_branch_type {
@@ -329,6 +361,10 @@ void rockchip_clk_register_branches(struct rockchip_clk_branch *clk_list,
 				    unsigned int nr_clk);
 void rockchip_clk_register_plls(struct rockchip_pll_clock *pll_list,
 				unsigned int nr_pll, int grf_lock_offset);
+void rockchip_clk_register_armclk(unsigned int lookup_id, const char *name,
+			const char **parent_names, u8 num_parents,
+			const struct rockchip_cpuclk_reg_data *reg_data,
+			struct rockchip_cpuclk_rate_table *rate_table);
 void rockchip_clk_protect_critical(const char *clocks[], int nclocks);
 
 #define ROCKCHIP_SOFTRST_HIWORD_MASK	BIT(0)
Signature · 1 line
2.0.1
author maintainer
#7 lore raw

PATCH 6/11 clk: rockchip: add binding id for ARMCLK

In reply to Heiko Stuebner
---
 include/dt-bindings/clock/rk3188-cru-common.h | 1 +
 include/dt-bindings/clock/rk3288-cru.h        | 1 +
 2 files changed, 2 insertions(+)
include/dt-bindings/clock/rk3188-cru-common.h +1 -0
index 750ee60..6a37050 100644
@@ -20,6 +20,7 @@
 #define PLL_GPLL		4
 #define CORE_PERI		5
 #define CORE_L2C		6
+#define ARMCLK			7
 
 /* sclk gates (special clocks) */
 #define SCLK_UART0		64
include/dt-bindings/clock/rk3288-cru.h +1 -0
index ebcb460..8f75bf0 100644
@@ -19,6 +19,7 @@
 #define PLL_CPLL		3
 #define PLL_GPLL		4
 #define PLL_NPLL		5
+#define ARMCLK			6
 
 /* sclk gates (special clocks) */
 #define SCLK_GPU		64
Signature · 1 line
2.0.1
author maintainer
#8 lore raw

PATCH 7/11 clk: rockchip: switch to using the new cpuclk type for armclk

In reply to Heiko Stuebner

This adds the necessary soc-specific divider values and switches the armclk to use the newly introduced cpuclk type.

---
 drivers/clk/rockchip/clk-rk3188.c | 104 ++++++++++++++++++++++++++++++++++++--
 drivers/clk/rockchip/clk-rk3288.c |  66 +++++++++++++++++++++++-
 2 files changed, 164 insertions(+), 6 deletions(-)
drivers/clk/rockchip/clk-rk3188.c +100 -4
index f6e3a70..ea2ed6c 100644
@@ -101,6 +101,100 @@ struct rockchip_pll_rate_table rk3188_pll_rates[] = {
 	{ /* sentinel */ },
 };
 
+#define RK3066_DIV_CORE_PERIPH_MASK	0x3
+#define RK3066_DIV_CORE_PERIPH_SHIFT	6
+#define RK3066_DIV_ACLK_CORE_MASK	0x7
+#define RK3066_DIV_ACLK_CORE_SHIFT	0
+#define RK3066_DIV_ACLK_HCLK_MASK	0x3
+#define RK3066_DIV_ACLK_HCLK_SHIFT	8
+#define RK3066_DIV_ACLK_PCLK_MASK	0x3
+#define RK3066_DIV_ACLK_PCLK_SHIFT	12
+#define RK3066_DIV_AHB2APB_MASK		0x3
+#define RK3066_DIV_AHB2APB_SHIFT	14
+
+#define RK3066_CLKSEL0(_core_peri)					\
+	{								\
+		.reg = RK2928_CLKSEL_CON(0),				\
+		.val = HIWORD_UPDATE(_core_peri, RK3066_DIV_CORE_PERIPH_MASK, \
+				RK3066_DIV_CORE_PERIPH_SHIFT)		\
+	}
+#define RK3066_CLKSEL1(_aclk_core, _aclk_hclk, _aclk_pclk, _ahb2apb)	\
+	{								\
+		.reg = RK2928_CLKSEL_CON(1),				\
+		.val = HIWORD_UPDATE(_aclk_core, RK3066_DIV_ACLK_CORE_MASK, \
+				RK3066_DIV_ACLK_CORE_SHIFT) |		\
+		       HIWORD_UPDATE(_aclk_hclk, RK3066_DIV_ACLK_HCLK_MASK, \
+				RK3066_DIV_ACLK_HCLK_SHIFT) |		\
+		       HIWORD_UPDATE(_aclk_pclk, RK3066_DIV_ACLK_PCLK_MASK, \
+				RK3066_DIV_ACLK_PCLK_SHIFT) |		\
+		       HIWORD_UPDATE(_ahb2apb, RK3066_DIV_AHB2APB_MASK,	\
+				RK3066_DIV_AHB2APB_SHIFT),		\
+	}
+
+#define RK3066_CPUCLK_RATE(_prate, _core_peri, _acore, _ahclk, _apclk, _h2p) \
+	{								\
+		.prate = _prate,					\
+		.divs = {						\
+			RK3066_CLKSEL0(_core_peri),			\
+			RK3066_CLKSEL1(_acore, _ahclk, _apclk, _h2p),	\
+		},							\
+	}
+
+static struct rockchip_cpuclk_rate_table rk3066_cpuclk_rates[] = {
+	RK3066_CPUCLK_RATE(1416000000, 2, 3, 1, 2, 1),
+	RK3066_CPUCLK_RATE(1200000000, 2, 3, 1, 2, 1),
+	RK3066_CPUCLK_RATE(1008000000, 2, 2, 1, 2, 1),
+	RK3066_CPUCLK_RATE( 816000000, 2, 2, 1, 2, 1),
+	RK3066_CPUCLK_RATE( 600000000, 1, 2, 1, 2, 1),
+	RK3066_CPUCLK_RATE( 504000000, 1, 1, 1, 2, 1),
+	RK3066_CPUCLK_RATE( 312000000, 0, 1, 1, 1, 0),
+	{ /* sentinel */ },
+};
+
+static const struct rockchip_cpuclk_reg_data rk3066_cpuclk_data = {
+	.core_reg = RK2928_CLKSEL_CON(0),
+	.div_core_shift = 0,
+	.div_core_mask = 0x1f,
+	.mux_core_shift = 8,
+};
+
+#define RK3188_DIV_ACLK_CORE_MASK	0x7
+#define RK3188_DIV_ACLK_CORE_SHIFT	3
+
+#define RK3188_CLKSEL1(_aclk_core)		\
+	{					\
+		.reg = RK2928_CLKSEL_CON(1),	\
+		.val = HIWORD_UPDATE(_aclk_core, RK3188_DIV_ACLK_CORE_MASK,\
+				 RK3188_DIV_ACLK_CORE_SHIFT) \
+	}
+#define RK3188_CPUCLK_RATE(_prate, _core_peri, _aclk_core)	\
+	{							\
+		.prate = _prate,				\
+		.divs = {					\
+			RK3066_CLKSEL0(_core_peri),		\
+			RK3188_CLKSEL1(_aclk_core),		\
+		},						\
+	}
+
+static struct rockchip_cpuclk_rate_table rk3188_cpuclk_rates[] = {
+	RK3188_CPUCLK_RATE(1608000000, 2, 3),
+	RK3188_CPUCLK_RATE(1416000000, 2, 3),
+	RK3188_CPUCLK_RATE(1200000000, 2, 3),
+	RK3188_CPUCLK_RATE(1008000000, 2, 3),
+	RK3188_CPUCLK_RATE( 816000000, 2, 3),
+	RK3188_CPUCLK_RATE( 600000000, 1, 3),
+	RK3188_CPUCLK_RATE( 504000000, 1, 3),
+	RK3188_CPUCLK_RATE( 312000000, 0, 1),
+	{ /* sentinel */ },
+};
+
+static const struct rockchip_cpuclk_reg_data rk3188_cpuclk_data = {
+	.core_reg = RK2928_CLKSEL_CON(0),
+	.div_core_shift = 9,
+	.div_core_mask = 0x1f,
+	.mux_core_shift = 8,
+};
+
 PNAME(mux_pll_p)		= { "xin24m", "xin32k" };
 PNAME(mux_armclk_p)		= { "apll", "gpll_armclk" };
 PNAME(mux_ddrphy_p)		= { "dpll", "gpll_ddr" };
@@ -406,8 +500,6 @@ static struct clk_div_table div_aclk_cpu_t[] = {
 };
 
 static struct rockchip_clk_branch rk3066a_clk_branches[] __initdata = {
-	COMPOSITE_NOGATE(0, "armclk", mux_armclk_p, 0,
-			RK2928_CLKSEL_CON(0), 8, 1, MFLAGS, 0, 5, DFLAGS),
 	DIVTBL(0, "aclk_cpu_pre", "armclk", 0,
 			RK2928_CLKSEL_CON(1), 0, 3, DFLAGS | CLK_DIVIDER_READ_ONLY, div_aclk_cpu_t),
 	DIV(0, "pclk_cpu_pre", "aclk_cpu_pre", 0,
@@ -528,8 +620,6 @@ PNAME(mux_hsicphy_p)		= { "sclk_otgphy0", "sclk_otgphy1",
 				    "gpll", "cpll" };
 
 static struct rockchip_clk_branch rk3188_clk_branches[] __initdata = {
-	COMPOSITE_NOGATE(0, "armclk", mux_armclk_p, 0,
-			RK2928_CLKSEL_CON(0), 8, 1, MFLAGS, 9, 5, DFLAGS),
 	COMPOSITE_NOMUX_DIVTBL(0, "aclk_core", "armclk", 0,
 			RK2928_CLKSEL_CON(1), 3, 3, DFLAGS | CLK_DIVIDER_READ_ONLY,
 			div_rk3188_aclk_core_t, RK2928_CLKGATE_CON(0), 7, GFLAGS),
@@ -656,6 +746,9 @@ static void __init rk3066a_clk_init(struct device_node *np)
 				   RK3066_GRF_SOC_STATUS);
 	rockchip_clk_register_branches(rk3066a_clk_branches,
 				  ARRAY_SIZE(rk3066a_clk_branches));
+	rockchip_clk_register_armclk(ARMCLK, "armclk",
+			mux_armclk_p, ARRAY_SIZE(mux_armclk_p),
+			&rk3066_cpuclk_data, rk3066_cpuclk_rates);
 }
 CLK_OF_DECLARE(rk3066a_cru, "rockchip,rk3066a-cru", rk3066a_clk_init);
 
@@ -671,6 +764,9 @@ static void __init rk3188a_clk_init(struct device_node *np)
 				   RK3188_GRF_SOC_STATUS);
 	rockchip_clk_register_branches(rk3188_clk_branches,
 				  ARRAY_SIZE(rk3188_clk_branches));
+	rockchip_clk_register_armclk(ARMCLK, "armclk",
+				  mux_armclk_p, ARRAY_SIZE(mux_armclk_p),
+				  &rk3188_cpuclk_data, rk3188_cpuclk_rates);
 
 	/* reparent aclk_cpu_pre from apll */
 	clk1 = __clk_lookup("aclk_cpu_pre");
drivers/clk/rockchip/clk-rk3288.c +64 -2

84 lines not on this page · raw message

Signature · 1 line
2.0.1
author maintainer
#9 lore raw

PATCH 8/11 ARM: dts: rockchip: add operating points and armclk references

In reply to Heiko Stuebner

Add basic OPP entries for current supported Rockchip SoCs. The operating points are currently very conservative, so individual boards may opt to redefine them.

---
 arch/arm/boot/dts/rk3066a.dtsi | 12 +++++++++++-
 arch/arm/boot/dts/rk3188.dtsi  | 15 ++++++++++++++-
 arch/arm/boot/dts/rk3288.dtsi  | 17 ++++++++++++++++-
 3 files changed, 41 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3066a.dtsi +11 -1
index 879a818..572c30b 100644
@@ -26,11 +26,21 @@
 		#size-cells = <0>;
 		enable-method = "rockchip,rk3066-smp";
 
-		cpu at 0 {
+		cpu0: cpu at 0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			next-level-cache = <&L2>;
 			reg = <0x0>;
+			operating-points = <
+				/* kHz    uV */
+				1008000 1075000
+				 816000 1025000
+				 600000 1025000
+				 504000 1000000
+				 312000  975000
+			>;
+			clock-latency = <40000>;
+			clocks = <&cru ARMCLK>;
 		};
 		cpu at 1 {
 			device_type = "cpu";
arch/arm/boot/dts/rk3188.dtsi +14 -1
index ee801a9..e237216 100644
@@ -26,11 +26,24 @@
 		#size-cells = <0>;
 		enable-method = "rockchip,rk3066-smp";
 
-		cpu at 0 {
+		cpu0: cpu at 0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			next-level-cache = <&L2>;
 			reg = <0x0>;
+			operating-points = <
+				/* kHz    uV */
+				1608000 1350000
+				1416000 1250000
+				1200000 1150000
+				1008000 1075000
+				 816000  975000
+				 600000  950000
+				 504000  925000
+				 312000  875000
+			>;
+			clock-latency = <40000>;
+			clocks = <&cru ARMCLK>;
 		};
 		cpu at 1 {
 			device_type = "cpu";
arch/arm/boot/dts/rk3288.dtsi +16 -1
index 5950b0a..9275a47 100644
@@ -40,10 +40,25 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		cpu at 500 {
+		cpu0: cpu at 500 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a12";
 			reg = <0x500>;
+			operating-points = <
+				/* KHz    uV */
+				1416000 1150000
+				1200000 1050000
+				1008000 1000000
+				816000  950000
+				696000  900000
+				600000  850000
+				408000  850000
+				312000  850000
+				216000  850000
+				126000  850000
+			>;
+			clock-latency = <40000>;
+			clocks = <&cru ARMCLK>;
 		};
 		cpu at 501 {
 			device_type = "cpu";
Signature · 1 line
2.0.1
#10 lore raw

PATCH 8/11 ARM: dts: rockchip: add operating points and armclk references

Heiko,

Quoted 84 lines · Heiko Stuebner

Add basic OPP entries for current supported Rockchip SoCs. The operating points are currently very conservative, so individual boards may opt to redefine them.

---
 arch/arm/boot/dts/rk3066a.dtsi | 12 +++++++++++-
 arch/arm/boot/dts/rk3188.dtsi  | 15 ++++++++++++++-
 arch/arm/boot/dts/rk3288.dtsi  | 17 ++++++++++++++++-
 3 files changed, 41 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3066a.dtsi +11 -1
index 879a818..572c30b 100644
@@ -26,11 +26,21 @@
                #size-cells = <0>;
                enable-method = "rockchip,rk3066-smp";
 
-               cpu at 0 {
+               cpu0: cpu at 0 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a9";
                        next-level-cache = <&L2>;
                        reg = <0x0>;
+                       operating-points = <
+                               /* kHz    uV */
+                               1008000 1075000
+                                816000 1025000
+                                600000 1025000
+                                504000 1000000
+                                312000  975000
+                       >;
+                       clock-latency = <40000>;
+                       clocks = <&cru ARMCLK>;
                };
                cpu at 1 {
                        device_type = "cpu";
arch/arm/boot/dts/rk3188.dtsi +14 -1
index ee801a9..e237216 100644
@@ -26,11 +26,24 @@
                #size-cells = <0>;
                enable-method = "rockchip,rk3066-smp";
 
-               cpu at 0 {
+               cpu0: cpu at 0 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a9";
                        next-level-cache = <&L2>;
                        reg = <0x0>;
+                       operating-points = <
+                               /* kHz    uV */
+                               1608000 1350000
+                               1416000 1250000
+                               1200000 1150000
+                               1008000 1075000
+                                816000  975000
+                                600000  950000
+                                504000  925000
+                                312000  875000
+                       >;
+                       clock-latency = <40000>;
+                       clocks = <&cru ARMCLK>;
                };
                cpu at 1 {
                        device_type = "cpu";
arch/arm/boot/dts/rk3288.dtsi +4 -1
index 5950b0a..9275a47 100644
@@ -40,10 +40,25 @@
                #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu at 500 {
+               cpu0: cpu at 500 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a12";
                        reg = <0x500>;
+                       operating-points = <
+                               /* KHz    uV */
+                               1416000 1150000

arch/arm/boot/dts/rk3288.dtsi line 59

Quoted 10 lines
arch/arm/boot/dts/rk3288.dtsi +10 -0
+                               1200000 1050000
+                               1008000 1000000
+                               816000  950000
+                               696000  900000
+                               600000  850000
+                               408000  850000
+                               312000  850000
+                               216000  850000
+                               126000  850000
+                       >;

This doesn't quite match the ordering that Kever put up most recently
at <https://chromium-review.googlesource.com/#/c/211862/2/arch/arm/boot/dts/rk3288.dtsi>.
Specifically, he has:

1800000 1300000
1608000 1200000
1416000 1150000
1200000 1100000
1008000 1050000
[ 816000 1000000
600000 900000
408000 850000
216000 850000
126000 850000

-Doug

#11 lore raw

PATCH 8/11 ARM: dts: rockchip: add operating points and armclk references

hi

Quoted 102 lines · Doug Anderson

Heiko,

Quoted 84 lines · Heiko Stuebner

Add basic OPP entries for current supported Rockchip SoCs. The operating points are currently very conservative, so individual boards may opt to redefine them.

---
 arch/arm/boot/dts/rk3066a.dtsi | 12 +++++++++++-
 arch/arm/boot/dts/rk3188.dtsi  | 15 ++++++++++++++-
 arch/arm/boot/dts/rk3288.dtsi  | 17 ++++++++++++++++-
 3 files changed, 41 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3066a.dtsi +11 -1
index 879a818..572c30b 100644
@@ -26,11 +26,21 @@
                #size-cells = <0>;
                enable-method = "rockchip,rk3066-smp";
 
-               cpu at 0 {
+               cpu0: cpu at 0 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a9";
                        next-level-cache = <&L2>;
                        reg = <0x0>;
+                       operating-points = <
+                               /* kHz    uV */
+                               1008000 1075000
+                                816000 1025000
+                                600000 1025000
+                                504000 1000000
+                                312000  975000
+                       >;
+                       clock-latency = <40000>;
+                       clocks = <&cru ARMCLK>;
                };
                cpu at 1 {
                        device_type = "cpu";
arch/arm/boot/dts/rk3188.dtsi +14 -1
index ee801a9..e237216 100644
@@ -26,11 +26,24 @@
                #size-cells = <0>;
                enable-method = "rockchip,rk3066-smp";
 
-               cpu at 0 {
+               cpu0: cpu at 0 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a9";
                        next-level-cache = <&L2>;
                        reg = <0x0>;
+                       operating-points = <
+                               /* kHz    uV */
+                               1608000 1350000
+                               1416000 1250000
+                               1200000 1150000
+                               1008000 1075000
+                                816000  975000
+                                600000  950000
+                                504000  925000
+                                312000  875000
+                       >;
+                       clock-latency = <40000>;
+                       clocks = <&cru ARMCLK>;
                };
                cpu at 1 {
                        device_type = "cpu";
arch/arm/boot/dts/rk3288.dtsi +4 -1
index 5950b0a..9275a47 100644
@@ -40,10 +40,25 @@
                #address-cells = <1>;
                #size-cells = <0>;
 
-               cpu at 500 {
+               cpu0: cpu at 500 {
                        device_type = "cpu";
                        compatible = "arm,cortex-a12";
                        reg = <0x500>;
+                       operating-points = <
+                               /* KHz    uV */
+                               1416000 1150000

arch/arm/boot/dts/rk3288.dtsi line 59

Quoted 10 lines
arch/arm/boot/dts/rk3288.dtsi +10 -0
+                               1200000 1050000
+                               1008000 1000000
+                               816000  950000
+                               696000  900000
+                               600000  850000
+                               408000  850000
+                               312000  850000
+                               216000  850000
+                               126000  850000
+                       >;

This doesn't quite match the ordering that Kever put up most recently
at <https://chromium-review.googlesource.com/#/c/211862/2/arch/arm/boot/dts/rk3288.dtsi>.
Specifically, he has:

Quoted 10 lines

1800000 1300000
1608000 1200000
1416000 1150000
1200000 1100000
1008000 1050000
[ 816000 1000000
600000 900000
408000 850000
216000 850000
126000 850000

in Rockchip R-BOX SDK(for Box/HDMI dongle), voltage is bit higher...

https://bitbucket.org/T-Firefly/firefly-rk3288/src/ab220fdc428283b2358644eec36059bb58b429a0/kernel/arch/arm/boot/dts/rk3288-box.dts?at=master#cl-557

                126000 900000
                216000 900000
                312000 900000
                408000 900000
                600000 950000
                696000 950000
                816000 1000000
                1008000 1050000
                1200000 1100000
                1416000 1200000
                1512000 1300000
                1608000 1350000
                1704000 1350000
                1800000 1350000

and there are different set of values in other rk3288-*.dts.

(I don't know which is correct, sorry)

#12 lore raw

PATCH 8/11 ARM: dts: rockchip: add operating points and armclk references

In reply to Doug Anderson

Heiko,

Quoted 101 lines · Doug Anderson

Heiko,

Quoted 84 lines · Heiko Stuebner

Add basic OPP entries for current supported Rockchip SoCs. The operating points are currently very conservative, so individual boards may opt to redefine them.

---
  arch/arm/boot/dts/rk3066a.dtsi | 12 +++++++++++-
  arch/arm/boot/dts/rk3188.dtsi  | 15 ++++++++++++++-
  arch/arm/boot/dts/rk3288.dtsi  | 17 ++++++++++++++++-
  3 files changed, 41 insertions(+), 3 deletions(-)
arch/arm/boot/dts/rk3066a.dtsi +11 -1
index 879a818..572c30b 100644
@@ -26,11 +26,21 @@
                 #size-cells = <0>;
                 enable-method = "rockchip,rk3066-smp";
 
-               cpu at 0 {
+               cpu0: cpu at 0 {
                         device_type = "cpu";
                         compatible = "arm,cortex-a9";
                         next-level-cache = <&L2>;
                         reg = <0x0>;
+                       operating-points = <
+                               /* kHz    uV */
+                               1008000 1075000
+                                816000 1025000
+                                600000 1025000
+                                504000 1000000
+                                312000  975000
+                       >;
+                       clock-latency = <40000>;
+                       clocks = <&cru ARMCLK>;
                 };
                 cpu at 1 {
                         device_type = "cpu";
arch/arm/boot/dts/rk3188.dtsi +14 -1
index ee801a9..e237216 100644
@@ -26,11 +26,24 @@
                 #size-cells = <0>;
                 enable-method = "rockchip,rk3066-smp";
 
-               cpu at 0 {
+               cpu0: cpu at 0 {
                         device_type = "cpu";
                         compatible = "arm,cortex-a9";
                         next-level-cache = <&L2>;
                         reg = <0x0>;
+                       operating-points = <
+                               /* kHz    uV */
+                               1608000 1350000
+                               1416000 1250000
+                               1200000 1150000
+                               1008000 1075000
+                                816000  975000
+                                600000  950000
+                                504000  925000
+                                312000  875000
+                       >;
+                       clock-latency = <40000>;
+                       clocks = <&cru ARMCLK>;
                 };
                 cpu at 1 {
                         device_type = "cpu";
arch/arm/boot/dts/rk3288.dtsi +4 -1
index 5950b0a..9275a47 100644
@@ -40,10 +40,25 @@
                 #address-cells = <1>;
                 #size-cells = <0>;
 
-               cpu at 500 {
+               cpu0: cpu at 500 {
                         device_type = "cpu";
                         compatible = "arm,cortex-a12";
                         reg = <0x500>;
+                       operating-points = <
+                               /* KHz    uV */
+                               1416000 1150000

arch/arm/boot/dts/rk3288.dtsi line 59

Quoted 10 lines
arch/arm/boot/dts/rk3288.dtsi +10 -0
+                               1200000 1050000
+                               1008000 1000000
+                               816000  950000
+                               696000  900000
+                               600000  850000
+                               408000  850000
+                               312000  850000
+                               216000  850000
+                               126000  850000
+                       >;

This doesn't quite match the ordering that Kever put up most recently
at <https://chromium-review.googlesource.com/#/c/211862/2/arch/arm/boot/dts/rk3288.dtsi>.
Specifically, he has:

Quoted 10 lines

1800000 1300000
1608000 1200000
1416000 1150000
1200000 1100000
1008000 1050000
[ 816000 1000000
600000 900000
408000 850000
216000 850000
126000 850000

Here is the general OPP table for rk3288 we recommend to use in upstream:

    operating-points = <
                 /* KHz    uV */
                 1608000 1350000
                 1512000 1300000
                 1416000 1200000
                 1200000 1100000
                 1008000 1050000
                 816000 1000000
                 696000 950000
                 600000 900000
                 408000 900000
                 312000 900000
                 216000 900000
                 126000 900000
                 >;

After this,

Note that the CPU can't not stay on top frequency for a long time, the cpu might overheat, the cpufreq is better to work with cpu thermal for rk3288.

-Kever

#13 lore raw

PATCH 8/11 ARM: dts: rockchip: add operating points and armclk references

Hi Kever Yang,

Quoted 18 lines · Kever Yang

Here is the general OPP table for rk3288 we recommend to use in upstream:

   operating-points = <
                /* KHz    uV */
                1608000 1350000
                1512000 1300000
                1416000 1200000
                1200000 1100000
                1008000 1050000
                816000 1000000
                696000 950000
                600000 900000
                408000 900000
                312000 900000
                216000 900000
                126000 900000
                >;
Quoted 5 lines

After this,

Note that the CPU can't not stay on top frequency for a long time, the cpu might overheat, the cpufreq is better to work with cpu thermal for rk3288.

This commit says 1800000 is safe, but actually it's not safe?
https://bitbucket.org/T-Firefly/firefly-rk3288/commits/7048675eec554a1aa4a3874c7bb24806e1e1c06b/raw/

#14 lore raw

PATCH 8/11 ARM: dts: rockchip: add operating points and armclk references

Hi Naoki FUKAUMI,

Quoted 21 lines · Naoki FUKAUMI

Hi Kever Yang,

Quoted 18 lines · Kever Yang

Here is the general OPP table for rk3288 we recommend to use in upstream:

    operating-points = <
                 /* KHz    uV */
                 1608000 1350000
                 1512000 1300000
                 1416000 1200000
                 1200000 1100000
                 1008000 1050000
                 816000 1000000
                 696000 950000
                 600000 900000
                 408000 900000
                 312000 900000
                 216000 900000
                 126000 900000
                 >;
Quoted 7 lines
Quoted 5 lines

After this,

Note that the CPU can't not stay on top frequency for a long time, the cpu might overheat, the cpufreq is better to work with cpu thermal for rk3288.

This commit says 1800000 is safe, but actually it's not safe?
https://bitbucket.org/T-Firefly/firefly-rk3288/commits/7048675eec554a1aa4a3874c7bb24806e1e1c06b/raw/

As you have seen, that patch is for a dts file which is board related instead of rk3288.dtsi,
it should be safe for T-firefly board, but I'm not sure it works for all the boards.

The operation table I provide for rk3288.dtsi with conservative values and available for all boards
based on rk3288, and maybe need an OPP table with optimized values in dts board file
for board customized.

-Kever

#15 lore raw

PATCH 8/11 ARM: dts: rockchip: add operating points and armclk references

Hi,

Quoted 9 lines · Kever Yang
Quoted 3 lines

This commit says 1800000 is safe, but actually it's not safe?

https://bitbucket.org/T-Firefly/firefly-rk3288/commits/7048675eec554a1aa4a3874c7bb24806e1e1c06b/raw/

As you have seen, that patch is for a dts file which is board related instead of rk3288.dtsi,
it should be safe for T-firefly board, but I'm not sure it works for all the boards.

Quoted 5 lines

The operation table I provide for rk3288.dtsi with conservative values and available for all boards
based on rk3288, and maybe need an OPP table with optimized values in dts board file
for board customized.

I see, thank you so much.
sorry for the noise.

author maintainer
#16 lore raw

PATCH 9/11 ARM: dts: rockchip: add cpu supplies to boards

In reply to Heiko Stuebner

This adds the cpu-supplies to the curie2 and radxarock boards. The rk3288 boards are currently still missing their cpu-regulator, so will get their supply later.

---
 arch/arm/boot/dts/rk3066a-bqcurie2.dts | 4 ++++
 arch/arm/boot/dts/rk3188-radxarock.dts | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
arch/arm/boot/dts/rk3066a-bqcurie2.dts +4 -0
index 042f821d..b185738 100644
@@ -60,6 +60,10 @@
 	};
 };
 
+&cpu0 {
+	cpu0-supply = <&vdd_arm>;
+};
+
 &i2c1 {
 	status = "okay";
 	clock-frequency = <400000>;
arch/arm/boot/dts/rk3188-radxarock.dts +5 -1
index 171b610..f3656d4 100644
@@ -76,6 +76,10 @@
 	};
 };
 
+&cpu0 {
+	cpu0-supply = <&vdd_arm>;
+};
+
 &i2c1 {
 	status = "okay";
 	clock-frequency = <400000>;
@@ -106,7 +110,7 @@
 			vdd_arm: REG3 {
 				regulator-name = "VDD_ARM";
 				regulator-min-microvolt = <875000>;
-				regulator-max-microvolt = <1300000>;
+				regulator-max-microvolt = <1350000>;
 				regulator-always-on;
 			};
 
Signature · 1 line
2.0.1
author maintainer
#17 lore raw

PATCH 10/11 ARM: rockchip: enable cpufreq-related options

In reply to Heiko Stuebner

Enable ARCH_HAS_CPUFREQ and ARCH_HAS_OPP.

---
 arch/arm/mach-rockchip/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-rockchip/Kconfig +2 -0
index d168669..007e9dd 100644
@@ -2,6 +2,8 @@ config ARCH_ROCKCHIP
 	bool "Rockchip RK2928 and RK3xxx SOCs" if ARCH_MULTI_V7
 	select PINCTRL
 	select PINCTRL_ROCKCHIP
+	select ARCH_HAS_CPUFREQ
+	select ARCH_HAS_OPP
 	select ARCH_HAS_RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_GIC
Signature · 1 line
2.0.1
#18 lore raw

PATCH 10/11 ARM: rockchip: enable cpufreq-related options

Heiko,

Quoted 12 lines · Heiko Stuebner

Enable ARCH_HAS_CPUFREQ and ARCH_HAS_OPP.

---
 arch/arm/mach-rockchip/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-rockchip/Kconfig +0 -0
index d168669..007e9dd 100644

arch/arm/mach-rockchip/Kconfig config ARCH_ROCKCHIP · line 9

Quoted 8 lines
arch/arm/mach-rockchip/Kconfig +2 -0
@@ -2,6 +2,8 @@ config ARCH_ROCKCHIP
        bool "Rockchip RK2928 and RK3xxx SOCs" if ARCH_MULTI_V7
        select PINCTRL
        select PINCTRL_ROCKCHIP
+       select ARCH_HAS_CPUFREQ
+       select ARCH_HAS_OPP
        select ARCH_HAS_RESET_CONTROLLER
        select ARCH_REQUIRE_GPIOLIB
        select ARM_GIC

This patch might be useful to folks trying to pick patches on older kernels, but I don't think we want it to land upstream. See:

19682f7 ARM: Remove ARCH_HAS_CPUFREQ config option 78c5e0b PM / OPP: Remove ARCH_HAS_OPP

-Doug

author maintainer
#19 lore raw

PATCH 11/11 ARM: rockchip: add a cpufreq-cpu0 device

In reply to Heiko Stuebner

Rockchip SoCs can sucessfully use the generic cpufreq-cpu0 driver to do frequency scaling. Therefore add a platform device in the machine init code.

---
 arch/arm/mach-rockchip/rockchip.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/mach-rockchip/rockchip.c +7 -0
index 8ab9e0e..eea1f06 100644
@@ -24,6 +24,12 @@
 #include <asm/hardware/cache-l2x0.h>
 #include "core.h"
 
+static void __init rockchip_dt_init(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+	platform_device_register_simple("cpufreq-cpu0", 0, NULL, 0);
+}
+
 static const char * const rockchip_board_dt_compat[] = {
 	"rockchip,rk2928",
 	"rockchip,rk3066a",
@@ -37,4 +43,5 @@ DT_MACHINE_START(ROCKCHIP_DT, "Rockchip Cortex-A9 (Device Tree)")
 	.l2c_aux_val	= 0,
 	.l2c_aux_mask	= ~0,
 	.dt_compat	= rockchip_board_dt_compat,
+	.init_machine	= rockchip_dt_init,
 MACHINE_END
Signature · 1 line
2.0.1
#20 lore raw

cover clk: rockchip: add a cpu clock-type

In reply to Heiko Stuebner

Quoting Heiko Stuebner (2014-09-05 16:06:03)

Quoted 4 lines

This series implements cpu frequency-scaling for Rockchip SoCs. The whole handling of the armclk frequency changes and therefore the implementention is very similar to the recent series for Samsung SoCs from Thomas Abraham.

Clock patches look OK to me, with exception of the review comments pointed out by Doug.

Regards,
Mike

Quoted 47 lines

Tested on a
- rk3066 Marsboard
- rk3188 Radxa Rock
- rk3288 Evaluation board

If applicable, a good split would be patch 6 in a pullable branch of the clock tree so that arm-soc can pull it in, patches 8-11 through arm-soc and the rest through the clock tree.

Heiko Stuebner (10):
clk: rockchip: fix rk3066 pll status register location
clk: rockchip: reparent aclk_cpu_pre to the gpll
clk: rockchip: make tightly bound armclk child-clocks read-only
clk: rockchip: add new clock-type for the cpuclk
clk: rockchip: add binding id for ARMCLK
clk: rockchip: switch to using the new cpuclk type for armclk
ARM: dts: rockchip: add operating points and armclk references
ARM: dts: rockchip: add cpu supplies to boards
ARM: rockchip: enable cpufreq-related options
ARM: rockchip: add a cpufreq-cpu0 device

Jianqun (1):
clk: rockchip: fix rk3288 pll status register location

 arch/arm/boot/dts/rk3066a-bqcurie2.dts        |   4 +
 arch/arm/boot/dts/rk3066a.dtsi                |  12 +-
 arch/arm/boot/dts/rk3188-radxarock.dts        |   6 +-
 arch/arm/boot/dts/rk3188.dtsi                 |  15 +-
 arch/arm/boot/dts/rk3288.dtsi                 |  17 +-
 arch/arm/mach-rockchip/Kconfig                |   2 +
 arch/arm/mach-rockchip/rockchip.c             |   7 +
 drivers/clk/rockchip/Makefile                 |   1 +
 drivers/clk/rockchip/clk-cpu.c                | 313 ++++++++++++++++++++++++++
 drivers/clk/rockchip/clk-rk3188.c             | 159 +++++++++++--
 drivers/clk/rockchip/clk-rk3288.c             |  86 ++++++-
 drivers/clk/rockchip/clk.c                    |  18 ++
 drivers/clk/rockchip/clk.h                    |  36 +++
 include/dt-bindings/clock/rk3188-cru-common.h |   1 +
 include/dt-bindings/clock/rk3288-cru.h        |   1 +
 15 files changed, 647 insertions(+), 31 deletions(-)
 create mode 100644 drivers/clk/rockchip/clk-cpu.c
Signature · 1 line
2.0.1