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 <console/console.h>
#include <spi_flash.h>
#include <spi-generic.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include <types.h>
#include "SBPLATFORM.h"
#include <vendorcode/amd/cimx/sb800/ECfan.h>
Include dependency graph for spi.c:

Go to the source code of this file.

Macros

#define AMD_SB_SPI_TX_LEN   8
 

Functions

static void reset_internal_fifo_pointer (void)
 
static void execute_command (void)
 
void spi_init (void)
 Init all SPI controllers with default values and enable all SPI controller. More...
 
static int spi_ctrlr_xfer (const struct spi_slave *slave, const void *dout, size_t bytesout, void *din, size_t bytesin)
 
static void ImcSleep (void)
 
static void ImcWakeup (void)
 
int chipset_volatile_group_begin (const struct spi_flash *flash)
 
int chipset_volatile_group_end (const struct spi_flash *flash)
 
static int xfer_vectors (const struct spi_slave *slave, struct spi_op vectors[], size_t count)
 

Variables

static uintptr_t spibar
 
static const struct spi_ctrlr spi_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

◆ AMD_SB_SPI_TX_LEN

#define AMD_SB_SPI_TX_LEN   8

Definition at line 15 of file spi.c.

Function Documentation

◆ chipset_volatile_group_begin()

int chipset_volatile_group_begin ( const struct spi_flash flash)

Definition at line 121 of file spi.c.

References CONFIG, ImcSleep(), and NULL.

Referenced by spi_flash_volatile_group_begin().

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

◆ chipset_volatile_group_end()

int chipset_volatile_group_end ( const struct spi_flash flash)

Definition at line 130 of file spi.c.

References CONFIG, ImcWakeup(), and NULL.

Referenced by spi_flash_volatile_group_end().

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

◆ execute_command()

static void execute_command ( void  )
static

Definition at line 27 of file spi.c.

References read8(), spibar, and write8().

Referenced by spi_ctrlr_xfer().

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

◆ ImcSleep()

static void ImcSleep ( void  )
static

Definition at line 95 of file spi.c.

References AccWidthUint8.

Referenced by chipset_volatile_group_begin().

Here is the caller graph for this function:

◆ ImcWakeup()

static void ImcWakeup ( void  )
static

Definition at line 108 of file spi.c.

References AccWidthUint8.

Referenced by chipset_volatile_group_end().

Here is the caller graph for this function:

◆ reset_internal_fifo_pointer()

static void reset_internal_fifo_pointer ( void  )
static

Definition at line 19 of file spi.c.

References read8(), spibar, and write8().

Referenced by spi_ctrlr_xfer().

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

◆ spi_ctrlr_xfer()

static int spi_ctrlr_xfer ( const struct spi_slave slave,
const void dout,
size_t  bytesout,
void din,
size_t  bytesin 
)
static

Definition at line 43 of file spi.c.

References AMD_SB_SPI_TX_LEN, BIOS_DEBUG, count, execute_command(), printk, read8(), reset_internal_fifo_pointer(), spibar, and write8().

Here is the call graph for this function:

◆ spi_init()

void spi_init ( void  )

Init all SPI controllers with default values and enable all SPI controller.

Definition at line 35 of file spi.c.

References pci_read_config32(), pcidev_on_root(), and spibar.

Here is the call graph for this function:

◆ xfer_vectors()

static int xfer_vectors ( const struct spi_slave slave,
struct spi_op  vectors[],
size_t  count 
)
static

Definition at line 139 of file spi.c.

Variable Documentation

◆ spi_ctrlr

const struct spi_ctrlr spi_ctrlr
static
Initial value:
= {
.xfer_vector = xfer_vectors,
.max_xfer_size = AMD_SB_SPI_TX_LEN,
}
static int xfer_vectors(const struct spi_slave *slave, struct spi_op vectors[], size_t count)
Definition: spi.c:139
#define AMD_SB_SPI_TX_LEN
Definition: spi.c:15
@ SPI_CNTRLR_DEDUCT_CMD_LEN
Definition: spi-generic.h:116

Definition at line 139 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 = 0,
},
}
const struct spi_ctrlr spi_ctrlr
Definition: spi.c:261

Definition at line 139 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 159 of file spi.c.

◆ spibar

uintptr_t spibar
static

Definition at line 17 of file spi.c.

Referenced by execute_command(), reset_internal_fifo_pointer(), spi_ctrlr_xfer(), and spi_init().