Fix a rounding problem in HSMCI divider calculation
This commit is contained in:
parent
aac2a6759d
commit
4d6b1ed2c8
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user