![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <spi-generic.h>
#include <spi_flash.h>
#include <arch/cache.h>
#include <device/mmio.h>
#include <soc/addressmap.h>
#include <soc/qspi_common.h>
#include <soc/gpio.h>
#include <soc/clock.h>
#include <symbols.h>
#include <assert.h>
#include <gpio.h>
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | cmd_desc |
struct | xfer_cfg |
Macros | |
#define | CACHE_LINE_SIZE 64 |
Enumerations | |
enum | qspi_mode { SDR_1BIT = 1 , SDR_2BIT = 2 , SDR_4BIT = 3 , DDR_1BIT = 5 , DDR_2BIT = 6 , DDR_4BIT = 7 } |
enum | cs_state { CS_DEASSERT , CS_ASSERT } |
enum | bus_xfer_direction { MASTER_READ = 0 , MASTER_WRITE = 1 } |
Functions | |
static void | dma_transfer_chain (struct cmd_desc *chain) |
static void | flush_chain (void) |
static struct cmd_desc * | allocate_descriptor (void) |
static void | cs_change (enum cs_state state) |
static void | configure_gpios (void) |
static void | queue_bounce_data (uint8_t *data, uint32_t data_bytes, enum qspi_mode data_mode, bool write) |
static void | queue_direct_data (uint8_t *data, uint32_t data_bytes, enum qspi_mode data_mode, bool write) |
static void | queue_data (uint8_t *data, uint32_t data_bytes, enum qspi_mode data_mode, bool write) |
static void | reg_init (void) |
void | quadspi_init (uint32_t hz) |
int | qspi_claim_bus (const struct spi_slave *slave) |
void | qspi_release_bus (const struct spi_slave *slave) |
static int | xfer (enum qspi_mode mode, const void *dout, size_t out_bytes, void *din, size_t in_bytes) |
int | qspi_xfer (const struct spi_slave *slave, const void *dout, size_t out_bytes, void *din, size_t in_bytes) |
int | qspi_xfer_dual (const struct spi_slave *slave, const void *dout, size_t out_bytes, void *din, size_t in_bytes) |
Variables | |
static int | curr_desc_idx = -1 |
struct { | |
struct cmd_desc descriptors [3] | |
uint8_t buffers [3][CACHE_LINE_SIZE] | |
} * | dma = (void *)_dma_coherent |
enum bus_xfer_direction |
enum qspi_mode |
Definition at line 103 of file qspi.c.
References cmd_desc::bounce_dst, cmd_desc::bounce_length, cmd_desc::bounce_src, curr_desc_idx, cmd_desc::data_address, cmd_desc::direction, dma, cmd_desc::fragment, cmd_desc::length, MASTER_READ, cmd_desc::multi_io_mode, cmd_desc::next_descriptor, NULL, cmd_desc::reserved1, and cmd_desc::reserved2.
Referenced by queue_bounce_data(), and queue_direct_data().
Definition at line 144 of file qspi.c.
References GPIO_8MA, gpio_configure(), GPIO_FUNC_QSPI_CLK, GPIO_FUNC_QSPI_DATA_0, GPIO_FUNC_QSPI_DATA_1, GPIO_NO_PULL, gpio_output(), GPIO_OUTPUT, QSPI_CLK, QSPI_CS, QSPI_DATA_0, and QSPI_DATA_1.
Referenced by quadspi_init().
Definition at line 139 of file qspi.c.
References CS_DEASSERT, gpio_set(), and QSPI_CS.
Referenced by qspi_claim_bus(), and qspi_release_bus().
Definition at line 64 of file qspi.c.
References DMA_CHAIN_DONE, qcom_qspi_regs::mstr_int_sts, qcom_qspi_regs::next_dma_desc_addr, qcom_qspi, read32(), and write32().
Referenced by flush_chain().
Definition at line 78 of file qspi.c.
References cmd_desc::bounce_dst, cmd_desc::bounce_length, cmd_desc::bounce_src, curr_desc_idx, cmd_desc::data_address, dcache_invalidate_by_mva, cmd_desc::direction, dma, dma_transfer_chain(), cmd_desc::length, MASTER_READ, memcpy(), and cmd_desc::next_descriptor.
Referenced by xfer().
int qspi_claim_bus | ( | const struct spi_slave * | slave | ) |
Definition at line 259 of file qspi.c.
References CS_ASSERT, and cs_change().
Definition at line 265 of file qspi.c.
References cs_change(), and CS_DEASSERT.
Definition at line 251 of file qspi.c.
References assert, CACHE_LINE_SIZE, clock_configure_qspi(), configure_gpios(), dcache_line_bytes(), and reg_init().
Referenced by bootblock_soc_init().
|
static |
Definition at line 158 of file qspi.c.
References allocate_descriptor(), cmd_desc::bounce_dst, cmd_desc::bounce_length, cmd_desc::bounce_src, cmd_desc::data_address, cmd_desc::direction, cmd_desc::length, memcpy(), and cmd_desc::multi_io_mode.
Referenced by queue_data().
|
static |
Definition at line 197 of file qspi.c.
References ALIGN_DOWN, ALIGN_UP, CACHE_LINE_SIZE, MIN, queue_bounce_data(), and queue_direct_data().
Referenced by xfer().
|
static |
Definition at line 180 of file qspi.c.
References allocate_descriptor(), cmd_desc::data_address, dcache_clean_by_mva(), dcache_invalidate_by_mva, cmd_desc::direction, cmd_desc::length, and cmd_desc::multi_io_mode.
Referenced by queue_data().
Definition at line 224 of file qspi.c.
References qcom_qspi_regs::ahb_mstr_cfg, DMA_ENABLE, FB_CLK_EN, FULL_CYCLE_MODE, qcom_qspi_regs::mstr_cfg, qcom_qspi_regs::mstr_int_en, qcom_qspi_regs::mstr_int_sts, PIN_HOLDN, qcom_qspi, qcom_qspi_regs::rd_fifo_cfg, qcom_qspi_regs::rd_fifo_rst, RESET_FIFO, SBL_EN, SPI_MODE_SHIFT, TX_DATA_DELAY_SHIFT, TX_DATA_OE_DELAY_SHIFT, and write32().
Referenced by quadspi_init().
|
static |
Definition at line 270 of file qspi.c.
References flush_chain(), and queue_data().
Referenced by qspi_xfer(), and qspi_xfer_dual().
uint8_t buffers[3][CACHE_LINE_SIZE] |
|
static |
Definition at line 18 of file qspi.c.
Referenced by allocate_descriptor(), and flush_chain().
struct { ... } * dma |
Referenced by allocate_descriptor(), dump_dma_regs(), flush_chain(), fw_cfg_dma(), lb_board(), and setup_dma_params().