Skip to content

Commit 0fa0498

Browse files
committed
Merge branch 'v6.9-shared/clkids' into v6.9-clk/next
2 parents b324435 + c81798c commit 0fa0498

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

drivers/clk/rockchip/clk-rk3588.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2458,15 +2458,18 @@ static struct rockchip_clk_branch rk3588_clk_branches[] __initdata = {
24582458
static void __init rk3588_clk_init(struct device_node *np)
24592459
{
24602460
struct rockchip_clk_provider *ctx;
2461+
unsigned long clk_nr_clks;
24612462
void __iomem *reg_base;
24622463

2464+
clk_nr_clks = rockchip_clk_find_max_clk_id(rk3588_clk_branches,
2465+
ARRAY_SIZE(rk3588_clk_branches)) + 1;
24632466
reg_base = of_iomap(np, 0);
24642467
if (!reg_base) {
24652468
pr_err("%s: could not map cru region\n", __func__);
24662469
return;
24672470
}
24682471

2469-
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
2472+
ctx = rockchip_clk_init(np, reg_base, clk_nr_clks);
24702473
if (IS_ERR(ctx)) {
24712474
pr_err("%s: rockchip clk init failed\n", __func__);
24722475
iounmap(reg_base);

drivers/clk/rockchip/clk.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,23 @@ void rockchip_clk_register_plls(struct rockchip_clk_provider *ctx,
429429
}
430430
EXPORT_SYMBOL_GPL(rockchip_clk_register_plls);
431431

432+
unsigned long rockchip_clk_find_max_clk_id(struct rockchip_clk_branch *list,
433+
unsigned int nr_clk)
434+
{
435+
unsigned long max = 0;
436+
unsigned int idx;
437+
438+
for (idx = 0; idx < nr_clk; idx++, list++) {
439+
if (list->id > max)
440+
max = list->id;
441+
if (list->child && list->child->id > max)
442+
max = list->id;
443+
}
444+
445+
return max;
446+
}
447+
EXPORT_SYMBOL_GPL(rockchip_clk_find_max_clk_id);
448+
432449
void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
433450
struct rockchip_clk_branch *list,
434451
unsigned int nr_clk)

drivers/clk/rockchip/clk.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,8 @@ struct rockchip_clk_provider *rockchip_clk_init(struct device_node *np,
973973
void __iomem *base, unsigned long nr_clks);
974974
void rockchip_clk_of_add_provider(struct device_node *np,
975975
struct rockchip_clk_provider *ctx);
976+
unsigned long rockchip_clk_find_max_clk_id(struct rockchip_clk_branch *list,
977+
unsigned int nr_clk);
976978
void rockchip_clk_register_branches(struct rockchip_clk_provider *ctx,
977979
struct rockchip_clk_branch *list,
978980
unsigned int nr_clk);

include/dt-bindings/clock/rockchip,rk3588-cru.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,8 +733,7 @@
733733
#define ACLK_AV1_PRE 718
734734
#define PCLK_AV1_PRE 719
735735
#define HCLK_SDIO_PRE 720
736-
737-
#define CLK_NR_CLKS (HCLK_SDIO_PRE + 1)
736+
#define PCLK_VO1GRF 721
738737

739738
/* scmi-clocks indices */
740739

0 commit comments

Comments
 (0)