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 | 1d7541f | 2014-02-17 21:34:42 +0200 | [diff] [blame] | 16 | #include <console/uart.h> |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 17 | |
Kyösti Mälkki | c2610a4 | 2014-02-24 20:51:30 +0200 | [diff] [blame^] | 18 | 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] | 19 | { |
Kyösti Mälkki | c2610a4 | 2014-02-24 20:51:30 +0200 | [diff] [blame^] | 20 | *uart_base = (unsigned int)data; |
| 21 | } |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 22 | |
Kyösti Mälkki | c2610a4 | 2014-02-24 20:51:30 +0200 | [diff] [blame^] | 23 | unsigned int uart_platform_base(int idx) |
| 24 | { |
| 25 | return CONFIG_CONSOLE_SERIAL_UART_ADDRESS; |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 26 | } |
| 27 | |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 28 | #if !defined(__PRE_RAM__) |
Ronald G. Minnich | c8fadd9 | 2013-02-20 14:13:01 -0800 | [diff] [blame] | 29 | uint32_t uartmem_getbaseaddr(void) |
| 30 | { |
Kyösti Mälkki | 7e75f20 | 2014-02-10 23:21:14 +0200 | [diff] [blame] | 31 | return CONFIG_CONSOLE_SERIAL_UART_ADDRESS; |
Ronald G. Minnich | c8fadd9 | 2013-02-20 14:13:01 -0800 | [diff] [blame] | 32 | } |
Kyösti Mälkki | 0567c91 | 2014-02-14 10:31:38 +0200 | [diff] [blame] | 33 | #endif |
| 34 | |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 35 | void uart_init(void) |
| 36 | { |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | void uart_tx_byte(unsigned char data) |
| 40 | { |
Kyösti Mälkki | c2610a4 | 2014-02-24 20:51:30 +0200 | [diff] [blame^] | 41 | unsigned int *uart_base = uart_platform_baseptr(0); |
| 42 | pl011_uart_tx_byte(uart_base, data); |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 43 | } |
| 44 | |
Kyösti Mälkki | 7e75f20 | 2014-02-10 23:21:14 +0200 | [diff] [blame] | 45 | void uart_tx_flush(void) |
| 46 | { |
Hung-Te Lin | 7635a60 | 2013-02-12 00:07:38 +0800 | [diff] [blame] | 47 | } |
Kyösti Mälkki | 0567c91 | 2014-02-14 10:31:38 +0200 | [diff] [blame] | 48 | |
| 49 | unsigned char uart_rx_byte(void) |
| 50 | { |
| 51 | return 0; |
| 52 | } |