soc: stm32l4xx: support of Cube LL Clock driver

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

Change-Id: I979a4169148c5fe5a0693d182d2d17f9ffaf1c77
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2017-01-24 11:37:26 +01:00 committed by Maureen Helm
commit 7c7bfd3a8d
3 changed files with 21 additions and 0 deletions

View file

@ -43,7 +43,12 @@ static int stm32l4_init(struct device *arg)
irq_unlock(key);
/* 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;
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
return 0;
}

View file

@ -35,6 +35,13 @@
#include <stm32l4xx_ll_usart.h>
#endif
#ifdef CONFIG_CLOCK_CONTROL_STM32_CUBE
#include <stm32l4xx_ll_utils.h>
#include <stm32l4xx_ll_bus.h>
#include <stm32l4xx_ll_rcc.h>
#include <stm32l4xx_ll_system.h>
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
#endif /* !_ASMLANGUAGE */
#endif /* _STM32L4X_SOC_H_ */

View file

@ -214,8 +214,17 @@ int stm32_gpio_enable_int(int port, int pin)
struct device *clk = device_get_binding(STM32_CLOCK_CONTROL_NAME);
uint32_t *reg;
/* Enable SYSCFG clock */
#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, (clock_control_subsys_t *)
STM32L4X_CLOCK_SUBSYS_SYSCFG);
#endif /* CONFIG_CLOCK_CONTROL_STM32_CUBE */
if (pin <= STM32L4X_PIN3) {
reg = &syscfg->exticr1;