@@ -757,9 +757,11 @@ static const char *const rk3188_critical_clocks[] __initconst = {
757
757
"sclk_mac_lbtest" ,
758
758
};
759
759
760
- static struct rockchip_clk_provider * __init rk3188_common_clk_init (struct device_node * np )
760
+ static struct rockchip_clk_provider * __init rk3188_common_clk_init (struct device_node * np ,
761
+ unsigned long soc_nr_clks )
761
762
{
762
763
struct rockchip_clk_provider * ctx ;
764
+ unsigned long common_nr_clks ;
763
765
void __iomem * reg_base ;
764
766
765
767
reg_base = of_iomap (np , 0 );
@@ -768,7 +770,9 @@ static struct rockchip_clk_provider *__init rk3188_common_clk_init(struct device
768
770
return ERR_PTR (- ENOMEM );
769
771
}
770
772
771
- ctx = rockchip_clk_init (np , reg_base , CLK_NR_CLKS );
773
+ common_nr_clks = rockchip_clk_find_max_clk_id (common_clk_branches ,
774
+ ARRAY_SIZE (common_clk_branches )) + 1 ;
775
+ ctx = rockchip_clk_init (np , reg_base , max (common_nr_clks , soc_nr_clks ));
772
776
if (IS_ERR (ctx )) {
773
777
pr_err ("%s: rockchip clk init failed\n" , __func__ );
774
778
iounmap (reg_base );
@@ -789,8 +793,11 @@ static struct rockchip_clk_provider *__init rk3188_common_clk_init(struct device
789
793
static void __init rk3066a_clk_init (struct device_node * np )
790
794
{
791
795
struct rockchip_clk_provider * ctx ;
796
+ unsigned long soc_nr_clks ;
792
797
793
- ctx = rk3188_common_clk_init (np );
798
+ soc_nr_clks = rockchip_clk_find_max_clk_id (rk3066a_clk_branches ,
799
+ ARRAY_SIZE (rk3066a_clk_branches )) + 1 ;
800
+ ctx = rk3188_common_clk_init (np , soc_nr_clks );
794
801
if (IS_ERR (ctx ))
795
802
return ;
796
803
@@ -812,11 +819,14 @@ CLK_OF_DECLARE(rk3066a_cru, "rockchip,rk3066a-cru", rk3066a_clk_init);
812
819
static void __init rk3188a_clk_init (struct device_node * np )
813
820
{
814
821
struct rockchip_clk_provider * ctx ;
822
+ unsigned long soc_nr_clks ;
815
823
struct clk * clk1 , * clk2 ;
816
824
unsigned long rate ;
817
825
int ret ;
818
826
819
- ctx = rk3188_common_clk_init (np );
827
+ soc_nr_clks = rockchip_clk_find_max_clk_id (rk3188_clk_branches ,
828
+ ARRAY_SIZE (rk3188_clk_branches )) + 1 ;
829
+ ctx = rk3188_common_clk_init (np , soc_nr_clks );
820
830
if (IS_ERR (ctx ))
821
831
return ;
822
832
0 commit comments