drivers: clock control: Provide LL based clock control for stm32f4 series

This commit enables STM32Cube LL based driver for stm32f4 series.
This generic driver provides a unified API to clock driver for all
stm32 series.
LL API allows driver to be lightweight and to keep genericity across
stm32 family to ease further devlopment and maintenance.

Change-Id: Ie31ae8f433313787f9c9eda77de41925721d54dd
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2017-04-18 14:24:04 +02:00 committed by Kumar Gala
commit fda01e52c2
13 changed files with 150 additions and 1 deletions

View file

@ -45,6 +45,9 @@ if CLOCK_CONTROL
config CLOCK_CONTROL_STM32F4X
def_bool y
config CLOCK_CONTROL_STM32_CUBE
def_bool n
endif #CLOCK_CONTROL
if GPIO

View file

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

View file

@ -52,6 +52,13 @@ enum stm32f4x_pin_config_mode {
#include "soc_irq.h"
#ifdef CONFIG_CLOCK_CONTROL_STM32_CUBE
#include <stm32f4xx_ll_utils.h>
#include <stm32f4xx_ll_bus.h>
#include <stm32f4xx_ll_rcc.h>
#include <stm32f4xx_ll_system.h>
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
#endif /* !_ASMLANGUAGE */
#endif /* _STM32F4_SOC_H_ */

View file

@ -234,10 +234,17 @@ int stm32_gpio_enable_int(int port, int pin)
(struct stm32f4x_syscfg *)SYSCFG_BASE;
volatile union syscfg_exticr *exticr;
struct device *clk = 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
};
#else
struct stm32f4x_pclken pclken = {
.bus = STM32F4X_CLOCK_BUS_APB2,
.enr = STM32F4X_CLOCK_ENABLE_SYSCFG
};
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
int shift = 0;
/* Enable SYSCFG clock */