diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2025-04-22 10:52:43 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2025-04-28 19:36:55 -0400 |
commit | c352617c30ea71198b332233cea0e3de1d85c4a8 (patch) | |
tree | 10c0584ecceb89b6778e0d42adfc7dfd29446aa8 /src | |
parent | 5d1f773ffb5d4a718ba544400958744bab88e1c6 (diff) | |
download | kutter-c352617c30ea71198b332233cea0e3de1d85c4a8.tar.gz kutter-c352617c30ea71198b332233cea0e3de1d85c4a8.tar.xz kutter-c352617c30ea71198b332233cea0e3de1d85c4a8.zip |
stm32: Use enable_pclock() in stm32h7 clock_setup()
Use the helper functions to enable the peripheral clock instead of
directly manipulating the clock enable bits.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/stm32/stm32h7.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/stm32/stm32h7.c b/src/stm32/stm32h7.c index 6d875819..5a85335e 100644 --- a/src/stm32/stm32h7.c +++ b/src/stm32/stm32h7.c @@ -141,7 +141,7 @@ clock_setup(void) // Enable VOS0 (overdrive) if (CONFIG_CLOCK_FREQ > 400000000) { - RCC->APB4ENR |= RCC_APB4ENR_SYSCFGEN; + enable_pclock((uint32_t)SYSCFG); #if !CONFIG_MACH_STM32H723 SYSCFG->PWRCR |= SYSCFG_PWRCR_ODEN; #else @@ -190,10 +190,9 @@ clock_setup(void) // Configure HSI48 clock for USB if (CONFIG_USB) { SET_BIT(RCC->CR, RCC_CR_HSI48ON); - while((RCC->CR & RCC_CR_HSI48RDY) == 0); - SET_BIT(RCC->APB1HENR, RCC_APB1HENR_CRSEN); - SET_BIT(RCC->APB1HRSTR, RCC_APB1HRSTR_CRSRST); - CLEAR_BIT(RCC->APB1HRSTR, RCC_APB1HRSTR_CRSRST); + while ((RCC->CR & RCC_CR_HSI48RDY) == 0) + ; + enable_pclock((uint32_t)CRS); CLEAR_BIT(CRS->CFGR, CRS_CFGR_SYNCSRC); SET_BIT(CRS->CR, CRS_CR_CEN | CRS_CR_AUTOTRIMEN); CLEAR_BIT(RCC->D2CCIP2R, RCC_D2CCIP2R_USBSEL); |