Commit 7b890994 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Kumar Gala

cpm2: Round the baud-rate clock divider to the nearest integer.

Instead of rounding the divider down, improve the baud-rate generators
accuracy by rounding to the nearest integer.
Signed-off-by: default avatarLaurent Pinchart <laurentp@cse-semaphore.com>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 96051465
...@@ -129,7 +129,8 @@ void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src) ...@@ -129,7 +129,8 @@ void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src)
brg -= 4; brg -= 4;
} }
bp += brg; bp += brg;
val = (((clk / rate) - 1) << 1) | CPM_BRG_EN | src; /* Round the clock divider to the nearest integer. */
val = (((clk * 2 / rate) - 1) & ~1) | CPM_BRG_EN | src;
if (div16) if (div16)
val |= CPM_BRG_DIV16; val |= CPM_BRG_DIV16;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment