coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spi.h File Reference
#include <soc/iomap.h>
#include <soc/qup.h>
#include <spi-generic.h>
Include dependency graph for spi.h:

Go to the source code of this file.

Data Structures

struct  blsp_spi
 
struct  ipq_spi_slave
 

Macros

#define BLSP0_QUP_REG_BASE   ((void *)0x78b5000u)
 
#define BLSP1_QUP_REG_BASE   ((void *)0x78b6000u)
 
#define BLSP0_SPI_CONFIG_REG   (BLSP0_QUP_REG_BASE + 0x00000300)
 
#define BLSP1_SPI_CONFIG_REG   (BLSP1_QUP_REG_BASE + 0x00000300)
 
#define BLSP0_SPI_IO_CONTROL_REG   (BLSP0_QUP_REG_BASE + 0x00000304)
 
#define BLSP1_SPI_IO_CONTROL_REG   (BLSP1_QUP_REG_BASE + 0x00000304)
 
#define BLSP0_SPI_ERROR_FLAGS_REG   (BLSP0_QUP_REG_BASE + 0x00000308)
 
#define BLSP1_SPI_ERROR_FLAGS_REG   (BLSP1_QUP_REG_BASE + 0x00000308)
 
#define BLSP0_SPI_DEASSERT_WAIT_REG   (BLSP0_QUP_REG_BASE + 0x00000310)
 
#define BLSP1_SPI_DEASSERT_WAIT_REG   (BLSP1_QUP_REG_BASE + 0x00000310)
 
#define BLSP0_SPI_ERROR_FLAGS_EN_REG   (BLSP0_QUP_REG_BASE + 0x0000030c)
 
#define BLSP1_SPI_ERROR_FLAGS_EN_REG   (BLSP1_QUP_REG_BASE + 0x0000030c)
 
#define BLSP0_QUP_CONFIG_REG   (BLSP0_QUP_REG_BASE + 0x00000000)
 
#define BLSP1_QUP_CONFIG_REG   (BLSP1_QUP_REG_BASE + 0x00000000)
 
#define BLSP0_QUP_ERROR_FLAGS_REG   (BLSP0_QUP_REG_BASE + 0x0000001c)
 
#define BLSP1_QUP_ERROR_FLAGS_REG   (BLSP1_QUP_REG_BASE + 0x0000001c)
 
#define BLSP0_QUP_ERROR_FLAGS_EN_REG   (BLSP0_QUP_REG_BASE + 0x00000020)
 
#define BLSP1_QUP_ERROR_FLAGS_EN_REG   (BLSP1_QUP_REG_BASE + 0x00000020)
 
#define BLSP0_QUP_OPERATIONAL_MASK   (BLSP0_QUP_REG_BASE + 0x00000028)
 
#define BLSP1_QUP_OPERATIONAL_MASK   (BLSP1_QUP_REG_BASE + 0x00000028)
 
#define BLSP0_QUP_OPERATIONAL_REG   (BLSP0_QUP_REG_BASE + 0x00000018)
 
#define BLSP1_QUP_OPERATIONAL_REG   (BLSP1_QUP_REG_BASE + 0x00000018)
 
#define BLSP0_QUP_IO_MODES_REG   (BLSP0_QUP_REG_BASE + 0x00000008)
 
#define BLSP1_QUP_IO_MODES_REG   (BLSP1_QUP_REG_BASE + 0x00000008)
 
#define BLSP0_QUP_STATE_REG   (BLSP0_QUP_REG_BASE + 0x00000004)
 
#define BLSP1_QUP_STATE_REG   (BLSP1_QUP_REG_BASE + 0x00000004)
 
#define BLSP0_QUP_INPUT_FIFOc_REG(c)    (BLSP0_QUP_REG_BASE + 0x00000218 + 4 * (c))
 
#define BLSP1_QUP_INPUT_FIFOc_REG(c)    (BLSP1_QUP_REG_BASE + 0x00000218 + 4 * (c))
 
#define BLSP0_QUP_OUTPUT_FIFOc_REG(c)    (BLSP0_QUP_REG_BASE + 0x00000110 + 4 * (c))
 
#define BLSP1_QUP_OUTPUT_FIFOc_REG(c)    (BLSP1_QUP_REG_BASE + 0x00000110 + 4 * (c))
 
#define BLSP0_QUP_MX_INPUT_COUNT_REG   (BLSP0_QUP_REG_BASE + 0x00000200)
 
#define BLSP1_QUP_MX_INPUT_COUNT_REG   (BLSP1_QUP_REG_BASE + 0x00000200)
 
#define BLSP0_QUP_MX_OUTPUT_COUNT_REG   (BLSP0_QUP_REG_BASE + 0x00000100)
 
#define BLSP1_QUP_MX_OUTPUT_COUNT_REG   (BLSP1_QUP_REG_BASE + 0x00000100)
 
#define BLSP0_QUP_SW_RESET_REG   (BLSP0_QUP_REG_BASE + 0x0000000c)
 
#define BLSP1_QUP_SW_RESET_REG   (BLSP1_QUP_REG_BASE + 0x0000000c)
 
#define QUP_CONFIG_MINI_CORE_MSK   (0x0F << 8)
 
#define QUP_CONFIG_MINI_CORE_SPI   (1 << 8)
 
#define QUP_CONF_INPUT_MSK   (1 << 7)
 
#define QUP_CONF_INPUT_ENA   (0 << 7)
 
#define QUP_CONF_NO_INPUT   (1 << 7)
 
#define QUP_CONF_OUTPUT_MSK   (1 << 6)
 
#define QUP_CONF_OUTPUT_ENA   (0 << 6)
 
#define QUP_CONF_NO_OUTPUT   (1 << 6)
 
#define QUP_CONF_N_MASK   0x1F
 
#define QUP_CONF_N_SPI_8_BIT_WORD   0x07
 
#define SPI_CONFIG_INPUT_FIRST   (1 << 9)
 
#define SPI_CONFIG_INPUT_FIRST_BACK   (0 << 9)
 
#define SPI_CONFIG_LOOP_BACK_MSK   (1 << 8)
 
#define SPI_CONFIG_NO_LOOP_BACK   (0 << 8)
 
#define SPI_CONFIG_NO_SLAVE_OPER_MSK   (1 << 5)
 
#define SPI_CONFIG_NO_SLAVE_OPER   (0 << 5)
 
#define SPI_IO_CTRL_CLK_ALWAYS_ON   (0 << 9)
 
#define SPI_IO_CTRL_MX_CS_MODE   (1 << 8)
 
#define SPI_IO_CTRL_NO_TRI_STATE   (1 << 0)
 
#define SPI_IO_CTRL_FORCE_CS_MSK   (1 << 11)
 
#define SPI_IO_CTRL_FORCE_CS_EN   (1 << 11)
 
#define SPI_IO_CTRL_FORCE_CS_DIS   (0 << 11)
 
#define SPI_IO_CTRL_CLOCK_IDLE_HIGH   (1 << 10)
 
#define QUP_IO_MODES_OUTPUT_BIT_SHIFT_MSK   (1 << 16)
 
#define QUP_IO_MODES_OUTPUT_BIT_SHIFT_EN   (1 << 16)
 
#define QUP_IO_MODES_INPUT_MODE_MSK   (0x03 << 12)
 
#define QUP_IO_MODES_INPUT_BLOCK_MODE   (0x01 << 12)
 
#define QUP_IO_MODES_OUTPUT_MODE_MSK   (0x03 << 10)
 
#define QUP_IO_MODES_OUTPUT_BLOCK_MODE   (0x01 << 10)
 
#define SPI_INPUT_BLOCK_SIZE   4
 
#define SPI_OUTPUT_BLOCK_SIZE   4
 
#define MAX_COUNT_SIZE   0xffff
 
#define SPI_CORE_RESET   0
 
#define SPI_CORE_RUNNING   1
 
#define SPI_MODE0   0
 
#define SPI_MODE1   1
 
#define SPI_MODE2   2
 
#define SPI_MODE3   3
 
#define BLSP0_SPI   0
 
#define BLSP1_SPI   1
 
#define SUCCESS   0
 
#define DUMMY_DATA_VAL   0
 
#define TIMEOUT_CNT   100
 
#define ETIMEDOUT   -10
 
#define EINVAL   -11
 
#define EIO   -12
 
#define MAX_PACKET_COUNT   ((64 * KiB) - 1)
 

Macro Definition Documentation

◆ BLSP0_QUP_CONFIG_REG

#define BLSP0_QUP_CONFIG_REG   (BLSP0_QUP_REG_BASE + 0x00000000)

Definition at line 28 of file spi.h.

◆ BLSP0_QUP_ERROR_FLAGS_EN_REG

#define BLSP0_QUP_ERROR_FLAGS_EN_REG   (BLSP0_QUP_REG_BASE + 0x00000020)

Definition at line 34 of file spi.h.

◆ BLSP0_QUP_ERROR_FLAGS_REG

#define BLSP0_QUP_ERROR_FLAGS_REG   (BLSP0_QUP_REG_BASE + 0x0000001c)

Definition at line 31 of file spi.h.

◆ BLSP0_QUP_INPUT_FIFOc_REG

#define BLSP0_QUP_INPUT_FIFOc_REG (   c)     (BLSP0_QUP_REG_BASE + 0x00000218 + 4 * (c))

Definition at line 49 of file spi.h.

◆ BLSP0_QUP_IO_MODES_REG

#define BLSP0_QUP_IO_MODES_REG   (BLSP0_QUP_REG_BASE + 0x00000008)

Definition at line 43 of file spi.h.

◆ BLSP0_QUP_MX_INPUT_COUNT_REG

#define BLSP0_QUP_MX_INPUT_COUNT_REG   (BLSP0_QUP_REG_BASE + 0x00000200)

Definition at line 59 of file spi.h.

◆ BLSP0_QUP_MX_OUTPUT_COUNT_REG

#define BLSP0_QUP_MX_OUTPUT_COUNT_REG   (BLSP0_QUP_REG_BASE + 0x00000100)

Definition at line 62 of file spi.h.

◆ BLSP0_QUP_OPERATIONAL_MASK

#define BLSP0_QUP_OPERATIONAL_MASK   (BLSP0_QUP_REG_BASE + 0x00000028)

Definition at line 37 of file spi.h.

◆ BLSP0_QUP_OPERATIONAL_REG

#define BLSP0_QUP_OPERATIONAL_REG   (BLSP0_QUP_REG_BASE + 0x00000018)

Definition at line 40 of file spi.h.

◆ BLSP0_QUP_OUTPUT_FIFOc_REG

#define BLSP0_QUP_OUTPUT_FIFOc_REG (   c)     (BLSP0_QUP_REG_BASE + 0x00000110 + 4 * (c))

Definition at line 54 of file spi.h.

◆ BLSP0_QUP_REG_BASE

#define BLSP0_QUP_REG_BASE   ((void *)0x78b5000u)

Definition at line 11 of file spi.h.

◆ BLSP0_QUP_STATE_REG

#define BLSP0_QUP_STATE_REG   (BLSP0_QUP_REG_BASE + 0x00000004)

Definition at line 46 of file spi.h.

◆ BLSP0_QUP_SW_RESET_REG

#define BLSP0_QUP_SW_RESET_REG   (BLSP0_QUP_REG_BASE + 0x0000000c)

Definition at line 65 of file spi.h.

◆ BLSP0_SPI

#define BLSP0_SPI   0

Definition at line 112 of file spi.h.

◆ BLSP0_SPI_CONFIG_REG

#define BLSP0_SPI_CONFIG_REG   (BLSP0_QUP_REG_BASE + 0x00000300)

Definition at line 14 of file spi.h.

◆ BLSP0_SPI_DEASSERT_WAIT_REG

#define BLSP0_SPI_DEASSERT_WAIT_REG   (BLSP0_QUP_REG_BASE + 0x00000310)

Definition at line 23 of file spi.h.

◆ BLSP0_SPI_ERROR_FLAGS_EN_REG

#define BLSP0_SPI_ERROR_FLAGS_EN_REG   (BLSP0_QUP_REG_BASE + 0x0000030c)

Definition at line 25 of file spi.h.

◆ BLSP0_SPI_ERROR_FLAGS_REG

#define BLSP0_SPI_ERROR_FLAGS_REG   (BLSP0_QUP_REG_BASE + 0x00000308)

Definition at line 20 of file spi.h.

◆ BLSP0_SPI_IO_CONTROL_REG

#define BLSP0_SPI_IO_CONTROL_REG   (BLSP0_QUP_REG_BASE + 0x00000304)

Definition at line 17 of file spi.h.

◆ BLSP1_QUP_CONFIG_REG

#define BLSP1_QUP_CONFIG_REG   (BLSP1_QUP_REG_BASE + 0x00000000)

Definition at line 29 of file spi.h.

◆ BLSP1_QUP_ERROR_FLAGS_EN_REG

#define BLSP1_QUP_ERROR_FLAGS_EN_REG   (BLSP1_QUP_REG_BASE + 0x00000020)

Definition at line 35 of file spi.h.

◆ BLSP1_QUP_ERROR_FLAGS_REG

#define BLSP1_QUP_ERROR_FLAGS_REG   (BLSP1_QUP_REG_BASE + 0x0000001c)

Definition at line 32 of file spi.h.

◆ BLSP1_QUP_INPUT_FIFOc_REG

#define BLSP1_QUP_INPUT_FIFOc_REG (   c)     (BLSP1_QUP_REG_BASE + 0x00000218 + 4 * (c))

Definition at line 51 of file spi.h.

◆ BLSP1_QUP_IO_MODES_REG

#define BLSP1_QUP_IO_MODES_REG   (BLSP1_QUP_REG_BASE + 0x00000008)

Definition at line 44 of file spi.h.

◆ BLSP1_QUP_MX_INPUT_COUNT_REG

#define BLSP1_QUP_MX_INPUT_COUNT_REG   (BLSP1_QUP_REG_BASE + 0x00000200)

Definition at line 60 of file spi.h.

◆ BLSP1_QUP_MX_OUTPUT_COUNT_REG

#define BLSP1_QUP_MX_OUTPUT_COUNT_REG   (BLSP1_QUP_REG_BASE + 0x00000100)

Definition at line 63 of file spi.h.

◆ BLSP1_QUP_OPERATIONAL_MASK

#define BLSP1_QUP_OPERATIONAL_MASK   (BLSP1_QUP_REG_BASE + 0x00000028)

Definition at line 38 of file spi.h.

◆ BLSP1_QUP_OPERATIONAL_REG

#define BLSP1_QUP_OPERATIONAL_REG   (BLSP1_QUP_REG_BASE + 0x00000018)

Definition at line 41 of file spi.h.

◆ BLSP1_QUP_OUTPUT_FIFOc_REG

#define BLSP1_QUP_OUTPUT_FIFOc_REG (   c)     (BLSP1_QUP_REG_BASE + 0x00000110 + 4 * (c))

Definition at line 56 of file spi.h.

◆ BLSP1_QUP_REG_BASE

#define BLSP1_QUP_REG_BASE   ((void *)0x78b6000u)

Definition at line 12 of file spi.h.

◆ BLSP1_QUP_STATE_REG

#define BLSP1_QUP_STATE_REG   (BLSP1_QUP_REG_BASE + 0x00000004)

Definition at line 47 of file spi.h.

◆ BLSP1_QUP_SW_RESET_REG

#define BLSP1_QUP_SW_RESET_REG   (BLSP1_QUP_REG_BASE + 0x0000000c)

Definition at line 66 of file spi.h.

◆ BLSP1_SPI

#define BLSP1_SPI   1

Definition at line 113 of file spi.h.

◆ BLSP1_SPI_CONFIG_REG

#define BLSP1_SPI_CONFIG_REG   (BLSP1_QUP_REG_BASE + 0x00000300)

Definition at line 15 of file spi.h.

◆ BLSP1_SPI_DEASSERT_WAIT_REG

#define BLSP1_SPI_DEASSERT_WAIT_REG   (BLSP1_QUP_REG_BASE + 0x00000310)

Definition at line 24 of file spi.h.

◆ BLSP1_SPI_ERROR_FLAGS_EN_REG

#define BLSP1_SPI_ERROR_FLAGS_EN_REG   (BLSP1_QUP_REG_BASE + 0x0000030c)

Definition at line 26 of file spi.h.

◆ BLSP1_SPI_ERROR_FLAGS_REG

#define BLSP1_SPI_ERROR_FLAGS_REG   (BLSP1_QUP_REG_BASE + 0x00000308)

Definition at line 21 of file spi.h.

◆ BLSP1_SPI_IO_CONTROL_REG

#define BLSP1_SPI_IO_CONTROL_REG   (BLSP1_QUP_REG_BASE + 0x00000304)

Definition at line 18 of file spi.h.

◆ DUMMY_DATA_VAL

#define DUMMY_DATA_VAL   0

Definition at line 139 of file spi.h.

◆ EINVAL

#define EINVAL   -11

Definition at line 143 of file spi.h.

◆ EIO

#define EIO   -12

Definition at line 144 of file spi.h.

◆ ETIMEDOUT

#define ETIMEDOUT   -10

Definition at line 142 of file spi.h.

◆ MAX_COUNT_SIZE

#define MAX_COUNT_SIZE   0xffff

Definition at line 104 of file spi.h.

◆ MAX_PACKET_COUNT

#define MAX_PACKET_COUNT   ((64 * KiB) - 1)

Definition at line 148 of file spi.h.

◆ QUP_CONF_INPUT_ENA

#define QUP_CONF_INPUT_ENA   (0 << 7)

Definition at line 71 of file spi.h.

◆ QUP_CONF_INPUT_MSK

#define QUP_CONF_INPUT_MSK   (1 << 7)

Definition at line 70 of file spi.h.

◆ QUP_CONF_N_MASK

#define QUP_CONF_N_MASK   0x1F

Definition at line 76 of file spi.h.

◆ QUP_CONF_N_SPI_8_BIT_WORD

#define QUP_CONF_N_SPI_8_BIT_WORD   0x07

Definition at line 77 of file spi.h.

◆ QUP_CONF_NO_INPUT

#define QUP_CONF_NO_INPUT   (1 << 7)

Definition at line 72 of file spi.h.

◆ QUP_CONF_NO_OUTPUT

#define QUP_CONF_NO_OUTPUT   (1 << 6)

Definition at line 75 of file spi.h.

◆ QUP_CONF_OUTPUT_ENA

#define QUP_CONF_OUTPUT_ENA   (0 << 6)

Definition at line 74 of file spi.h.

◆ QUP_CONF_OUTPUT_MSK

#define QUP_CONF_OUTPUT_MSK   (1 << 6)

Definition at line 73 of file spi.h.

◆ QUP_CONFIG_MINI_CORE_MSK

#define QUP_CONFIG_MINI_CORE_MSK   (0x0F << 8)

Definition at line 68 of file spi.h.

◆ QUP_CONFIG_MINI_CORE_SPI

#define QUP_CONFIG_MINI_CORE_SPI   (1 << 8)

Definition at line 69 of file spi.h.

◆ QUP_IO_MODES_INPUT_BLOCK_MODE

#define QUP_IO_MODES_INPUT_BLOCK_MODE   (0x01 << 12)

Definition at line 97 of file spi.h.

◆ QUP_IO_MODES_INPUT_MODE_MSK

#define QUP_IO_MODES_INPUT_MODE_MSK   (0x03 << 12)

Definition at line 96 of file spi.h.

◆ QUP_IO_MODES_OUTPUT_BIT_SHIFT_EN

#define QUP_IO_MODES_OUTPUT_BIT_SHIFT_EN   (1 << 16)

Definition at line 95 of file spi.h.

◆ QUP_IO_MODES_OUTPUT_BIT_SHIFT_MSK

#define QUP_IO_MODES_OUTPUT_BIT_SHIFT_MSK   (1 << 16)

Definition at line 94 of file spi.h.

◆ QUP_IO_MODES_OUTPUT_BLOCK_MODE

#define QUP_IO_MODES_OUTPUT_BLOCK_MODE   (0x01 << 10)

Definition at line 99 of file spi.h.

◆ QUP_IO_MODES_OUTPUT_MODE_MSK

#define QUP_IO_MODES_OUTPUT_MODE_MSK   (0x03 << 10)

Definition at line 98 of file spi.h.

◆ SPI_CONFIG_INPUT_FIRST

#define SPI_CONFIG_INPUT_FIRST   (1 << 9)

Definition at line 79 of file spi.h.

◆ SPI_CONFIG_INPUT_FIRST_BACK

#define SPI_CONFIG_INPUT_FIRST_BACK   (0 << 9)

Definition at line 80 of file spi.h.

◆ SPI_CONFIG_LOOP_BACK_MSK

#define SPI_CONFIG_LOOP_BACK_MSK   (1 << 8)

Definition at line 81 of file spi.h.

◆ SPI_CONFIG_NO_LOOP_BACK

#define SPI_CONFIG_NO_LOOP_BACK   (0 << 8)

Definition at line 82 of file spi.h.

◆ SPI_CONFIG_NO_SLAVE_OPER

#define SPI_CONFIG_NO_SLAVE_OPER   (0 << 5)

Definition at line 84 of file spi.h.

◆ SPI_CONFIG_NO_SLAVE_OPER_MSK

#define SPI_CONFIG_NO_SLAVE_OPER_MSK   (1 << 5)

Definition at line 83 of file spi.h.

◆ SPI_CORE_RESET

#define SPI_CORE_RESET   0

Definition at line 106 of file spi.h.

◆ SPI_CORE_RUNNING

#define SPI_CORE_RUNNING   1

Definition at line 107 of file spi.h.

◆ SPI_INPUT_BLOCK_SIZE

#define SPI_INPUT_BLOCK_SIZE   4

Definition at line 101 of file spi.h.

◆ SPI_IO_CTRL_CLK_ALWAYS_ON

#define SPI_IO_CTRL_CLK_ALWAYS_ON   (0 << 9)

Definition at line 86 of file spi.h.

◆ SPI_IO_CTRL_CLOCK_IDLE_HIGH

#define SPI_IO_CTRL_CLOCK_IDLE_HIGH   (1 << 10)

Definition at line 92 of file spi.h.

◆ SPI_IO_CTRL_FORCE_CS_DIS

#define SPI_IO_CTRL_FORCE_CS_DIS   (0 << 11)

Definition at line 91 of file spi.h.

◆ SPI_IO_CTRL_FORCE_CS_EN

#define SPI_IO_CTRL_FORCE_CS_EN   (1 << 11)

Definition at line 90 of file spi.h.

◆ SPI_IO_CTRL_FORCE_CS_MSK

#define SPI_IO_CTRL_FORCE_CS_MSK   (1 << 11)

Definition at line 89 of file spi.h.

◆ SPI_IO_CTRL_MX_CS_MODE

#define SPI_IO_CTRL_MX_CS_MODE   (1 << 8)

Definition at line 87 of file spi.h.

◆ SPI_IO_CTRL_NO_TRI_STATE

#define SPI_IO_CTRL_NO_TRI_STATE   (1 << 0)

Definition at line 88 of file spi.h.

◆ SPI_MODE0

#define SPI_MODE0   0

Definition at line 108 of file spi.h.

◆ SPI_MODE1

#define SPI_MODE1   1

Definition at line 109 of file spi.h.

◆ SPI_MODE2

#define SPI_MODE2   2

Definition at line 110 of file spi.h.

◆ SPI_MODE3

#define SPI_MODE3   3

Definition at line 111 of file spi.h.

◆ SPI_OUTPUT_BLOCK_SIZE

#define SPI_OUTPUT_BLOCK_SIZE   4

Definition at line 102 of file spi.h.

◆ SUCCESS

#define SUCCESS   0

Definition at line 137 of file spi.h.

◆ TIMEOUT_CNT

#define TIMEOUT_CNT   100

Definition at line 140 of file spi.h.