Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/releases/migration-guide-4.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ Kernel
Boards
******

Devicetree
**********

STM32
=====

* MCO clock source and prescaler are now exclusively configured by the DTS
as it was introduced earlier.
The Kconfig method for configuration is now removed.


Modules
*******

Expand Down
306 changes: 2 additions & 304 deletions drivers/clock_control/Kconfig.stm32
Original file line number Diff line number Diff line change
Expand Up @@ -97,310 +97,8 @@ config CLOCK_STM32_MCO
bool
default y
depends on DT_HAS_ST_STM32_CLOCK_MCO_ENABLED || DT_HAS_ST_STM32F1_CLOCK_MCO_ENABLED
# Although deprecated, MCO configuration via Kconfig takes priority over Device Tree.
# Prevent DT-based MCO driver from compiling when Kconfig is used.
depends on CLOCK_STM32_MCO1_SRC_NOCLOCK && CLOCK_STM32_MCO2_SRC_NOCLOCK

choice
prompt "STM32 MCO1 Clock Source"
default CLOCK_STM32_MCO1_SRC_NOCLOCK

config CLOCK_STM32_MCO1_SRC_NOCLOCK
bool "NOCLOCK"
help
MCO1 output disabled, no clock on MCO1

config CLOCK_STM32_MCO1_SRC_EXT_HSE
bool "EXT_HSE"
depends on SOC_STM32F10X_CONNECTIVITY_LINE_DEVICE
select DEPRECATED
help
Use EXT_HSE as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_LSE
bool "LSE"
depends on SOC_SERIES_STM32F4X || \
SOC_SERIES_STM32F7X || \
SOC_SERIES_STM32L4X || \
SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X || \
SOC_SERIES_STM32U5X
select DEPRECATED
help
Use LSE as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_HSE
bool "HSE"
depends on SOC_SERIES_STM32F1X || \
SOC_SERIES_STM32F4X || \
SOC_SERIES_STM32F7X || \
SOC_SERIES_STM32L4X || \
SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X || \
SOC_SERIES_STM32U5X
select DEPRECATED
help
Use HSE as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_LSI
bool "LSI"
depends on SOC_SERIES_STM32L4X || \
SOC_SERIES_STM32U5X
select DEPRECATED
help
Use LSI as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_MSI
bool "MSI"
depends on SOC_SERIES_STM32L4X
select DEPRECATED
help
Use MSI as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_MSIK
bool "MSIK"
depends on SOC_SERIES_STM32U5X
select DEPRECATED
help
Use MSIK as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_MSIS
bool "MSIS"
depends on SOC_SERIES_STM32U5X
select DEPRECATED
help
Use MSIS as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_HSI
bool "HSI"
depends on SOC_SERIES_STM32F1X || \
SOC_SERIES_STM32F4X || \
SOC_SERIES_STM32F7X || \
SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X
select DEPRECATED
help
Use HSI as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_HSI16
bool "HSI16"
depends on SOC_SERIES_STM32L4X || \
SOC_SERIES_STM32U5X
select DEPRECATED
help
Use HSI16 as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_HSI48
bool "HSI48"
depends on SOC_SERIES_STM32L4X || \
SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X || \
SOC_SERIES_STM32U5X
select DEPRECATED
help
Use HSI48 as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_PLLCLK
bool "PLLCLK"
depends on SOC_SERIES_STM32F4X || \
SOC_SERIES_STM32F7X || \
SOC_SERIES_STM32L4X || \
SOC_SERIES_STM32U5X
select DEPRECATED
help
Use PLLCLK as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_PLLQCLK
bool "PLLQ"
depends on SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X
select DEPRECATED
help
Use PLLQ as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_PLLCLK_DIV2
bool "PLLCLK_DIV2"
depends on SOC_SERIES_STM32F1X
select DEPRECATED
help
Use PLLCLK/2 as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_PLL2CLK
bool "PLL2CLK"
depends on SOC_STM32F10X_CONNECTIVITY_LINE_DEVICE
select DEPRECATED
help
Use PLL2CLK as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_PLLI2SCLK
bool "PLLI2SCLK"
depends on SOC_STM32F10X_CONNECTIVITY_LINE_DEVICE
select DEPRECATED
help
Use PLLI2SCLK as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_PLLI2SCLK_DIV2
bool "PLLI2SCLK_DIV2"
depends on SOC_STM32F10X_CONNECTIVITY_LINE_DEVICE
select DEPRECATED
help
Use PLLI2SCLK/2 as source of MCO1
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO1_SRC_SYSCLK
bool "SYSCLK"
depends on SOC_SERIES_STM32F1X || \
SOC_SERIES_STM32L4X || \
SOC_SERIES_STM32U5X
select DEPRECATED
help
Use SYSCLK as source of MCO1
This option is deprecated, please use devicetree instead.

endchoice

config CLOCK_STM32_MCO1_DIV
int "MCO1 prescaler"
depends on !CLOCK_STM32_MCO1_SRC_NOCLOCK && (\
SOC_SERIES_STM32F4X || \
SOC_SERIES_STM32F7X || \
SOC_SERIES_STM32L4X || \
SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X || \
SOC_SERIES_STM32U5X \
)
default 1
range 1 5 if SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X
range 1 15 if SOC_SERIES_STM32H7X || SOC_SERIES_STM32H7RSX || SOC_SERIES_STM32H5X
range 1 16 if SOC_SERIES_STM32L4X || SOC_SERIES_STM32U5X
help
Prescaler for MCO1 output clock
This option is deprecated, please use devicetree instead.

choice
prompt "STM32 MCO2 Clock Source"
default CLOCK_STM32_MCO2_SRC_NOCLOCK

config CLOCK_STM32_MCO2_SRC_NOCLOCK
bool "NOCLOCK"
help
MCO2 output disabled, no clock on MCO2

config CLOCK_STM32_MCO2_SRC_SYSCLK
bool "SYSCLK"
depends on SOC_SERIES_STM32F4X || \
SOC_SERIES_STM32F7X || \
SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X
select DEPRECATED
help
Use SYSCLK as source of MCO2
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO2_SRC_PLLI2S
bool "PLLI2S"
depends on SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X
select DEPRECATED
help
Use PLLI2S as source of MCO2
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO2_SRC_HSE
bool "HSE"
depends on SOC_SERIES_STM32F4X || \
SOC_SERIES_STM32F7X || \
SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X
select DEPRECATED
help
Use HSE as source of MCO2
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO2_SRC_LSI
bool "LSI"
depends on SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X
help
Use LSI as source of MCO2
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO2_SRC_CSI
bool "CSI"
depends on SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X
select DEPRECATED
help
Use CSI as source of MCO2
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO2_SRC_PLLCLK
bool "PLLCLK"
depends on SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X
select DEPRECATED
help
Use PLLCLK as source of MCO2
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO2_SRC_PLLPCLK
bool "PLLPCLK"
depends on SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X
select DEPRECATED
help
Use PLLPCLK as source of MC02
This option is deprecated, please use devicetree instead.

config CLOCK_STM32_MCO2_SRC_PLL2PCLK
bool "PLL2PCLK"
depends on SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX || \
SOC_SERIES_STM32H5X
select DEPRECATED
help
Use PLL2PCLK as source of MC02
This option is deprecated, please use devicetree instead.

endchoice

config CLOCK_STM32_MCO2_DIV
int "MCO2 prescaler"
depends on !CLOCK_STM32_MCO2_SRC_NOCLOCK && (\
SOC_SERIES_STM32F4X || \
SOC_SERIES_STM32F7X || \
SOC_SERIES_STM32H5X || \
SOC_SERIES_STM32H7X || \
SOC_SERIES_STM32H7RSX \
)
default 1
range 1 5 if SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X
range 1 15 if SOC_SERIES_STM32H7X || SOC_SERIES_STM32H7RSX || SOC_SERIES_STM32H5X
help
Prescaler for MCO2 output clock
Allows to output various different clock sources onto the MCO pin
using a configurable prescaler.

endif # CLOCK_CONTROL_STM32_CUBE
4 changes: 0 additions & 4 deletions drivers/clock_control/clock_stm32_ll_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <zephyr/sys/__assert.h>
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
#include "clock_stm32_ll_common.h"
#include "clock_stm32_ll_mco.h"
#include "stm32_hsem.h"

/* Macros to fill up prescaler values */
Expand Down Expand Up @@ -870,9 +869,6 @@ int stm32_clock_control_init(const struct device *dev)
LL_RCC_SetADCClockSource(adc34_prescaler(STM32_ADC34_PRESCALER));
#endif

/* configure MCO1/MCO2 based on Kconfig */
stm32_clock_control_mco_init();

return 0;
}

Expand Down
6 changes: 6 additions & 0 deletions drivers/clock_control/clock_stm32_ll_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
#define z_pllr(v) LL_RCC_PLLR_DIV_ ## v
#define pllr(v) z_pllr(v)

#if defined(RCC_PLLI2SCFGR_PLLI2SM)
/* Some stm32F4 devices have a dedicated PLL I2S with M divider */
#define z_plli2s_m(v) LL_RCC_PLLI2SM_DIV_ ## v
#else
/* Some stm32F4 devices (typ. stm32F401) have a dedicated PLL I2S with PLL M divider */
#define z_plli2s_m(v) LL_RCC_PLLM_DIV_ ## v
#endif /* RCC_PLLI2SCFGR_PLLI2SM */
#define plli2sm(v) z_plli2s_m(v)

#define z_plli2s_r(v) LL_RCC_PLLI2SR_DIV_ ## v
Expand Down
4 changes: 0 additions & 4 deletions drivers/clock_control/clock_stm32_ll_h5.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <zephyr/drivers/clock_control.h>
#include <zephyr/sys/util.h>
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
#include "clock_stm32_ll_mco.h"

/* Macros to fill up prescaler values */
#define z_hsi_divider(v) LL_RCC_HSI_DIV_ ## v
Expand Down Expand Up @@ -769,9 +768,6 @@ int stm32_clock_control_init(const struct device *dev)
/* Update CMSIS variable */
SystemCoreClock = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC;

/* configure MCO1/MCO2 based on Kconfig */
stm32_clock_control_mco_init();

return 0;
}

Expand Down
4 changes: 0 additions & 4 deletions drivers/clock_control/clock_stm32_ll_h7.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <zephyr/drivers/clock_control.h>
#include <zephyr/sys/util.h>
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
#include "clock_stm32_ll_mco.h"
#include "stm32_hsem.h"


Expand Down Expand Up @@ -1083,9 +1082,6 @@ int stm32_clock_control_init(const struct device *dev)
#endif
z_stm32_hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY);

/* Configure MCO1/MCO2 based on Kconfig */
stm32_clock_control_mco_init();

/* Set up individual enabled clocks */
set_up_fixed_clock_sources();

Expand Down
Loading
Loading