Browse Source

[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 <scottwood@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Scott Wood 18 years ago
parent
commit
83fcdb4b35
1 changed files with 1 additions and 1 deletions
  1. 1 1
      arch/powerpc/sysdev/cpm2_common.c

+ 1 - 1
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);
 }