Skip to content

Commit

Permalink
drivers: clock_control: Add clock sources to common enabled_clock check
Browse files Browse the repository at this point in the history
Add clock sources PLL2CLK, PLL3CLK and EXT_HSE.
Needed to check that these clocks are enabled in MCO code.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
  • Loading branch information
joerchan authored and carlescufi committed Sep 16, 2024
1 parent 3c3487a commit 807ccf5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions drivers/clock_control/clock_stm32_ll_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ int enabled_clock(uint32_t src_clk)
}
break;
#endif /* STM32_SRC_HSE */
#if defined(STM32_SRC_EXT_HSE)
case STM32_SRC_EXT_HSE:
/* EXT_HSE is the raw OSC_IN signal, so it is always
* available, regardless of the clocks configuration.
*/
break;
#endif /* STM32_SRC_HSE */
#if defined(STM32_SRC_HSI)
case STM32_SRC_HSI:
if (!IS_ENABLED(STM32_HSI_ENABLED)) {
Expand Down Expand Up @@ -210,6 +217,20 @@ int enabled_clock(uint32_t src_clk)
}
break;
#endif /* STM32_SRC_PLLI2S_R */
#if defined(STM32_SRC_PLL2CLK)
case STM32_SRC_PLL2CLK:
if (!IS_ENABLED(STM32_PLL2_ENABLED)) {
r = -ENOTSUP;
}
break;
#endif
#if defined(STM32_SRC_PLL3CLK)
case STM32_SRC_PLL3CLK:
if (!IS_ENABLED(STM32_PLL3_ENABLED)) {
r = -ENOTSUP;
}
break;
#endif
default:
return -ENOTSUP;
}
Expand Down
9 changes: 9 additions & 0 deletions drivers/clock_control/clock_stm32f1.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@

#if defined(STM32_PLL_ENABLED)

uint32_t get_pllout_frequency(void)
{
/* Stub implementation for compatibility with clock_stm32_ll_common.
* The PLL domain clock is only used for MCO configuration, but the
* MCO driver never queries the PLL output clock frequency.
*/
return 0;
}

/*
* Select PLL source for STM32F1 Connectivity line devices (STM32F105xx and
* STM32F107xx).
Expand Down

0 comments on commit 807ccf5

Please sign in to comment.