@@ -569,18 +569,22 @@ static const char *const rk3128_critical_clocks[] __initconst = {
569
569
"sclk_timer5" ,
570
570
};
571
571
572
- static struct rockchip_clk_provider * __init rk3128_common_clk_init (struct device_node * np )
572
+ static struct rockchip_clk_provider * __init rk3128_common_clk_init (struct device_node * np ,
573
+ unsigned long soc_nr_clks )
573
574
{
574
575
struct rockchip_clk_provider * ctx ;
576
+ unsigned long common_nr_clks ;
575
577
void __iomem * reg_base ;
576
578
579
+ common_nr_clks = rockchip_clk_find_max_clk_id (common_clk_branches ,
580
+ ARRAY_SIZE (common_clk_branches )) + 1 ;
577
581
reg_base = of_iomap (np , 0 );
578
582
if (!reg_base ) {
579
583
pr_err ("%s: could not map cru region\n" , __func__ );
580
584
return ERR_PTR (- ENOMEM );
581
585
}
582
586
583
- ctx = rockchip_clk_init (np , reg_base , CLK_NR_CLKS );
587
+ ctx = rockchip_clk_init (np , reg_base , max ( common_nr_clks , soc_nr_clks ) );
584
588
if (IS_ERR (ctx )) {
585
589
pr_err ("%s: rockchip clk init failed\n" , __func__ );
586
590
iounmap (reg_base );
@@ -609,8 +613,12 @@ static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device
609
613
static void __init rk3126_clk_init (struct device_node * np )
610
614
{
611
615
struct rockchip_clk_provider * ctx ;
616
+ unsigned long soc_nr_clks ;
612
617
613
- ctx = rk3128_common_clk_init (np );
618
+ soc_nr_clks = rockchip_clk_find_max_clk_id (rk3126_clk_branches ,
619
+ ARRAY_SIZE (rk3126_clk_branches )) + 1 ;
620
+
621
+ ctx = rk3128_common_clk_init (np , soc_nr_clks );
614
622
if (IS_ERR (ctx ))
615
623
return ;
616
624
@@ -627,8 +635,12 @@ CLK_OF_DECLARE(rk3126_cru, "rockchip,rk3126-cru", rk3126_clk_init);
627
635
static void __init rk3128_clk_init (struct device_node * np )
628
636
{
629
637
struct rockchip_clk_provider * ctx ;
638
+ unsigned long soc_nr_clks ;
639
+
640
+ soc_nr_clks = rockchip_clk_find_max_clk_id (rk3128_clk_branches ,
641
+ ARRAY_SIZE (rk3128_clk_branches )) + 1 ;
630
642
631
- ctx = rk3128_common_clk_init (np );
643
+ ctx = rk3128_common_clk_init (np , soc_nr_clks );
632
644
if (IS_ERR (ctx ))
633
645
return ;
634
646
0 commit comments