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

Go to the source code of this file.

Data Structures

struct  exynos_spi
 

Macros

#define EXYNOS_SPI_MAX_FREQ   50000000
 
#define SPI_TIMEOUT_MS   10
 
#define SF_READ_DATA_CMD   0x3
 
#define SPI_CH_HS_EN   (1 << 6)
 
#define SPI_CH_RST   (1 << 5)
 
#define SPI_SLAVE_MODE   (1 << 4)
 
#define SPI_CH_CPOL_L   (1 << 3)
 
#define SPI_CH_CPHA_B   (1 << 2)
 
#define SPI_RX_CH_ON   (1 << 1)
 
#define SPI_TX_CH_ON   (1 << 0)
 
#define SPI_MODE_CH_WIDTH_WORD   (0x2 << 29)
 
#define SPI_MODE_BUS_WIDTH_WORD   (0x2 << 17)
 
#define SPI_SLAVE_SIG_INACT   (1 << 0)
 
#define SPI_ST_TX_DONE   (1 << 25)
 
#define SPI_FIFO_LVL_MASK   0x1ff
 
#define SPI_TX_LVL_OFFSET   6
 
#define SPI_RX_LVL_OFFSET   15
 
#define SPI_CLK_BYPASS   (0 << 0)
 
#define SPI_FB_DELAY_90   (1 << 0)
 
#define SPI_FB_DELAY_180   (2 << 0)
 
#define SPI_FB_DELAY_270   (3 << 0)
 
#define SPI_PACKET_CNT_EN   (1 << 16)
 
#define SPI_TX_SWAP_EN   (1 << 0)
 
#define SPI_TX_BYTE_SWAP   (1 << 2)
 
#define SPI_TX_HWORD_SWAP   (1 << 3)
 
#define SPI_TX_BYTE_SWAP   (1 << 2)
 
#define SPI_RX_SWAP_EN   (1 << 4)
 
#define SPI_RX_BYTE_SWAP   (1 << 6)
 
#define SPI_RX_HWORD_SWAP   (1 << 7)
 

Functions

 check_member (exynos_spi, fb_clk, 0x2c)
 
int exynos_spi_open (struct exynos_spi *regs)
 
int exynos_spi_read (struct exynos_spi *regs, void *dest, u32 len, u32 off)
 
int exynos_spi_close (struct exynos_spi *regs)
 
void exynos_init_spi_boot_device (void)
 
const struct region_deviceexynos_spi_boot_device (void)
 

Macro Definition Documentation

◆ EXYNOS_SPI_MAX_FREQ

#define EXYNOS_SPI_MAX_FREQ   50000000

Definition at line 26 of file spi.h.

◆ SF_READ_DATA_CMD

#define SF_READ_DATA_CMD   0x3

Definition at line 30 of file spi.h.

◆ SPI_CH_CPHA_B

#define SPI_CH_CPHA_B   (1 << 2)

Definition at line 37 of file spi.h.

◆ SPI_CH_CPOL_L

#define SPI_CH_CPOL_L   (1 << 3)

Definition at line 36 of file spi.h.

◆ SPI_CH_HS_EN

#define SPI_CH_HS_EN   (1 << 6)

Definition at line 33 of file spi.h.

◆ SPI_CH_RST

#define SPI_CH_RST   (1 << 5)

Definition at line 34 of file spi.h.

◆ SPI_CLK_BYPASS

#define SPI_CLK_BYPASS   (0 << 0)

Definition at line 55 of file spi.h.

◆ SPI_FB_DELAY_180

#define SPI_FB_DELAY_180   (2 << 0)

Definition at line 57 of file spi.h.

◆ SPI_FB_DELAY_270

#define SPI_FB_DELAY_270   (3 << 0)

Definition at line 58 of file spi.h.

◆ SPI_FB_DELAY_90

#define SPI_FB_DELAY_90   (1 << 0)

Definition at line 56 of file spi.h.

◆ SPI_FIFO_LVL_MASK

#define SPI_FIFO_LVL_MASK   0x1ff

Definition at line 50 of file spi.h.

◆ SPI_MODE_BUS_WIDTH_WORD

#define SPI_MODE_BUS_WIDTH_WORD   (0x2 << 17)

Definition at line 43 of file spi.h.

◆ SPI_MODE_CH_WIDTH_WORD

#define SPI_MODE_CH_WIDTH_WORD   (0x2 << 29)

Definition at line 42 of file spi.h.

◆ SPI_PACKET_CNT_EN

#define SPI_PACKET_CNT_EN   (1 << 16)

Definition at line 61 of file spi.h.

◆ SPI_RX_BYTE_SWAP

#define SPI_RX_BYTE_SWAP   (1 << 6)

Definition at line 69 of file spi.h.

◆ SPI_RX_CH_ON

#define SPI_RX_CH_ON   (1 << 1)

Definition at line 38 of file spi.h.

◆ SPI_RX_HWORD_SWAP

#define SPI_RX_HWORD_SWAP   (1 << 7)

Definition at line 70 of file spi.h.

◆ SPI_RX_LVL_OFFSET

#define SPI_RX_LVL_OFFSET   15

Definition at line 52 of file spi.h.

◆ SPI_RX_SWAP_EN

#define SPI_RX_SWAP_EN   (1 << 4)

Definition at line 68 of file spi.h.

◆ SPI_SLAVE_MODE

#define SPI_SLAVE_MODE   (1 << 4)

Definition at line 35 of file spi.h.

◆ SPI_SLAVE_SIG_INACT

#define SPI_SLAVE_SIG_INACT   (1 << 0)

Definition at line 46 of file spi.h.

◆ SPI_ST_TX_DONE

#define SPI_ST_TX_DONE   (1 << 25)

Definition at line 49 of file spi.h.

◆ SPI_TIMEOUT_MS

#define SPI_TIMEOUT_MS   10

Definition at line 28 of file spi.h.

◆ SPI_TX_BYTE_SWAP [1/2]

#define SPI_TX_BYTE_SWAP   (1 << 2)

Definition at line 67 of file spi.h.

◆ SPI_TX_BYTE_SWAP [2/2]

#define SPI_TX_BYTE_SWAP   (1 << 2)

Definition at line 67 of file spi.h.

◆ SPI_TX_CH_ON

#define SPI_TX_CH_ON   (1 << 0)

Definition at line 39 of file spi.h.

◆ SPI_TX_HWORD_SWAP

#define SPI_TX_HWORD_SWAP   (1 << 3)

Definition at line 66 of file spi.h.

◆ SPI_TX_LVL_OFFSET

#define SPI_TX_LVL_OFFSET   6

Definition at line 51 of file spi.h.

◆ SPI_TX_SWAP_EN

#define SPI_TX_SWAP_EN   (1 << 0)

Definition at line 64 of file spi.h.

Function Documentation

◆ check_member()

check_member ( exynos_spi  ,
fb_clk  ,
0x2c   
)

◆ exynos_init_spi_boot_device()

void exynos_init_spi_boot_device ( void  )

Definition at line 167 of file spi.c.

References boot_slave_regs, and EXYNOS5_SPI1_BASE.

Referenced by boot_device_init().

Here is the caller graph for this function:

◆ exynos_spi_boot_device()

const struct region_device* exynos_spi_boot_device ( void  )

Definition at line 172 of file spi.c.

References mdev, and mmap_helper_region_device::rdev.

Referenced by boot_device_ro().

Here is the caller graph for this function:

◆ exynos_spi_close()

int exynos_spi_close ( struct exynos_spi regs)

Definition at line 114 of file spi.c.

References clrbits32, clrsetbits32, SPI_CH_HS_EN, SPI_CH_RST, SPI_MODE_BUS_WIDTH_WORD, SPI_MODE_CH_WIDTH_WORD, SPI_RX_CH_ON, SPI_TX_CH_ON, and write32().

Referenced by exynos_spi_readat().

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

◆ exynos_spi_open()

int exynos_spi_open ( struct exynos_spi regs)

Definition at line 64 of file spi.c.

References clrbits32, setbits32, SPI_CH_CPOL_L, SPI_CH_HS_EN, SPI_CH_RST, SPI_FB_DELAY_180, SPI_MODE_BUS_WIDTH_WORD, SPI_MODE_CH_WIDTH_WORD, SPI_PACKET_CNT_EN, SPI_RX_BYTE_SWAP, SPI_RX_CH_ON, SPI_RX_HWORD_SWAP, SPI_RX_SWAP_EN, SPI_TX_CH_ON, and write32().

Referenced by exynos_spi_readat().

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

◆ exynos_spi_read()

int exynos_spi_read ( struct exynos_spi regs,
void dest,
u32  len,
u32  off 
)

Definition at line 92 of file spi.c.

References clrbits32, exynos_spi_rx_tx(), MIN, read32(), setbits32, SF_READ_DATA_CMD, SPI_SLAVE_SIG_INACT, SPI_ST_TX_DONE, and write32().

Referenced by exynos_spi_readat().

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