122122#define VC5_GLOBAL_REGISTER 0x76
123123#define VC5_GLOBAL_REGISTER_GLOBAL_RESET BIT(5)
124124
125- /* PLL/ VCO runs between 2.5 GHz and 3.0 GHz */
125+ /* The minimum VCO frequency is 2.5 GHz. The maximum is variant specific. */
126126#define VC5_PLL_VCO_MIN 2500000000UL
127- #define VC5_PLL_VCO_MAX 3000000000UL
128127
129128/* VC5 Input mux settings */
130129#define VC5_MUX_IN_XIN BIT(0)
@@ -150,6 +149,7 @@ enum vc5_model {
150149 IDT_VC5_5P49V5925 ,
151150 IDT_VC5_5P49V5933 ,
152151 IDT_VC5_5P49V5935 ,
152+ IDT_VC6_5P49V60 ,
153153 IDT_VC6_5P49V6901 ,
154154 IDT_VC6_5P49V6965 ,
155155 IDT_VC6_5P49V6975 ,
@@ -161,6 +161,7 @@ struct vc5_chip_info {
161161 const unsigned int clk_fod_cnt ;
162162 const unsigned int clk_out_cnt ;
163163 const u32 flags ;
164+ const unsigned long vco_max ;
164165};
165166
166167struct vc5_driver_data ;
@@ -446,13 +447,11 @@ static long vc5_pll_round_rate(struct clk_hw *hw, unsigned long rate,
446447 unsigned long * parent_rate )
447448{
448449 struct vc5_hw_data * hwdata = container_of (hw , struct vc5_hw_data , hw );
450+ struct vc5_driver_data * vc5 = hwdata -> vc5 ;
449451 u32 div_int ;
450452 u64 div_frc ;
451453
452- if (rate < VC5_PLL_VCO_MIN )
453- rate = VC5_PLL_VCO_MIN ;
454- if (rate > VC5_PLL_VCO_MAX )
455- rate = VC5_PLL_VCO_MAX ;
454+ rate = clamp (rate , VC5_PLL_VCO_MIN , vc5 -> chip_info -> vco_max );
456455
457456 /* Determine integer part, which is 12 bit wide */
458457 div_int = rate / * parent_rate ;
@@ -1212,55 +1211,71 @@ static const struct vc5_chip_info idt_5p49v5923_info = {
12121211 .clk_fod_cnt = 2 ,
12131212 .clk_out_cnt = 3 ,
12141213 .flags = 0 ,
1214+ .vco_max = 3000000000UL ,
12151215};
12161216
12171217static const struct vc5_chip_info idt_5p49v5925_info = {
12181218 .model = IDT_VC5_5P49V5925 ,
12191219 .clk_fod_cnt = 4 ,
12201220 .clk_out_cnt = 5 ,
12211221 .flags = 0 ,
1222+ .vco_max = 3000000000UL ,
12221223};
12231224
12241225static const struct vc5_chip_info idt_5p49v5933_info = {
12251226 .model = IDT_VC5_5P49V5933 ,
12261227 .clk_fod_cnt = 2 ,
12271228 .clk_out_cnt = 3 ,
12281229 .flags = VC5_HAS_INTERNAL_XTAL ,
1230+ .vco_max = 3000000000UL ,
12291231};
12301232
12311233static const struct vc5_chip_info idt_5p49v5935_info = {
12321234 .model = IDT_VC5_5P49V5935 ,
12331235 .clk_fod_cnt = 4 ,
12341236 .clk_out_cnt = 5 ,
12351237 .flags = VC5_HAS_INTERNAL_XTAL ,
1238+ .vco_max = 3000000000UL ,
1239+ };
1240+
1241+ static const struct vc5_chip_info idt_5p49v60_info = {
1242+ .model = IDT_VC6_5P49V60 ,
1243+ .clk_fod_cnt = 4 ,
1244+ .clk_out_cnt = 5 ,
1245+ .flags = VC5_HAS_PFD_FREQ_DBL | VC5_HAS_BYPASS_SYNC_BIT ,
1246+ .vco_max = 2700000000UL ,
12361247};
12371248
12381249static const struct vc5_chip_info idt_5p49v6901_info = {
12391250 .model = IDT_VC6_5P49V6901 ,
12401251 .clk_fod_cnt = 4 ,
12411252 .clk_out_cnt = 5 ,
12421253 .flags = VC5_HAS_PFD_FREQ_DBL | VC5_HAS_BYPASS_SYNC_BIT ,
1254+ .vco_max = 3000000000UL ,
12431255};
12441256
12451257static const struct vc5_chip_info idt_5p49v6965_info = {
12461258 .model = IDT_VC6_5P49V6965 ,
12471259 .clk_fod_cnt = 4 ,
12481260 .clk_out_cnt = 5 ,
12491261 .flags = VC5_HAS_BYPASS_SYNC_BIT ,
1262+ .vco_max = 3000000000UL ,
12501263};
12511264
12521265static const struct vc5_chip_info idt_5p49v6975_info = {
12531266 .model = IDT_VC6_5P49V6975 ,
12541267 .clk_fod_cnt = 4 ,
12551268 .clk_out_cnt = 5 ,
12561269 .flags = VC5_HAS_BYPASS_SYNC_BIT | VC5_HAS_INTERNAL_XTAL ,
1270+ .vco_max = 3000000000UL ,
12571271};
12581272
12591273static const struct i2c_device_id vc5_id [] = {
12601274 { "5p49v5923" , .driver_data = IDT_VC5_5P49V5923 },
12611275 { "5p49v5925" , .driver_data = IDT_VC5_5P49V5925 },
12621276 { "5p49v5933" , .driver_data = IDT_VC5_5P49V5933 },
12631277 { "5p49v5935" , .driver_data = IDT_VC5_5P49V5935 },
1278+ { "5p49v60" , .driver_data = IDT_VC6_5P49V60 },
12641279 { "5p49v6901" , .driver_data = IDT_VC6_5P49V6901 },
12651280 { "5p49v6965" , .driver_data = IDT_VC6_5P49V6965 },
12661281 { "5p49v6975" , .driver_data = IDT_VC6_5P49V6975 },
@@ -1273,6 +1288,7 @@ static const struct of_device_id clk_vc5_of_match[] = {
12731288 { .compatible = "idt,5p49v5925" , .data = & idt_5p49v5925_info },
12741289 { .compatible = "idt,5p49v5933" , .data = & idt_5p49v5933_info },
12751290 { .compatible = "idt,5p49v5935" , .data = & idt_5p49v5935_info },
1291+ { .compatible = "idt,5p49v60" , .data = & idt_5p49v60_info },
12761292 { .compatible = "idt,5p49v6901" , .data = & idt_5p49v6901_info },
12771293 { .compatible = "idt,5p49v6965" , .data = & idt_5p49v6965_info },
12781294 { .compatible = "idt,5p49v6975" , .data = & idt_5p49v6975_info },
0 commit comments