diff options
author | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2011-04-22 01:45:11 +0000 |
---|---|---|
committer | Stefan Reinauer <stepan@openbios.org> | 2011-04-22 01:45:11 +0000 |
commit | 6aca1e8b26e712d056816ba936fb4d5834a07467 (patch) | |
tree | b2a1336d6d32358d88db8743070a6105b00feb53 | |
parent | 3e4fb9d1a12c6a4b69702badc7223fec3b6e8ddb (diff) |
The UART divider should be calculated based on the base frequency
and baudrate, not hardcoded in addition to that.
Signed-off-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6538 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
-rw-r--r-- | src/console/uart8250_console.c | 8 | ||||
-rw-r--r-- | src/include/uart8250.h | 4 | ||||
-rw-r--r-- | src/lib/uart8250.c | 8 | ||||
-rw-r--r-- | src/mainboard/iwave/iWRainbowG6/Kconfig | 6 |
4 files changed, 16 insertions, 10 deletions
diff --git a/src/console/uart8250_console.c b/src/console/uart8250_console.c index 53ca3a762e..03db400319 100644 --- a/src/console/uart8250_console.c +++ b/src/console/uart8250_console.c @@ -25,7 +25,13 @@ static void ttyS0_init(void) { static const unsigned char div[8] = { 1, 2, 3, 6, 12, 24, 48, 96 }; int b_index = 0; - unsigned int divisor = CONFIG_TTYS0_DIV; + /* 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) + */ + unsigned int divisor = 115200 / CONFIG_TTYS0_BAUD; if (get_option(&b_index, "baud_rate") == 0) { divisor = div[b_index]; diff --git a/src/include/uart8250.h b/src/include/uart8250.h index 3918bf1333..217558a8d5 100644 --- a/src/include/uart8250.h +++ b/src/include/uart8250.h @@ -28,13 +28,9 @@ #ifndef CONFIG_TTYS0_BAUD #define CONFIG_TTYS0_BAUD 115200 #endif - -#ifndef CONFIG_TTYS0_DIV #if ((115200%CONFIG_TTYS0_BAUD) != 0) #error Bad ttys0 baud rate #endif -#define CONFIG_TTYS0_DIV (115200/CONFIG_TTYS0_BAUD) -#endif /* Line Control Settings */ #ifndef CONFIG_TTYS0_LCS 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 diff --git a/src/mainboard/iwave/iWRainbowG6/Kconfig b/src/mainboard/iwave/iWRainbowG6/Kconfig index 7005bd365e..7ec8029579 100644 --- a/src/mainboard/iwave/iWRainbowG6/Kconfig +++ b/src/mainboard/iwave/iWRainbowG6/Kconfig @@ -37,9 +37,7 @@ config IRQ_SLOT_COUNT int default 10 -# WTF, is this 19200? -config TTYS0_DIV - int - default 6 +# This mainboard might have a higher clocked UART or might not be able to run +# serial output at 115200 baud endif |