Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2013 Google, Inc. |
| 5 | * |
| 6 | * This software is licensed under the terms of the GNU General Public |
| 7 | * License version 2, as published by the Free Software Foundation, and |
| 8 | * may be copied, distributed, and modified under those terms. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
Kyösti Mälkki | bbf6f3d | 2014-03-15 01:32:55 +0200 | [diff] [blame] | 16 | #include <boot/coreboot_tables.h> |
Kyösti Mälkki | 1d7541f | 2014-02-17 21:34:42 +0200 | [diff] [blame] | 17 | #include <console/uart.h> |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 18 | |
Kyösti Mälkki | c2610a4 | 2014-02-24 20:51:30 +0200 | [diff] [blame] | 19 | static void pl011_uart_tx_byte(unsigned int *uart_base, unsigned char data) |
Kyösti Mälkki | 7e75f20 | 2014-02-10 23:21:14 +0200 | [diff] [blame] | 20 | { |
Kyösti Mälkki | c2610a4 | 2014-02-24 20:51:30 +0200 | [diff] [blame] | 21 | *uart_base = (unsigned int)data; |
| 22 | } |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 23 | |
Kyösti Mälkki | 70342a7 | 2014-03-14 22:28:29 +0200 | [diff] [blame] | 24 | void uart_init(int idx) |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 25 | { |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 26 | } |
| 27 | |
Kyösti Mälkki | 70342a7 | 2014-03-14 22:28:29 +0200 | [diff] [blame] | 28 | void uart_tx_byte(int idx, unsigned char data) |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 29 | { |
Kyösti Mälkki | 70342a7 | 2014-03-14 22:28:29 +0200 | [diff] [blame] | 30 | unsigned int *uart_base = uart_platform_baseptr(idx); |
Kyösti Mälkki | c2610a4 | 2014-02-24 20:51:30 +0200 | [diff] [blame] | 31 | pl011_uart_tx_byte(uart_base, data); |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 32 | } |
| 33 | |
Kyösti Mälkki | 70342a7 | 2014-03-14 22:28:29 +0200 | [diff] [blame] | 34 | void uart_tx_flush(int idx) |
Kyösti Mälkki | 7e75f20 | 2014-02-10 23:21:14 +0200 | [diff] [blame] | 35 | { |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 36 | } |
Kyösti Mälkki | 0567c91 | 2014-02-14 10:31:38 +0200 | [diff] [blame] | 37 | |
Kyösti Mälkki | 70342a7 | 2014-03-14 22:28:29 +0200 | [diff] [blame] | 38 | unsigned char uart_rx_byte(int idx) |
Kyösti Mälkki | 0567c91 | 2014-02-14 10:31:38 +0200 | [diff] [blame] | 39 | { |
| 40 | return 0; |
| 41 | } |
Kyösti Mälkki | bbf6f3d | 2014-03-15 01:32:55 +0200 | [diff] [blame] | 42 | |
| 43 | #ifndef __PRE_RAM__ |
| 44 | void uart_fill_lb(void *data) |
| 45 | { |
| 46 | struct lb_serial serial; |
| 47 | serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED; |
Kyösti Mälkki | 70342a7 | 2014-03-14 22:28:29 +0200 | [diff] [blame] | 48 | serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE); |
Kyösti Mälkki | bbf6f3d | 2014-03-15 01:32:55 +0200 | [diff] [blame] | 49 | serial.baud = default_baudrate(); |
Vadim Bendebury | 9dccf1c | 2015-01-09 16:54:19 -0800 | [diff] [blame] | 50 | serial.regwidth = 1; |
Kyösti Mälkki | bbf6f3d | 2014-03-15 01:32:55 +0200 | [diff] [blame] | 51 | lb_add_serial(&serial, data); |
| 52 | |
| 53 | lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data); |
| 54 | } |
| 55 | #endif |