blob: aa55c682a687d5b9483afdd1c09f89c54b960c25 [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älkki70342a72014-03-14 22:28:29 +020024void uart_init(int idx)
Hung-Te Lin7635a602013-02-12 00:07:38 +080025{
Hung-Te Lin7635a602013-02-12 00:07:38 +080026}
27
Kyösti Mälkki70342a72014-03-14 22:28:29 +020028void uart_tx_byte(int idx, unsigned char data)
Hung-Te Lin7635a602013-02-12 00:07:38 +080029{
Kyösti Mälkki70342a72014-03-14 22:28:29 +020030 unsigned int *uart_base = uart_platform_baseptr(idx);
Kyösti Mälkkic2610a42014-02-24 20:51:30 +020031 pl011_uart_tx_byte(uart_base, data);
Hung-Te Lin7635a602013-02-12 00:07:38 +080032}
33
Kyösti Mälkki70342a72014-03-14 22:28:29 +020034void uart_tx_flush(int idx)
Kyösti Mälkki7e75f202014-02-10 23:21:14 +020035{
Hung-Te Lin7635a602013-02-12 00:07:38 +080036}
Kyösti Mälkki0567c912014-02-14 10:31:38 +020037
Kyösti Mälkki70342a72014-03-14 22:28:29 +020038unsigned char uart_rx_byte(int idx)
Kyösti Mälkki0567c912014-02-14 10:31:38 +020039{
40 return 0;
41}
Kyösti Mälkkibbf6f3d2014-03-15 01:32:55 +020042
43#ifndef __PRE_RAM__
44void uart_fill_lb(void *data)
45{
46 struct lb_serial serial;
47 serial.type = LB_SERIAL_TYPE_MEMORY_MAPPED;
Kyösti Mälkki70342a72014-03-14 22:28:29 +020048 serial.baseaddr = uart_platform_base(CONFIG_UART_FOR_CONSOLE);
Kyösti Mälkkibbf6f3d2014-03-15 01:32:55 +020049 serial.baud = default_baudrate();
Vadim Bendebury9dccf1c2015-01-09 16:54:19 -080050 serial.regwidth = 1;
Kyösti Mälkkibbf6f3d2014-03-15 01:32:55 +020051 lb_add_serial(&serial, data);
52
53 lb_add_console(LB_TAG_CONSOLE_SERIAL8250MEM, data);
54}
55#endif