summaryrefslogtreecommitdiff
path: root/src/cpu/allwinner/a10/uart.c
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2014-02-19 08:58:12 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2014-03-04 15:24:32 +0100
commit65ba20e17bd91e4b92e34b495f64a51a0313f6a9 (patch)
tree4365d0fcd3548c03d5895df7b4114e77c6d5d1dd /src/cpu/allwinner/a10/uart.c
parentc5332e30da4c314c1d44d6d3f9df6d2ae6417e0f (diff)
allwinner/a10: Fix baudrate calculation
UART input clock is platform dependent. Also account for possible use of get_option() where baudrate is not compile-time constant. Change-Id: Ie1c8789ef72430e43fc33bfa9ffb9f5346762439 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/5289 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/cpu/allwinner/a10/uart.c')
-rw-r--r--src/cpu/allwinner/a10/uart.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cpu/allwinner/a10/uart.c b/src/cpu/allwinner/a10/uart.c
index 97ac302ddc..990026be26 100644
--- a/src/cpu/allwinner/a10/uart.c
+++ b/src/cpu/allwinner/a10/uart.c
@@ -7,6 +7,7 @@
#include "uart.h"
#include <arch/io.h>
+#include <uart.h>
#include <uart8250.h>
/**
@@ -19,11 +20,11 @@ void a10_uart_configure(void *uart_base, u32 baud_rate, u8 data_bits,
u16 div;
struct a10_uart *uart = uart_base;
+ div = (u16) uart_baudrate_divisor(baud_rate,
+ uart_platform_refclk(), 16);
/* Enable access to Divisor Latch register */
write32(UART_LCR_DLAB, &uart->lcr);
/* Set baudrate */
- /* FIXME: We assume clock is 24MHz, which may not be the case */
- div = 24000000 / 16 / baud_rate;
write32((div >> 8) & 0xff, &uart->dlh);
write32(div & 0xff, &uart->dll);
/* Set line control */