198#define ALT_48MHZ_NO 0
199#define ALT_48MHZ_I2S 1
200#define ALT_48MHZ_SAI 2
206#define STM32F(x) [STM32F##x] = x
207#define STM32F0(x) [STM32F0##x] = x
210static const unsigned stm32_f_model[] = {
274#define STM32MP(x) [STM32MP##x] = x
277static const unsigned stm32_model_mp[] = {
282#define stm32f2_4_192_pll_cfg { \
283 .min_vco_input = 1000000U, \
284 .max_vco_input = 2000000U, \
285 .min_vco_output = 192000000U, \
286 .max_vco_output = 432000000U, \
302#define stm32f4_7_pll_cfg { \
303 .min_vco_input = 1000000U, \
304 .max_vco_input = 2000000U, \
305 .min_vco_output = 192000000U, \
306 .max_vco_output = 432000000U, \
322#define stm32mp1_pll_cfg { \
323 .min_vco_input = 4000000U, \
324 .max_vco_input = 16000000U, \
325 .min_vco_output = 400000000U, \
326 .max_vco_output = 800000000U, \
344static const clk_cfg_t stm32_f_clk_cfg[] = {
345 [STM32F030 ... STM32F098] = {
347 .max_coreclock = 48000000U,
348 .max_apb1 = 48000000U,
352 .min_vco_input = 1000000U,
353 .max_vco_input = 24000000U,
354 .min_vco_output = 16000000U,
355 .max_vco_output = 48000000U,
366 .has_pll_i2s =
false,
367 .has_pll_sai =
false,
368 .has_pll_i2s_alt_input =
false,
375 .max_coreclock = 24000000U,
376 .max_apb1 = 24000000U,
377 .max_apb2 = 24000000U,
380 .min_vco_input = 1000000U,
381 .max_vco_input = 24000000U,
382 .min_vco_output = 16000000U,
383 .max_vco_output = 24000000U,
394 .has_pll_i2s =
false,
395 .has_pll_sai =
false,
396 .has_pll_i2s_alt_input =
false,
401 [STM32F101 ... STM32F103] = {
403 .max_coreclock = 72000000U,
404 .max_apb1 = 36000000U,
405 .max_apb2 = 72000000U,
408 .min_vco_input = 1000000U,
409 .max_vco_input = 25000000U,
410 .min_vco_output = 1000000U,
411 .max_vco_output = 72000000U,
422 .has_pll_i2s =
false,
423 .has_pll_sai =
false,
424 .has_pll_i2s_alt_input =
false,
429 [STM32F205 ... STM32F217] = {
431 .max_coreclock = 120000000U,
432 .max_apb1 = 30000000U,
433 .max_apb2 = 60000000U,
435 .pll = stm32f2_4_192_pll_cfg,
437 .has_pll_sai =
false,
438 .has_pll_i2s_alt_input =
false,
442 [STM32F301 ... STM32F398] = {
444 .max_coreclock = 72000000U,
445 .max_apb1 = 36000000U,
446 .max_apb2 = 72000000U,
449 .min_vco_input = 1000000U,
450 .max_vco_input = 25000000U,
451 .min_vco_output = 1000000U,
452 .max_vco_output = 72000000U,
463 .has_pll_i2s =
false,
464 .has_pll_sai =
false,
465 .has_pll_i2s_alt_input =
false,
472 .max_coreclock = 84000000U,
473 .max_apb1 = 42000000U,
474 .max_apb2 = 84000000U,
476 .pll = stm32f2_4_192_pll_cfg,
478 .has_pll_sai =
false,
479 .has_pll_i2s_m =
false,
480 .has_pll_i2s_alt_input =
false,
484 [STM32F405 ... STM32F407] = {
486 .max_coreclock = 168000000U,
487 .max_apb1 = 42000000U,
488 .max_apb2 = 84000000U,
490 .pll = stm32f4_7_pll_cfg,
492 .has_pll_sai =
false,
493 .has_pll_i2s_m =
false,
494 .has_pll_i2s_alt_input =
false,
500 .max_coreclock = 100000000U,
501 .max_apb1 = 50000000U,
502 .max_apb2 = 100000000U,
504 .pll = stm32f4_7_pll_cfg,
505 .has_pll_i2s =
false,
506 .has_pll_sai =
false,
507 .has_pll_i2s_m =
false,
508 .has_pll_i2s_alt_input =
false,
514 .max_coreclock = 100000000U,
515 .max_apb1 = 50000000U,
516 .max_apb2 = 100000000U,
518 .pll = stm32f4_7_pll_cfg,
520 .has_pll_sai =
false,
521 .has_pll_i2s_m =
true,
522 .has_pll_i2s_alt_input =
false,
526 [STM32F412 ... STM32F413] = {
528 .max_coreclock = 100000000U,
529 .max_apb1 = 50000000U,
530 .max_apb2 = 100000000U,
532 .pll = stm32f4_7_pll_cfg,
535 .has_pll_i2s_m =
true,
536 .has_pll_sai_m =
false,
537 .has_pll_i2s_alt_input =
true,
538 .has_alt_48MHz = ALT_48MHZ_I2S,
541 [STM32F415 ... STM32F417] = {
543 .max_coreclock = 168000000U,
544 .max_apb1 = 42000000U,
545 .max_apb2 = 84000000U,
547 .pll = stm32f4_7_pll_cfg,
549 .has_pll_sai =
false,
550 .has_pll_i2s_m =
false,
551 .has_pll_i2s_alt_input =
false,
557 .max_coreclock = 100000000U,
558 .max_apb1 = 50000000U,
559 .max_apb2 = 100000000U,
561 .pll = stm32f4_7_pll_cfg,
564 .has_pll_i2s_m =
true,
565 .has_pll_sai_m =
false,
566 .has_pll_i2s_alt_input =
true,
567 .has_alt_48MHz = ALT_48MHZ_I2S,
570 [STM32F427 ... STM32F439] = {
572 .max_coreclock = 180000000U,
573 .max_apb1 = 45000000U,
574 .max_apb2 = 90000000U,
576 .pll = stm32f4_7_pll_cfg,
579 .has_pll_i2s_m =
false,
580 .has_pll_sai_m =
false,
581 .has_pll_i2s_alt_input =
false,
587 .max_coreclock = 180000000U,
588 .max_apb1 = 45000000U,
589 .max_apb2 = 90000000U,
591 .pll = stm32f4_7_pll_cfg,
594 .has_pll_i2s_m =
true,
595 .has_pll_sai_m =
true,
596 .has_pll_i2s_alt_input =
false,
597 .has_alt_48MHz = ALT_48MHZ_SAI | ALT_48MHZ_P,
600 [STM32F469 ... STM32F479] = {
602 .max_coreclock = 180000000U,
603 .max_apb1 = 45000000U,
604 .max_apb2 = 90000000U,
606 .pll = stm32f4_7_pll_cfg,
609 .has_pll_i2s_m =
false,
610 .has_pll_sai_m =
false,
611 .has_pll_i2s_alt_input =
false,
612 .has_alt_48MHz = ALT_48MHZ_SAI | ALT_48MHZ_P,
615 [STM32F722 ... STM32F779] = {
617 .max_coreclock = 216000000U,
618 .max_apb1 = 54000000U,
619 .max_apb2 = 108000000U,
621 .pll = stm32f4_7_pll_cfg,
624 .has_pll_i2s_m =
false,
625 .has_pll_sai_m =
false,
626 .has_pll_i2s_alt_input =
false,
627 .has_alt_48MHz = ALT_48MHZ_SAI | ALT_48MHZ_P,
635static const clk_cfg_t stm32_mp_clk_cfg[] = {
638 .max_coreclock = 209000000U,
639 .max_apb1 = 104500000U,
640 .max_apb2 = 104500000U,
641 .max_apb3 = 104500000U,
643 .pll = stm32mp1_pll_cfg,
644 .has_pll_i2s =
false,
645 .has_pll_sai =
false,
646 .has_pll_i2s_m =
false,
647 .has_pll_sai_m =
false,
648 .has_pll_i2s_alt_input =
false,
unsigned max_apb1
Max APB1 clock.
bool has_pll_i2s_m
PLL I2S has a M factor.
unsigned max_coreclock
Max coreclock.
unsigned hsi
HSI frequency.
bool has_pll_i2s
PLL I2S available.
unsigned max_apb3
Max APB3 clock.
pll_cfg_t pll
PLL configuration.
bool has_pll_sai
PLL SAI available.
bool has_pll_i2s_alt_input
PLL I2S has an external input available.
int has_alt_48MHz
48MHz can be generated by an alternate source
unsigned hsi_prediv
Value if HSI has a fixed prediv, 0 otherwise.
bool need_48MHz
48MHz is needed
unsigned max_apb2
Max APB2 clock.
bool has_pll_sai_m
PLL SAI has a M factor.
PLL configuration parameters.
unsigned min_vco_output
Min VCO output.
unsigned max_vco_input
Max VCO input.
unsigned min_vco_input
Min VCO input.
unsigned inc_n
Increment between two values of N.
unsigned inc_m
Increment between two values of M.
unsigned inc_p
Increment between two values of P.
unsigned max_vco_output
Max VCO output.
unsigned inc_q
Increment between two values of Q.