|
53 | 53 | /* This check should only be performed for the M7 core code */ |
54 | 54 | #ifdef CONFIG_CPU_CORTEX_M7 |
55 | 55 |
|
56 | | -/* Choose PLL SRC */ |
57 | | -#if defined(STM32_PLL_SRC_HSI) |
| 56 | +/* Choose PLL SRC : same source for all the PLL */ |
| 57 | +#if defined(STM32_PLL_SRC_HSI) || defined(STM32_PLL2_SRC_HSI) || defined(STM32_PLL3_SRC_HSI) |
58 | 58 | #define PLLSRC_FREQ ((STM32_HSI_FREQ)/(STM32_HSI_DIVISOR)) |
59 | | -#elif defined(STM32_PLL_SRC_CSI) |
| 59 | +#endif |
| 60 | + |
| 61 | +#if defined(STM32_PLL_SRC_CSI) || defined(STM32_PLL2_SRC_CSI) || defined(STM32_PLL3_SRC_CSI) |
| 62 | +#if !defined(PLLSRC_FREQ) |
60 | 63 | #define PLLSRC_FREQ STM32_CSI_FREQ |
61 | | -#elif defined(STM32_PLL_SRC_HSE) |
| 64 | +#else |
| 65 | +#error "All PLLs must have the same clock source" |
| 66 | +#endif |
| 67 | +#endif |
| 68 | + |
| 69 | +#if defined(STM32_PLL_SRC_HSE) || defined(STM32_PLL2_SRC_HSE) || defined(STM32_PLL3_SRC_HSE) |
| 70 | +#if !defined(PLLSRC_FREQ) |
62 | 71 | #define PLLSRC_FREQ STM32_HSE_FREQ |
63 | 72 | #else |
64 | | -#define PLLSRC_FREQ 0 |
| 73 | +#error "All PLLs must have the same clock source" |
| 74 | +#endif |
| 75 | +#endif |
| 76 | + |
| 77 | +#if !defined(PLLSRC_FREQ) |
| 78 | +#define PLLSRC_FREQ 0 |
65 | 79 | #endif |
66 | 80 |
|
67 | 81 | /* Given source clock and dividers, computed the output frequency of PLLP */ |
@@ -782,13 +796,19 @@ static int set_up_plls(void) |
782 | 796 | /* Configure PLL source */ |
783 | 797 |
|
784 | 798 | /* Can be HSE , HSI 64Mhz/HSIDIV, CSI 4MHz*/ |
785 | | - if (IS_ENABLED(STM32_PLL_SRC_HSE)) { |
| 799 | + if (IS_ENABLED(STM32_PLL_SRC_HSE) || |
| 800 | + IS_ENABLED(STM32_PLL2_SRC_HSE) || |
| 801 | + IS_ENABLED(STM32_PLL3_SRC_HSE)) { |
786 | 802 | /* Main PLL configuration and activation */ |
787 | 803 | LL_RCC_PLL_SetSource(LL_RCC_PLLSOURCE_HSE); |
788 | | - } else if (IS_ENABLED(STM32_PLL_SRC_CSI)) { |
| 804 | + } else if (IS_ENABLED(STM32_PLL_SRC_CSI) || |
| 805 | + IS_ENABLED(STM32_PLL2_SRC_CSI) || |
| 806 | + IS_ENABLED(STM32_PLL3_SRC_CSI)) { |
789 | 807 | /* Main PLL configuration and activation */ |
790 | 808 | LL_RCC_PLL_SetSource(LL_RCC_PLLSOURCE_CSI); |
791 | | - } else if (IS_ENABLED(STM32_PLL_SRC_HSI)) { |
| 809 | + } else if (IS_ENABLED(STM32_PLL_SRC_HSI) || |
| 810 | + IS_ENABLED(STM32_PLL2_SRC_HSI) || |
| 811 | + IS_ENABLED(STM32_PLL3_SRC_HSI)) { |
792 | 812 | /* Main PLL configuration and activation */ |
793 | 813 | LL_RCC_PLL_SetSource(LL_RCC_PLLSOURCE_HSI); |
794 | 814 | } else { |
|
0 commit comments