coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spi.c File Reference
#include <device/mmio.h>
#include <assert.h>
#include <boot_device.h>
#include <cbfs.h>
#include <commonlib/region.h>
#include <console/console.h>
#include <soc/clk.h>
#include <soc/gpio.h>
#include <soc/spi.h>
#include <stddef.h>
#include <stdint.h>
#include <symbols.h>
Include dependency graph for spi.c:

Go to the source code of this file.

Macros

#define DEBUG_SPI(x, ...)
 

Functions

static void exynos_spi_rx_tx (struct exynos_spi *regs, int todo, void *dinp, void const *doutp, int i)
 
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)
 
static ssize_t exynos_spi_readat (const struct region_device *rdev, void *dest, size_t offset, size_t count)
 
static voidexynos_spi_map (const struct region_device *rdev, size_t offset, size_t count)
 
void exynos_init_spi_boot_device (void)
 
const struct region_deviceexynos_spi_boot_device (void)
 

Variables

static struct exynos_spiboot_slave_regs
 
static const struct region_device_ops exynos_spi_ops
 
static struct mmap_helper_region_device mdev
 

Macro Definition Documentation

◆ DEBUG_SPI

#define DEBUG_SPI (   x,
  ... 
)

Definition at line 19 of file spi.c.

Function Documentation

◆ exynos_init_spi_boot_device()

void exynos_init_spi_boot_device ( void  )

Definition at line 167 of file spi.c.

◆ exynos_spi_boot_device()

const struct region_device* exynos_spi_boot_device ( void  )

Definition at line 172 of file spi.c.

◆ 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_map()

static void* exynos_spi_map ( const struct region_device rdev,
size_t  offset,
size_t  count 
)
static

Definition at line 147 of file spi.c.

References count, DEBUG_SPI, mmap_helper_rdev_mmap(), offset, and rdev.

Here is the call 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:

◆ exynos_spi_readat()

static ssize_t exynos_spi_readat ( const struct region_device rdev,
void dest,
size_t  offset,
size_t  count 
)
static

Definition at line 136 of file spi.c.

References boot_slave_regs, count, DEBUG_SPI, exynos_spi_close(), exynos_spi_open(), exynos_spi_read(), and offset.

Here is the call graph for this function:

◆ exynos_spi_rx_tx()

static void exynos_spi_rx_tx ( struct exynos_spi regs,
int  todo,
void dinp,
void const *  doutp,
int  i 
)
static

Definition at line 22 of file spi.c.

References ASSERT, clrbits32, read32(), setbits32, SPI_CH_RST, SPI_PACKET_CNT_EN, and write32().

Referenced by exynos_spi_read().

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

Variable Documentation

◆ boot_slave_regs

struct exynos_spi* boot_slave_regs
static

Definition at line 134 of file spi.c.

Referenced by exynos_init_spi_boot_device(), and exynos_spi_readat().

◆ exynos_spi_ops

const struct region_device_ops exynos_spi_ops
static
Initial value:
= {
.mmap = exynos_spi_map,
.readat = exynos_spi_readat,
}
int mmap_helper_rdev_munmap(const struct region_device *, void *)
Definition: region.c:324
static ssize_t exynos_spi_readat(const struct region_device *rdev, void *dest, size_t offset, size_t count)
Definition: spi.c:136
static void * exynos_spi_map(const struct region_device *rdev, size_t offset, size_t count)
Definition: spi.c:147

Definition at line 147 of file spi.c.

◆ mdev

struct mmap_helper_region_device mdev
static
Initial value:
=
struct mem_pool cbfs_cache
Definition: cbfs.c:26
#define MMAP_HELPER_DEV_INIT(ops_, offset_, size_, mpool_)
Definition: region.h:219
static const struct region_device_ops exynos_spi_ops
Definition: spi.c:158

Definition at line 147 of file spi.c.

Referenced by exynos_spi_boot_device().