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 <soc/addressmap.h>
#include <soc/flash_controller_common.h>
#include <soc/gpio.h>
#include <soc/spi.h>
Include dependency graph for spi.c:

Go to the source code of this file.

Data Structures

struct  pad_func
 

Macros

#define PAD_FUNC(name, func)   {PAD_##name##_ID, PAD_##name##_FUNC_##func}
 
#define PAD_FUNC_GPIO(name)   {PAD_##name##_ID, 0}
 

Functions

void mtk_spi_set_gpio_pinmux (unsigned int bus, enum spi_pad_mask pad_select)
 

Variables

struct mtk_spi_bus spi_bus [SPI_BUS_NUMBER]
 
static const struct pad_func pad0_funcs [SPI_BUS_NUMBER][4]
 
static const struct spi_ctrlr spi_flash_ctrlr
 
const struct spi_ctrlr_buses spi_ctrlr_bus_map []
 
const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map)
 

Macro Definition Documentation

◆ PAD_FUNC

#define PAD_FUNC (   name,
  func 
)    {PAD_##name##_ID, PAD_##name##_FUNC_##func}

Definition at line 50 of file spi.c.

◆ PAD_FUNC_GPIO

#define PAD_FUNC_GPIO (   name)    {PAD_##name##_ID, 0}

Definition at line 51 of file spi.c.

Function Documentation

◆ mtk_spi_set_gpio_pinmux()

void mtk_spi_set_gpio_pinmux ( unsigned int  bus,
enum spi_pad_mask  pad_select 
)

Definition at line 104 of file spi.c.

References assert, pad_func::func, gpio_set_mode(), NULL, pad0_funcs, pad_func::pin_id, SPI_BUS_NUMBER, and SPI_PAD0_MASK.

Here is the call graph for this function:

Variable Documentation

◆ pad0_funcs

const struct pad_func pad0_funcs[SPI_BUS_NUMBER][4]
static

Definition at line 1 of file spi.c.

Referenced by mtk_spi_set_gpio_pinmux().

◆ spi_bus

struct mtk_spi_bus spi_bus[SPI_BUS_NUMBER]

Definition at line 1 of file spi.c.

◆ spi_ctrlr_bus_map

const struct spi_ctrlr_buses spi_ctrlr_bus_map[]
Initial value:
= {
{
.ctrlr = &spi_ctrlr,
.bus_start = 0,
.bus_end = SPI_BUS_NUMBER - 1,
},
{
.ctrlr = &spi_flash_ctrlr,
.bus_start = CONFIG_BOOT_DEVICE_SPI_FLASH_BUS,
.bus_end = CONFIG_BOOT_DEVICE_SPI_FLASH_BUS,
},
}
const struct spi_ctrlr spi_ctrlr
Definition: spi.c:261
#define SPI_BUS_NUMBER
Definition: spi.h:8
static const struct spi_ctrlr spi_flash_ctrlr
Definition: spi.c:115

Definition at line 104 of file spi.c.

◆ spi_ctrlr_bus_map_count

const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map)

Definition at line 133 of file spi.c.

◆ spi_flash_ctrlr

const struct spi_ctrlr spi_flash_ctrlr
static
Initial value:
= {
.max_xfer_size = 65535,
.flash_probe = mtk_spi_flash_probe,
}
int mtk_spi_flash_probe(const struct spi_slave *spi, struct spi_flash *flash)

Definition at line 104 of file spi.c.