@@ -66,6 +66,16 @@ struct clkgen_quadfs_data {
66
66
unsigned long * );
67
67
};
68
68
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
+
69
79
static const struct clk_ops st_quadfs_pll_c32_ops ;
70
80
71
81
static int clk_fs660c32_dig_get_params (unsigned long input ,
@@ -115,6 +125,18 @@ static const struct clkgen_quadfs_data st_fs660c32_C = {
115
125
.get_rate = clk_fs660c32_dig_get_rate ,
116
126
};
117
127
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
+
118
140
static const struct clkgen_quadfs_data st_fs660c32_D = {
119
141
.nrst_present = true,
120
142
.nrst = { CLKGEN_FIELD (0x2a0 , 0x1 , 0 ),
@@ -156,6 +178,46 @@ static const struct clkgen_quadfs_data st_fs660c32_D = {
156
178
.get_params = clk_fs660c32_dig_get_params ,
157
179
.get_rate = clk_fs660c32_dig_get_rate ,};
158
180
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
+
159
221
/**
160
222
* DOC: A Frequency Synthesizer that multiples its input clock by a fixed factor
161
223
*
@@ -857,7 +919,7 @@ static struct clk * __init st_clk_register_quadfs_fsynth(
857
919
858
920
static void __init st_of_create_quadfs_fsynths (
859
921
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 ,
861
923
spinlock_t * lock )
862
924
{
863
925
struct clk_onecell_data * clk_data ;
@@ -881,9 +943,15 @@ static void __init st_of_create_quadfs_fsynths(
881
943
const char * clk_name ;
882
944
unsigned long flags = 0 ;
883
945
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 );
887
955
}
888
956
889
957
/*
@@ -892,10 +960,8 @@ static void __init st_of_create_quadfs_fsynths(
892
960
if (* clk_name == '\0' )
893
961
continue ;
894
962
895
- of_clk_detect_critical (np , fschan , & flags );
896
-
897
963
clk = st_clk_register_quadfs_fsynth (clk_name , pll_name ,
898
- quadfs , reg , fschan ,
964
+ quadfs -> data , reg , fschan ,
899
965
flags , lock );
900
966
901
967
/*
@@ -915,7 +981,7 @@ static void __init st_of_create_quadfs_fsynths(
915
981
}
916
982
917
983
static void __init st_of_quadfs_setup (struct device_node * np ,
918
- struct clkgen_quadfs_data * data )
984
+ struct clkgen_quadfs_data_clks * datac )
919
985
{
920
986
struct clk * clk ;
921
987
const char * pll_name , * clk_parent_name ;
@@ -940,7 +1006,7 @@ static void __init st_of_quadfs_setup(struct device_node *np,
940
1006
941
1007
spin_lock_init (lock );
942
1008
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 ,
944
1010
reg , lock );
945
1011
if (IS_ERR (clk ))
946
1012
goto err_exit ;
@@ -950,20 +1016,43 @@ static void __init st_of_quadfs_setup(struct device_node *np,
950
1016
__clk_get_name (clk_get_parent (clk )),
951
1017
(unsigned int )clk_get_rate (clk ));
952
1018
953
- st_of_create_quadfs_fsynths (np , pll_name , data , reg , lock );
1019
+ st_of_create_quadfs_fsynths (np , pll_name , datac , reg , lock );
954
1020
955
1021
err_exit :
956
1022
kfree (pll_name ); /* No longer need local copy of the PLL name */
957
1023
}
958
1024
959
1025
static void __init st_of_quadfs660C_setup (struct device_node * np )
960
1026
{
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 );
962
1029
}
963
1030
CLK_OF_DECLARE (quadfs660C , "st,quadfs-pll" , st_of_quadfs660C_setup );
964
1031
965
1032
static void __init st_of_quadfs660D_setup (struct device_node * np )
966
1033
{
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 );
968
1036
}
969
1037
CLK_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