[U-Boot-Users] [PATCH] ColdFire: Fix UART baudrate formula
Tsi-Chung.Liew
Tsi-Chung.Liew at freescale.com
Thu May 29 19:29:26 CEST 2008
From: TsiChung Liew <Tsi-Chung.Liew at freescale.com>
Replace counter = bus_clk / (baudrate * 32) with
counter = ((bus_clk / 32) + (baudrate /2 )) / baudrate
formula
Signed-off-by: TsiChung Liew <Tsi-Chung.Liew at freescale.com>
---
drivers/serial/mcfuart.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index 88f3eb1..75e85b7 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -63,8 +63,8 @@ int serial_init(void)
uart->umr = UART_UMR_SB_STOP_BITS_1;
/* Setting up BaudRate */
- counter = (u32) (gd->bus_clk / (gd->baudrate));
- counter >>= 5;
+ counter = (u32) (gd->bus_clk / 32) + (gd->baudrate / 2));
+ counter = counter / gd->baudrate;
/* write to CTUR: divide counter upper byte */
uart->ubg1 = (u8) ((counter & 0xff00) >> 8);
--
1.5.4.1
More information about the U-Boot
mailing list