From 02aecc89cb4a75fe803265e509e2ee9b213f4907 Mon Sep 17 00:00:00 2001 From: Alexandre Bourdiol Date: Tue, 4 May 2021 11:07:19 +0200 Subject: [PATCH] boards: stm32f412g_disco: Use dts for clocks configuration Convert board to use of device tree for clocks configuration. Signed-off-by: Alexandre Bourdiol --- .../arm/stm32f412g_disco/stm32f412g_disco.dts | 23 +++++++++++++++++++ .../stm32f412g_disco_defconfig | 21 +---------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/boards/arm/stm32f412g_disco/stm32f412g_disco.dts b/boards/arm/stm32f412g_disco/stm32f412g_disco.dts index 7de30c716f2..dbf5ac28bef 100644 --- a/boards/arm/stm32f412g_disco/stm32f412g_disco.dts +++ b/boards/arm/stm32f412g_disco/stm32f412g_disco.dts @@ -72,6 +72,29 @@ }; }; +&clk_hse { + hse-bypass; + clock-frequency = ; /* STLink 8MHz clock */ + status = "okay"; +}; + +&pll { + div-m = <4>; + mul-n = <100>; + div-p = <2>; + div-q = <8>; + clocks = <&clk_hse>; + status = "okay"; +}; + +&rcc { + clocks = <&pll>; + clock-frequency = ; + ahb-prescaler = <1>; + apb1-prescaler = <2>; + apb2-prescaler = <1>; +}; + &usart2 { pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3>; current-speed = <115200>; diff --git a/boards/arm/stm32f412g_disco/stm32f412g_disco_defconfig b/boards/arm/stm32f412g_disco/stm32f412g_disco_defconfig index b561ad19ec2..7bee732675a 100644 --- a/boards/arm/stm32f412g_disco/stm32f412g_disco_defconfig +++ b/boards/arm/stm32f412g_disco/stm32f412g_disco_defconfig @@ -2,8 +2,6 @@ CONFIG_SOC_SERIES_STM32F4X=y CONFIG_SOC_STM32F412ZG=y -# 100MHz system clock (highest value to get a precise USB clock should be 96MHz) -CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=100000000 # Enable MPU CONFIG_ARM_MPU=y @@ -23,22 +21,5 @@ CONFIG_PINMUX=y # enable GPIO ports A, B, C, D, E CONFIG_GPIO=y -# clock configuration +# Enable Clocks CONFIG_CLOCK_CONTROL=y - -# Clock configuration for Cube Clock control driver -CONFIG_CLOCK_STM32_HSE_CLOCK=8000000 -CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y -# use HSE as PLL input -CONFIG_CLOCK_STM32_PLL_SRC_HSE=y -# however, the board does not have an external oscillator, so just use -# the 8MHz clock signal coming from integrated STLink -CONFIG_CLOCK_STM32_HSE_BYPASS=y -# produce 100MHz clock at PLL output -CONFIG_CLOCK_STM32_PLL_M_DIVISOR=4 -CONFIG_CLOCK_STM32_PLL_N_MULTIPLIER=100 -CONFIG_CLOCK_STM32_PLL_P_DIVISOR=2 -CONFIG_CLOCK_STM32_PLL_Q_DIVISOR=8 -CONFIG_CLOCK_STM32_AHB_PRESCALER=1 -CONFIG_CLOCK_STM32_APB1_PRESCALER=2 -CONFIG_CLOCK_STM32_APB2_PRESCALER=1