From 6aca1e8b26e712d056816ba936fb4d5834a07467 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Fri, 22 Apr 2011 01:45:11 +0000 Subject: The UART divider should be calculated based on the base frequency and baudrate, not hardcoded in addition to that. Signed-off-by: Stefan Reinauer Acked-by: Peter Stuge git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6538 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/lib/uart8250.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib/uart8250.c') diff --git a/src/lib/uart8250.c b/src/lib/uart8250.c index 03d954ba2c..e7a75017a9 100644 --- a/src/lib/uart8250.c +++ b/src/lib/uart8250.c @@ -88,6 +88,12 @@ void uart8250_init(unsigned base_port, unsigned divisor) #if defined(__PRE_RAM__) || defined(__SMM__) void uart_init(void) { + /* TODO the divisor calculation is hard coded to standard UARTs. Some + * UARTs won't work with these values. This should be a property of the + * UART used, worst case a Kconfig variable. For now live with hard + * codes as the only devices that might be different are the iWave + * iRainbowG6 and the OXPCIe952 card (and the latter is memory mapped) + */ #if CONFIG_USE_OPTION_TABLE && !defined(__SMM__) static const unsigned char divisor[] = { 1, 2, 3, 6, 12, 24, 48, 96 }; unsigned ttys0_div, ttys0_index; @@ -97,7 +103,7 @@ void uart_init(void) uart8250_init(CONFIG_TTYS0_BASE, ttys0_div); #else - uart8250_init(CONFIG_TTYS0_BASE, CONFIG_TTYS0_DIV); + uart8250_init(CONFIG_TTYS0_BASE, (115200 / CONFIG_TTYS0_BAUD)); #endif } #endif -- cgit v1.2.3