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

Go to the source code of this file.

Data Structures

struct  uart_params_t
 

Macros

#define FIFO_DATA_SIZE   4
 

Functions

static unsigned int msm_boot_uart_dm_init_rx_transfer (void *uart_dm_base)
 msm_boot_uart_dm_init_rx_transfer - Init Rx transfer More...
 
static unsigned int msm_boot_uart_dm_init (void *uart_dm_base)
 
void uart_tx_byte (unsigned int idx, unsigned char data)
 msm_boot_uart_dm_read - reads a word from the RX FIFO. More...
 
static unsigned int msm_boot_uart_dm_reset (void *base)
 
void uart_init (unsigned int idx)
 ipq806x_uart_init - initializes UART More...
 
void ipq806x_uart_init (void)
 
void uart_tx_flush (unsigned int idx)
 uart_tx_flush - transmits a string of data @s: string to transmit More...
 
uint8_t uart_rx_byte (unsigned int idx)
 uart_can_rx_byte - checks if data available for reading More...
 
void uart_fill_lb (void *data)
 

Variables

static const uart_params_t uart_board_param
 
static int valid_data = 0
 
static unsigned int word = 0
 

Macro Definition Documentation

◆ FIFO_DATA_SIZE

#define FIFO_DATA_SIZE   4

Definition at line 14 of file uart.c.

Function Documentation

◆ ipq806x_uart_init()

void ipq806x_uart_init ( void  )

Definition at line 303 of file uart.c.

References uart_init().

Referenced by soc_init().

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

◆ msm_boot_uart_dm_init()

◆ msm_boot_uart_dm_init_rx_transfer()

static unsigned int msm_boot_uart_dm_init_rx_transfer ( void uart_dm_base)
static

msm_boot_uart_dm_init_rx_transfer - Init Rx transfer

Parameters
uart_dm_baseUART controller base address

Definition at line 57 of file uart.c.

References MSM_BOOT_UART_DM_CMD_RES_STALE_INT, MSM_BOOT_UART_DM_CMD_RESET_RX, MSM_BOOT_UART_DM_CR, MSM_BOOT_UART_DM_CR_RX_ENABLE, MSM_BOOT_UART_DM_DMRX, MSM_BOOT_UART_DM_DMRX_DEF_VALUE, MSM_BOOT_UART_DM_E_SUCCESS, MSM_BOOT_UART_DM_GCMD_ENA_STALE_EVT, and write32().

Referenced by msm_boot_uart_dm_init().

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

◆ msm_boot_uart_dm_reset()

static unsigned int msm_boot_uart_dm_reset ( void base)
static

Definition at line 187 of file uart.c.

References base, MSM_BOOT_UART_DM_CMD_RES_STALE_INT, MSM_BOOT_UART_DM_CMD_RES_TX_ERR, MSM_BOOT_UART_DM_CMD_RESET_ERR_STAT, MSM_BOOT_UART_DM_CMD_RESET_RX, MSM_BOOT_UART_DM_CMD_RESET_TX, MSM_BOOT_UART_DM_CR, MSM_BOOT_UART_DM_E_SUCCESS, and write32().

Referenced by msm_boot_uart_dm_init().

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)

Definition at line 371 of file uart.c.

◆ uart_init()

◆ uart_rx_byte()

uint8_t uart_rx_byte ( unsigned int  idx)

uart_can_rx_byte - checks if data available for reading

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 354 of file uart.c.

References valid_data, and word.

◆ 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 base, MSM_BOOT_UART_DM_NO_CHARS_FOR_TX, MSM_BOOT_UART_DM_SR, MSM_BOOT_UART_DM_SR_TXEMT, MSM_BOOT_UART_DM_TF, read32(), uart_board_param, uart_params_t::uart_dm_base, udelay(), and write32().

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 @s: string to transmit

uart_tx_flush - transmits a string of data

Definition at line 319 of file uart.c.

References base, MSM_BOOT_UART_DM_SR, MSM_BOOT_UART_DM_SR_TXEMT, read32(), uart_board_param, and uart_params_t::uart_dm_base.

Here is the call graph for this function:

Variable Documentation

◆ uart_board_param

const uart_params_t uart_board_param
static
Initial value:
= {
.uart_dm_base = (void *)UART4_DM_BASE,
.uart_gsbi_base = (void *)UART_GSBI4_BASE,
.uart_gsbi = GSBI_4,
.mnd_value = { 12, 625, 313 },
.dbg_uart_gpio = {
{
.gpio = 10,
.func = 1,
.dir = GPIO_OUTPUT,
.pull = GPIO_NO_PULL,
.drvstr = GPIO_12MA,
.enable = GPIO_DISABLE
},
{
.gpio = 11,
.func = 1,
.dir = GPIO_INPUT,
.pull = GPIO_NO_PULL,
.drvstr = GPIO_12MA,
.enable = GPIO_DISABLE
},
}
}
#define GPIO_OUTPUT
Definition: gpio_ftns.h:23
#define GPIO_INPUT
Definition: gpio_ftns.h:24
@ GPIO_12MA
Definition: gpio_common.h:75
@ GPIO_NO_PULL
Definition: gpio_common.h:62
#define UART_GSBI4_BASE
Definition: iomap.h:76
#define UART4_DM_BASE
Definition: iomap.h:75
#define GSBI_4
Definition: iomap.h:70
#define GPIO_DISABLE
Definition: gpio.h:37

Definition at line 28 of file uart.c.

Referenced by uart_init(), uart_tx_byte(), and uart_tx_flush().

◆ valid_data

int valid_data = 0
static

Definition at line 83 of file uart.c.

Referenced by uart_rx_byte().

◆ word

unsigned int word = 0
static

Definition at line 86 of file uart.c.

Referenced by uart_rx_byte().