@@ -526,7 +526,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = {
526526 GATE (PCLK_ACODEC , "pclk_acodec" , "pclk_cpu" , 0 , RK2928_CLKGATE_CON (5 ), 14 , GFLAGS ),
527527 GATE (0 , "pclk_ddrupctl" , "pclk_cpu" , CLK_IGNORE_UNUSED , RK2928_CLKGATE_CON (5 ), 7 , GFLAGS ),
528528 GATE (0 , "pclk_grf" , "pclk_cpu" , CLK_IGNORE_UNUSED , RK2928_CLKGATE_CON (5 ), 4 , GFLAGS ),
529- GATE (0 , "pclk_mipiphy" , "pclk_cpu" , CLK_IGNORE_UNUSED , RK2928_CLKGATE_CON (5 ), 0 , GFLAGS ),
529+ GATE (PCLK_MIPIPHY , "pclk_mipiphy" , "pclk_cpu" , 0 , RK2928_CLKGATE_CON (5 ), 0 , GFLAGS ),
530530
531531 GATE (0 , "pclk_pmu" , "pclk_pmu_pre" , 0 , RK2928_CLKGATE_CON (9 ), 2 , GFLAGS ),
532532 GATE (0 , "pclk_pmu_niu" , "pclk_pmu_pre" , CLK_IGNORE_UNUSED , RK2928_CLKGATE_CON (9 ), 3 , GFLAGS ),
@@ -553,6 +553,7 @@ static struct rockchip_clk_branch rk3128_clk_branches[] __initdata = {
553553 RK2928_CLKSEL_CON (11 ), 14 , 2 , MFLAGS , 8 , 5 , DFLAGS ,
554554 RK2928_CLKGATE_CON (3 ), 15 , GFLAGS ),
555555
556+ GATE (HCLK_SFC , "hclk_sfc" , "hclk_peri" , 0 , RK2928_CLKGATE_CON (7 ), 1 , GFLAGS ),
556557 GATE (HCLK_GPS , "hclk_gps" , "aclk_peri" , 0 , RK2928_CLKGATE_CON (3 ), 14 , GFLAGS ),
557558 GATE (PCLK_HDMI , "pclk_hdmi" , "pclk_cpu" , 0 , RK2928_CLKGATE_CON (3 ), 8 , GFLAGS ),
558559};
@@ -563,23 +564,28 @@ static const char *const rk3128_critical_clocks[] __initconst = {
563564 "pclk_cpu" ,
564565 "aclk_peri" ,
565566 "hclk_peri" ,
567+ "hclk_vio_h2p" ,
566568 "pclk_peri" ,
567569 "pclk_pmu" ,
568570 "sclk_timer5" ,
569571};
570572
571- static struct rockchip_clk_provider * __init rk3128_common_clk_init (struct device_node * np )
573+ static struct rockchip_clk_provider * __init rk3128_common_clk_init (struct device_node * np ,
574+ unsigned long soc_nr_clks )
572575{
573576 struct rockchip_clk_provider * ctx ;
577+ unsigned long common_nr_clks ;
574578 void __iomem * reg_base ;
575579
580+ common_nr_clks = rockchip_clk_find_max_clk_id (common_clk_branches ,
581+ ARRAY_SIZE (common_clk_branches )) + 1 ;
576582 reg_base = of_iomap (np , 0 );
577583 if (!reg_base ) {
578584 pr_err ("%s: could not map cru region\n" , __func__ );
579585 return ERR_PTR (- ENOMEM );
580586 }
581587
582- ctx = rockchip_clk_init (np , reg_base , CLK_NR_CLKS );
588+ ctx = rockchip_clk_init (np , reg_base , max ( common_nr_clks , soc_nr_clks ) );
583589 if (IS_ERR (ctx )) {
584590 pr_err ("%s: rockchip clk init failed\n" , __func__ );
585591 iounmap (reg_base );
@@ -608,8 +614,12 @@ static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device
608614static void __init rk3126_clk_init (struct device_node * np )
609615{
610616 struct rockchip_clk_provider * ctx ;
617+ unsigned long soc_nr_clks ;
611618
612- ctx = rk3128_common_clk_init (np );
619+ soc_nr_clks = rockchip_clk_find_max_clk_id (rk3126_clk_branches ,
620+ ARRAY_SIZE (rk3126_clk_branches )) + 1 ;
621+
622+ ctx = rk3128_common_clk_init (np , soc_nr_clks );
613623 if (IS_ERR (ctx ))
614624 return ;
615625
@@ -626,8 +636,12 @@ CLK_OF_DECLARE(rk3126_cru, "rockchip,rk3126-cru", rk3126_clk_init);
626636static void __init rk3128_clk_init (struct device_node * np )
627637{
628638 struct rockchip_clk_provider * ctx ;
639+ unsigned long soc_nr_clks ;
640+
641+ soc_nr_clks = rockchip_clk_find_max_clk_id (rk3128_clk_branches ,
642+ ARRAY_SIZE (rk3128_clk_branches )) + 1 ;
629643
630- ctx = rk3128_common_clk_init (np );
644+ ctx = rk3128_common_clk_init (np , soc_nr_clks );
631645 if (IS_ERR (ctx ))
632646 return ;
633647
0 commit comments