| 1 |
|
| 2 |
|
| 3 |
#include <commonlib/helpers.h> |
| 4 |
#include <spi_flash.h> |
| 5 |
#include <spi-generic.h> |
| 6 |
|
| 7 |
#include "spi_flash_internal.h" |
| 8 |
|
| 9 |
|
| 10 |
#define CMD_AT25_WREN 0x06 |
| 11 |
#define CMD_AT25_WRDI 0x04 |
| 12 |
#define CMD_AT25_RDSR 0x05 |
| 13 |
#define CMD_AT25_WRSR 0x01 |
| 14 |
#define CMD_AT25_READ 0x03 |
| 15 |
#define CMD_AT25_FAST_READ 0x0b |
| 16 |
#define CMD_AT25_PP 0x02 |
| 17 |
#define CMD_AT25_SE 0x20 |
| 18 |
#define CMD_AT25_BE 0xd8 |
| 19 |
#define CMD_AT25_CE 0xc7 |
| 20 |
#define CMD_AT25_DP 0xb9 |
| 21 |
#define CMD_AT25_RES 0xab |
| 22 |
|
| 23 |
static const struct spi_flash_part_id flash_table[] = { |
| 24 |
{ |
| 25 |
|
| 26 |
.id[0] = 0x3015, |
| 27 |
.nr_sectors_shift = 9, |
| 28 |
}, |
| 29 |
{ |
| 30 |
|
| 31 |
.id[0] = 0x47, |
| 32 |
.nr_sectors_shift = 10, |
| 33 |
}, |
| 34 |
{ |
| 35 |
|
| 36 |
.id[0] = 0x3017, |
| 37 |
.nr_sectors_shift = 11, |
| 38 |
}, |
| 39 |
{ |
| 40 |
|
| 41 |
.id[0] = 0x4015, |
| 42 |
.nr_sectors_shift = 9, |
| 43 |
}, |
| 44 |
{ |
| 45 |
|
| 46 |
.id[0] = 0x4016, |
| 47 |
.nr_sectors_shift = 10, |
| 48 |
}, |
| 49 |
{ |
| 50 |
|
| 51 |
.id[0] = 0x4017, |
| 52 |
.nr_sectors_shift = 11, |
| 53 |
}, |
| 54 |
{ |
| 55 |
|
| 56 |
.id[0] = 0x4018, |
| 57 |
.nr_sectors_shift = 12, |
| 58 |
}, |
| 59 |
}; |
| 60 |
|
| 61 |
const struct spi_flash_vendor_info spi_flash_atmel_vi = { |
| 62 |
.id = VENDOR_ID_ATMEL, |
| 63 |
.page_size_shift = 8, |
| 64 |
.sector_size_kib_shift = 2, |
| 65 |
.match_id_mask[0] = 0xffff, |
| 66 |
.ids = flash_table, |
| 67 |
.nr_part_ids = ARRAY_SIZE(flash_table), |
| 68 |
.desc = &spi_flash_pp_0x20_sector_desc, |
| 69 |
}; |