summaryrefslogtreecommitdiff
path: root/src/lib/uart8250mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/uart8250mem.c')
-rw-r--r--src/lib/uart8250mem.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/lib/uart8250mem.c b/src/lib/uart8250mem.c
index 040e732df3..5e96825834 100644
--- a/src/lib/uart8250mem.c
+++ b/src/lib/uart8250mem.c
@@ -21,10 +21,6 @@
#include <arch/io.h>
#include <uart.h>
#include <uart8250.h>
-#include <pc80/mc146818rtc.h>
-#if CONFIG_USE_OPTION_TABLE
-#include "option_table.h"
-#endif
#include <device/device.h>
#include <delay.h>
@@ -96,7 +92,6 @@ void uart8250_mem_init(unsigned base_port, unsigned divisor)
/* DLAB on */
write8(base_port + UART_LCR, UART_LCR_DLAB | CONFIG_TTYS0_LCS);
- /* Set Baud Rate Divisor. 12 ==> 9600 Baud */
write8(base_port + UART_DLL, divisor & 0xFF);
write8(base_port + UART_DLM, (divisor >> 8) & 0xFF);
@@ -106,27 +101,11 @@ void uart8250_mem_init(unsigned base_port, unsigned divisor)
u32 uart_mem_init(void)
{
- unsigned uart_baud = CONFIG_TTYS0_BAUD;
u32 uart_bar = 0;
unsigned div;
- /* find out the correct baud rate */
-#if !defined(__SMM__) && CONFIG_USE_OPTION_TABLE
- static const unsigned baud[8] = { 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1200 };
- unsigned b_index = 0;
-#if defined(__PRE_RAM__)
- b_index = read_option(baud_rate, 0);
- b_index &= 7;
- uart_baud = baud[b_index];
-#else
- if (get_option(&b_index, "baud_rate") == CB_SUCCESS)
- uart_baud = baud[b_index];
-#endif
-#endif
-
/* Now find the UART base address and calculate the divisor */
#if CONFIG_DRIVERS_OXFORD_OXPCIE
-
#if defined(MORE_TESTING) && !defined(__SIMPLE_DEVICE__)
device_t dev = dev_find_device(0x1415, 0xc158, NULL);
if (!dev)
@@ -145,10 +124,9 @@ u32 uart_mem_init(void)
#endif
uart_bar = CONFIG_OXFORD_OXPCIE_BASE_ADDRESS + 0x1000; // 1st UART
// uart_bar = CONFIG_OXFORD_OXPCIE_BASE_ADDRESS + 0x2000; // 2nd UART
-
- div = 4000000 / uart_baud;
#endif
+ div = uart_baudrate_divisor(default_baudrate(), uart_platform_refclk(), 16);
if (uart_bar)
uart8250_mem_init(uart_bar, div);