]> err.no Git - linux-2.6/commitdiff
[POWERPC] cpm2: Fix off-by-one error in setbrg().
authorScott Wood <scottwood@freescale.com>
Wed, 5 Sep 2007 19:29:10 +0000 (14:29 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Mon, 10 Sep 2007 21:02:09 +0000 (16:02 -0500)
The hardware adds one to the BRG value to get the divider, so it must
be subtracted by software.  Without this patch, characters will occasionally
be corrupted.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/sysdev/cpm2_common.c

index 9244129747955d062b7a255c3797b97a23b88ab4..c827715a50907704ad1e7d4b65d7206fa9988477 100644 (file)
@@ -102,7 +102,7 @@ cpm_setbrg(uint brg, uint rate)
                brg -= 4;
        }
        bp += brg;
-       *bp = ((BRG_UART_CLK / rate) << 1) | CPM_BRG_EN;
+       out_be32(bp, (((BRG_UART_CLK / rate) - 1) << 1) | CPM_BRG_EN);
 
        cpm2_unmap(bp);
 }