Lines Matching +full:prescaler +full:- +full:src
4 * SPDX-License-Identifier: Apache-2.0
19 /* Macros to fill up prescaler values */
38 static uint32_t get_bus_clock(uint32_t clock, uint32_t prescaler) in get_bus_clock() argument
40 return clock / prescaler; in get_bus_clock()
62 return -ENOTSUP; in enabled_clock()
73 if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) { in stm32_clock_control_on()
75 return -ENOTSUP; in stm32_clock_control_on()
78 sys_set_bits(DT_REG_ADDR(DT_NODELABEL(rcc)) + pclken->bus, in stm32_clock_control_on()
79 pclken->enr); in stm32_clock_control_on()
81 temp = sys_read32(DT_REG_ADDR(DT_NODELABEL(rcc)) + pclken->bus); in stm32_clock_control_on()
94 if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == 0) { in stm32_clock_control_off()
96 return -ENOTSUP; in stm32_clock_control_off()
99 sys_clear_bits(DT_REG_ADDR(DT_NODELABEL(rcc)) + pclken->bus, in stm32_clock_control_off()
100 pclken->enr); in stm32_clock_control_off()
110 /* At least one alt src clock available */ in stm32_clock_control_configure()
117 err = enabled_clock(pclken->bus); in stm32_clock_control_configure()
119 /* Attempt to configure a src clock not available or not valid */ in stm32_clock_control_configure()
123 sys_clear_bits(DT_REG_ADDR(DT_NODELABEL(rcc)) + STM32_CLOCK_REG_GET(pclken->enr), in stm32_clock_control_configure()
124 STM32_CLOCK_MASK_GET(pclken->enr) << STM32_CLOCK_SHIFT_GET(pclken->enr)); in stm32_clock_control_configure()
125 sys_set_bits(DT_REG_ADDR(DT_NODELABEL(rcc)) + STM32_CLOCK_REG_GET(pclken->enr), in stm32_clock_control_configure()
126 STM32_CLOCK_VAL_GET(pclken->enr) << STM32_CLOCK_SHIFT_GET(pclken->enr)); in stm32_clock_control_configure()
130 /* No src clock available: Not supported */ in stm32_clock_control_configure()
131 return -ENOTSUP; in stm32_clock_control_configure()
169 * Get AHB Clock (= SystemCoreClock = SYSCLK/prescaler) in stm32_clock_control_get_subsys_rate()
183 /* PLL is the SYSCLK source, use 'ahb5-prescaler' */ in stm32_clock_control_get_subsys_rate()
187 /* PLL is not the SYSCLK source, use 'ahb5-div'(if set) */ in stm32_clock_control_get_subsys_rate()
198 switch (pclken->bus) { in stm32_clock_control_get_subsys_rate()
271 return -ENOTSUP; in stm32_clock_control_get_subsys_rate()
274 if (pclken->div) { in stm32_clock_control_get_subsys_rate()
275 *rate /= (pclken->div + 1); in stm32_clock_control_get_subsys_rate()
288 if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == true) { in stm32_clock_control_get_status()
290 if ((sys_read32(DT_REG_ADDR(DT_NODELABEL(rcc)) + pclken->bus) & pclken->enr) in stm32_clock_control_get_status()
291 == pclken->enr) { in stm32_clock_control_get_status()
298 if (enabled_clock(pclken->bus) == 0) { in stm32_clock_control_get_status()
326 return -ERANGE; in get_vco_input_range()
365 * Re-enable HSE clock if required after switch source to HSI in stm32_clock_switch_to_hsi()
398 return -ENOTSUP; in set_up_plls()
470 /* LSI belongs to the back-up domain, enable access.*/ in set_up_fixed_clock_sources()
486 /* LSE belongs to the back-up domain, enable access.*/ in set_up_fixed_clock_sources()
533 * was already configured as sysclk src by bootloader. in stm32_clock_control_init()
575 /* PLL is the SYSCLK source, use 'ahb5-prescaler' */ in stm32_clock_control_init()
578 /* PLL is not the SYSCLK source, use 'ahb5-div'(if set) */ in stm32_clock_control_init()
613 /* Set bus prescalers prescaler */ in stm32_clock_control_init()