1 /*
2  *
3  * Copyright (c) 2023 Benjamin Björnsson <benjamin.bjornsson@gmail.com>.
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 
9 #include <soc.h>
10 #include <stm32_ll_bus.h>
11 #include <stm32_ll_crs.h>
12 #include <stm32_ll_rcc.h>
13 #include <stm32_ll_utils.h>
14 #include <zephyr/drivers/clock_control.h>
15 #include <zephyr/sys/util.h>
16 #include <zephyr/drivers/clock_control/stm32_clock_control.h>
17 #include "clock_stm32_ll_common.h"
18 
19 /**
20  * @brief Activate default clocks
21  */
config_enable_default_clocks(void)22 void config_enable_default_clocks(void)
23 {
24 	/* Enable the power interface clock */
25 	LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
26 
27 #if IS_ENABLED(STM32_HSI48_CRS_USB_SOF)
28 	LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_CRS);
29 	LL_CRS_SetSyncSignalSource(LL_CRS_SYNC_SOURCE_USB);
30 	LL_CRS_EnableAutoTrimming();
31 	LL_CRS_EnableFreqErrorCounter();
32 #endif
33 }
34