Skip to contentSkip to conversation

clk: rockchip: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage

PATCH Applied Johan Jonker 3 participants 12 messages Aug 26, 2024 – Aug 28, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover clk: rockchip: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage

In order to get rid of CLK_NR_CLKS and CLKPMU_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

Johan Jonker (9):
clk: rockchip: px30: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage
clk: rockchip: rk3036: Drop CLK_NR_CLKS usage
clk: rockchip: rk3228: Drop CLK_NR_CLKS usage
clk: rockchip: rk3288: Drop CLK_NR_CLKS usage
clk: rockchip: rk3308: Drop CLK_NR_CLKS usage
clk: rockchip: rk3328: Drop CLK_NR_CLKS usage
clk: rockchip: rk3368: Drop CLK_NR_CLKS usage
clk: rockchip: rk3399: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage
dt-bindings: clock: rockchip: remove CLK_NR_CLKS and CLKPMU_NR_CLKS

 drivers/clk/rockchip/clk-px30.c        | 10 ++++++++--
 drivers/clk/rockchip/clk-rk3036.c      |  5 ++++-
 drivers/clk/rockchip/clk-rk3228.c      |  5 ++++-
 drivers/clk/rockchip/clk-rk3288.c      |  5 ++++-
 drivers/clk/rockchip/clk-rk3308.c      |  5 ++++-
 drivers/clk/rockchip/clk-rk3328.c      |  5 ++++-
 drivers/clk/rockchip/clk-rk3368.c      |  5 ++++-
 drivers/clk/rockchip/clk-rk3399.c      | 10 ++++++++--
 include/dt-bindings/clock/px30-cru.h   |  4 ----
 include/dt-bindings/clock/rk3036-cru.h |  2 --
 include/dt-bindings/clock/rk3228-cru.h |  2 --
 include/dt-bindings/clock/rk3288-cru.h |  2 --
 include/dt-bindings/clock/rk3308-cru.h |  2 --
 include/dt-bindings/clock/rk3328-cru.h |  2 --
 include/dt-bindings/clock/rk3368-cru.h |  2 --
 include/dt-bindings/clock/rk3399-cru.h |  4 ----
 16 files changed, 40 insertions(+), 30 deletions(-)

--
2.39.2

#1 lore raw

PATCH 1/9 clk: rockchip: px30: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage

In order to get rid of CLK_NR_CLKS and CLKPMU_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

---
 drivers/clk/rockchip/clk-px30.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/clk/rockchip/clk-px30.c +8 -2
index b58619eb412b..caf7c0e6e479 100644
@@ -1002,6 +1002,7 @@ static const char *const px30_cru_critical_clocks[] __initconst = {
 static void __init px30_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clk_nr_clks;
 	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
@@ -1010,7 +1011,9 @@ static void __init px30_clk_init(struct device_node *np)
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
+	clk_nr_clks = rockchip_clk_find_max_clk_id(px30_clk_branches,
+						   ARRAY_SIZE(px30_clk_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip clk init failed\n", __func__);
 		iounmap(reg_base);
@@ -1043,6 +1046,7 @@ CLK_OF_DECLARE(px30_cru, "rockchip,px30-cru", px30_clk_init);
 static void __init px30_pmu_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clkpmu_nr_clks;
 	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
@@ -1051,7 +1055,9 @@ static void __init px30_pmu_clk_init(struct device_node *np)
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, reg_base, CLKPMU_NR_CLKS);
+	clkpmu_nr_clks = rockchip_clk_find_max_clk_id(px30_clk_pmu_branches,
+						      ARRAY_SIZE(px30_clk_pmu_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clkpmu_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip pmu clk init failed\n", __func__);
 		return;

--
2.39.2

#2 lore raw

PATCH 2/9 clk: rockchip: rk3036: Drop CLK_NR_CLKS usage

In reply to Johan Jonker

In order to get rid of CLK_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

---
 drivers/clk/rockchip/clk-rk3036.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3036.c +4 -1
index d644bc155ec6..d341ce0708aa 100644
@@ -436,6 +436,7 @@ static const char *const rk3036_critical_clocks[] __initconst = {
 static void __init rk3036_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clk_nr_clks;
 	void __iomem *reg_base;
 	struct clk *clk;
 
@@ -452,7 +453,9 @@ static void __init rk3036_clk_init(struct device_node *np)
 	writel_relaxed(HIWORD_UPDATE(0x2, 0x3, 10),
 		       reg_base + RK2928_CLKSEL_CON(13));
 
-	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
+	clk_nr_clks = rockchip_clk_find_max_clk_id(rk3036_clk_branches,
+						   ARRAY_SIZE(rk3036_clk_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip clk init failed\n", __func__);
 		iounmap(reg_base);

--
2.39.2

#3 lore raw

PATCH 3/9 clk: rockchip: rk3228: Drop CLK_NR_CLKS usage

In reply to Johan Jonker

In order to get rid of CLK_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

---
 drivers/clk/rockchip/clk-rk3228.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3228.c +4 -1
index 7343d2d7676b..ed602c27b624 100644
@@ -683,6 +683,7 @@ static const char *const rk3228_critical_clocks[] __initconst = {
 static void __init rk3228_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clk_nr_clks;
 	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
@@ -691,7 +692,9 @@ static void __init rk3228_clk_init(struct device_node *np)
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
+	clk_nr_clks = rockchip_clk_find_max_clk_id(rk3228_clk_branches,
+						   ARRAY_SIZE(rk3228_clk_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip clk init failed\n", __func__);
 		iounmap(reg_base);

--
2.39.2

#4 lore raw

PATCH 4/9 clk: rockchip: rk3288: Drop CLK_NR_CLKS usage

In reply to Johan Jonker

In order to get rid of CLK_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

---
 drivers/clk/rockchip/clk-rk3288.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3288.c +4 -1
index baa5aebd3277..90d329216064 100644
@@ -932,6 +932,7 @@ static void __init rk3288_common_init(struct device_node *np,
 				      enum rk3288_variant soc)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clk_nr_clks;
 
 	rk3288_cru_base = of_iomap(np, 0);
 	if (!rk3288_cru_base) {
@@ -939,7 +940,9 @@ static void __init rk3288_common_init(struct device_node *np,
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, rk3288_cru_base, CLK_NR_CLKS);
+	clk_nr_clks = rockchip_clk_find_max_clk_id(rk3288_clk_branches,
+						   ARRAY_SIZE(rk3288_clk_branches)) + 1;
+	ctx = rockchip_clk_init(np, rk3288_cru_base, clk_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip clk init failed\n", __func__);
 		iounmap(rk3288_cru_base);

--
2.39.2

#5 lore raw

PATCH 5/9 clk: rockchip: rk3308: Drop CLK_NR_CLKS usage

In reply to Johan Jonker

In order to get rid of CLK_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

---
 drivers/clk/rockchip/clk-rk3308.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3308.c +4 -1
index db3396c3e6e9..95a9512a41a3 100644
@@ -917,6 +917,7 @@ static const char *const rk3308_critical_clocks[] __initconst = {
 static void __init rk3308_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clk_nr_clks;
 	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
@@ -925,7 +926,9 @@ static void __init rk3308_clk_init(struct device_node *np)
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
+	clk_nr_clks = rockchip_clk_find_max_clk_id(rk3308_clk_branches,
+						   ARRAY_SIZE(rk3308_clk_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip clk init failed\n", __func__);
 		iounmap(reg_base);

--
2.39.2

#6 lore raw

PATCH 6/9 clk: rockchip: rk3328: Drop CLK_NR_CLKS usage

In reply to Johan Jonker

In order to get rid of CLK_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

---
 drivers/clk/rockchip/clk-rk3328.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3328.c +4 -1
index 267ab54937d3..3bb87b27b662 100644
@@ -881,6 +881,7 @@ static const char *const rk3328_critical_clocks[] __initconst = {
 static void __init rk3328_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clk_nr_clks;
 	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
@@ -889,7 +890,9 @@ static void __init rk3328_clk_init(struct device_node *np)
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
+	clk_nr_clks = rockchip_clk_find_max_clk_id(rk3328_clk_branches,
+						   ARRAY_SIZE(rk3328_clk_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip clk init failed\n", __func__);
 		iounmap(reg_base);

--
2.39.2

#7 lore raw

PATCH 7/9 clk: rockchip: rk3368: Drop CLK_NR_CLKS usage

In reply to Johan Jonker

In order to get rid of CLK_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

---
 drivers/clk/rockchip/clk-rk3368.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/rockchip/clk-rk3368.c +4 -1
index 2c50cc2cc6db..04391e4e2874 100644
@@ -866,6 +866,7 @@ static const char *const rk3368_critical_clocks[] __initconst = {
 static void __init rk3368_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clk_nr_clks;
 	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
@@ -874,7 +875,9 @@ static void __init rk3368_clk_init(struct device_node *np)
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
+	clk_nr_clks = rockchip_clk_find_max_clk_id(rk3368_clk_branches,
+						   ARRAY_SIZE(rk3368_clk_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip clk init failed\n", __func__);
 		iounmap(reg_base);

--
2.39.2

#8 lore raw

PATCH 8/9 clk: rockchip: rk3399: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage

In reply to Johan Jonker

In order to get rid of CLK_NR_CLKS and CLKPMU_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

---
 drivers/clk/rockchip/clk-rk3399.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/clk/rockchip/clk-rk3399.c +8 -2
index 4f1a5782c230..c2b243d7a5e2 100644
@@ -1531,6 +1531,7 @@ static const char *const rk3399_pmucru_critical_clocks[] __initconst = {
 static void __init rk3399_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clk_nr_clks;
 	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
@@ -1539,7 +1540,9 @@ static void __init rk3399_clk_init(struct device_node *np)
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
+	clk_nr_clks = rockchip_clk_find_max_clk_id(rk3399_clk_branches,
+						   ARRAY_SIZE(rk3399_clk_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip clk init failed\n", __func__);
 		iounmap(reg_base);
@@ -1577,6 +1580,7 @@ CLK_OF_DECLARE(rk3399_cru, "rockchip,rk3399-cru", rk3399_clk_init);
 static void __init rk3399_pmu_clk_init(struct device_node *np)
 {
 	struct rockchip_clk_provider *ctx;
+	unsigned long clkpmu_nr_clks;
 	void __iomem *reg_base;
 
 	reg_base = of_iomap(np, 0);
@@ -1585,7 +1589,9 @@ static void __init rk3399_pmu_clk_init(struct device_node *np)
 		return;
 	}
 
-	ctx = rockchip_clk_init(np, reg_base, CLKPMU_NR_CLKS);
+	clkpmu_nr_clks = rockchip_clk_find_max_clk_id(rk3399_clk_pmu_branches,
+						      ARRAY_SIZE(rk3399_clk_pmu_branches)) + 1;
+	ctx = rockchip_clk_init(np, reg_base, clkpmu_nr_clks);
 	if (IS_ERR(ctx)) {
 		pr_err("%s: rockchip pmu clk init failed\n", __func__);
 		iounmap(reg_base);

--
2.39.2

#9 lore raw

PATCH 9/9 dt-bindings: clock: rockchip: remove CLK_NR_CLKS and CLKPMU_NR_CLKS

In reply to Johan Jonker

CLK_NR_CLKS and CLKPMU_NR_CLKS should not be part of the binding. Remove since the kernel code no longer uses it.

---
 include/dt-bindings/clock/px30-cru.h   | 4 ----
 include/dt-bindings/clock/rk3036-cru.h | 2 --
 include/dt-bindings/clock/rk3228-cru.h | 2 --
 include/dt-bindings/clock/rk3288-cru.h | 2 --
 include/dt-bindings/clock/rk3308-cru.h | 2 --
 include/dt-bindings/clock/rk3328-cru.h | 2 --
 include/dt-bindings/clock/rk3368-cru.h | 2 --
 include/dt-bindings/clock/rk3399-cru.h | 4 ----
 8 files changed, 20 deletions(-)
include/dt-bindings/clock/px30-cru.h +0 -4
index 5b1416fcde6f..a2abf1995c34 100644
@@ -175,8 +175,6 @@
 #define PCLK_CIF		352
 #define PCLK_OTP_PHY		353
 
-#define CLK_NR_CLKS		(PCLK_OTP_PHY + 1)
-
 /* pmu-clocks indices */
 
 #define PLL_GPLL		1
@@ -195,8 +193,6 @@
 #define PCLK_GPIO0_PMU		20
 #define PCLK_UART0_PMU		21
 
-#define CLKPMU_NR_CLKS		(PCLK_UART0_PMU + 1)
-
 /* soft-reset indices */
 #define SRST_CORE0_PO		0
 #define SRST_CORE1_PO		1
include/dt-bindings/clock/rk3036-cru.h +0 -2
index a96a9870ad59..99cc617e1e54 100644
@@ -94,8 +94,6 @@
 #define HCLK_CPU		477
 #define HCLK_PERI		478
 
-#define CLK_NR_CLKS		(HCLK_PERI + 1)
-
 /* soft-reset indices */
 #define SRST_CORE0		0
 #define SRST_CORE1		1
include/dt-bindings/clock/rk3228-cru.h +0 -2
index de550ea56eeb..138b6ce514dd 100644
@@ -146,8 +146,6 @@
 #define HCLK_S_CRYPTO		477
 #define HCLK_PERI		478
 
-#define CLK_NR_CLKS		(HCLK_PERI + 1)
-
 /* soft-reset indices */
 #define SRST_CORE0_PO		0
 #define SRST_CORE1_PO		1
include/dt-bindings/clock/rk3288-cru.h +0 -2
index 33819acbfc56..c6034b01b050 100644
@@ -195,8 +195,6 @@
 #define HCLK_CPU		477
 #define HCLK_PERI		478
 
-#define CLK_NR_CLKS		(HCLK_PERI + 1)
-
 /* soft-reset indices */
 #define SRST_CORE0		0
 #define SRST_CORE1		1
include/dt-bindings/clock/rk3308-cru.h +0 -2
index d97840f9ee2e..ce4cd72b9d3d 100644
@@ -212,8 +212,6 @@
 #define PCLK_CAN		233
 #define PCLK_OWIRE		234
 
-#define CLK_NR_CLKS		(PCLK_OWIRE + 1)
-
 /* soft-reset indices */
 
 /* cru_softrst_con0 */
include/dt-bindings/clock/rk3328-cru.h +0 -2
index 555b4ff660ae..8885a2e98c65 100644
@@ -201,8 +201,6 @@
 #define HCLK_RGA		340
 #define HCLK_HDCP		341
 
-#define CLK_NR_CLKS		(HCLK_HDCP + 1)
-
 /* soft-reset indices */
 #define SRST_CORE0_PO		0
 #define SRST_CORE1_PO		1
include/dt-bindings/clock/rk3368-cru.h +0 -2
index 83c72a163fd3..ebae3cbf8192 100644
@@ -182,8 +182,6 @@
 #define HCLK_BUS		477
 #define HCLK_PERI		478
 
-#define CLK_NR_CLKS		(HCLK_PERI + 1)
-
 /* soft-reset indices */
 #define SRST_CORE_B0		0
 #define SRST_CORE_B1		1
include/dt-bindings/clock/rk3399-cru.h +0 -4
index 39169d94a44e..4c90c7703a83 100644
@@ -335,8 +335,6 @@
 #define HCLK_SDIO_NOC			495
 #define HCLK_SDIOAUDIO_NOC		496
 
-#define CLK_NR_CLKS			(HCLK_SDIOAUDIO_NOC + 1)
-
 /* pmu-clocks indices */
 
 #define PLL_PPLL			1
@@ -378,8 +376,6 @@
 #define PCLK_INTR_ARB_PMU		49
 #define HCLK_NOC_PMU			50
 
-#define CLKPMU_NR_CLKS			(HCLK_NOC_PMU + 1)
-
 /* soft-reset indices */
 
 /* cru_softrst_con0 */

--
2.39.2

maintainer Applied
#11 lore raw
In reply to Johan Jonker
Quoted 16 lines · Johan Jonker

In order to get rid of CLK_NR_CLKS and CLKPMU_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id.

Johan Jonker (9):
clk: rockchip: px30: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage
clk: rockchip: rk3036: Drop CLK_NR_CLKS usage
clk: rockchip: rk3228: Drop CLK_NR_CLKS usage
clk: rockchip: rk3288: Drop CLK_NR_CLKS usage
clk: rockchip: rk3308: Drop CLK_NR_CLKS usage
clk: rockchip: rk3328: Drop CLK_NR_CLKS usage
clk: rockchip: rk3368: Drop CLK_NR_CLKS usage
clk: rockchip: rk3399: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage
dt-bindings: clock: rockchip: remove CLK_NR_CLKS and CLKPMU_NR_CLKS

Quoted 1 line

[...]

Applied, thanks!

[1/9] clk: rockchip: px30: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage

      commit: 2496910c84a4bd1aa2c10fe57cf4ae1cbcab17f4
[2/9] clk: rockchip: rk3036: Drop CLK_NR_CLKS usage
      commit: ec4f4261c315d9bc30bb1bb8c3bb17cbaebe7741
[3/9] clk: rockchip: rk3228: Drop CLK_NR_CLKS usage
      commit: 819b2e19a9f7dc9e84a00e2f6da2b2f15a01cee6
[4/9] clk: rockchip: rk3288: Drop CLK_NR_CLKS usage
      commit: 545b1313c5a24eed0e4d34554c715b46686251ff
[5/9] clk: rockchip: rk3308: Drop CLK_NR_CLKS usage
      commit: 31fe14956883bc09846ce239993e215330218a6f
[6/9] clk: rockchip: rk3328: Drop CLK_NR_CLKS usage
      commit: 0758fe99bc969294c2391de145b67c1223c7b104
[7/9] clk: rockchip: rk3368: Drop CLK_NR_CLKS usage
      commit: 41563197e7f2a0b449476bbbe931cb2806e84966
[8/9] clk: rockchip: rk3399: Drop CLK_NR_CLKS CLKPMU_NR_CLKS usage
      commit: 1a229868852ffe1d59f6bdad1e473d9d5f9e14bb
[9/9] dt-bindings: clock: rockchip: remove CLK_NR_CLKS and CLKPMU_NR_CLKS
      commit: fb234516c5a0728d7dbd718667c33c1523b55fe8

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>