[U-Boot-Users] [PATCH] ColdFire: Fix UART baudrate at 115200

Tsi-Chung.Liew Tsi-Chung.Liew at freescale.com
Wed May 28 20:05:53 CEST 2008


From: TsiChung Liew <Tsi-Chung.Liew at freescale.com>

If bus frequency is larger than 133MHz, the UART cannot
output baudrate at 115200 correctly.

Signed-off-by: TsiChung Liew <Tsi-Chung.Liew at freescale.com>
---
 drivers/serial/mcfuart.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index 88f3eb1..fca76bd 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -64,7 +64,10 @@ int serial_init(void)
 
 	/* Setting up BaudRate */
 	counter = (u32) (gd->bus_clk / (gd->baudrate));
-	counter >>= 5;
+	counter = (counter + 31) >> 5;
+
+	if ((gd->bus_clk > 133333333) && (gd->baudrate >= 115200))
+		counter++;
 
 	/* 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