summaryrefslogtreecommitdiff
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
authorLaurent Pinchart <laurentp@cse-semaphore.com>2008-11-20 13:32:23 +0100
committerKumar Gala <galak@kernel.crashing.org>2009-01-28 18:16:57 -0600
commit7b8909940a524d67b4352c29256ada476f50fbba (patch)
tree4de0284227e6bea6affcfd2f828ac311953d33eb /arch/powerpc/sysdev
parent96051465fdc29e00dd14b484a45daac089c657f8 (diff)
downloadlwn-7b8909940a524d67b4352c29256ada476f50fbba.tar.gz
lwn-7b8909940a524d67b4352c29256ada476f50fbba.zip
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: Laurent Pinchart <laurentp@cse-semaphore.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r--arch/powerpc/sysdev/cpm2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
index f1c3395633b9..474d176a6ec3 100644
--- 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;