@@ -66,6 +66,16 @@ struct clkgen_quadfs_data {
6666 unsigned long * );
6767};
6868
69+ struct clkgen_clk_out {
70+ const char * name ;
71+ unsigned long flags ;
72+ };
73+
74+ struct clkgen_quadfs_data_clks {
75+ struct clkgen_quadfs_data * data ;
76+ const struct clkgen_clk_out * outputs ;
77+ };
78+
6979static const struct clk_ops st_quadfs_pll_c32_ops ;
7080
7181static int clk_fs660c32_dig_get_params (unsigned long input ,
@@ -115,6 +125,18 @@ static const struct clkgen_quadfs_data st_fs660c32_C = {
115125 .get_rate = clk_fs660c32_dig_get_rate ,
116126};
117127
128+ static const struct clkgen_clk_out st_fs660c32_C_clks [] = {
129+ { .name = "clk-s-c0-fs0-ch0" , },
130+ { .name = "clk-s-c0-fs0-ch1" , },
131+ { .name = "clk-s-c0-fs0-ch2" , },
132+ { .name = "clk-s-c0-fs0-ch3" , },
133+ };
134+
135+ static const struct clkgen_quadfs_data_clks st_fs660c32_C_data = {
136+ .data = (struct clkgen_quadfs_data * )& st_fs660c32_C ,
137+ .outputs = st_fs660c32_C_clks ,
138+ };
139+
118140static const struct clkgen_quadfs_data st_fs660c32_D = {
119141 .nrst_present = true,
120142 .nrst = { CLKGEN_FIELD (0x2a0 , 0x1 , 0 ),
@@ -156,6 +178,46 @@ static const struct clkgen_quadfs_data st_fs660c32_D = {
156178 .get_params = clk_fs660c32_dig_get_params ,
157179 .get_rate = clk_fs660c32_dig_get_rate ,};
158180
181+ static const struct clkgen_quadfs_data_clks st_fs660c32_D_data = {
182+ .data = (struct clkgen_quadfs_data * )& st_fs660c32_D ,
183+ };
184+
185+ static const struct clkgen_clk_out st_fs660c32_D0_clks [] = {
186+ { .name = "clk-s-d0-fs0-ch0" , },
187+ { .name = "clk-s-d0-fs0-ch1" , },
188+ { .name = "clk-s-d0-fs0-ch2" , },
189+ { .name = "clk-s-d0-fs0-ch3" , },
190+ };
191+
192+ static const struct clkgen_quadfs_data_clks st_fs660c32_D0_data = {
193+ .data = (struct clkgen_quadfs_data * )& st_fs660c32_D ,
194+ .outputs = st_fs660c32_D0_clks ,
195+ };
196+
197+ static const struct clkgen_clk_out st_fs660c32_D2_clks [] = {
198+ { .name = "clk-s-d2-fs0-ch0" , },
199+ { .name = "clk-s-d2-fs0-ch1" , },
200+ { .name = "clk-s-d2-fs0-ch2" , },
201+ { .name = "clk-s-d2-fs0-ch3" , },
202+ };
203+
204+ static const struct clkgen_quadfs_data_clks st_fs660c32_D2_data = {
205+ .data = (struct clkgen_quadfs_data * )& st_fs660c32_D ,
206+ .outputs = st_fs660c32_D2_clks ,
207+ };
208+
209+ static const struct clkgen_clk_out st_fs660c32_D3_clks [] = {
210+ { .name = "clk-s-d3-fs0-ch0" , },
211+ { .name = "clk-s-d3-fs0-ch1" , },
212+ { .name = "clk-s-d3-fs0-ch2" , },
213+ { .name = "clk-s-d3-fs0-ch3" , },
214+ };
215+
216+ static const struct clkgen_quadfs_data_clks st_fs660c32_D3_data = {
217+ .data = (struct clkgen_quadfs_data * )& st_fs660c32_D ,
218+ .outputs = st_fs660c32_D3_clks ,
219+ };
220+
159221/**
160222 * DOC: A Frequency Synthesizer that multiples its input clock by a fixed factor
161223 *
@@ -857,7 +919,7 @@ static struct clk * __init st_clk_register_quadfs_fsynth(
857919
858920static void __init st_of_create_quadfs_fsynths (
859921 struct device_node * np , const char * pll_name ,
860- struct clkgen_quadfs_data * quadfs , void __iomem * reg ,
922+ struct clkgen_quadfs_data_clks * quadfs , void __iomem * reg ,
861923 spinlock_t * lock )
862924{
863925 struct clk_onecell_data * clk_data ;
@@ -881,9 +943,15 @@ static void __init st_of_create_quadfs_fsynths(
881943 const char * clk_name ;
882944 unsigned long flags = 0 ;
883945
884- if (of_property_read_string_index (np , "clock-output-names" ,
885- fschan , & clk_name )) {
886- break ;
946+ if (quadfs -> outputs ) {
947+ clk_name = quadfs -> outputs [fschan ].name ;
948+ flags = quadfs -> outputs [fschan ].flags ;
949+ } else {
950+ if (of_property_read_string_index (np ,
951+ "clock-output-names" ,
952+ fschan , & clk_name ))
953+ break ;
954+ of_clk_detect_critical (np , fschan , & flags );
887955 }
888956
889957 /*
@@ -892,10 +960,8 @@ static void __init st_of_create_quadfs_fsynths(
892960 if (* clk_name == '\0' )
893961 continue ;
894962
895- of_clk_detect_critical (np , fschan , & flags );
896-
897963 clk = st_clk_register_quadfs_fsynth (clk_name , pll_name ,
898- quadfs , reg , fschan ,
964+ quadfs -> data , reg , fschan ,
899965 flags , lock );
900966
901967 /*
@@ -915,7 +981,7 @@ static void __init st_of_create_quadfs_fsynths(
915981}
916982
917983static void __init st_of_quadfs_setup (struct device_node * np ,
918- struct clkgen_quadfs_data * data )
984+ struct clkgen_quadfs_data_clks * datac )
919985{
920986 struct clk * clk ;
921987 const char * pll_name , * clk_parent_name ;
@@ -940,7 +1006,7 @@ static void __init st_of_quadfs_setup(struct device_node *np,
9401006
9411007 spin_lock_init (lock );
9421008
943- clk = st_clk_register_quadfs_pll (pll_name , clk_parent_name , data ,
1009+ clk = st_clk_register_quadfs_pll (pll_name , clk_parent_name , datac -> data ,
9441010 reg , lock );
9451011 if (IS_ERR (clk ))
9461012 goto err_exit ;
@@ -950,20 +1016,43 @@ static void __init st_of_quadfs_setup(struct device_node *np,
9501016 __clk_get_name (clk_get_parent (clk )),
9511017 (unsigned int )clk_get_rate (clk ));
9521018
953- st_of_create_quadfs_fsynths (np , pll_name , data , reg , lock );
1019+ st_of_create_quadfs_fsynths (np , pll_name , datac , reg , lock );
9541020
9551021err_exit :
9561022 kfree (pll_name ); /* No longer need local copy of the PLL name */
9571023}
9581024
9591025static void __init st_of_quadfs660C_setup (struct device_node * np )
9601026{
961- st_of_quadfs_setup (np , (struct clkgen_quadfs_data * ) & st_fs660c32_C );
1027+ st_of_quadfs_setup (np ,
1028+ (struct clkgen_quadfs_data_clks * ) & st_fs660c32_C_data );
9621029}
9631030CLK_OF_DECLARE (quadfs660C , "st,quadfs-pll" , st_of_quadfs660C_setup );
9641031
9651032static void __init st_of_quadfs660D_setup (struct device_node * np )
9661033{
967- st_of_quadfs_setup (np , (struct clkgen_quadfs_data * ) & st_fs660c32_D );
1034+ st_of_quadfs_setup (np ,
1035+ (struct clkgen_quadfs_data_clks * ) & st_fs660c32_D_data );
9681036}
9691037CLK_OF_DECLARE (quadfs660D , "st,quadfs" , st_of_quadfs660D_setup );
1038+
1039+ static void __init st_of_quadfs660D0_setup (struct device_node * np )
1040+ {
1041+ st_of_quadfs_setup (np ,
1042+ (struct clkgen_quadfs_data_clks * ) & st_fs660c32_D0_data );
1043+ }
1044+ CLK_OF_DECLARE (quadfs660D0 , "st,quadfs-d0" , st_of_quadfs660D0_setup );
1045+
1046+ static void __init st_of_quadfs660D2_setup (struct device_node * np )
1047+ {
1048+ st_of_quadfs_setup (np ,
1049+ (struct clkgen_quadfs_data_clks * ) & st_fs660c32_D2_data );
1050+ }
1051+ CLK_OF_DECLARE (quadfs660D2 , "st,quadfs-d2" , st_of_quadfs660D2_setup );
1052+
1053+ static void __init st_of_quadfs660D3_setup (struct device_node * np )
1054+ {
1055+ st_of_quadfs_setup (np ,
1056+ (struct clkgen_quadfs_data_clks * ) & st_fs660c32_D3_data );
1057+ }
1058+ CLK_OF_DECLARE (quadfs660D3 , "st,quadfs-d3" , st_of_quadfs660D3_setup );
0 commit comments