From b116a1aa9ce289cd27f6eed51d3ce1d7dd35377b Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Mon, 26 Jan 2015 07:11:01 -0800 Subject: [PATCH] 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 Original-Commit-Id: ed4cfdd5ed6ccbf87a50f56d3e07f2f1a9d49464 Original-Change-Id: I3faeb92f026062cded390603a610e5b8f7c9bc12 Original-Signed-off-by: David Hendricks Original-Reviewed-on: https://chromium-review.googlesource.com/243211 Original-Reviewed-by: Ionela Voinescu Reviewed-on: http://review.coreboot.org/9777 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks --- src/soc/imgtec/pistachio/uart.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/src/soc/imgtec/pistachio/uart.c b/src/soc/imgtec/pistachio/uart.c index ee5da57a37..a9e1a54bee 100644 --- a/src/soc/imgtec/pistachio/uart.c +++ b/src/soc/imgtec/pistachio/uart.c @@ -122,23 +122,9 @@ unsigned int uart_platform_refclk(void) 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) { - u32 base = uart_platform_base(idx); + u32 base = CONFIG_CONSOLE_SERIAL_UART_ADDRESS; if (!base) return; @@ -150,26 +136,17 @@ void uart_init(int idx) void uart_tx_byte(int idx, unsigned char data) { - u32 base = uart_platform_base(idx); - if (!base) - return; - uart8250_mem_tx_byte(base, data); + uart8250_mem_tx_byte(CONFIG_CONSOLE_SERIAL_UART_ADDRESS, data); } unsigned char uart_rx_byte(int idx) { - u32 base = uart_platform_base(idx); - if (!base) - return 0xff; - return uart8250_mem_rx_byte(base); + return uart8250_mem_rx_byte(CONFIG_CONSOLE_SERIAL_UART_ADDRESS); } void uart_tx_flush(int idx) { - u32 base = uart_platform_base(idx); - if (!base) - return; - uart8250_mem_tx_flush(base); + uart8250_mem_tx_flush(CONFIG_CONSOLE_SERIAL_UART_ADDRESS); } #ifndef __PRE_RAM__ @@ -177,7 +154,7 @@ void uart_fill_lb(void *data) { struct lb_serial serial; 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.regwidth = 1 << UART_SHIFT; lb_add_serial(&serial, data);