Skip to content

Commit f0ba72e

Browse files
FRASTMnashif
authored andcommitted
drivers: clock_control: stm32 mco driver get define from DTS
Rely on the DTS to get the MCO input source clock and prescaler. DTS configuration has been introduced and Kconfig method deprecated two releases before and can be then safely removed. Signed-off-by: Francois Ramu <francois.ramu@st.com>
1 parent 505e1e5 commit f0ba72e

File tree

6 files changed

+3
-432
lines changed

6 files changed

+3
-432
lines changed

drivers/clock_control/Kconfig.stm32

Lines changed: 2 additions & 304 deletions
Original file line numberDiff line numberDiff line change
@@ -97,310 +97,8 @@ config CLOCK_STM32_MCO
9797
bool
9898
default y
9999
depends on DT_HAS_ST_STM32_CLOCK_MCO_ENABLED || DT_HAS_ST_STM32F1_CLOCK_MCO_ENABLED
100-
# Although deprecated, MCO configuration via Kconfig takes priority over Device Tree.
101-
# Prevent DT-based MCO driver from compiling when Kconfig is used.
102-
depends on CLOCK_STM32_MCO1_SRC_NOCLOCK && CLOCK_STM32_MCO2_SRC_NOCLOCK
103-
104-
choice
105-
prompt "STM32 MCO1 Clock Source"
106-
default CLOCK_STM32_MCO1_SRC_NOCLOCK
107-
108-
config CLOCK_STM32_MCO1_SRC_NOCLOCK
109-
bool "NOCLOCK"
110-
help
111-
MCO1 output disabled, no clock on MCO1
112-
113-
config CLOCK_STM32_MCO1_SRC_EXT_HSE
114-
bool "EXT_HSE"
115-
depends on SOC_STM32F10X_CONNECTIVITY_LINE_DEVICE
116-
select DEPRECATED
117-
help
118-
Use EXT_HSE as source of MCO1
119-
This option is deprecated, please use devicetree instead.
120-
121-
config CLOCK_STM32_MCO1_SRC_LSE
122-
bool "LSE"
123-
depends on SOC_SERIES_STM32F4X || \
124-
SOC_SERIES_STM32F7X || \
125-
SOC_SERIES_STM32L4X || \
126-
SOC_SERIES_STM32H7X || \
127-
SOC_SERIES_STM32H7RSX || \
128-
SOC_SERIES_STM32H5X || \
129-
SOC_SERIES_STM32U5X
130-
select DEPRECATED
131-
help
132-
Use LSE as source of MCO1
133-
This option is deprecated, please use devicetree instead.
134-
135-
config CLOCK_STM32_MCO1_SRC_HSE
136-
bool "HSE"
137-
depends on SOC_SERIES_STM32F1X || \
138-
SOC_SERIES_STM32F4X || \
139-
SOC_SERIES_STM32F7X || \
140-
SOC_SERIES_STM32L4X || \
141-
SOC_SERIES_STM32H7X || \
142-
SOC_SERIES_STM32H7RSX || \
143-
SOC_SERIES_STM32H5X || \
144-
SOC_SERIES_STM32U5X
145-
select DEPRECATED
146-
help
147-
Use HSE as source of MCO1
148-
This option is deprecated, please use devicetree instead.
149-
150-
config CLOCK_STM32_MCO1_SRC_LSI
151-
bool "LSI"
152-
depends on SOC_SERIES_STM32L4X || \
153-
SOC_SERIES_STM32U5X
154-
select DEPRECATED
155-
help
156-
Use LSI as source of MCO1
157-
This option is deprecated, please use devicetree instead.
158-
159-
config CLOCK_STM32_MCO1_SRC_MSI
160-
bool "MSI"
161-
depends on SOC_SERIES_STM32L4X
162-
select DEPRECATED
163-
help
164-
Use MSI as source of MCO1
165-
This option is deprecated, please use devicetree instead.
166-
167-
config CLOCK_STM32_MCO1_SRC_MSIK
168-
bool "MSIK"
169-
depends on SOC_SERIES_STM32U5X
170-
select DEPRECATED
171-
help
172-
Use MSIK as source of MCO1
173-
This option is deprecated, please use devicetree instead.
174-
175-
config CLOCK_STM32_MCO1_SRC_MSIS
176-
bool "MSIS"
177-
depends on SOC_SERIES_STM32U5X
178-
select DEPRECATED
179-
help
180-
Use MSIS as source of MCO1
181-
This option is deprecated, please use devicetree instead.
182-
183-
config CLOCK_STM32_MCO1_SRC_HSI
184-
bool "HSI"
185-
depends on SOC_SERIES_STM32F1X || \
186-
SOC_SERIES_STM32F4X || \
187-
SOC_SERIES_STM32F7X || \
188-
SOC_SERIES_STM32H7X || \
189-
SOC_SERIES_STM32H7RSX || \
190-
SOC_SERIES_STM32H5X
191-
select DEPRECATED
192-
help
193-
Use HSI as source of MCO1
194-
This option is deprecated, please use devicetree instead.
195-
196-
config CLOCK_STM32_MCO1_SRC_HSI16
197-
bool "HSI16"
198-
depends on SOC_SERIES_STM32L4X || \
199-
SOC_SERIES_STM32U5X
200-
select DEPRECATED
201-
help
202-
Use HSI16 as source of MCO1
203-
This option is deprecated, please use devicetree instead.
204-
205-
config CLOCK_STM32_MCO1_SRC_HSI48
206-
bool "HSI48"
207-
depends on SOC_SERIES_STM32L4X || \
208-
SOC_SERIES_STM32H7X || \
209-
SOC_SERIES_STM32H7RSX || \
210-
SOC_SERIES_STM32H5X || \
211-
SOC_SERIES_STM32U5X
212-
select DEPRECATED
213-
help
214-
Use HSI48 as source of MCO1
215-
This option is deprecated, please use devicetree instead.
216-
217-
config CLOCK_STM32_MCO1_SRC_PLLCLK
218-
bool "PLLCLK"
219-
depends on SOC_SERIES_STM32F4X || \
220-
SOC_SERIES_STM32F7X || \
221-
SOC_SERIES_STM32L4X || \
222-
SOC_SERIES_STM32U5X
223-
select DEPRECATED
224-
help
225-
Use PLLCLK as source of MCO1
226-
This option is deprecated, please use devicetree instead.
227-
228-
config CLOCK_STM32_MCO1_SRC_PLLQCLK
229-
bool "PLLQ"
230-
depends on SOC_SERIES_STM32H7X || \
231-
SOC_SERIES_STM32H7RSX || \
232-
SOC_SERIES_STM32H5X
233-
select DEPRECATED
234-
help
235-
Use PLLQ as source of MCO1
236-
This option is deprecated, please use devicetree instead.
237-
238-
config CLOCK_STM32_MCO1_SRC_PLLCLK_DIV2
239-
bool "PLLCLK_DIV2"
240-
depends on SOC_SERIES_STM32F1X
241-
select DEPRECATED
242-
help
243-
Use PLLCLK/2 as source of MCO1
244-
This option is deprecated, please use devicetree instead.
245-
246-
config CLOCK_STM32_MCO1_SRC_PLL2CLK
247-
bool "PLL2CLK"
248-
depends on SOC_STM32F10X_CONNECTIVITY_LINE_DEVICE
249-
select DEPRECATED
250-
help
251-
Use PLL2CLK as source of MCO1
252-
This option is deprecated, please use devicetree instead.
253-
254-
config CLOCK_STM32_MCO1_SRC_PLLI2SCLK
255-
bool "PLLI2SCLK"
256-
depends on SOC_STM32F10X_CONNECTIVITY_LINE_DEVICE
257-
select DEPRECATED
258-
help
259-
Use PLLI2SCLK as source of MCO1
260-
This option is deprecated, please use devicetree instead.
261-
262-
config CLOCK_STM32_MCO1_SRC_PLLI2SCLK_DIV2
263-
bool "PLLI2SCLK_DIV2"
264-
depends on SOC_STM32F10X_CONNECTIVITY_LINE_DEVICE
265-
select DEPRECATED
266-
help
267-
Use PLLI2SCLK/2 as source of MCO1
268-
This option is deprecated, please use devicetree instead.
269-
270-
config CLOCK_STM32_MCO1_SRC_SYSCLK
271-
bool "SYSCLK"
272-
depends on SOC_SERIES_STM32F1X || \
273-
SOC_SERIES_STM32L4X || \
274-
SOC_SERIES_STM32U5X
275-
select DEPRECATED
276-
help
277-
Use SYSCLK as source of MCO1
278-
This option is deprecated, please use devicetree instead.
279-
280-
endchoice
281-
282-
config CLOCK_STM32_MCO1_DIV
283-
int "MCO1 prescaler"
284-
depends on !CLOCK_STM32_MCO1_SRC_NOCLOCK && (\
285-
SOC_SERIES_STM32F4X || \
286-
SOC_SERIES_STM32F7X || \
287-
SOC_SERIES_STM32L4X || \
288-
SOC_SERIES_STM32H7X || \
289-
SOC_SERIES_STM32H7RSX || \
290-
SOC_SERIES_STM32H5X || \
291-
SOC_SERIES_STM32U5X \
292-
)
293-
default 1
294-
range 1 5 if SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X
295-
range 1 15 if SOC_SERIES_STM32H7X || SOC_SERIES_STM32H7RSX || SOC_SERIES_STM32H5X
296-
range 1 16 if SOC_SERIES_STM32L4X || SOC_SERIES_STM32U5X
297-
help
298-
Prescaler for MCO1 output clock
299-
This option is deprecated, please use devicetree instead.
300-
301-
choice
302-
prompt "STM32 MCO2 Clock Source"
303-
default CLOCK_STM32_MCO2_SRC_NOCLOCK
304-
305-
config CLOCK_STM32_MCO2_SRC_NOCLOCK
306-
bool "NOCLOCK"
307-
help
308-
MCO2 output disabled, no clock on MCO2
309-
310-
config CLOCK_STM32_MCO2_SRC_SYSCLK
311-
bool "SYSCLK"
312-
depends on SOC_SERIES_STM32F4X || \
313-
SOC_SERIES_STM32F7X || \
314-
SOC_SERIES_STM32H7X || \
315-
SOC_SERIES_STM32H7RSX || \
316-
SOC_SERIES_STM32H5X
317-
select DEPRECATED
318-
help
319-
Use SYSCLK as source of MCO2
320-
This option is deprecated, please use devicetree instead.
321-
322-
config CLOCK_STM32_MCO2_SRC_PLLI2S
323-
bool "PLLI2S"
324-
depends on SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X
325-
select DEPRECATED
326-
help
327-
Use PLLI2S as source of MCO2
328-
This option is deprecated, please use devicetree instead.
329-
330-
config CLOCK_STM32_MCO2_SRC_HSE
331-
bool "HSE"
332-
depends on SOC_SERIES_STM32F4X || \
333-
SOC_SERIES_STM32F7X || \
334-
SOC_SERIES_STM32H7X || \
335-
SOC_SERIES_STM32H7RSX || \
336-
SOC_SERIES_STM32H5X
337-
select DEPRECATED
338-
help
339-
Use HSE as source of MCO2
340-
This option is deprecated, please use devicetree instead.
341-
342-
config CLOCK_STM32_MCO2_SRC_LSI
343-
bool "LSI"
344-
depends on SOC_SERIES_STM32H7X || \
345-
SOC_SERIES_STM32H7RSX || \
346-
SOC_SERIES_STM32H5X
347-
help
348-
Use LSI as source of MCO2
349-
This option is deprecated, please use devicetree instead.
350-
351-
config CLOCK_STM32_MCO2_SRC_CSI
352-
bool "CSI"
353-
depends on SOC_SERIES_STM32H7X || \
354-
SOC_SERIES_STM32H7RSX || \
355-
SOC_SERIES_STM32H5X
356-
select DEPRECATED
357-
help
358-
Use CSI as source of MCO2
359-
This option is deprecated, please use devicetree instead.
360-
361-
config CLOCK_STM32_MCO2_SRC_PLLCLK
362-
bool "PLLCLK"
363-
depends on SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X
364-
select DEPRECATED
365-
help
366-
Use PLLCLK as source of MCO2
367-
This option is deprecated, please use devicetree instead.
368-
369-
config CLOCK_STM32_MCO2_SRC_PLLPCLK
370-
bool "PLLPCLK"
371-
depends on SOC_SERIES_STM32H7X || \
372-
SOC_SERIES_STM32H7RSX || \
373-
SOC_SERIES_STM32H5X
374-
select DEPRECATED
375-
help
376-
Use PLLPCLK as source of MC02
377-
This option is deprecated, please use devicetree instead.
378-
379-
config CLOCK_STM32_MCO2_SRC_PLL2PCLK
380-
bool "PLL2PCLK"
381-
depends on SOC_SERIES_STM32H7X || \
382-
SOC_SERIES_STM32H7RSX || \
383-
SOC_SERIES_STM32H5X
384-
select DEPRECATED
385-
help
386-
Use PLL2PCLK as source of MC02
387-
This option is deprecated, please use devicetree instead.
388-
389-
endchoice
390-
391-
config CLOCK_STM32_MCO2_DIV
392-
int "MCO2 prescaler"
393-
depends on !CLOCK_STM32_MCO2_SRC_NOCLOCK && (\
394-
SOC_SERIES_STM32F4X || \
395-
SOC_SERIES_STM32F7X || \
396-
SOC_SERIES_STM32H5X || \
397-
SOC_SERIES_STM32H7X || \
398-
SOC_SERIES_STM32H7RSX \
399-
)
400-
default 1
401-
range 1 5 if SOC_SERIES_STM32F4X || SOC_SERIES_STM32F7X
402-
range 1 15 if SOC_SERIES_STM32H7X || SOC_SERIES_STM32H7RSX || SOC_SERIES_STM32H5X
403100
help
404-
Prescaler for MCO2 output clock
101+
Allows to output various different clock sources onto the MCO pin
102+
using a configurable prescaler.
405103

406104
endif # CLOCK_CONTROL_STM32_CUBE

drivers/clock_control/clock_stm32_ll_common.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <zephyr/sys/__assert.h>
1818
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
1919
#include "clock_stm32_ll_common.h"
20-
#include "clock_stm32_ll_mco.h"
2120
#include "stm32_hsem.h"
2221

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

873-
/* configure MCO1/MCO2 based on Kconfig */
874-
stm32_clock_control_mco_init();
875-
876872
return 0;
877873
}
878874

drivers/clock_control/clock_stm32_ll_h5.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <zephyr/drivers/clock_control.h>
1919
#include <zephyr/sys/util.h>
2020
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
21-
#include "clock_stm32_ll_mco.h"
2221

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

772-
/* configure MCO1/MCO2 based on Kconfig */
773-
stm32_clock_control_mco_init();
774-
775771
return 0;
776772
}
777773

drivers/clock_control/clock_stm32_ll_h7.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <zephyr/drivers/clock_control.h>
1717
#include <zephyr/sys/util.h>
1818
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
19-
#include "clock_stm32_ll_mco.h"
2019
#include "stm32_hsem.h"
2120

2221

@@ -1083,9 +1082,6 @@ int stm32_clock_control_init(const struct device *dev)
10831082
#endif
10841083
z_stm32_hsem_lock(CFG_HW_RCC_SEMID, HSEM_LOCK_DEFAULT_RETRY);
10851084

1086-
/* Configure MCO1/MCO2 based on Kconfig */
1087-
stm32_clock_control_mco_init();
1088-
10891085
/* Set up individual enabled clocks */
10901086
set_up_fixed_clock_sources();
10911087

0 commit comments

Comments
 (0)