Merge tag 'v9.0.0-rc3'
[qemu/ar7.git] / hw / block / pflash.h
blob544f5d1a54e7b68d6a617e375c84bdd1802a372d
1 /*
2 * This file contains parts from Linux header files (several authors)
3 * Copyright (c) 2006-2011 Stefan Weil (modifications for QEMU integration)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #if !defined(__pflash_h)
20 #define __pflash_h
22 #define PFLASH_DEBUG
24 #define P_ID_NONE 0
25 #define P_ID_INTEL_EXT 1
26 #define P_ID_AMD_STD 2
27 #define P_ID_INTEL_STD 3
28 #define P_ID_AMD_EXT 4
29 #define P_ID_MITSUBISHI_STD 256
30 #define P_ID_MITSUBISHI_EXT 257
31 #define P_ID_RESERVED 65535
33 /* flashchip.h */
35 typedef enum {
36 FL_READY,
37 FL_STATUS,
38 FL_CFI_QUERY,
39 FL_JEDEC_QUERY,
40 FL_ERASING,
41 FL_ERASE_SUSPENDING,
42 FL_ERASE_SUSPENDED,
43 FL_WRITING,
44 FL_WRITING_TO_BUFFER,
45 FL_WRITE_SUSPENDING,
46 FL_WRITE_SUSPENDED,
47 FL_PM_SUSPENDED,
48 FL_SYNCING,
49 FL_UNLOADING,
50 FL_LOCKING,
51 FL_UNLOCKING,
52 FL_POINT,
53 FL_UNKNOWN
54 } flstate_t;
56 /* jedec_probe.c */
58 /* Manufacturers */
59 #define MANUFACTURER_AMD 0x0001
60 #define MANUFACTURER_ATMEL 0x001f
61 #define MANUFACTURER_FUJITSU 0x0004
62 #define MANUFACTURER_HYUNDAI 0x00ad
63 #define MANUFACTURER_INTEL 0x0089
64 #define MANUFACTURER_MACRONIX 0x00c2
65 #define MANUFACTURER_NEC 0x0010
66 #define MANUFACTURER_PMC 0x009d
67 #define MANUFACTURER_SHARP 0x00b0
68 #define MANUFACTURER_SPANSION 0x0001
69 #define MANUFACTURER_SST 0x00bf
70 #define MANUFACTURER_ST 0x0020
71 #define MANUFACTURER_TOSHIBA 0x0098
72 #define MANUFACTURER_WINBOND 0x00da
73 #define MANUFACTURER_004A 0x004a
75 /* AMD */
76 #define AM29DL800BB 0x22C8
77 #define AM29DL800BT 0x224A
79 #define AM29F800BB 0x2258
80 #define AM29F800BT 0x22D6
81 #define AM29LV400BB 0x22BA
82 #define AM29LV400BT 0x22B9
83 #define AM29LV800BB 0x225B
84 #define AM29LV800BT 0x22DA
85 #define AM29LV160DT 0x22C4
86 #define AM29LV160DB 0x2249
87 #define AM29F017D 0x003D
88 #define AM29F016D 0x00AD
89 #define AM29F080 0x00D5
90 #define AM29F040 0x00A4
91 #define AM29LV040B 0x004F
92 #define AM29F032B 0x0041
93 #define AM29F002T 0x00B0
95 /* Atmel */
96 #define AT49BV512 0x0003
97 #define AT29LV512 0x003d
98 #define AT49BV16X 0x00C0
99 #define AT49BV16XT 0x00C2
100 #define AT49BV32X 0x00C8
101 #define AT49BV32XT 0x00C9
103 /* ??? 0x004a */
104 #define ES29LV160DB 0x2249
106 /* Fujitsu */
107 #define MBM29F040C 0x00A4
108 #define MBM29LV650UE 0x22D7
109 #define MBM29LV320TE 0x22F6
110 #define MBM29LV320BE 0x22F9
111 #define MBM29LV160TE 0x22C4
112 #define MBM29LV160BE 0x2249
113 #define MBM29LV800BA 0x225B
114 #define MBM29LV800TA 0x22DA
115 #define MBM29LV400TC 0x22B9
116 #define MBM29LV400BC 0x22BA
118 /* Hyundai */
119 #define HY29F002T 0x00B0
121 /* Intel */
122 #define I28F004B3T 0x00d4
123 #define I28F004B3B 0x00d5
124 #define I28F400B3T 0x8894
125 #define I28F400B3B 0x8895
126 #define I28F008S5 0x00a6
127 #define I28F016S5 0x00a0
128 #define I28F008SA 0x00a2
129 #define I28F008B3T 0x00d2
130 #define I28F008B3B 0x00d3
131 #define I28F800B3T 0x8892
132 #define I28F800B3B 0x8893
133 #define I28F016S3 0x00aa
134 #define I28F016B3T 0x00d0
135 #define I28F016B3B 0x00d1
136 #define I28F160S5 0x00d0
137 #define I28F160B3T 0x8890
138 #define I28F160B3B 0x8891
139 #define I28F160C3B 0x88c3
140 #define I28F320B3T 0x8896
141 #define I28F320B3B 0x8897
142 #define I28F640B3T 0x8898
143 #define I28F640B3B 0x8899
144 #define I82802AB 0x00ad
145 #define I82802AC 0x00ac
147 /* Macronix */
148 #define MX29LV040C 0x004F
149 #define MX29LV160T 0x22C4
150 #define MX29LV160B 0x2249
151 #define MX29LV320CT 0x22a7
152 #define MX29LV320CB 0x22a8
153 #define MX29LV640BT 0x22c9
154 #define MX29LV640BB 0x22cb
155 #define MX29F016 0x00AD
156 #define MX29F002T 0x00B0
157 #define MX29F004T 0x0045
158 #define MX29F004B 0x0046
160 /* NEC */
161 #define UPD29F064115 0x221C
163 /* PMC */
164 #define PM49FL002 0x006D
165 #define PM49FL004 0x006E
166 #define PM49FL008 0x006A
168 /* Sharp */
169 #define LH28F640BF 0x00b0
171 /* Spansion (AMD + Fujitsu) */
172 #define S29AL016DT 0x22C4
173 #define S29AL016DB 0x2249
175 /* ST - www.st.com */
176 #define M29W800DT 0x00D7
177 #define M29W800DB 0x005B
178 #define M29W160DT 0x22C4
179 #define M29W160DB 0x2249
180 #define M29W040B 0x00E3
181 #define M50FW040 0x002C
182 #define M50FW080 0x002D
183 #define M50FW016 0x002E
184 #define M50LPW080 0x002F
186 /* SST */
187 #define SST29EE020 0x0010
188 #define SST29LE020 0x0012
189 #define SST29EE512 0x005d
190 #define SST29LE512 0x003d
191 #define SST39LF800 0x2781
192 #define SST39LF160 0x2782
193 #define SST39VF1601 0x234b
194 #define SST39LF512 0x00D4
195 #define SST39LF010 0x00D5
196 #define SST39LF020 0x00D6
197 #define SST39LF040 0x00D7
198 #define SST39SF010A 0x00B5
199 #define SST39SF020A 0x00B6
200 #define SST49LF004B 0x0060
201 #define SST49LF008A 0x005a
202 #define SST49LF030A 0x001C
203 #define SST49LF040A 0x0051
204 #define SST49LF080A 0x005B
206 /* Toshiba */
207 #define TC58FVT160 0x00C2
208 #define TC58FVB160 0x0043
209 #define TC58FVT321 0x009A
210 #define TC58FVB321 0x009C
211 #define TC58FVT641 0x0093
212 #define TC58FVB641 0x0095
214 /* Winbond */
215 #define W49V002A 0x00b0
217 /* QEMU interface */
219 #include "hw/block/flash.h"
221 /* NOR flash devices */
222 typedef struct PFlash PFlash;
224 /* Special interfaces used by pflash_register. */
226 PFlash *pflash_amd_register(hwaddr base, ram_addr_t off,
227 BlockBackend *blk,
228 uint32_t sector_len, int nb_blocs, int width,
229 uint16_t id0, uint16_t id1,
230 uint16_t id2, uint16_t id3, int be);
232 /* User interface. */
234 PFlash *pflash_device_register(hwaddr base,
235 const char *name,
236 hwaddr size,
237 BlockBackend *blk, int width,
238 uint16_t flash_manufacturer,
239 uint16_t flash_type,
240 int be);
242 #endif /* __pflash_h */