Lines Matching +full:clock +full:- +full:divider
2 * Copyright 2022-2023 NXP
3 * SPDX-License-Identifier: Apache-2.0
15 * @brief Set flexspi clock to given frequency
18 * the FlexSPI with a new MUX source, only change the divider. This function
19 * is used by the clock control framework to set the clock frequency of
25 uint32_t divider; in flexspi_clock_set_freq() local
29 /* Get the root clock rate: FlexSPI clock * divisor */ in flexspi_clock_set_freq()
30 root_rate = ((CLKCTL0->FLEXSPIFCLKDIV & CLKCTL0_FLEXSPIFCLKDIV_DIV_MASK) + 1) * in flexspi_clock_set_freq()
33 /* Select a divider based on root frequency. in flexspi_clock_set_freq()
34 * if we can't get an exact divider, round down in flexspi_clock_set_freq()
36 divider = ((root_rate + (rate - 1)) / rate) - 1; in flexspi_clock_set_freq()
37 /* Cap divider to max value */ in flexspi_clock_set_freq()
38 divider = MIN(divider, CLKCTL0_FLEXSPIFCLKDIV_DIV_MASK); in flexspi_clock_set_freq()
45 set_flexspi_clock(FLEXSPI, (CLKCTL0->FLEXSPIFCLKSEL & in flexspi_clock_set_freq()
46 CLKCTL0_FLEXSPIFCLKSEL_SEL_MASK), (divider + 1)); in flexspi_clock_set_freq()
58 * @brief Set flexspi clock
60 void __ramfunc set_flexspi_clock(FLEXSPI_Type *base, uint32_t src, uint32_t divider) in set_flexspi_clock() argument
62 CLKCTL0->FLEXSPIFCLKSEL = CLKCTL0_FLEXSPIFCLKSEL_SEL(src); in set_flexspi_clock()
63 CLKCTL0->FLEXSPIFCLKDIV |= in set_flexspi_clock()
64 CLKCTL0_FLEXSPIFCLKDIV_RESET_MASK; /* Reset the divider counter */ in set_flexspi_clock()
65 CLKCTL0->FLEXSPIFCLKDIV = CLKCTL0_FLEXSPIFCLKDIV_DIV(divider - 1); in set_flexspi_clock()
66 while ((CLKCTL0->FLEXSPIFCLKDIV) & CLKCTL0_FLEXSPIFCLKDIV_REQFLAG_MASK) { in set_flexspi_clock()