projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9605146
)
cpm2: Round the baud-rate clock divider to the nearest integer.
author
Laurent Pinchart
<laurentp@cse-semaphore.com>
Thu, 20 Nov 2008 12:32:23 +0000
(13:32 +0100)
committer
Kumar Gala
<galak@kernel.crashing.org>
Thu, 29 Jan 2009 00:16:57 +0000
(18:16 -0600)
Instead of rounding the divider down, improve the baud-rate generators
accuracy by rounding to the nearest integer.
Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/sysdev/cpm2.c
patch
|
blob
|
history
diff --git
a/arch/powerpc/sysdev/cpm2.c
b/arch/powerpc/sysdev/cpm2.c
index f1c3395633b9aedebda4c1979e6801f659c9fa40..474d176a6ec3a52ad8ed5abd5959448bd545ca25 100644
(file)
--- a/
arch/powerpc/sysdev/cpm2.c
+++ b/
arch/powerpc/sysdev/cpm2.c
@@
-129,7
+129,8
@@
void __cpm2_setbrg(uint brg, uint rate, uint clk, int div16, int src)
brg -= 4;
}
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)
val |= CPM_BRG_DIV16;