boards: stm32h747i_disco: Use dts for clocks configuration
Convert board to use of device tree for clocks configuration.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
diff --git a/boards/arm/stm32h747i_disco/Kconfig.defconfig b/boards/arm/stm32h747i_disco/Kconfig.defconfig
index 43589e9..6afd0f5 100644
--- a/boards/arm/stm32h747i_disco/Kconfig.defconfig
+++ b/boards/arm/stm32h747i_disco/Kconfig.defconfig
@@ -9,32 +9,6 @@
default "stm32h747i_disco_m7" if BOARD_STM32H747I_DISCO_M7
default "stm32h747i_disco_m4" if BOARD_STM32H747I_DISCO_M4
-# clock configuration
-config SYS_CLOCK_HW_CYCLES_PER_SEC
- default 400000000 if BOARD_STM32H747I_DISCO_M7
- # SYS_CLOCK_M4 = SYS_CLOCK_M7 / CLOCK_STM32_HPRE
- default 200000000 if BOARD_STM32H747I_DISCO_M4
-
-config CLOCK_STM32_D1CPRE
- default 1
-
-config CLOCK_STM32_HPRE
- # HCLK: 200MHz
- default 2
-
-config CLOCK_STM32_D2PPRE1
- # APBX: 100MHz
- default 2
-
-config CLOCK_STM32_D2PPRE2
- default 2
-
-config CLOCK_STM32_D1PPRE
- default 2
-
-config CLOCK_STM32_D3PPRE
- default 2
-
config STM32H7_DUAL_CORE
default y
diff --git a/boards/arm/stm32h747i_disco/stm32h747i_disco.dtsi b/boards/arm/stm32h747i_disco/stm32h747i_disco.dtsi
index efe5e72..abfce14 100644
--- a/boards/arm/stm32h747i_disco/stm32h747i_disco.dtsi
+++ b/boards/arm/stm32h747i_disco/stm32h747i_disco.dtsi
@@ -66,4 +66,13 @@
};
};
+&rcc {
+ d1cpre = <1>;
+ hpre = <2>;
+ d1ppre = <2>;
+ d2ppre1 = <2>;
+ d2ppre2 = <2>;
+ d3ppre = <2>;
+};
+
arduino_serial: &uart8 {};
diff --git a/boards/arm/stm32h747i_disco/stm32h747i_disco_m4.dts b/boards/arm/stm32h747i_disco/stm32h747i_disco_m4.dts
index 36e3d8c..db033c0 100644
--- a/boards/arm/stm32h747i_disco/stm32h747i_disco_m4.dts
+++ b/boards/arm/stm32h747i_disco/stm32h747i_disco_m4.dts
@@ -43,6 +43,10 @@
};
};
+&rcc {
+ clock-frequency = <DT_FREQ_M(200)>;
+};
+
&usart1 {
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
current-speed = <115200>;
diff --git a/boards/arm/stm32h747i_disco/stm32h747i_disco_m7.dts b/boards/arm/stm32h747i_disco/stm32h747i_disco_m7.dts
index 5fa7c1f..b63dfa7 100644
--- a/boards/arm/stm32h747i_disco/stm32h747i_disco_m7.dts
+++ b/boards/arm/stm32h747i_disco/stm32h747i_disco_m7.dts
@@ -48,6 +48,26 @@
};
};
+&clk_hse {
+ clock-frequency = <DT_FREQ_M(25)>;
+ status = "okay";
+};
+
+&pll {
+ div-m = <5>;
+ mul-n = <160>;
+ div-p = <2>;
+ div-q = <4>;
+ div-r = <2>;
+ clocks = <&clk_hse>;
+ status = "okay";
+};
+
+&rcc {
+ clocks = <&pll>;
+ clock-frequency = <DT_FREQ_M(400)>;
+};
+
&usart1 {
pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>;
current-speed = <115200>;
diff --git a/boards/arm/stm32h747i_disco/stm32h747i_disco_m7_defconfig b/boards/arm/stm32h747i_disco/stm32h747i_disco_m7_defconfig
index d0239ba..9da952a 100644
--- a/boards/arm/stm32h747i_disco/stm32h747i_disco_m7_defconfig
+++ b/boards/arm/stm32h747i_disco/stm32h747i_disco_m7_defconfig
@@ -12,24 +12,9 @@
# enable GPIO
CONFIG_GPIO=y
-# clock configuration
+# Enable clocks
CONFIG_CLOCK_CONTROL=y
-# Clock configuration for Cube Clock control driver
-CONFIG_CLOCK_STM32_HSE_CLOCK=25000000
-CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
-
-# use HSE (bypass) as PLL input
-CONFIG_CLOCK_STM32_PLL_SRC_HSE=y
-CONFIG_CLOCK_STM32_HSE_BYPASS=y
-
-# produce 400MHz clock at PLL output
-CONFIG_CLOCK_STM32_PLL_M_DIVISOR=5
-CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=160
-CONFIG_CLOCK_STM32_PLL_P_DIVISOR=2
-CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=4
-CONFIG_CLOCK_STM32_PLL_R_DIVISOR=2
-
# Enable MPU
CONFIG_ARM_MPU=y