@@ -757,9 +757,11 @@ static const char *const rk3188_critical_clocks[] __initconst = {
757757 "sclk_mac_lbtest" ,
758758};
759759
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 )
761762{
762763 struct rockchip_clk_provider * ctx ;
764+ unsigned long common_nr_clks ;
763765 void __iomem * reg_base ;
764766
765767 reg_base = of_iomap (np , 0 );
@@ -768,7 +770,9 @@ static struct rockchip_clk_provider *__init rk3188_common_clk_init(struct device
768770 return ERR_PTR (- ENOMEM );
769771 }
770772
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 ));
772776 if (IS_ERR (ctx )) {
773777 pr_err ("%s: rockchip clk init failed\n" , __func__ );
774778 iounmap (reg_base );
@@ -789,8 +793,11 @@ static struct rockchip_clk_provider *__init rk3188_common_clk_init(struct device
789793static void __init rk3066a_clk_init (struct device_node * np )
790794{
791795 struct rockchip_clk_provider * ctx ;
796+ unsigned long soc_nr_clks ;
792797
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 );
794801 if (IS_ERR (ctx ))
795802 return ;
796803
@@ -812,11 +819,14 @@ CLK_OF_DECLARE(rk3066a_cru, "rockchip,rk3066a-cru", rk3066a_clk_init);
812819static void __init rk3188a_clk_init (struct device_node * np )
813820{
814821 struct rockchip_clk_provider * ctx ;
822+ unsigned long soc_nr_clks ;
815823 struct clk * clk1 , * clk2 ;
816824 unsigned long rate ;
817825 int ret ;
818826
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 );
820830 if (IS_ERR (ctx ))
821831 return ;
822832
0 commit comments