coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
uart.c File Reference
#include <types.h>
#include <console/uart.h>
#include <device/mmio.h>
#include <boot/coreboot_tables.h>
#include <soc/ti/am335x/uart.h>
Include dependency graph for uart.c:

Go to the source code of this file.

Macros

#define EFR_ENHANCED_EN   (1 << 4)
 
#define FCR_FIFO_EN   (1 << 0)
 
#define MCR_TCR_TLR   (1 << 6)
 
#define SYSC_SOFTRESET   (1 << 1)
 
#define SYSS_RESETDONE   (1 << 0)
 
#define LSR_RXFIFOE   (1 << 0)
 
#define LSR_TXFIFOE   (1 << 5)
 

Functions

static void am335x_uart_init (struct am335x_uart *uart, uint16_t div)
 
static unsigned char am335x_uart_rx_byte (struct am335x_uart *uart)
 
static void am335x_uart_tx_byte (struct am335x_uart *uart, unsigned char data)
 
unsigned int uart_platform_refclk (void)
 
uintptr_t uart_platform_base (unsigned int idx)
 
void uart_init (unsigned int idx)
 ipq40xx_uart_init - initializes UART More...
 
unsigned char uart_rx_byte (unsigned int idx)
 ipq40xx_serial_getc - reads a character More...
 
void uart_tx_byte (unsigned int idx, unsigned char data)
 msm_boot_uart_dm_read - reads a word from the RX FIFO. More...
 
void uart_tx_flush (unsigned int idx)
 uart_tx_flush - transmits a string of data More...
 
void uart_fill_lb (void *data)
 

Macro Definition Documentation

◆ EFR_ENHANCED_EN

#define EFR_ENHANCED_EN   (1 << 4)

Definition at line 9 of file uart.c.

◆ FCR_FIFO_EN

#define FCR_FIFO_EN   (1 << 0)

Definition at line 10 of file uart.c.

◆ LSR_RXFIFOE

#define LSR_RXFIFOE   (1 << 0)

Definition at line 15 of file uart.c.

◆ LSR_TXFIFOE

#define LSR_TXFIFOE   (1 << 5)

Definition at line 16 of file uart.c.

◆ MCR_TCR_TLR

#define MCR_TCR_TLR   (1 << 6)

Definition at line 11 of file uart.c.

◆ SYSC_SOFTRESET

#define SYSC_SOFTRESET   (1 << 1)

Definition at line 12 of file uart.c.

◆ SYSS_RESETDONE

#define SYSS_RESETDONE   (1 << 0)

Definition at line 13 of file uart.c.

Function Documentation

◆ am335x_uart_init()

static void am335x_uart_init ( struct am335x_uart uart,
uint16_t  div 
)
static

Definition at line 22 of file uart.c.

References am335x_uart::dlh, am335x_uart::dll, am335x_uart::efr, EFR_ENHANCED_EN, am335x_uart::fcr, FCR_FIFO_EN, am335x_uart::ier, am335x_uart::lcr, am335x_uart::mcr, MCR_TCR_TLR, am335x_uart::mdr1, read16(), am335x_uart::sysc, SYSC_SOFTRESET, am335x_uart::syss, SYSS_RESETDONE, and write16().

Referenced by uart_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ am335x_uart_rx_byte()

static unsigned char am335x_uart_rx_byte ( struct am335x_uart uart)
static

Definition at line 116 of file uart.c.

References am335x_uart::lsr, LSR_RXFIFOE, read16(), read8(), and am335x_uart::rhr.

Referenced by uart_rx_byte().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ am335x_uart_tx_byte()

static void am335x_uart_tx_byte ( struct am335x_uart uart,
unsigned char  data 
)
static

Definition at line 126 of file uart.c.

References am335x_uart::lsr, LSR_TXFIFOE, read16(), am335x_uart::thr, and write8().

Referenced by uart_tx_byte().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uart_fill_lb()

void uart_fill_lb ( void data)

◆ uart_init()

void uart_init ( unsigned int  idx)

ipq40xx_uart_init - initializes UART

Initializes clocks, GPIO and UART controller.

ipq40xx_uart_init - initializes UART

Initializes clocks, GPIO and UART controller.

Definition at line 149 of file uart.c.

References am335x_uart_init(), get_uart_baudrate(), uart_baudrate_divisor(), uart_platform_baseptr(), and uart_platform_refclk().

Here is the call graph for this function:

◆ uart_platform_base()

uintptr_t uart_platform_base ( unsigned int  idx)

Definition at line 138 of file uart.c.

References ARRAY_SIZE, and bases.

◆ uart_platform_refclk()

unsigned int uart_platform_refclk ( void  )

Definition at line 133 of file uart.c.

◆ uart_rx_byte()

unsigned char uart_rx_byte ( unsigned int  idx)

ipq40xx_serial_getc - reads a character

Returns the character read from serial port.

ipq40xx_serial_getc - reads a character

Returns 1 if data available, 0 otherwise ipq806x_serial_getc - reads a character

Returns the character read from serial port.

Definition at line 157 of file uart.c.

References am335x_uart_rx_byte(), and uart_platform_baseptr().

Here is the call graph for this function:

◆ uart_tx_byte()

void uart_tx_byte ( unsigned int  idx,
unsigned char  data 
)

msm_boot_uart_dm_read - reads a word from the RX FIFO.

@data: location where the read data is stored @count: no of valid data in the FIFO @wait: indicates blocking call or not blocking call

Reads a word from the RX FIFO. If no data is available blocks if @wait is true, else returns MSM_BOOT_UART_DM_E_RX_NOT_READY.

Definition at line 163 of file uart.c.

References am335x_uart_tx_byte(), and uart_platform_baseptr().

Here is the call graph for this function:

◆ uart_tx_flush()

void uart_tx_flush ( unsigned int  idx)

uart_tx_flush - transmits a string of data

Parameters
idxstring to transmit

uart_tx_flush - transmits a string of data

Definition at line 169 of file uart.c.