Skip to content

Commit

Permalink
boards: Add MCO support for the stm32c0xx family
Browse files Browse the repository at this point in the history
Add MCO support for the stm32c0xx family.

Signed-off-by: Joakim Andersson <joerchan@gmail.com>
  • Loading branch information
joerchan committed Aug 28, 2024
1 parent fd3b508 commit 1afa987
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
17 changes: 17 additions & 0 deletions dts/arm/st/c0/stm32c0.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@
};
};

mcos {
#address-cells = <1>;
#size-cells = <0>;

mco1: mco@1 {
reg = <0x1>;
compatible = "st,stm32-clock-mco";
status = "disabled";
};

mco2: mco@2 {
reg = <0x2>;
compatible = "st,stm32-clock-mco";
status = "disabled";
};
};

soc {
flash: flash-controller@40022000 {
compatible = "st,stm32-flash-controller";
Expand Down
9 changes: 9 additions & 0 deletions include/zephyr/dt-bindings/clock/stm32c0_clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
/** @brief RCC_CSR1 register offset */
#define CSR1_REG 0x5C

/** @brief CFGR1_REG register offset */
#define CFGR1_REG 0x08

/** @brief Device domain clocks selection helpers */
/** CCIPR devices */
#define USART1_SEL(val) STM32_CLOCK(val, 3, 0, CCIPR_REG)
Expand All @@ -72,4 +75,10 @@
/** CSR1 devices */
#define RTC_SEL(val) STM32_CLOCK(val, 3, 8, CSR1_REG)

/** CFGR1 devices */
#define MCO1_SEL(val) STM32_MCO_CFGR(val, 0x7, 24, CFGR1_REG)
#define MCO1_PRE(val) STM32_MCO_CFGR(val, 0x7, 28, CFGR1_REG)
#define MCO2_SEL(val) STM32_MCO_CFGR(val, 0x7, 16, CFGR1_REG)
#define MCO2_PRE(val) STM32_MCO_CFGR(val, 0x7, 20, CFGR1_REG)

#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32C0_CLOCK_H_ */

0 comments on commit 1afa987

Please sign in to comment.