From: Scott Wood Date: Wed, 5 Sep 2007 19:29:10 +0000 (-0500) Subject: [POWERPC] cpm2: Fix off-by-one error in setbrg(). X-Git-Tag: v2.6.23-rc7~57^2~2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=83fcdb4b352f74a8a74737aedeaf622c37140c73;p=karo-tx-linux.git [POWERPC] cpm2: Fix off-by-one error in setbrg(). 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 Signed-off-by: Kumar Gala --- diff --git a/arch/powerpc/sysdev/cpm2_common.c b/arch/powerpc/sysdev/cpm2_common.c index 924412974795..c827715a5090 100644 --- a/arch/powerpc/sysdev/cpm2_common.c +++ b/arch/powerpc/sysdev/cpm2_common.c @@ -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); }