pistachio: Move console UART to a Kconfig variable

This allows us to define the serial console UART on a per-board
basis.

BUG=chrome-os-partner:31438
BRANCH=none
TEST=built and booted on urara w/ follow-up patches

Change-Id: Idbb0d39bf8855df4312f7499c60b8b92826fdd07
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: ed4cfdd5ed6ccbf87a50f56d3e07f2f1a9d49464
Original-Change-Id: I3faeb92f026062cded390603a610e5b8f7c9bc12
Original-Signed-off-by: David Hendricks <dhendrix@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/243211
Original-Reviewed-by: Ionela Voinescu <ionela.voinescu@imgtec.com>
Reviewed-on: http://review.coreboot.org/9777
Tested-by: build bot (Jenkins)
Reviewed-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
David Hendricks 2015-01-26 07:11:01 -08:00 committed by Patrick Georgi
parent d82e0cf331
commit b116a1aa9c
1 changed files with 5 additions and 28 deletions

View File

@ -122,23 +122,9 @@ unsigned int uart_platform_refclk(void)
return 1843318; return 1843318;
} }
uintptr_t uart_platform_base(int idx)
{
switch (idx) {
case 0:
return 0xb8101400;
case 1:
return 0xb8101500;
default:
return 0x0;
}
}
void uart_init(int idx) void uart_init(int idx)
{ {
u32 base = uart_platform_base(idx); u32 base = CONFIG_CONSOLE_SERIAL_UART_ADDRESS;
if (!base) if (!base)
return; return;
@ -150,26 +136,17 @@ void uart_init(int idx)
void uart_tx_byte(int idx, unsigned char data) void uart_tx_byte(int idx, unsigned char data)
{ {
u32 base = uart_platform_base(idx); uart8250_mem_tx_byte(CONFIG_CONSOLE_SERIAL_UART_ADDRESS, data);
if (!base)
return;
uart8250_mem_tx_byte(base, data);
} }
unsigned char uart_rx_byte(int idx) unsigned char uart_rx_byte(int idx)
{ {
u32 base = uart_platform_base(idx); return uart8250_mem_rx_byte(CONFIG_CONSOLE_SERIAL_UART_ADDRESS);
if (!base)
return 0xff;
return uart8250_mem_rx_byte(base);
} }
void uart_tx_flush(int idx) void uart_tx_flush(int idx)
{ {
u32 base = uart_platform_base(idx); uart8250_mem_tx_flush(CONFIG_CONSOLE_SERIAL_UART_ADDRESS);
if (!base)
return;
uart8250_mem_tx_flush(base);
} }
#ifndef __PRE_RAM__ #ifndef __PRE_RAM__
@ -177,7 +154,7 @@ void uart_fill_lb(void *data)
{ {
struct lb_serial serial; struct lb_serial serial;
serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED; serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE); serial.baseaddr = CONFIG_CONSOLE_SERIAL_UART_ADDRESS;
serial.baud = default_baudrate(); serial.baud = default_baudrate();
serial.regwidth = 1 << UART_SHIFT; serial.regwidth = 1 << UART_SHIFT;
lb_add_serial(&serial, data); lb_add_serial(&serial, data);