coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
qup.c File Reference
#include <device/mmio.h>
#include <console/console.h>
#include <delay.h>
#include <timer.h>
#include <soc/iomap.h>
#include <soc/qup.h>
Include dependency graph for qup.c:

Go to the source code of this file.

Macros

#define TIMEOUT_CNT   100000
 
#define QUP_ADDR(gsbi_num, reg)   ((void *)((gsbi_qup_base[gsbi_num-1]) + (reg)))
 

Functions

static qup_return_t qup_i2c_master_status (gsbi_id_t gsbi_id)
 
static int check_bit_state (uint32_t *reg, int wait_for)
 
static qup_return_t qup_wait_for_state (gsbi_id_t gsbi_id, unsigned int wait_for)
 
qup_return_t qup_reset_i2c_master_status (gsbi_id_t gsbi_id)
 
static qup_return_t qup_reset_master_status (gsbi_id_t gsbi_id)
 
static qup_return_t qup_fifo_wait_for (gsbi_id_t gsbi_id, uint32_t status, struct stopwatch *timeout)
 
static qup_return_t qup_fifo_wait_while (gsbi_id_t gsbi_id, uint32_t status, struct stopwatch *timeout)
 
static qup_return_t qup_i2c_write_fifo (gsbi_id_t gsbi_id, qup_data_t *p_tx_obj, uint8_t stop_seq)
 
static qup_return_t qup_i2c_write (gsbi_id_t gsbi_id, uint8_t mode, qup_data_t *p_tx_obj, uint8_t stop_seq)
 
static qup_return_t qup_i2c_read_fifo (gsbi_id_t gsbi_id, qup_data_t *p_tx_obj)
 
static qup_return_t qup_i2c_read (gsbi_id_t gsbi_id, uint8_t mode, qup_data_t *p_tx_obj)
 
qup_return_t qup_init (gsbi_id_t gsbi_id, const qup_config_t *config_ptr)
 
qup_return_t qup_set_state (gsbi_id_t gsbi_id, uint32_t state)
 
static qup_return_t qup_i2c_send_data (gsbi_id_t gsbi_id, qup_data_t *p_tx_obj, uint8_t stop_seq)
 
qup_return_t qup_send_data (gsbi_id_t gsbi_id, qup_data_t *p_tx_obj, uint8_t stop_seq)
 
static qup_return_t qup_i2c_recv_data (gsbi_id_t gsbi_id, qup_data_t *p_rx_obj)
 
qup_return_t qup_recv_data (gsbi_id_t gsbi_id, qup_data_t *p_rx_obj)
 

Variables

static unsigned int gsbi_qup_base []
 

Macro Definition Documentation

◆ QUP_ADDR

#define QUP_ADDR (   gsbi_num,
  reg 
)    ((void *)((gsbi_qup_base[gsbi_num-1]) + (reg)))

Definition at line 23 of file qup.c.

◆ TIMEOUT_CNT

#define TIMEOUT_CNT   100000

Definition at line 10 of file qup.c.

Function Documentation

◆ check_bit_state()

static int check_bit_state ( uint32_t reg,
int  wait_for 
)
static

Definition at line 49 of file qup.c.

References count, QUP_ERR_TIMEOUT, QUP_STATE_MASK, QUP_STATE_VALID, QUP_STATE_VALID_MASK, QUP_SUCCESS, read32(), TIMEOUT_CNT, and udelay().

Referenced by qup_wait_for_state().

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

◆ qup_fifo_wait_for()

static qup_return_t qup_fifo_wait_for ( gsbi_id_t  gsbi_id,
uint32_t  status,
struct stopwatch timeout 
)
static

Definition at line 91 of file qup.c.

References QUP_ADDR, QUP_ERR_TIMEOUT, QUP_ERR_UNDEFINED, qup_i2c_master_status(), QUP_OPERATIONAL, QUP_SUCCESS, read32(), and stopwatch_expired().

Referenced by qup_i2c_read_fifo().

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

◆ qup_fifo_wait_while()

static qup_return_t qup_fifo_wait_while ( gsbi_id_t  gsbi_id,
uint32_t  status,
struct stopwatch timeout 
)
static

Definition at line 107 of file qup.c.

References QUP_ADDR, QUP_ERR_TIMEOUT, QUP_ERR_UNDEFINED, qup_i2c_master_status(), QUP_OPERATIONAL, QUP_SUCCESS, read32(), and stopwatch_expired().

Referenced by qup_i2c_read_fifo(), and qup_i2c_write_fifo().

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

◆ qup_i2c_master_status()

◆ qup_i2c_read()

static qup_return_t qup_i2c_read ( gsbi_id_t  gsbi_id,
uint8_t  mode,
qup_data_t p_tx_obj 
)
static

Definition at line 268 of file qup.c.

References BIOS_ERR, printk, QUP_ERR_UNDEFINED, QUP_ERR_UNSUPPORTED, qup_i2c_read_fifo(), QUP_MODE_FIFO, qup_set_state(), and QUP_STATE_RESET.

Referenced by qup_i2c_recv_data().

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

◆ qup_i2c_read_fifo()

◆ qup_i2c_recv_data()

static qup_return_t qup_i2c_recv_data ( gsbi_id_t  gsbi_id,
qup_data_t p_rx_obj 
)
static

Definition at line 415 of file qup.c.

References BIOS_DEBUG, qup_data_t::iic, qup_data_t::p, printk, QUP_ADDR, QUP_ERR_UNDEFINED, qup_i2c_read(), QUP_INPUT_MODE_SHFT, QUP_IO_MODES, QUP_MODE_MASK, and read32().

Referenced by qup_recv_data().

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

◆ qup_i2c_send_data()

static qup_return_t qup_i2c_send_data ( gsbi_id_t  gsbi_id,
qup_data_t p_tx_obj,
uint8_t  stop_seq 
)
static

Definition at line 376 of file qup.c.

References BIOS_DEBUG, qup_data_t::iic, qup_data_t::p, printk, QUP_ADDR, QUP_ERR_UNDEFINED, qup_i2c_write(), QUP_IO_MODES, QUP_MODE_MASK, QUP_OUTPUT_MODE_SHFT, and read32().

Referenced by qup_send_data().

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

◆ qup_i2c_write()

static qup_return_t qup_i2c_write ( gsbi_id_t  gsbi_id,
uint8_t  mode,
qup_data_t p_tx_obj,
uint8_t  stop_seq 
)
static

Definition at line 179 of file qup.c.

References BIOS_ERR, printk, QUP_ERR_UNDEFINED, QUP_ERR_UNSUPPORTED, qup_i2c_write_fifo(), QUP_MODE_FIFO, qup_set_state(), and QUP_STATE_RESET.

Referenced by qup_i2c_send_data().

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

◆ qup_i2c_write_fifo()

◆ qup_init()

◆ qup_recv_data()

qup_return_t qup_recv_data ( gsbi_id_t  gsbi_id,
qup_data_t p_rx_obj 
)

◆ qup_reset_i2c_master_status()

qup_return_t qup_reset_i2c_master_status ( gsbi_id_t  gsbi_id)

Definition at line 72 of file qup.c.

References QUP_ADDR, QUP_I2C_MASTER_STATUS, QUP_SUCCESS, and write32().

Here is the call graph for this function:

◆ qup_reset_master_status()

static qup_return_t qup_reset_master_status ( gsbi_id_t  gsbi_id)
static

Definition at line 83 of file qup.c.

References QUP_ADDR, QUP_ERROR_FLAGS, QUP_ERROR_FLAGS_EN, qup_reset_i2c_master_status(), QUP_SUCCESS, and write32().

Referenced by qup_i2c_read_fifo(), and qup_i2c_write_fifo().

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

◆ qup_send_data()

qup_return_t qup_send_data ( gsbi_id_t  gsbi_id,
qup_data_t p_tx_obj,
uint8_t  stop_seq 
)

◆ qup_set_state()

qup_return_t qup_set_state ( gsbi_id_t  gsbi_id,
uint32_t  state 
)

Definition at line 353 of file qup.c.

References QUP_ADDR, QUP_ERR_UNDEFINED, QUP_STATE, QUP_STATE_PAUSE, QUP_STATE_RESET, QUP_STATE_VALID_MASK, qup_wait_for_state(), read32(), and write32().

Here is the call graph for this function:

◆ qup_wait_for_state()

static qup_return_t qup_wait_for_state ( gsbi_id_t  gsbi_id,
unsigned int  wait_for 
)
static

Definition at line 67 of file qup.c.

References check_bit_state(), QUP_ADDR, and QUP_STATE.

Referenced by qup_init(), and qup_set_state().

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

Variable Documentation

◆ gsbi_qup_base

unsigned int gsbi_qup_base[]
static
Initial value:
= {
(unsigned int)GSBI_QUP1_BASE,
(unsigned int)GSBI_QUP2_BASE,
(unsigned int)GSBI_QUP3_BASE,
(unsigned int)GSBI_QUP4_BASE,
(unsigned int)GSBI_QUP5_BASE,
(unsigned int)GSBI_QUP6_BASE,
(unsigned int)GSBI_QUP7_BASE,
}
#define GSBI_QUP2_BASE
Definition: iomap.h:98
#define GSBI_QUP6_BASE
Definition: iomap.h:102
#define GSBI_QUP5_BASE
Definition: iomap.h:101
#define GSBI_QUP4_BASE
Definition: iomap.h:100
#define GSBI_QUP3_BASE
Definition: iomap.h:99
#define GSBI_QUP7_BASE
Definition: iomap.h:103
#define GSBI_QUP1_BASE
Definition: iomap.h:97

Definition at line 13 of file qup.c.