Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clock_control: stm32: Configure MCO through devicetree instead of Kconfig #76556

Merged
merged 14 commits into from
Sep 16, 2024

Conversation

joerchan
Copy link
Contributor

@joerchan joerchan commented Jul 31, 2024

Deprecated setting MCO source and prescalor in Kconfig in favour of setting it through devicetree.

Copy link
Collaborator

@mathieuchopstm mathieuchopstm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Off with a very good start!
Some points to address or discuss:

drivers/clock_control/clock_stm32_mco.c Outdated Show resolved Hide resolved
dts/arm/st/f4/stm32f4.dtsi Outdated Show resolved Hide resolved
dts/arm/st/f7/stm32f7.dtsi Outdated Show resolved Hide resolved
dts/arm/st/h5/stm32h5.dtsi Outdated Show resolved Hide resolved
dts/arm/st/h7/stm32h7.dtsi Outdated Show resolved Hide resolved
samples/boards/stm32/mco/README.rst Outdated Show resolved Hide resolved
drivers/clock_control/clock_stm32_mco.c Outdated Show resolved Hide resolved
drivers/clock_control/clock_stm32_mco.c Show resolved Hide resolved
drivers/clock_control/clock_stm32_mco.c Outdated Show resolved Hide resolved
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work on this long awaited piece of code.

include/zephyr/dt-bindings/clock/stm32f1_clock.h Outdated Show resolved Hide resolved
drivers/clock_control/Kconfig.stm32 Outdated Show resolved Hide resolved
drivers/clock_control/Kconfig.stm32 Show resolved Hide resolved
dts/bindings/clock/st,stm32-clock-mco.yaml Outdated Show resolved Hide resolved
drivers/clock_control/clock_stm32_mco.c Show resolved Hide resolved
dts/arm/st/c0/stm32c0.dtsi Outdated Show resolved Hide resolved
Copy link
Collaborator

@mathieuchopstm mathieuchopstm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty solid!

A few minor points to iron out:

dts/bindings/clock/st,stm32-clock-mco.yaml Outdated Show resolved Hide resolved
include/zephyr/drivers/clock_control/stm32_clock_control.h Outdated Show resolved Hide resolved
samples/boards/stm32/mco/boards/nucleo_u5a5zj_q.overlay Outdated Show resolved Hide resolved
samples/boards/stm32/mco/boards/stm32f746g_disco.overlay Outdated Show resolved Hide resolved
samples/boards/stm32/mco/boards/stm32f746g_disco.overlay Outdated Show resolved Hide resolved
drivers/clock_control/clock_stm32_mco.c Show resolved Hide resolved
drivers/clock_control/clock_stm32_mco.c Outdated Show resolved Hide resolved
drivers/clock_control/clock_stm32_mco.c Outdated Show resolved Hide resolved
@joerchan
Copy link
Contributor Author

I will rebase this PR and resolve the conflict after the review is finished, so that it is easier to see the updates that are being done.

The conflict is trivial to resolve, only adjacent context lines that have been updated.

mathieuchopstm
mathieuchopstm previously approved these changes Sep 13, 2024
Copy link
Collaborator

@mathieuchopstm mathieuchopstm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit from last review remaining, but non-blocking. LGTM otherwise.

erwango
erwango previously approved these changes Sep 13, 2024
Expose the helper function enabled_clock so that it can be used in
other clock library sources.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
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>
Add clock sources that can be output by the MCO on the stm32f1x and
stm32f10 connectivity line devices.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add MCO select and prescaler macros to set bits in the RCC CFGRx
register.
The set of supported boards are chosen to replace what is currently
supported in Kconfig.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add stm32 microcontroller clock output binding.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add macro for encoding MCO bit values into the CFGR register
of RCC. Add macros for decoding and extracting the different fields.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add device driver for STM32 MCO peripheral which takes configures
the MCO clock source and prescaler, and outputs it on one of the GPIO
pins.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add MCO device nodes to the STM32 boards.
The set of supported boards are chosen to replace what is currently
supported in Kconfig.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Fix stm32f7 missing the definition for HSE and PLLI2S_R clock source.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add MCO support for the stm32c0xx family.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Update MCO board sample to use devicetree information instead of Kconfig
configurations.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Add stm32f746g_disco board to MCO sample.
This board has 2 MCO instances so useful to show multiple instances
as well as checking the implementation.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Deprecate support for configuring the MCO source and prescaler from
Kconfig configurations.
This is now done by devicetree and an MCO driver instead, which also
configures the pin to be used by the MCO peripheral.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
Document deprecated stm32 MCO Kconfig options in favour of
setting MCO through devicetree.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
@joerchan
Copy link
Contributor Author

One nit from last review remaining, but non-blocking. LGTM otherwise.

Addressed last nit and rebased the PR to fix the conflicts.

@joerchan
Copy link
Contributor Author

Re-running documentation build, failed because of server issues.

Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once again a great thanks!

@carlescufi carlescufi merged commit f5e047e into zephyrproject-rtos:main Sep 16, 2024
23 checks passed
@joerchan joerchan deleted the stm32-mco-dts branch September 16, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Clock Control area: Devicetree Binding PR modifies or adds a Device Tree binding area: Samples Samples platform: STM32 ST Micro STM32 Release Notes To be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants