forked from 981213/ch347-nor-prog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspi_ids.cpp
167 lines (146 loc) · 11.6 KB
/
spi_ids.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#include "stdafx.h"
#include "spi_flash.h"
const static spi_flash_id flash_ids[] =
{
{"Atmel AT25DF321A", 0x1f4701, 0, SIZE_4MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_INIT_SR | SF_BP0_3},
{"Atmel AT25DF641", 0x1f4800, 0, SIZE_8MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_INIT_SR | SF_BP0_3},
{"Atmel AT26DF081A", 0x1f4501, 0, SIZE_1MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_INIT_SR | SF_BP0_3},
{"Atmel AT26DF161A", 0x1f4601, 0, SIZE_2MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_INIT_SR | SF_BP0_3},
{"Atmel AT26DF321", 0x1f4700, 0, SIZE_4MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_INIT_SR | SF_BP0_3},
{"Atmel AT45DB081D", 0x1f2500, 0, SIZE_1MB, SF_64K_BLOCK | SF_INIT_SR},
{"EON EN25Q80A", 0x1c3014, 0, SIZE_1MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"EON EN25F80", 0x1c3114, 0, SIZE_1MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"EON EN25F16", 0x1c3115, 0, SIZE_2MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"EON EN25Q16", 0x1c3015, 0, SIZE_2MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"EON EN25QH16", 0x1c7015, 0, SIZE_2MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"EON EN25F32", 0x1c3116, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"EON EN25P32", 0x1c2016, 0, SIZE_4MB, SF_64K_BLOCK | SF_BP0_2},
{"EON EN25Q32", 0x1c3016, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"EON EN25QH32", 0x1c7016, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"EON EN25P64", 0x1c2017, 0, SIZE_8MB, SF_64K_BLOCK | SF_BP0_2},
{"EON EN25Q64", 0x1c3017, 0, SIZE_8MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"EON EN25QH64", 0x1c7017, 0, SIZE_8MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"EON EN25Q128", 0x1c3018, 0, SIZE_16MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"EON EN25QH128", 0x1c7018, 0, SIZE_16MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"EON EN25QH256", 0x1c7019, 0, SIZE_32MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"ESMT F25L08QA", 0x8c4014, 0, SIZE_1MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"ESMT F25L16PA", 0x8c2115, 0, SIZE_2MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"ESMT F25L32PA", 0x8c2016, 0, SIZE_4MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"ESMT F25L32QA", 0x8c4116, 0, SIZE_4MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"ESMT F25L64QA", 0x8c4117, 0, SIZE_8MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"ESMT F25L128QA", 0x8c4118, 0, SIZE_16MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"GigaDevice GD25Q80B", 0xc84014, 0, SIZE_1MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_4},
{"GigaDevice GD25Q16B", 0xc84015, 0, SIZE_2MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_4},
{"GigaDevice GD25Q32", 0xc84016, 0, SIZE_4MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_4},
{"GigaDevice GD25Q64", 0xc84017, 0, SIZE_8MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_4},
{"GigaDevice GD25Q128", 0xc84018, 0, SIZE_16MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_4},
{"GigaDevice GD25Q256", 0xc84019, 0, SIZE_32MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"GigaDevice GD25Q512", 0xc84020, 0, SIZE_64MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Intel 25F160S33B", 0x898911, 0, SIZE_2MB, SF_64K_BLOCK | SF_BP0_2},
{"Intel 25F320S33B", 0x898912, 0, SIZE_4MB, SF_64K_BLOCK | SF_BP0_2},
{"Intel 25F640S33B", 0x898913, 0, SIZE_8MB, SF_64K_BLOCK | SF_BP0_2},
{"Intel 25F160S33T", 0x898915, 0, SIZE_2MB, SF_64K_BLOCK | SF_BP0_2},
{"Intel 25F320S33T", 0x898916, 0, SIZE_4MB, SF_64K_BLOCK | SF_BP0_2},
{"Intel 25F640S33T", 0x898917, 0, SIZE_8MB, SF_64K_BLOCK | SF_BP0_2},
{"ISSI IS25LP080", 0x9d6014, 0, SIZE_1MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"ISSI IS25LP016", 0x9d6015, 0, SIZE_2MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"ISSI IS25LP032", 0x9d6016, 0, SIZE_4MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"ISSI IS25LP064", 0x9d6017, 0, SIZE_8MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"ISSI IS25LP128", 0x9d6018, 0, SIZE_16MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"ISSI IS25LP256", 0x9d6019, 0, SIZE_32MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX25L8005", 0xc22014, 0, SIZE_1MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Macronix MX25L1605D", 0xc22015, 0, SIZE_2MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX25L3235E", 0xc22016, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX25L3255E", 0xc29e16, 0, SIZE_4MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX25L6435E", 0xc22017, 0, SIZE_8MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX25L6455E", 0xc22617, 0, SIZE_8MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX25L12835E", 0xc22018, 0, SIZE_16MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX25L12855E", 0xc22618, 0, SIZE_16MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX25L25635E", 0xc22019, 0, SIZE_32MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX25L25655E", 0xc22619, 0, SIZE_32MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX66L51235F", 0xc2201a, 0, SIZE_64MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Macronix MX66L1G54G", 0xc2201b, 0, SIZE_128MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Micron M25P80", 0x202014, 0, SIZE_1MB, SF_64K_BLOCK | SF_BP0_2},
{"Micron M25PE80", 0x208014, 0, SIZE_1MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Micron M25PX80", 0x207114, 0, SIZE_1MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Micron M45PE80", 0x204014, 0, SIZE_1MB, SF_64K_BLOCK | SF_4K_SECTOR},
{"Micron M25P16", 0x202015, 0, SIZE_2MB, SF_64K_BLOCK | SF_BP0_2},
{"Micron M25PE16", 0x208015, 0, SIZE_2MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Micron M25PX16", 0x207115, 0, SIZE_2MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Micron M45PE16", 0x204015, 0, SIZE_2MB, SF_64K_BLOCK | SF_4K_SECTOR},
{"Micron M25P32", 0x202016, 0, SIZE_4MB, SF_64K_BLOCK | SF_BP0_2},
{"Micron M25PX32", 0x207116, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Micron M25PX32-S0", 0x207316, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Micron M25PX32-S1", 0x206316, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Micron N25Q032A", 0x20ba16, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Micron M25P64", 0x202017, 0, SIZE_8MB, SF_64K_BLOCK | SF_BP0_2},
{"Micron M25PX64", 0x207117, 0, SIZE_8MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Micron N25Q064A", 0x20ba17, 0, SIZE_8MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2 | SF_BP4},
{"Micron M25P128", 0x202018, 0, SIZE_16MB, SF_256K_BLOCK | SF_BP0_2},
{"Micron N25Q128A13", 0x20ba18, 0, SIZE_16MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2 | SF_BP4},
{"Micron N25Q128A11", 0x20bb18, 0, SIZE_16MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2 | SF_BP4},
{"Micron N25Q256A", 0x20ba19, 0, SIZE_32MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2 | SF_BP4},
{"Micron N25Q512A", 0x20ba20, 0, SIZE_64MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2 | SF_BP4},
{"Micron N25Q00AA", 0x20ba21, 0, SIZE_128MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2 | SF_BP4},
{"Micron MT25QL02GC", 0x20ba21, 0, SIZE_256MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2 | SF_BP4},
{"PMC PM25LQ080", 0x7f9d44, 0, SIZE_1MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_4K_PMC | SF_BP0_3},
{"PMC PM25LQ016", 0x7f9d45, 0, SIZE_2MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_4K_PMC | SF_BP0_3},
{"PMC PM25LQ032", 0x7f9d46, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Spansion S25FL008A", 0x010213, 0, SIZE_1MB, SF_64K_BLOCK | SF_BP0_2},
{"Spansion S25FL208K", 0x014014, 0, SIZE_1MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Spansion S25FL016A", 0x010214, 0, SIZE_2MB, SF_64K_BLOCK | SF_BP0_2},
{"Spansion S25FL216K", 0x014015, 0, SIZE_2MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Spansion S25FL032P", 0x010215, 0x4d00, SIZE_4MB, SF_64K_BLOCK | SF_BP0_2},
{"Spansion S25FL032A", 0x010215, 0, SIZE_4MB, SF_64K_BLOCK | SF_BP0_2},
{"Spansion S25FL132K", 0x014016, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Spansion S25FL064P", 0x010216, 0x4d00, SIZE_8MB, SF_64K_BLOCK | SF_BP0_2},
{"Spansion S25FL064A", 0x010216, 0, SIZE_8MB, SF_64K_BLOCK | SF_BP0_2},
{"Spansion S25FL164K", 0x014017, 0, SIZE_8MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Spansion S25FL128P0", 0x012018, 0x0300, SIZE_16MB, SF_256K_BLOCK | SF_BP0_2},
{"Spansion S25FL128P1", 0x012018, 0x0301, SIZE_16MB, SF_64K_BLOCK | SF_BP0_3},
{"Spansion S25FL128S0", 0x012018, 0x4d00, SIZE_16MB, SF_256K_BLOCK | SF_BP0_2},
{"Spansion S25FL128S1", 0x012018, 0x4d01, SIZE_16MB, SF_64K_BLOCK | SF_BP0_2},
{"Spansion S25FL256S0", 0x010219, 0x4d00, SIZE_32MB, SF_256K_BLOCK | SF_BP0_2},
{"Spansion S25FL256S1", 0x010219, 0x4d01, SIZE_32MB, SF_64K_BLOCK | SF_BP0_2},
{"Spansion S25FL512S", 0x010220, 0x4d00, SIZE_64MB, SF_256K_BLOCK | SF_BP0_2},
{"Spansion S70FL01GS", 0x010221, 0x4d00, SIZE_128MB, SF_256K_BLOCK},
{"SST SST25VF080B", 0xbf258e, 0, SIZE_1MB, SF_4K_SECTOR | SF_SST | SF_INIT_SR},
{"SST SST25VF016B", 0xbf2541, 0, SIZE_2MB, SF_4K_SECTOR | SF_SST | SF_INIT_SR},
{"SST SST26VF016", 0xbf2601, 0, SIZE_2MB, SF_4K_SECTOR | SF_SST | SF_INIT_SR},
{"SST SST26VF016B", 0xbf2641, 0, SIZE_2MB, SF_4K_SECTOR | SF_SST | SF_INIT_SR},
{"SST SST25VF032B", 0xbf254a, 0, SIZE_4MB, SF_4K_SECTOR | SF_SST | SF_INIT_SR},
{"SST SST26VF032", 0xbf2602, 0, SIZE_4MB, SF_4K_SECTOR | SF_SST | SF_INIT_SR},
{"SST SST26VF032B", 0xbf2642, 0, SIZE_4MB, SF_4K_SECTOR | SF_SST | SF_INIT_SR},
{"SST SST25VF064C", 0xbf254b, 0, SIZE_8MB, SF_4K_SECTOR | SF_INIT_SR},
{"SST SST26VF064B", 0xbf2643, 0, SIZE_8MB, SF_4K_SECTOR | SF_INIT_SR},
{"Winbond W25X80", 0xef3014, 0, SIZE_1MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q80", 0xef5014, 0, SIZE_1MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q80", 0xef4014, 0, SIZE_1MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25X16", 0xef3015, 0, SIZE_2MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q16", 0xef4015, 0, SIZE_2MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25X32", 0xef3016, 0, SIZE_4MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q32", 0xef4016, 0, SIZE_4MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25X64", 0xef3017, 0, SIZE_8MB, SF_64K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q64", 0xef4017, 0, SIZE_8MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q128", 0xef4018, 0, SIZE_16MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q256", 0xef4019, 0, SIZE_32MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_3},
{"Winbond W25Q80*W", 0xef6014, 0, SIZE_1MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q16*W", 0xef6015, 0, SIZE_2MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q32FW", 0xef6016, 0, SIZE_4MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q64FW", 0xef6017, 0, SIZE_8MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
{"Winbond W25Q128FW", 0xef6018, 0, SIZE_16MB, SF_64K_BLOCK | SF_32K_BLOCK | SF_4K_SECTOR | SF_BP0_2},
};
const spi_flash_id *spi_flash_id_lookup(unsigned int jedec_id, unsigned int ext_id)
{
int i;
for (i = 0; i < sizeof (flash_ids) / sizeof (spi_flash_id) - 1; i++)
{
if (flash_ids[i].jedec_id == jedec_id)
{
if (flash_ids[i].ext_id != 0 && flash_ids[i].ext_id != ext_id)
continue;
return &flash_ids[i];
}
}
return NULL;
}