![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <assert.h>
#include <console/console.h>
#include <device/mmio.h>
#include <soc/flash_controller_common.h>
#include <soc/symbols.h>
#include <spi_flash.h>
#include <spi-generic.h>
#include <string.h>
#include <symbols.h>
#include <timer.h>
#include <types.h>
Go to the source code of this file.
Macros | |
#define | GET_NTH_BYTE(d, n) ((d >> (8 * n)) & 0xff) |
Functions | |
static int | polling_cmd (u32 val) |
static int | mtk_nor_execute_cmd (u8 cmdval) |
static int | sflashhw_read_flash_status (u8 *value) |
static int | wait_for_write_done (void) |
static void | set_sfpaddr (u32 addr) |
static int | sector_erase (int offset) |
static int | dma_read (u32 addr, uintptr_t dma_buf, u32 len) |
static int | nor_read (const struct spi_flash *flash, u32 addr, size_t len, void *buf) |
static int | nor_write (const struct spi_flash *flash, u32 addr, size_t len, const void *buf) |
static int | nor_erase (const struct spi_flash *flash, u32 offset, size_t len) |
int | mtk_spi_flash_probe (const struct spi_slave *spi, struct spi_flash *flash) |
Variables | |
static struct mtk_nor_regs *const | mtk_nor = (void *)SFLASH_REG_BASE |
const struct spi_flash_ops | spi_flash_ops |
#define GET_NTH_BYTE | ( | d, | |
n | |||
) | ((d >> (8 * n)) & 0xff) |
Definition at line 17 of file flash_controller.c.
Definition at line 97 of file flash_controller.c.
References addr, assert, BIOS_WARNING, mtk_nor_regs::fdma_ctl, mtk_nor_regs::fdma_dadr, mtk_nor_regs::fdma_end_dadr, mtk_nor_regs::fdma_fadr, IS_ALIGNED, mtk_nor, printk, read32(), SFLASH_DMA_ALIGN, SFLASH_DMA_SW_RESET, SFLASH_DMA_TRIGGER, SFLASH_DMA_WDLE_EN, SFLASH_POLLINGREG_US, stopwatch_expired(), stopwatch_init_usecs_expire(), and write32().
Referenced by nor_read().
|
static |
Definition at line 33 of file flash_controller.c.
References mtk_nor_regs::cmd, mtk_nor, polling_cmd(), SFLASH_AUTOINC, val, and write8().
Referenced by nor_write(), sector_erase(), and sflashhw_read_flash_status().
Definition at line 212 of file flash_controller.c.
References spi_flash::erase_cmd, memcpy(), mtk_nor, spi_flash::ops, SECTOR_ERASE_CMD, spi_flash::sector_size, SFLASH_COMMAND_ENABLE, spi_flash::size, spi_flash::spi, spi_flash_ops, write32(), and mtk_nor_regs::wrprot.
Definition at line 188 of file flash_controller.c.
References BIOS_WARNING, offset, printk, sector_erase(), and spi_flash::sector_size.
Definition at line 125 of file flash_controller.c.
References addr, ALIGN_DOWN, ALIGN_UP, buf, CONFIG, dma_coherent(), dma_read(), ENV_BOOTBLOCK, ENV_SEPARATE_VERSTAGE, memcpy(), MIN, mtk_nor, mtk_nor_regs::prgdata, mtk_nor_regs::read_dual, REGION_SIZE, setbits8, SFLASH_1_1_2_READ, SFLASH_DMA_ALIGN, SFLASH_READ_DUAL_EN, stopwatch::start, and write8().
|
static |
Definition at line 169 of file flash_controller.c.
References addr, buf, buffer, mtk_nor, mtk_nor_execute_cmd(), set_sfpaddr(), SFLASH_AUTOINC, SFLASH_WR_TRIGGER, wait_for_write_done(), mtk_nor_regs::wdata, and write8().
|
static |
Definition at line 19 of file flash_controller.c.
References mtk_nor_regs::cmd, mtk_nor, read32(), SFLASH_POLLINGREG_US, stopwatch_expired(), stopwatch_init_usecs_expire(), and val.
Referenced by mtk_nor_execute_cmd().
|
static |
Definition at line 75 of file flash_controller.c.
References mtk_nor_regs::cnt, GET_NTH_BYTE, mtk_nor, mtk_nor_execute_cmd(), offset, mtk_nor_regs::prgdata, SECTOR_ERASE_CMD, SFLASH_OP_WREN, SFLASH_PRG_CMD, wait_for_write_done(), and write8().
Referenced by nor_erase().
Definition at line 68 of file flash_controller.c.
References addr, GET_NTH_BYTE, mtk_nor, mtk_nor_regs::radr, and write8().
Referenced by nor_write().
|
static |
Definition at line 41 of file flash_controller.c.
References mtk_nor, mtk_nor_execute_cmd(), mtk_nor_regs::rdsr, read8(), SFLASH_READSTATUS, and value.
Referenced by wait_for_write_done().
|
static |
Definition at line 50 of file flash_controller.c.
References SFLASH_POLLINGREG_US, SFLASH_WRITE_IN_PROGRESS, sflashhw_read_flash_status(), stopwatch_expired(), and stopwatch_init_usecs_expire().
Referenced by nor_write(), and sector_erase().
|
static |
Definition at line 15 of file flash_controller.c.
Referenced by dma_read(), mtk_nor_execute_cmd(), mtk_spi_flash_probe(), nor_read(), nor_write(), polling_cmd(), sector_erase(), set_sfpaddr(), and sflashhw_read_flash_status().
const struct spi_flash_ops spi_flash_ops |
Definition at line 188 of file flash_controller.c.
Referenced by mtk_spi_flash_probe().