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 | |
| 16 | #include <console/console.h> |
| 17 | #include <uart.h> |
| 18 | |
| 19 | #define VEXPRESS_UART0_IO_ADDRESS (0x10009000) |
| 20 | |
| 21 | static void pl011_init_dev(void) { |
| 22 | } |
| 23 | |
| 24 | static void pl011_uart_tx_byte(unsigned char data) { |
| 25 | static volatile unsigned int *uart0_address = |
| 26 | (unsigned int *)VEXPRESS_UART0_IO_ADDRESS; |
| 27 | |
| 28 | *uart0_address = (unsigned int)data; |
| 29 | } |
| 30 | |
| 31 | static void pl011_uart_tx_flush(void) { |
| 32 | } |
| 33 | |
| 34 | #if !defined(__PRE_RAM__) |
| 35 | |
| 36 | static const struct console_driver pl011_uart_console __console = { |
| 37 | .init = pl011_init_dev, |
| 38 | .tx_byte = pl011_uart_tx_byte, |
| 39 | .tx_flush = pl011_uart_tx_flush, |
| 40 | }; |
| 41 | |
| 42 | #else |
| 43 | void uart_init(void) |
| 44 | { |
| 45 | pl011_init_dev(); |
| 46 | } |
| 47 | |
| 48 | void uart_tx_byte(unsigned char data) |
| 49 | { |
| 50 | pl011_uart_tx_byte(data); |
| 51 | } |
| 52 | |
| 53 | void uart_tx_flush(void) { |
| 54 | pl011_uart_tx_flush(); |
| 55 | } |
| 56 | #endif |