| 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_EN25_WREN 0x06 |
| 11 |
#define CMD_EN25_WRDI 0x04 |
| 12 |
#define CMD_EN25_RDSR 0x05 |
| 13 |
#define CMD_EN25_WRSR 0x01 |
| 14 |
#define CMD_EN25_READ 0x03 |
| 15 |
#define CMD_EN25_FAST_READ 0x0b |
| 16 |
#define CMD_EN25_PP 0x02 |
| 17 |
#define CMD_EN25_SE 0x20 |
| 18 |
#define CMD_EN25_BE 0xd8 |
| 19 |
#define CMD_EN25_DP 0xb9 |
| 20 |
#define CMD_EN25_RES 0xab |
| 21 |
|
| 22 |
#define EON_ID_EN25B80 0x2014 |
| 23 |
#define EON_ID_EN25B16 0x2015 |
| 24 |
#define EON_ID_EN25B32 0x2016 |
| 25 |
#define EON_ID_EN25B64 0x2017 |
| 26 |
#define EON_ID_EN25F80 0x3114 |
| 27 |
#define EON_ID_EN25F16 0x3115 |
| 28 |
#define EON_ID_EN25F32 0x3116 |
| 29 |
#define EON_ID_EN25F64 0x3117 |
| 30 |
#define EON_ID_EN25Q80 0x3014 |
| 31 |
#define EON_ID_EN25Q16 0x3015 |
| 32 |
#define EON_ID_EN25Q32 0x3016 |
| 33 |
#define EON_ID_EN25Q64 0x3017 |
| 34 |
#define EON_ID_EN25Q128 0x3018 |
| 35 |
#define EON_ID_EN25QH16 0x7015 |
| 36 |
#define EON_ID_EN25QH32 0x7016 |
| 37 |
#define EON_ID_EN25QH64 0x7017 |
| 38 |
#define EON_ID_EN25QH128 0x7018 |
| 39 |
#define EON_ID_EN25S80 0x3814 |
| 40 |
#define EON_ID_EN25S16 0x3815 |
| 41 |
#define EON_ID_EN25S32 0x3816 |
| 42 |
#define EON_ID_EN25S64 0x3817 |
| 43 |
|
| 44 |
static const struct spi_flash_part_id flash_table[] = { |
| 45 |
{ |
| 46 |
|
| 47 |
.id[0] = EON_ID_EN25B80, |
| 48 |
.nr_sectors_shift = 8, |
| 49 |
}, |
| 50 |
{ |
| 51 |
|
| 52 |
.id[0] = EON_ID_EN25B16, |
| 53 |
.nr_sectors_shift = 9, |
| 54 |
}, |
| 55 |
{ |
| 56 |
|
| 57 |
.id[0] = EON_ID_EN25B32, |
| 58 |
.nr_sectors_shift = 10, |
| 59 |
}, |
| 60 |
{ |
| 61 |
|
| 62 |
.id[0] = EON_ID_EN25B64, |
| 63 |
.nr_sectors_shift = 11, |
| 64 |
}, |
| 65 |
{ |
| 66 |
|
| 67 |
.id[0] = EON_ID_EN25F80, |
| 68 |
.nr_sectors_shift = 8, |
| 69 |
}, |
| 70 |
{ |
| 71 |
|
| 72 |
.id[0] = EON_ID_EN25F16, |
| 73 |
.nr_sectors_shift = 9, |
| 74 |
}, |
| 75 |
{ |
| 76 |
|
| 77 |
.id[0] = EON_ID_EN25F32, |
| 78 |
.nr_sectors_shift = 10, |
| 79 |
}, |
| 80 |
{ |
| 81 |
|
| 82 |
.id[0] = EON_ID_EN25F64, |
| 83 |
.nr_sectors_shift = 11, |
| 84 |
}, |
| 85 |
{ |
| 86 |
|
| 87 |
.id[0] = EON_ID_EN25Q80, |
| 88 |
.nr_sectors_shift = 8, |
| 89 |
}, |
| 90 |
{ |
| 91 |
|
| 92 |
.id[0] = EON_ID_EN25Q16, |
| 93 |
.nr_sectors_shift = 9, |
| 94 |
}, |
| 95 |
{ |
| 96 |
|
| 97 |
.id[0] = EON_ID_EN25Q32, |
| 98 |
.nr_sectors_shift = 10, |
| 99 |
}, |
| 100 |
{ |
| 101 |
|
| 102 |
.id[0] = EON_ID_EN25Q64, |
| 103 |
.nr_sectors_shift = 11, |
| 104 |
}, |
| 105 |
{ |
| 106 |
|
| 107 |
.id[0] = EON_ID_EN25Q128, |
| 108 |
.nr_sectors_shift = 12, |
| 109 |
}, |
| 110 |
{ |
| 111 |
|
| 112 |
.id[0] = EON_ID_EN25QH16, |
| 113 |
.nr_sectors_shift = 9, |
| 114 |
}, |
| 115 |
{ |
| 116 |
|
| 117 |
.id[0] = EON_ID_EN25QH32, |
| 118 |
.nr_sectors_shift = 10, |
| 119 |
}, |
| 120 |
{ |
| 121 |
|
| 122 |
.id[0] = EON_ID_EN25QH64, |
| 123 |
.nr_sectors_shift = 11, |
| 124 |
}, |
| 125 |
{ |
| 126 |
|
| 127 |
.id[0] = EON_ID_EN25QH128, |
| 128 |
.nr_sectors_shift = 12, |
| 129 |
}, |
| 130 |
{ |
| 131 |
|
| 132 |
.id[0] = EON_ID_EN25S80, |
| 133 |
.nr_sectors_shift = 8, |
| 134 |
}, |
| 135 |
{ |
| 136 |
|
| 137 |
.id[0] = EON_ID_EN25S16, |
| 138 |
.nr_sectors_shift = 9, |
| 139 |
}, |
| 140 |
{ |
| 141 |
|
| 142 |
.id[0] = EON_ID_EN25S32, |
| 143 |
.nr_sectors_shift = 10, |
| 144 |
}, |
| 145 |
{ |
| 146 |
|
| 147 |
.id[0] = EON_ID_EN25S64, |
| 148 |
.nr_sectors_shift = 11, |
| 149 |
}, |
| 150 |
}; |
| 151 |
|
| 152 |
const struct spi_flash_vendor_info spi_flash_eon_vi = { |
| 153 |
.id = VENDOR_ID_EON, |
| 154 |
.page_size_shift = 8, |
| 155 |
.sector_size_kib_shift = 2, |
| 156 |
.match_id_mask[0] = 0xffff, |
| 157 |
.ids = flash_table, |
| 158 |
.nr_part_ids = ARRAY_SIZE(flash_table), |
| 159 |
.desc = &spi_flash_pp_0x20_sector_desc, |
| 160 |
}; |