aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
authorLaurent Pinchart <laurentp@cse-semaphore.com>2008-11-20 07:32:23 -0500
committerKumar Gala <galak@kernel.crashing.org>2009-01-28 19:16:57 -0500
commit7b8909940a524d67b4352c29256ada476f50fbba (patch)
tree4de0284227e6bea6affcfd2f828ac311953d33eb /arch/powerpc/sysdev
parent96051465fdc29e00dd14b484a45daac089c657f8 (diff)
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)
129 brg -= 4; 129 brg -= 4;
130 } 130 }
131 bp += brg; 131 bp += brg;
132 val = (((clk / rate) - 1) << 1) | CPM_BRG_EN | src; 132 /* Round the clock divider to the nearest integer. */
133 val = (((clk * 2 / rate) - 1) & ~1) | CPM_BRG_EN | src;
133 if (div16) 134 if (div16)
134 val |= CPM_BRG_DIV16; 135 val |= CPM_BRG_DIV16;
135 136