blob: 41e66face861bb41f1872bc16654f383197d0f22 [file] [log] [blame]
Hung-Te Lin7635a602013-02-12 00:07:38 +08001/*
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älkkibbf6f3d2014-03-15 01:32:55 +020016#include <boot/coreboot_tables.h>
Kyösti Mälkki1d7541f2014-02-17 21:34:42 +020017#include <console/uart.h>
Hung-Te Lin7635a602013-02-12 00:07:38 +080018
Kyösti Mälkkic2610a42014-02-24 20:51:30 +020019static void pl011_uart_tx_byte(unsigned int *uart_base, unsigned char data)
Kyösti Mälkki7e75f202014-02-10 23:21:14 +020020{
Kyösti Mälkkic2610a42014-02-24 20:51:30 +020021 *uart_base = (unsigned int)data;
22}
Hung-Te Lin7635a602013-02-12 00:07:38 +080023
Kyösti Mälkkic2610a42014-02-24 20:51:30 +020024unsigned int uart_platform_base(int idx)
25{
26 return CONFIG_CONSOLE_SERIAL_UART_ADDRESS;
Hung-Te Lin7635a602013-02-12 00:07:38 +080027}
28
Hung-Te Lin7635a602013-02-12 00:07:38 +080029void uart_init(void)
30{
Hung-Te Lin7635a602013-02-12 00:07:38 +080031}
32
33void uart_tx_byte(unsigned char data)
34{
Kyösti Mälkkic2610a42014-02-24 20:51:30 +020035 unsigned int *uart_base = uart_platform_baseptr(0);
36 pl011_uart_tx_byte(uart_base, data);
Hung-Te Lin7635a602013-02-12 00:07:38 +080037}
38
Kyösti Mälkki7e75f202014-02-10 23:21:14 +020039void uart_tx_flush(void)
40{
Hung-Te Lin7635a602013-02-12 00:07:38 +080041}
Kyösti Mälkki0567c912014-02-14 10:31:38 +020042
43unsigned char uart_rx_byte(void)
44{
45 return 0;
46}
Kyösti Mälkkibbf6f3d2014-03-15 01:32:55 +020047
48#ifndef __PRE_RAM__
49void uart_fill_lb(void *data)
50{
51 struct lb_serial serial;
52 serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
53 serial.baseaddr = uart_platform_base(0);
54 serial.baud = default_baudrate();
55 lb_add_serial(&serial, data);
56
57 lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
58}
59#endif