![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <arch/cache.h>
#include <device/mmio.h>
#include <assert.h>
#include <console/console.h>
#include <delay.h>
#include <soc/addressmap.h>
#include <soc/dma.h>
#include <soc/spi.h>
#include <spi-generic.h>
#include <spi_flash.h>
#include <timer.h>
#include <types.h>
Go to the source code of this file.
Enumerations | |
enum | spi_direction { SPI_SEND , SPI_RECEIVE , SPI_SEND , SPI_RECEIVE } |
Variables | |
static struct tegra_spi_channel | tegra_spi_channels [] |
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) |
#define SPI_MAX_TRANSFER_BYTES_DMA (65535 * SPI_PACKET_SIZE_BYTES) |
#define SPI_MAX_TRANSFER_BYTES_FIFO (64 * SPI_PACKET_SIZE_BYTES) |
enum spi_direction |
|
static |
Definition at line 250 of file spi.c.
References clrbits32, tegra_spi_regs::fifo_status, tegra_spi_channel::regs, SPI_FIFO_STATUS_ERR, SPI_FIFO_STATUS_RX_FIFO_OVF, SPI_FIFO_STATUS_RX_FIFO_UNR, SPI_FIFO_STATUS_TX_FIFO_OVF, and SPI_FIFO_STATUS_TX_FIFO_UNR.
|
static |
|
static |
Definition at line 230 of file spi.c.
References BIOS_INFO, tegra_spi_regs::fifo_status, printk, read32(), tegra_spi_channel::regs, tegra_spi_regs::rx_data, tegra_spi_regs::rx_fifo, SPI_FIFO_STATUS_RX_FIFO_OVF, SPI_FIFO_STATUS_RX_FIFO_UNR, SPI_FIFO_STATUS_TX_FIFO_OVF, SPI_FIFO_STATUS_TX_FIFO_UNR, tegra_spi_regs::tx_data, and tegra_spi_regs::tx_fifo.
Referenced by tegra_spi_dma_finish(), and tegra_spi_pio_finish().
|
static |
Definition at line 260 of file spi.c.
References BIOS_INFO, tegra_spi_regs::command1, tegra_spi_regs::dma_blk, tegra_spi_regs::dma_ctl, printk, read32(), tegra_spi_channel::regs, and tegra_spi_regs::trans_status.
Referenced by tegra_spi_dma_finish(), and tegra_spi_pio_finish().
|
static |
Definition at line 338 of file spi.c.
References tegra_spi_regs::fifo_status, read32(), tegra_spi_channel::regs, and SPI_FIFO_STATUS_ERR.
Referenced by tegra_spi_dma_finish(), and tegra_spi_pio_finish().
|
inlinestatic |
Definition at line 388 of file spi.c.
References tegra_spi_regs::fifo_status, read32(), tegra_spi_channel::regs, SPI_FIFO_STATUS_RX_FIFO_FULL_COUNT_MASK, and SPI_FIFO_STATUS_RX_FIFO_FULL_COUNT_SHIFT.
Referenced by tegra_spi_pio_finish().
|
static |
Definition at line 428 of file spi.c.
References AHB_BURST_MASK, AHB_BURST_SHIFT, APB_BUS_WIDTH_MASK, APB_BUS_WIDTH_SHIFT, APB_CSR_FLOW, APB_CSR_ONCE, APB_CSR_REQ_SEL_MASK, APB_CSR_REQ_SEL_SHIFT, clrbits32, clrsetbits32, dma, tegra_spi_channel::req_sel, and setbits32.
Referenced by tegra_spi_dma_prepare().
|
inlinestatic |
Definition at line 299 of file spi.c.
References read32(), tegra_spi_channel::regs, SPI_STATUS_BLOCK_COUNT, SPI_STATUS_BLOCK_COUNT_SHIFT, and tegra_spi_regs::trans_status.
Referenced by tegra_spi_dma_finish(), tegra_spi_pio_finish(), and tegra_spi_wait().
|
static |
Definition at line 192 of file spi.c.
References spi_slave::bus, spi_slave::cs, read32(), tegra_spi_channel::regs, slave, SPI_CMD1_CS_POL_INACTIVE0, SPI_CMD1_CS_SEL_MASK, SPI_CMD1_CS_SEL_SHIFT, SPI_CMD1_CS_SW_VAL, tegra_spi_init(), to_tegra_spi(), val, and write32().
Definition at line 215 of file spi.c.
References spi_slave::bus, spi_slave::cs, read32(), tegra_spi_channel::regs, slave, SPI_CMD1_CS_POL_INACTIVE0, SPI_CMD1_CS_SW_VAL, to_tegra_spi(), val, and write32().
|
static |
Definition at line 313 of file spi.c.
References spi_slave::bus, MIN_DELAY_US, tegra_spi_channel::slave, tegra_spi_speed(), and udelay().
Referenced by tegra_spi_dma_finish(), and tegra_spi_wait().
|
static |
Definition at line 527 of file spi.c.
References BIOS_ERR, clrbits32, tegra_spi_regs::command1, dma_busy(), apb_dma_channel_regs::dma_byte_sta, tegra_spi_channel::dma_in, tegra_spi_channel::dma_out, dma_release(), dma_stop(), dump_dma_regs(), dump_fifo_status(), dump_spi_regs(), fifo_error(), NULL, printk, read32(), apb_dma_channel::regs, tegra_spi_channel::regs, spi_byte_count(), SPI_CMD1_RX_EN, SPI_CMD1_TX_EN, spi_delay(), and apb_dma_channel_regs::wcount.
Referenced by xfer_finish().
|
static |
Definition at line 448 of file spi.c.
References apb_dma_channel_regs::ahb_ptr, ALIGN_DOWN, APB_CSR_DIR, apb_dma_channel_regs::apb_ptr, clrbits32, apb_dma_channel_regs::csr, dcache_clean_by_mva(), dcache_clean_invalidate_by_mva, tegra_spi_regs::dma_blk, dma_claim(), tegra_spi_channel::dma_in, tegra_spi_channel::dma_out, tegra_spi_channel::in_buf, MIN, tegra_spi_channel::out_buf, apb_dma_channel::regs, tegra_spi_channel::regs, tegra_spi_regs::rx_fifo, setbits32, setup_dma_params(), SPI_MAX_TRANSFER_BYTES_DMA, SPI_SEND, TEGRA_DMA_ALIGN_BYTES, tegra_spi_regs::tx_fifo, apb_dma_channel_regs::wcount, and write32().
Referenced by xfer_setup().
|
static |
Definition at line 502 of file spi.c.
References tegra_spi_regs::command1, tegra_spi_regs::dma_ctl, tegra_spi_channel::dma_in, tegra_spi_channel::dma_out, dma_start(), tegra_spi_channel::regs, setbits32, SPI_CMD1_RX_EN, SPI_CMD1_TX_EN, SPI_DMA_CTL_DMA, SPI_STATUS_RDY, and tegra_spi_regs::trans_status.
Referenced by xfer_start().
struct tegra_spi_channel* tegra_spi_init | ( | unsigned int | bus | ) |
Definition at line 156 of file spi.c.
Referenced by spi_ctrlr_claim_bus().
|
static |
Definition at line 395 of file spi.c.
References BIOS_ERR, clrbits32, tegra_spi_regs::command1, dump_fifo_status(), dump_spi_regs(), fifo_error(), tegra_spi_regs::fifo_status, tegra_spi_channel::in_buf, printk, read32(), read8(), tegra_spi_channel::regs, tegra_spi_regs::rx_fifo, rx_fifo_count(), spi_byte_count(), SPI_CMD1_RX_EN, SPI_CMD1_TX_EN, SPI_FIFO_STATUS_RX_FIFO_EMPTY, SPI_FIFO_XFER_TIMEOUT_US, stopwatch_expired(), and stopwatch_init_usecs_expire().
Referenced by xfer_finish().
|
static |
Definition at line 343 of file spi.c.
References tegra_spi_regs::command1, tegra_spi_regs::dma_blk, tegra_spi_regs::fifo_status, MIN, tegra_spi_channel::out_buf, read32(), tegra_spi_channel::regs, setbits32, SPI_CMD1_RX_EN, SPI_CMD1_TX_EN, SPI_FIFO_STATUS_RX_FIFO_FLUSH, SPI_FIFO_STATUS_TX_FIFO_FLUSH, SPI_MAX_TRANSFER_BYTES_FIFO, SPI_SEND, tegra_spi_regs::tx_fifo, and write32().
Referenced by xfer_setup().
|
static |
Definition at line 380 of file spi.c.
References tegra_spi_regs::command1, read32(), tegra_spi_channel::regs, setbits32, SPI_CMD1_GO, SPI_STATUS_RDY, and tegra_spi_regs::trans_status.
Referenced by xfer_start().
Definition at line 186 of file spi.c.
Referenced by spi_delay().
|
static |
Definition at line 327 of file spi.c.
References count, tegra_spi_regs::dma_blk, read32(), tegra_spi_channel::regs, spi_byte_count(), spi_delay(), SPI_DMA_CTL_BLOCK_SIZE_MASK, and SPI_DMA_CTL_BLOCK_SIZE_SHIFT.
Referenced by xfer_wait().
|
static |
Definition at line 182 of file spi.c.
References tegra_spi_channels.
Referenced by spi_ctrlr_claim_bus(), and spi_ctrlr_release_bus().
|
static |
Definition at line 687 of file spi.c.
References tegra_spi_dma_finish(), tegra_spi_pio_finish(), tegra_spi_channel::xfer_mode, XFER_MODE_DMA, and XFER_MODE_NONE.
|
static |
Definition at line 588 of file spi.c.
References buf, dcache_line_bytes(), tegra_spi_channel::in_buf, tegra_spi_channel::out_buf, SPI_RECEIVE, SPI_SEND, tegra_spi_dma_prepare(), tegra_spi_pio_prepare(), tegra_spi_channel::xfer_mode, XFER_MODE_DMA, XFER_MODE_NONE, and XFER_MODE_PIO.
|
static |
Definition at line 674 of file spi.c.
References tegra_spi_dma_start(), tegra_spi_pio_start(), tegra_spi_channel::xfer_mode, and XFER_MODE_DMA.
|
static |
Definition at line 682 of file spi.c.
References tegra_spi_wait().
const struct spi_ctrlr_buses spi_ctrlr_bus_map[] |
const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map) |
|
static |
Definition at line 1 of file spi.c.
Referenced by tegra_spi_init(), and to_tegra_spi().