Skip to content
Snippets Groups Projects
Commit 4d6b1ed2 authored by Gregory Nutt's avatar Gregory Nutt
Browse files

Fix a rounding problem in HSMCI divider calculation

parent aac2a675
No related branches found
No related tags found
No related merge requests found
......@@ -313,7 +313,10 @@ uint32_t sam_hsmci_clkdiv(uint32_t target)
uint32_t clkfulldiv;
uint32_t ret;
clkfulldiv = BOARD_MCK_FREQUENCY / target;
/* Get the largest divisor does not exceed the target value */
clkfulldiv = (BOARD_MCK_FREQUENCY + target - 1) / target;
if (clkfulldiv > 2)
{
clkfulldiv -= 2;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment