Skip to content

Commit 1a22986

Browse files
Johan Jonkermmind
authored andcommitted
clk: rockchip: rk3399: 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. Signed-off-by: Johan Jonker <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Stuebner <[email protected]>
1 parent 4156319 commit 1a22986

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/clk/rockchip/clk-rk3399.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,7 @@ static const char *const rk3399_pmucru_critical_clocks[] __initconst = {
15311531
static void __init rk3399_clk_init(struct device_node *np)
15321532
{
15331533
struct rockchip_clk_provider *ctx;
1534+
unsigned long clk_nr_clks;
15341535
void __iomem *reg_base;
15351536

15361537
reg_base = of_iomap(np, 0);
@@ -1539,7 +1540,9 @@ static void __init rk3399_clk_init(struct device_node *np)
15391540
return;
15401541
}
15411542

1542-
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
1543+
clk_nr_clks = rockchip_clk_find_max_clk_id(rk3399_clk_branches,
1544+
ARRAY_SIZE(rk3399_clk_branches)) + 1;
1545+
ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
15431546
if (IS_ERR(ctx)) {
15441547
pr_err("%s: rockchip clk init failed\n", __func__);
15451548
iounmap(reg_base);
@@ -1577,6 +1580,7 @@ CLK_OF_DECLARE(rk3399_cru, "rockchip,rk3399-cru", rk3399_clk_init);
15771580
static void __init rk3399_pmu_clk_init(struct device_node *np)
15781581
{
15791582
struct rockchip_clk_provider *ctx;
1583+
unsigned long clkpmu_nr_clks;
15801584
void __iomem *reg_base;
15811585

15821586
reg_base = of_iomap(np, 0);
@@ -1585,7 +1589,9 @@ static void __init rk3399_pmu_clk_init(struct device_node *np)
15851589
return;
15861590
}
15871591

1588-
ctx = rockchip_clk_init(np, reg_base, CLKPMU_NR_CLKS);
1592+
clkpmu_nr_clks = rockchip_clk_find_max_clk_id(rk3399_clk_pmu_branches,
1593+
ARRAY_SIZE(rk3399_clk_pmu_branches)) + 1;
1594+
ctx = rockchip_clk_init(np, reg_base, clkpmu_nr_clks);
15891595
if (IS_ERR(ctx)) {
15901596
pr_err("%s: rockchip pmu clk init failed\n", __func__);
15911597
iounmap(reg_base);

0 commit comments

Comments
 (0)