![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <device/mmio.h>
#include <console/uart.h>
#include <delay.h>
#include <endian.h>
#include <stdint.h>
#include <soc/clock.h>
#include <soc/uart.h>
#include <assert.h>
#include <soc/addressmap.h>
#include <drivers/uart/pl011.h>
Go to the source code of this file.
Data Structures | |
union | cn81xx_uart_ctl |
struct | cn81xx_uart |
Macros | |
#define | UART_IBRD_BAUD_DIVINT_SHIFT 0 |
#define | UART_IBRD_BAUD_DIVINT_MASK 0xffff |
#define | UART_FBRD_BAUD_DIVFRAC_SHIFT 0 |
#define | UART_FBRD_BAUD_DIVFRAC_MASK 0x3f |
#define | UART_SCLK_DIV 3 |
Functions | |
check_member (cn81xx_uart, uctl_ctl, 0x1000) | |
check_member (cn81xx_uart, uctl_spare1, 0x10f8) | |
static size_t | uart_sclk_divisor (const size_t reg) |
Returns the current UART HCLK divider. More... | |
static size_t | uart_hclk (struct cn81xx_uart *uart) |
Returns the current UART HCLK. More... | |
unsigned int | uart_platform_refclk (void) |
uintptr_t | uart_platform_base (unsigned int idx) |
static void | uart_wait_hclk (struct cn81xx_uart *uart, const size_t hclks) |
Waits given count if HCLK cycles. More... | |
int | uart_is_enabled (const size_t bus) |
Returns the UART state. More... | |
int | uart_setup (const size_t bus, int baudrate) |
Setup UART with desired BAUD rate in 8N1, no parity mode. More... | |
check_member | ( | cn81xx_uart | , |
uctl_ctl | , | ||
0x1000 | |||
) |
check_member | ( | cn81xx_uart | , |
uctl_spare1 | , | ||
0x10f8 | |||
) |
|
static |
Returns the current UART HCLK.
uart | The UART to operate on |
Definition at line 76 of file uart.c.
References cn81xx_uart_ctl::h_clkdiv_sel, read64(), cn81xx_uart_ctl::s, thunderx_get_io_clock(), cn81xx_uart_ctl::u, uart_sclk_divisor(), and cn81xx_uart::uctl_ctl.
Referenced by uart_platform_refclk(), and uart_wait_hclk().
int uart_is_enabled | ( | const size_t | bus | ) |
Returns the UART state.
bus | The UART to operate on |
Definition at line 120 of file uart.c.
References assert, cn81xx_uart_ctl::csclk_en, read64(), cn81xx_uart_ctl::s, cn81xx_uart_ctl::u, UAAx_PF_BAR0, and cn81xx_uart::uctl_ctl.
Referenced by bootblock_mainboard_early_init(), and dt_platform_fixup().
Definition at line 85 of file uart.c.
References uart_hclk().
Referenced by uart_fill_lb(), and uart_init().
Returns the current UART HCLK divider.
reg | The H_CLKDIV_SEL value |
Definition at line 61 of file uart.c.
References ARRAY_SIZE, and assert.
Referenced by uart_hclk(), and uart_setup().
int uart_setup | ( | const size_t | bus, |
int | baudrate | ||
) |
Setup UART with desired BAUD rate in 8N1, no parity mode.
bus | The UART to operate on |
baudrate | baudrate to set up |
Exit here if the UART is not going to be used in coreboot. The previous initialization steps are sufficient to make the Linux kernel not panic.
Definition at line 141 of file uart.c.
References assert, pl011_uart::cr, cn81xx_uart_ctl::csclk_en, pl011_uart::fbrd, cn81xx_uart_ctl::h_clk_byp_sel, cn81xx_uart_ctl::h_clk_en, cn81xx_uart_ctl::h_clkdiv_rst, cn81xx_uart_ctl::h_clkdiv_sel, pl011_uart::ibrd, pl011_uart::lcr_h, cn81xx_uart::pl011, PL011_UARTCR_RXE, PL011_UARTCR_TXE, PL011_UARTCR_UARTEN, PL011_UARTLCR_H_FEN, PL011_UARTLCR_H_WLEN_8, read64(), cn81xx_uart_ctl::s, thunderx_get_io_clock(), cn81xx_uart_ctl::u, cn81xx_uart_ctl::uaa_rst, UAAx_PF_BAR0, UART_FBRD_BAUD_DIVFRAC_MASK, UART_SCLK_DIV, uart_sclk_divisor(), uart_wait_hclk(), cn81xx_uart::uctl_ctl, cn81xx_uart_ctl::uctl_rst, write32(), and write64().
Referenced by bootblock_mainboard_early_init().
|
static |
Waits given count if HCLK cycles.
uart | The UART to operate on |
hclks | The number of HCLK cycles to wait |
Definition at line 107 of file uart.c.
References delay(), MAX, uart_hclk(), and udelay().
Referenced by uart_setup().