14 #define CMD_SST_WREN 0x06
15 #define CMD_SST_WRDI 0x04
16 #define CMD_SST_RDSR 0x05
17 #define CMD_SST_WRSR 0x01
18 #define CMD_SST_EWSR 0x50
19 #define CMD_SST_READ 0x03
20 #define CMD_SST_FAST_READ 0x0b
21 #define CMD_SST_BP 0x02
22 #define CMD_SST_PP 0x02
23 #define CMD_SST_AAI_WP 0xAD
24 #define CMD_SST_SE 0x20
26 #define SST_SR_WIP (1 << 0)
27 #define SST_SR_WEL (1 << 1)
28 #define SST_SR_BP0 (1 << 2)
29 #define SST_SR_BP1 (1 << 3)
30 #define SST_SR_BP2 (1 << 4)
31 #define SST_SR_AAI (1 << 6)
32 #define SST_SR_BPL (1 << 7)
38 .nr_sectors_shift = 7,
42 .nr_sectors_shift = 8,
46 .nr_sectors_shift = 8,
50 .nr_sectors_shift = 9,
54 .nr_sectors_shift = 10,
58 .nr_sectors_shift = 4,
62 .nr_sectors_shift = 5,
66 .nr_sectors_shift = 6,
70 .nr_sectors_shift = 7,
74 .nr_sectors_shift = 8,
78 .nr_sectors_shift = 8,
86 .nr_sectors_shift = 11,
128 #if CONFIG(DEBUG_SPI_FLASH)
147 size_t actual, cmd_len;
170 for (; actual < len - 1; actual += 2) {
171 #if CONFIG(DEBUG_SPI_FLASH)
197 if (!ret && actual != len)
201 #if CONFIG(DEBUG_SPI_FLASH)
203 ret ?
"failure" :
"success", len, (
unsigned long)
offset - actual);
243 .sector_size_kib_shift = 2,
244 .match_id_mask[0] = 0xff,
253 .page_size_shift = 8,
254 .sector_size_kib_shift = 2,
255 .match_id_mask[0] = 0xff,
#define printk(level,...)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
#define SPI_FLASH_PROG_TIMEOUT_MS
static int spi_w8r8(const struct spi_slave *slave, unsigned char byte)
int spi_flash_cmd_read(const struct spi_flash *flash, u32 offset, size_t len, void *buf)
int spi_flash_cmd_erase(const struct spi_flash *flash, u32 offset, size_t len)
const struct spi_flash_ops_descriptor spi_flash_pp_0x20_sector_desc
int spi_flash_cmd_wait_ready(const struct spi_flash *flash, unsigned long timeout)
int spi_flash_cmd(const struct spi_slave *spi, u8 cmd, void *response, size_t len)
int spi_flash_cmd_write(const struct spi_slave *spi, const u8 *cmd, size_t cmd_len, const void *data, size_t data_len)
int spi_flash_cmd_status(const struct spi_flash *flash, u8 *reg)
static int sst_write_ai(const struct spi_flash *flash, u32 offset, size_t len, const void *buf)
static int sst_byte_write(const struct spi_flash *flash, u32 offset, const void *buf)
static int sst_enable_writing_status(const struct spi_flash *flash)
static const struct spi_flash_part_id flash_table_pp256[]
const struct spi_flash_vendor_info spi_flash_sst_ai_vi
static const struct spi_flash_ops_descriptor descai
static int sst_enable_writing(const struct spi_flash *flash)
static int sst_disable_writing(const struct spi_flash *flash)
static const struct spi_flash_part_id flash_table_ai[]
static int sst_unlock(const struct spi_flash *flash)
const struct spi_flash_vendor_info spi_flash_sst_vi