diff options
Diffstat (limited to 'include/linux/mtd/cfi.h')
-rw-r--r-- | include/linux/mtd/cfi.h | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index e6b6a1c66bd5..39f1430bd6d5 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -1,7 +1,7 @@ | |||
1 | 1 | ||
2 | /* Common Flash Interface structures | 2 | /* Common Flash Interface structures |
3 | * See http://support.intel.com/design/flash/technote/index.htm | 3 | * See http://support.intel.com/design/flash/technote/index.htm |
4 | * $Id: cfi.h,v 1.54 2005/06/06 23:04:36 tpoynor Exp $ | 4 | * $Id: cfi.h,v 1.56 2005/11/07 11:14:54 gleixner Exp $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef __MTD_CFI_H__ | 7 | #ifndef __MTD_CFI_H__ |
@@ -82,8 +82,8 @@ static inline int cfi_interleave_supported(int i) | |||
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | /* NB: these values must represents the number of bytes needed to meet the | 85 | /* NB: these values must represents the number of bytes needed to meet the |
86 | * device type (x8, x16, x32). Eg. a 32 bit device is 4 x 8 bytes. | 86 | * device type (x8, x16, x32). Eg. a 32 bit device is 4 x 8 bytes. |
87 | * These numbers are used in calculations. | 87 | * These numbers are used in calculations. |
88 | */ | 88 | */ |
89 | #define CFI_DEVICETYPE_X8 (8 / 8) | 89 | #define CFI_DEVICETYPE_X8 (8 / 8) |
@@ -173,6 +173,15 @@ struct cfi_intelext_regioninfo { | |||
173 | struct cfi_intelext_blockinfo BlockTypes[1]; | 173 | struct cfi_intelext_blockinfo BlockTypes[1]; |
174 | } __attribute__((packed)); | 174 | } __attribute__((packed)); |
175 | 175 | ||
176 | struct cfi_intelext_programming_regioninfo { | ||
177 | uint8_t ProgRegShift; | ||
178 | uint8_t Reserved1; | ||
179 | uint8_t ControlValid; | ||
180 | uint8_t Reserved2; | ||
181 | uint8_t ControlInvalid; | ||
182 | uint8_t Reserved3; | ||
183 | } __attribute__((packed)); | ||
184 | |||
176 | /* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */ | 185 | /* Vendor-Specific PRI for AMD/Fujitsu Extended Command Set (0x0002) */ |
177 | 186 | ||
178 | struct cfi_pri_amdstd { | 187 | struct cfi_pri_amdstd { |
@@ -250,7 +259,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, int interleave, int | |||
250 | /* | 259 | /* |
251 | * Transforms the CFI command for the given geometry (bus width & interleave). | 260 | * Transforms the CFI command for the given geometry (bus width & interleave). |
252 | * It looks too long to be inline, but in the common case it should almost all | 261 | * It looks too long to be inline, but in the common case it should almost all |
253 | * get optimised away. | 262 | * get optimised away. |
254 | */ | 263 | */ |
255 | static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi) | 264 | static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi) |
256 | { | 265 | { |
@@ -259,7 +268,7 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
259 | unsigned long onecmd; | 268 | unsigned long onecmd; |
260 | int i; | 269 | int i; |
261 | 270 | ||
262 | /* We do it this way to give the compiler a fighting chance | 271 | /* We do it this way to give the compiler a fighting chance |
263 | of optimising away all the crap for 'bankwidth' larger than | 272 | of optimising away all the crap for 'bankwidth' larger than |
264 | an unsigned long, in the common case where that support is | 273 | an unsigned long, in the common case where that support is |
265 | disabled */ | 274 | disabled */ |
@@ -270,7 +279,7 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
270 | wordwidth = map_bankwidth(map); | 279 | wordwidth = map_bankwidth(map); |
271 | words_per_bus = 1; | 280 | words_per_bus = 1; |
272 | } | 281 | } |
273 | 282 | ||
274 | chip_mode = map_bankwidth(map) / cfi_interleave(cfi); | 283 | chip_mode = map_bankwidth(map) / cfi_interleave(cfi); |
275 | chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); | 284 | chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); |
276 | 285 | ||
@@ -289,7 +298,7 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
289 | break; | 298 | break; |
290 | } | 299 | } |
291 | 300 | ||
292 | /* Now replicate it across the size of an unsigned long, or | 301 | /* Now replicate it across the size of an unsigned long, or |
293 | just to the bus width as appropriate */ | 302 | just to the bus width as appropriate */ |
294 | switch (chips_per_word) { | 303 | switch (chips_per_word) { |
295 | default: BUG(); | 304 | default: BUG(); |
@@ -305,7 +314,7 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
305 | ; | 314 | ; |
306 | } | 315 | } |
307 | 316 | ||
308 | /* And finally, for the multi-word case, replicate it | 317 | /* And finally, for the multi-word case, replicate it |
309 | in all words in the structure */ | 318 | in all words in the structure */ |
310 | for (i=0; i < words_per_bus; i++) { | 319 | for (i=0; i < words_per_bus; i++) { |
311 | val.x[i] = onecmd; | 320 | val.x[i] = onecmd; |
@@ -316,14 +325,14 @@ static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cf | |||
316 | #define CMD(x) cfi_build_cmd((x), map, cfi) | 325 | #define CMD(x) cfi_build_cmd((x), map, cfi) |
317 | 326 | ||
318 | 327 | ||
319 | static inline unsigned char cfi_merge_status(map_word val, struct map_info *map, | 328 | static inline unsigned long cfi_merge_status(map_word val, struct map_info *map, |
320 | struct cfi_private *cfi) | 329 | struct cfi_private *cfi) |
321 | { | 330 | { |
322 | int wordwidth, words_per_bus, chip_mode, chips_per_word; | 331 | int wordwidth, words_per_bus, chip_mode, chips_per_word; |
323 | unsigned long onestat, res = 0; | 332 | unsigned long onestat, res = 0; |
324 | int i; | 333 | int i; |
325 | 334 | ||
326 | /* We do it this way to give the compiler a fighting chance | 335 | /* We do it this way to give the compiler a fighting chance |
327 | of optimising away all the crap for 'bankwidth' larger than | 336 | of optimising away all the crap for 'bankwidth' larger than |
328 | an unsigned long, in the common case where that support is | 337 | an unsigned long, in the common case where that support is |
329 | disabled */ | 338 | disabled */ |
@@ -334,7 +343,7 @@ static inline unsigned char cfi_merge_status(map_word val, struct map_info *map, | |||
334 | wordwidth = map_bankwidth(map); | 343 | wordwidth = map_bankwidth(map); |
335 | words_per_bus = 1; | 344 | words_per_bus = 1; |
336 | } | 345 | } |
337 | 346 | ||
338 | chip_mode = map_bankwidth(map) / cfi_interleave(cfi); | 347 | chip_mode = map_bankwidth(map) / cfi_interleave(cfi); |
339 | chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); | 348 | chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); |
340 | 349 | ||