From 535bfeb7849111d99a8d59bae071c3930641090f Mon Sep 17 00:00:00 2001 From: Pavlo Hamov Date: Thu, 17 Oct 2019 12:31:38 +0300 Subject: [PATCH] drivers: hci: stm32_ipm: Add possibility to work on LSI Use CLOCK_STM32_LSE as switch for the RF low speed clock source Signed-off-by: Pavlo Hamov --- drivers/bluetooth/hci/ipm_stm32wb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/bluetooth/hci/ipm_stm32wb.c b/drivers/bluetooth/hci/ipm_stm32wb.c index e1a7e85cf60..08beb0810c8 100644 --- a/drivers/bluetooth/hci/ipm_stm32wb.c +++ b/drivers/bluetooth/hci/ipm_stm32wb.c @@ -327,6 +327,7 @@ static void start_ble_rf(void) LL_RCC_ReleaseBackupDomainReset(); } +#ifdef CONFIG_CLOCK_STM32_LSE /* Select LSE clock */ LL_RCC_LSE_Enable(); while (!LL_RCC_LSE_IsReady()) { @@ -338,6 +339,16 @@ static void start_ble_rf(void) /* Switch OFF LSI */ LL_RCC_LSI1_Disable(); +#else + LL_RCC_LSI2_Enable(); + while (!LL_RCC_LSI2_IsReady()) { + } + + /* Select wakeup source of BLE RF */ + LL_RCC_SetRFWKPClockSource(LL_RCC_RFWKP_CLKSOURCE_LSI); + LL_RCC_SetRTCClockSource(LL_RCC_RTC_CLKSOURCE_LSI); +#endif + /* Set RNG on HSI48 */ LL_RCC_HSI48_Enable(); while (!LL_RCC_HSI48_IsReady()) {