soc: stm32f3xx: support of Cube LL Clock driver

After introduction of STM32Cube based clock control driver for
stm32 family, provide its support on stm32f3x soc.
Clean up will have to be done afterwards.

Change-Id: I20480579f12a6fc1f1f6a51589981ac3f1d63ef0
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2017-02-09 09:15:01 +01:00 committed by Maureen Helm
commit 7ed7ccc020
3 changed files with 21 additions and 1 deletions

View file

@ -42,8 +42,12 @@ static int stm32f3_init(struct device *arg)
irq_unlock(key); irq_unlock(key);
/* Update CMSIS SystemCoreClock variable (HCLK) */ /* Update CMSIS SystemCoreClock variable (HCLK) */
#ifdef CONFIG_CLOCK_CONTROL_STM32_CUBE
/* At reset, System core clock is set to 4MHz */
SystemCoreClock = 4000000;
#else
SystemCoreClock = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC; SystemCoreClock = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC;
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
return 0; return 0;
} }

View file

@ -52,6 +52,13 @@ enum stm32f3x_pin_config_mode {
#include <stm32f3xx_ll_usart.h> #include <stm32f3xx_ll_usart.h>
#endif #endif
#ifdef CONFIG_CLOCK_CONTROL_STM32_CUBE
#include <stm32f3xx_ll_utils.h>
#include <stm32f3xx_ll_bus.h>
#include <stm32f3xx_ll_rcc.h>
#include <stm32f3xx_ll_system.h>
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
#endif /* !_ASMLANGUAGE */ #endif /* !_ASMLANGUAGE */
#endif /* _STM32F3_SOC_H_ */ #endif /* _STM32F3_SOC_H_ */

View file

@ -188,7 +188,16 @@ int stm32_gpio_enable_int(int port, int pin)
struct device *clk = struct device *clk =
device_get_binding(STM32_CLOCK_CONTROL_NAME); device_get_binding(STM32_CLOCK_CONTROL_NAME);
#ifdef CONFIG_CLOCK_CONTROL_STM32_CUBE
struct stm32_pclken pclken = {
.bus = STM32_CLOCK_BUS_APB2,
.enr = LL_APB2_GRP1_PERIPH_SYSCFG
};
clock_control_on(clk, (clock_control_subsys_t *) &pclken);
#else
clock_control_on(clk, UINT_TO_POINTER(STM32F3X_CLOCK_SUBSYS_SYSCFG)); clock_control_on(clk, UINT_TO_POINTER(STM32F3X_CLOCK_SUBSYS_SYSCFG));
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
int shift = 0; int shift = 0;