Skip to content

Commit

Permalink
drivers: clk: clk-stm32mp13: round up VCO to the nearest frequency
Browse files Browse the repository at this point in the history
Round up the vco clock to avoid unexpected clock rate:
- 999,999,023 Hz instead 1,000,000,000 Hz
- 417,755,859 Hz instead 417,800,000 Hz

Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Signed-off-by: Gabriel Fernandez <gabriel.fernandez@foss.st.com>
  • Loading branch information
etienne-lms committed Feb 1, 2024
1 parent 41931f0 commit 07b488c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/drivers/clk/clk-stm32mp13.c
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ static unsigned long clk_stm32_pll_get_rate(struct clk *clk,
fvco = (unsigned long)(prate * (divn + 1U) / (divm + 1U));
}

return fvco;
return UDIV_ROUND_NEAREST(fvco, 100000) * 100000;
};

static bool clk_stm32_pll_is_enabled(struct clk *clk)
Expand Down

0 comments on commit 07b488c

Please sign in to comment.