blob: f0371a2a9837161c44d56aab68eb5c5db32d08df [file] [log] [blame]
Stefan Reinauer509f7722012-12-07 17:31:37 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2012 The ChromiumOS Authors. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
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 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stefan Reinauer509f7722012-12-07 17:31:37 -080018 */
19
Kyösti Mälkki1d7541f2014-02-17 21:34:42 +020020#ifndef CONSOLE_UART_H
21#define CONSOLE_UART_H
Stefan Reinauer509f7722012-12-07 17:31:37 -080022
Kyösti Mälkki0567c912014-02-14 10:31:38 +020023#include <stdint.h>
24
Kyösti Mälkki3ee16682014-02-17 19:37:52 +020025/* Return the clock frequency UART uses as reference clock for
26 * baudrate generator. */
27unsigned int uart_platform_refclk(void);
28
29/* Return the baudrate determined from option_table, or when that is
30 * not used, CONFIG_TTYS0_BAUD.
31 */
32unsigned int default_baudrate(void);
33
34/* Returns the divisor value for a given baudrate.
35 * The formula to satisfy is:
36 * refclk / divisor = baudrate * oversample
37 */
38unsigned int uart_baudrate_divisor(unsigned int baudrate,
39 unsigned int refclk, unsigned int oversample);
40
41
Kyösti Mälkki47707492014-02-15 07:53:18 +020042void uart_init(void);
Stefan Reinauer509f7722012-12-07 17:31:37 -080043void uart_tx_byte(unsigned char data);
44void uart_tx_flush(void);
Kyösti Mälkki47707492014-02-15 07:53:18 +020045unsigned char uart_rx_byte(void);
46int uart_can_rx_byte(void);
Stefan Reinauer509f7722012-12-07 17:31:37 -080047
Kyösti Mälkki2b95da02014-02-15 10:19:23 +020048unsigned int uart_platform_base(int idx);
David Hendricksfdcef1a2013-02-15 19:29:12 -080049uint32_t uartmem_getbaseaddr(void);
David Hendricksfdcef1a2013-02-15 19:29:12 -080050
Kyösti Mälkki1d7541f2014-02-17 21:34:42 +020051void oxford_init(void);
Kyösti Mälkki2b95da02014-02-15 10:19:23 +020052void oxford_remap(unsigned int new_base);
Kyösti Mälkki1d7541f2014-02-17 21:34:42 +020053
54#endif /* CONSOLE_UART_H */