diff options
| author | Anton Altaparmakov <aia21@cantab.net> | 2005-07-13 18:09:23 -0400 |
|---|---|---|
| committer | Anton Altaparmakov <aia21@cantab.net> | 2005-07-13 18:09:23 -0400 |
| commit | c514720716c7b109ff980f8b3cb93f9af872c91c (patch) | |
| tree | 490a9578995705de69712893a190b67651bddc56 /include/linux/mtd | |
| parent | 07929dcb963786512c760dd3ecd148d89295e7e5 (diff) | |
| parent | 1e279dd855d15b72364b4103f872d67d8592647e (diff) | |
Automatic merge with /usr/src/ntfs-2.6.git.
Diffstat (limited to 'include/linux/mtd')
| -rw-r--r-- | include/linux/mtd/cfi.h | 85 | ||||
| -rw-r--r-- | include/linux/mtd/flashchip.h | 7 | ||||
| -rw-r--r-- | include/linux/mtd/inftl.h | 4 | ||||
| -rw-r--r-- | include/linux/mtd/map.h | 33 | ||||
| -rw-r--r-- | include/linux/mtd/mtd.h | 15 | ||||
| -rw-r--r-- | include/linux/mtd/nand.h | 48 | ||||
| -rw-r--r-- | include/linux/mtd/plat-ram.h | 35 | ||||
| -rw-r--r-- | include/linux/mtd/xip.h | 31 |
8 files changed, 209 insertions, 49 deletions
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index 2ed8c585021e..e6b6a1c66bd5 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.50 2004/11/20 12:46:51 dwmw2 Exp $ | 4 | * $Id: cfi.h,v 1.54 2005/06/06 23:04:36 tpoynor Exp $ |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #ifndef __MTD_CFI_H__ | 7 | #ifndef __MTD_CFI_H__ |
| @@ -148,6 +148,14 @@ struct cfi_pri_intelext { | |||
| 148 | uint8_t extra[0]; | 148 | uint8_t extra[0]; |
| 149 | } __attribute__((packed)); | 149 | } __attribute__((packed)); |
| 150 | 150 | ||
| 151 | struct cfi_intelext_otpinfo { | ||
| 152 | uint32_t ProtRegAddr; | ||
| 153 | uint16_t FactGroups; | ||
| 154 | uint8_t FactProtRegSize; | ||
| 155 | uint16_t UserGroups; | ||
| 156 | uint8_t UserProtRegSize; | ||
| 157 | } __attribute__((packed)); | ||
| 158 | |||
| 151 | struct cfi_intelext_blockinfo { | 159 | struct cfi_intelext_blockinfo { |
| 152 | uint16_t NumIdentBlocks; | 160 | uint16_t NumIdentBlocks; |
| 153 | uint16_t BlockSize; | 161 | uint16_t BlockSize; |
| @@ -244,7 +252,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, int interleave, int | |||
| 244 | * It looks too long to be inline, but in the common case it should almost all | 252 | * It looks too long to be inline, but in the common case it should almost all |
| 245 | * get optimised away. | 253 | * get optimised away. |
| 246 | */ | 254 | */ |
| 247 | static inline map_word cfi_build_cmd(u_char cmd, struct map_info *map, struct cfi_private *cfi) | 255 | static inline map_word cfi_build_cmd(u_long cmd, struct map_info *map, struct cfi_private *cfi) |
| 248 | { | 256 | { |
| 249 | map_word val = { {0} }; | 257 | map_word val = { {0} }; |
| 250 | int wordwidth, words_per_bus, chip_mode, chips_per_word; | 258 | int wordwidth, words_per_bus, chip_mode, chips_per_word; |
| @@ -307,6 +315,69 @@ static inline map_word cfi_build_cmd(u_char cmd, struct map_info *map, struct cf | |||
| 307 | } | 315 | } |
| 308 | #define CMD(x) cfi_build_cmd((x), map, cfi) | 316 | #define CMD(x) cfi_build_cmd((x), map, cfi) |
| 309 | 317 | ||
| 318 | |||
| 319 | static inline unsigned char cfi_merge_status(map_word val, struct map_info *map, | ||
| 320 | struct cfi_private *cfi) | ||
| 321 | { | ||
| 322 | int wordwidth, words_per_bus, chip_mode, chips_per_word; | ||
| 323 | unsigned long onestat, res = 0; | ||
| 324 | int i; | ||
| 325 | |||
| 326 | /* We do it this way to give the compiler a fighting chance | ||
| 327 | of optimising away all the crap for 'bankwidth' larger than | ||
| 328 | an unsigned long, in the common case where that support is | ||
| 329 | disabled */ | ||
| 330 | if (map_bankwidth_is_large(map)) { | ||
| 331 | wordwidth = sizeof(unsigned long); | ||
| 332 | words_per_bus = (map_bankwidth(map)) / wordwidth; // i.e. normally 1 | ||
| 333 | } else { | ||
| 334 | wordwidth = map_bankwidth(map); | ||
| 335 | words_per_bus = 1; | ||
| 336 | } | ||
| 337 | |||
| 338 | chip_mode = map_bankwidth(map) / cfi_interleave(cfi); | ||
| 339 | chips_per_word = wordwidth * cfi_interleave(cfi) / map_bankwidth(map); | ||
| 340 | |||
| 341 | onestat = val.x[0]; | ||
| 342 | /* Or all status words together */ | ||
| 343 | for (i=1; i < words_per_bus; i++) { | ||
| 344 | onestat |= val.x[i]; | ||
| 345 | } | ||
| 346 | |||
| 347 | res = onestat; | ||
| 348 | switch(chips_per_word) { | ||
| 349 | default: BUG(); | ||
| 350 | #if BITS_PER_LONG >= 64 | ||
| 351 | case 8: | ||
| 352 | res |= (onestat >> (chip_mode * 32)); | ||
| 353 | #endif | ||
| 354 | case 4: | ||
| 355 | res |= (onestat >> (chip_mode * 16)); | ||
| 356 | case 2: | ||
| 357 | res |= (onestat >> (chip_mode * 8)); | ||
| 358 | case 1: | ||
| 359 | ; | ||
| 360 | } | ||
| 361 | |||
| 362 | /* Last, determine what the bit-pattern should be for a single | ||
| 363 | device, according to chip mode and endianness... */ | ||
| 364 | switch (chip_mode) { | ||
| 365 | case 1: | ||
| 366 | break; | ||
| 367 | case 2: | ||
| 368 | res = cfi16_to_cpu(res); | ||
| 369 | break; | ||
| 370 | case 4: | ||
| 371 | res = cfi32_to_cpu(res); | ||
| 372 | break; | ||
| 373 | default: BUG(); | ||
| 374 | } | ||
| 375 | return res; | ||
| 376 | } | ||
| 377 | |||
| 378 | #define MERGESTATUS(x) cfi_merge_status((x), map, cfi) | ||
| 379 | |||
| 380 | |||
| 310 | /* | 381 | /* |
| 311 | * Sends a CFI command to a bank of flash for the given geometry. | 382 | * Sends a CFI command to a bank of flash for the given geometry. |
| 312 | * | 383 | * |
| @@ -357,16 +428,6 @@ static inline void cfi_udelay(int us) | |||
| 357 | } | 428 | } |
| 358 | } | 429 | } |
| 359 | 430 | ||
| 360 | static inline void cfi_spin_lock(spinlock_t *mutex) | ||
| 361 | { | ||
| 362 | spin_lock_bh(mutex); | ||
| 363 | } | ||
| 364 | |||
| 365 | static inline void cfi_spin_unlock(spinlock_t *mutex) | ||
| 366 | { | ||
| 367 | spin_unlock_bh(mutex); | ||
| 368 | } | ||
| 369 | |||
| 370 | struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, | 431 | struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size, |
| 371 | const char* name); | 432 | const char* name); |
| 372 | struct cfi_fixup { | 433 | struct cfi_fixup { |
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h index c66ba812bf90..675776fa3e27 100644 --- a/include/linux/mtd/flashchip.h +++ b/include/linux/mtd/flashchip.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * | 6 | * |
| 7 | * (C) 2000 Red Hat. GPLd. | 7 | * (C) 2000 Red Hat. GPLd. |
| 8 | * | 8 | * |
| 9 | * $Id: flashchip.h,v 1.15 2004/11/05 22:41:06 nico Exp $ | 9 | * $Id: flashchip.h,v 1.17 2005/03/14 18:27:15 bjd Exp $ |
| 10 | * | 10 | * |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| @@ -29,6 +29,7 @@ typedef enum { | |||
| 29 | FL_ERASE_SUSPENDED, | 29 | FL_ERASE_SUSPENDED, |
| 30 | FL_WRITING, | 30 | FL_WRITING, |
| 31 | FL_WRITING_TO_BUFFER, | 31 | FL_WRITING_TO_BUFFER, |
| 32 | FL_OTP_WRITE, | ||
| 32 | FL_WRITE_SUSPENDING, | 33 | FL_WRITE_SUSPENDING, |
| 33 | FL_WRITE_SUSPENDED, | 34 | FL_WRITE_SUSPENDED, |
| 34 | FL_PM_SUSPENDED, | 35 | FL_PM_SUSPENDED, |
| @@ -62,8 +63,8 @@ struct flchip { | |||
| 62 | flstate_t state; | 63 | flstate_t state; |
| 63 | flstate_t oldstate; | 64 | flstate_t oldstate; |
| 64 | 65 | ||
| 65 | int write_suspended:1; | 66 | unsigned int write_suspended:1; |
| 66 | int erase_suspended:1; | 67 | unsigned int erase_suspended:1; |
| 67 | unsigned long in_progress_block_addr; | 68 | unsigned long in_progress_block_addr; |
| 68 | 69 | ||
| 69 | spinlock_t *mutex; | 70 | spinlock_t *mutex; |
diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h index b52c8cbd235c..0268125a6271 100644 --- a/include/linux/mtd/inftl.h +++ b/include/linux/mtd/inftl.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | * | 3 | * |
| 4 | * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) | 4 | * (C) Copyright 2002, Greg Ungerer (gerg@snapgear.com) |
| 5 | * | 5 | * |
| 6 | * $Id: inftl.h,v 1.6 2004/06/30 14:49:00 dbrown Exp $ | 6 | * $Id: inftl.h,v 1.7 2005/06/13 13:08:45 sean Exp $ |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #ifndef __MTD_INFTL_H__ | 9 | #ifndef __MTD_INFTL_H__ |
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <mtd/inftl-user.h> | 20 | #include <mtd/inftl-user.h> |
| 21 | 21 | ||
| 22 | #ifndef INFTL_MAJOR | 22 | #ifndef INFTL_MAJOR |
| 23 | #define INFTL_MAJOR 94 | 23 | #define INFTL_MAJOR 96 |
| 24 | #endif | 24 | #endif |
| 25 | #define INFTL_PARTN_BITS 4 | 25 | #define INFTL_PARTN_BITS 4 |
| 26 | 26 | ||
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index f0268b99c900..142963f01d29 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | /* Overhauled routines for dealing with different mmap regions of flash */ | 2 | /* Overhauled routines for dealing with different mmap regions of flash */ |
| 3 | /* $Id: map.h,v 1.46 2005/01/05 17:09:44 dwmw2 Exp $ */ | 3 | /* $Id: map.h,v 1.52 2005/05/25 10:29:41 gleixner Exp $ */ |
| 4 | 4 | ||
| 5 | #ifndef __LINUX_MTD_MAP_H__ | 5 | #ifndef __LINUX_MTD_MAP_H__ |
| 6 | #define __LINUX_MTD_MAP_H__ | 6 | #define __LINUX_MTD_MAP_H__ |
| @@ -263,6 +263,17 @@ static inline map_word map_word_and(struct map_info *map, map_word val1, map_wor | |||
| 263 | return r; | 263 | return r; |
| 264 | } | 264 | } |
| 265 | 265 | ||
| 266 | static inline map_word map_word_clr(struct map_info *map, map_word val1, map_word val2) | ||
| 267 | { | ||
| 268 | map_word r; | ||
| 269 | int i; | ||
| 270 | |||
| 271 | for (i=0; i<map_words(map); i++) { | ||
| 272 | r.x[i] = val1.x[i] & ~val2.x[i]; | ||
| 273 | } | ||
| 274 | return r; | ||
| 275 | } | ||
| 276 | |||
| 266 | static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2) | 277 | static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2) |
| 267 | { | 278 | { |
| 268 | map_word r; | 279 | map_word r; |
| @@ -273,6 +284,7 @@ static inline map_word map_word_or(struct map_info *map, map_word val1, map_word | |||
| 273 | } | 284 | } |
| 274 | return r; | 285 | return r; |
| 275 | } | 286 | } |
| 287 | |||
| 276 | #define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) | 288 | #define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) |
| 277 | 289 | ||
| 278 | static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) | 290 | static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) |
| @@ -328,16 +340,27 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig | |||
| 328 | return orig; | 340 | return orig; |
| 329 | } | 341 | } |
| 330 | 342 | ||
| 343 | #if BITS_PER_LONG < 64 | ||
| 344 | #define MAP_FF_LIMIT 4 | ||
| 345 | #else | ||
| 346 | #define MAP_FF_LIMIT 8 | ||
| 347 | #endif | ||
| 348 | |||
| 331 | static inline map_word map_word_ff(struct map_info *map) | 349 | static inline map_word map_word_ff(struct map_info *map) |
| 332 | { | 350 | { |
| 333 | map_word r; | 351 | map_word r; |
| 334 | int i; | 352 | int i; |
| 335 | 353 | ||
| 336 | for (i=0; i<map_words(map); i++) { | 354 | if (map_bankwidth(map) < MAP_FF_LIMIT) { |
| 337 | r.x[i] = ~0UL; | 355 | int bw = 8 * map_bankwidth(map); |
| 356 | r.x[0] = (1 << bw) - 1; | ||
| 357 | } else { | ||
| 358 | for (i=0; i<map_words(map); i++) | ||
| 359 | r.x[i] = ~0UL; | ||
| 338 | } | 360 | } |
| 339 | return r; | 361 | return r; |
| 340 | } | 362 | } |
| 363 | |||
| 341 | static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) | 364 | static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) |
| 342 | { | 365 | { |
| 343 | map_word r; | 366 | map_word r; |
| @@ -405,7 +428,7 @@ extern void simple_map_init(struct map_info *); | |||
| 405 | 428 | ||
| 406 | 429 | ||
| 407 | #define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth)) | 430 | #define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth)) |
| 408 | #define map_is_linear(map) (1) | 431 | #define map_is_linear(map) ({ (void)(map); 1; }) |
| 409 | 432 | ||
| 410 | #endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */ | 433 | #endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */ |
| 411 | 434 | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index b3d134392b31..c50c3f3927d9 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: mtd.h,v 1.56 2004/08/09 18:46:04 dmarlin Exp $ | 2 | * $Id: mtd.h,v 1.59 2005/04/11 10:19:02 gleixner Exp $ |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. | 4 | * Copyright (C) 1999-2003 David Woodhouse <dwmw2@infradead.org> et al. |
| 5 | * | 5 | * |
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
| 19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 20 | #include <linux/uio.h> | 20 | #include <linux/uio.h> |
| 21 | #include <linux/notifier.h> | ||
| 21 | 22 | ||
| 22 | #include <linux/mtd/compatmac.h> | 23 | #include <linux/mtd/compatmac.h> |
| 23 | #include <mtd/mtd-abi.h> | 24 | #include <mtd/mtd-abi.h> |
| @@ -69,7 +70,6 @@ struct mtd_info { | |||
| 69 | 70 | ||
| 70 | u_int32_t oobblock; // Size of OOB blocks (e.g. 512) | 71 | u_int32_t oobblock; // Size of OOB blocks (e.g. 512) |
| 71 | u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) | 72 | u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) |
| 72 | u_int32_t oobavail; // Number of bytes in OOB area available for fs | ||
| 73 | u_int32_t ecctype; | 73 | u_int32_t ecctype; |
| 74 | u_int32_t eccsize; | 74 | u_int32_t eccsize; |
| 75 | 75 | ||
| @@ -80,6 +80,7 @@ struct mtd_info { | |||
| 80 | 80 | ||
| 81 | // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) | 81 | // oobinfo is a nand_oobinfo structure, which can be set by iotcl (MEMSETOOBINFO) |
| 82 | struct nand_oobinfo oobinfo; | 82 | struct nand_oobinfo oobinfo; |
| 83 | u_int32_t oobavail; // Number of bytes in OOB area available for fs | ||
| 83 | 84 | ||
| 84 | /* Data for variable erase regions. If numeraseregions is zero, | 85 | /* Data for variable erase regions. If numeraseregions is zero, |
| 85 | * it means that the whole device has erasesize as given above. | 86 | * it means that the whole device has erasesize as given above. |
| @@ -113,12 +114,12 @@ struct mtd_info { | |||
| 113 | * flash devices. The user data is one time programmable but the | 114 | * flash devices. The user data is one time programmable but the |
| 114 | * factory data is read only. | 115 | * factory data is read only. |
| 115 | */ | 116 | */ |
| 116 | int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 117 | int (*get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); |
| 117 | |||
| 118 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 118 | int (*read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
| 119 | 119 | int (*get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, size_t len); | |
| 120 | /* This function is not yet implemented */ | 120 | int (*read_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
| 121 | int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 121 | int (*write_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
| 122 | int (*lock_user_prot_reg) (struct mtd_info *mtd, loff_t from, size_t len); | ||
| 122 | 123 | ||
| 123 | /* kvec-based read/write methods. We need these especially for NAND flash, | 124 | /* kvec-based read/write methods. We need these especially for NAND flash, |
| 124 | with its limited number of write cycles per erase. | 125 | with its limited number of write cycles per erase. |
| @@ -147,6 +148,8 @@ struct mtd_info { | |||
| 147 | int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); | 148 | int (*block_isbad) (struct mtd_info *mtd, loff_t ofs); |
| 148 | int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); | 149 | int (*block_markbad) (struct mtd_info *mtd, loff_t ofs); |
| 149 | 150 | ||
| 151 | struct notifier_block reboot_notifier; /* default mode before reboot */ | ||
| 152 | |||
| 150 | void *priv; | 153 | void *priv; |
| 151 | 154 | ||
| 152 | struct module *owner; | 155 | struct module *owner; |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 9a19c65abd74..9b5b76217584 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * Steven J. Hill <sjhill@realitydiluted.com> | 5 | * Steven J. Hill <sjhill@realitydiluted.com> |
| 6 | * Thomas Gleixner <tglx@linutronix.de> | 6 | * Thomas Gleixner <tglx@linutronix.de> |
| 7 | * | 7 | * |
| 8 | * $Id: nand.h,v 1.68 2004/11/12 10:40:37 gleixner Exp $ | 8 | * $Id: nand.h,v 1.73 2005/05/31 19:39:17 gleixner Exp $ |
| 9 | * | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
| @@ -48,6 +48,10 @@ | |||
| 48 | * 02-08-2004 tglx added option field to nand structure for chip anomalities | 48 | * 02-08-2004 tglx added option field to nand structure for chip anomalities |
| 49 | * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id | 49 | * 05-25-2004 tglx added bad block table support, ST-MICRO manufacturer id |
| 50 | * update of nand_chip structure description | 50 | * update of nand_chip structure description |
| 51 | * 01-17-2005 dmarlin added extended commands for AG-AND device and added option | ||
| 52 | * for BBT_AUTO_REFRESH. | ||
| 53 | * 01-20-2005 dmarlin added optional pointer to hardware specific callback for | ||
| 54 | * extra error status checks. | ||
| 51 | */ | 55 | */ |
| 52 | #ifndef __LINUX_MTD_NAND_H | 56 | #ifndef __LINUX_MTD_NAND_H |
| 53 | #define __LINUX_MTD_NAND_H | 57 | #define __LINUX_MTD_NAND_H |
| @@ -115,6 +119,25 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 115 | #define NAND_CMD_READSTART 0x30 | 119 | #define NAND_CMD_READSTART 0x30 |
| 116 | #define NAND_CMD_CACHEDPROG 0x15 | 120 | #define NAND_CMD_CACHEDPROG 0x15 |
| 117 | 121 | ||
| 122 | /* Extended commands for AG-AND device */ | ||
| 123 | /* | ||
| 124 | * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but | ||
| 125 | * there is no way to distinguish that from NAND_CMD_READ0 | ||
| 126 | * until the remaining sequence of commands has been completed | ||
| 127 | * so add a high order bit and mask it off in the command. | ||
| 128 | */ | ||
| 129 | #define NAND_CMD_DEPLETE1 0x100 | ||
| 130 | #define NAND_CMD_DEPLETE2 0x38 | ||
| 131 | #define NAND_CMD_STATUS_MULTI 0x71 | ||
| 132 | #define NAND_CMD_STATUS_ERROR 0x72 | ||
| 133 | /* multi-bank error status (banks 0-3) */ | ||
| 134 | #define NAND_CMD_STATUS_ERROR0 0x73 | ||
| 135 | #define NAND_CMD_STATUS_ERROR1 0x74 | ||
| 136 | #define NAND_CMD_STATUS_ERROR2 0x75 | ||
| 137 | #define NAND_CMD_STATUS_ERROR3 0x76 | ||
| 138 | #define NAND_CMD_STATUS_RESET 0x7f | ||
| 139 | #define NAND_CMD_STATUS_CLEAR 0xff | ||
| 140 | |||
| 118 | /* Status bits */ | 141 | /* Status bits */ |
| 119 | #define NAND_STATUS_FAIL 0x01 | 142 | #define NAND_STATUS_FAIL 0x01 |
| 120 | #define NAND_STATUS_FAIL_N1 0x02 | 143 | #define NAND_STATUS_FAIL_N1 0x02 |
| @@ -143,7 +166,7 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 143 | 166 | ||
| 144 | /* | 167 | /* |
| 145 | * Constants for Hardware ECC | 168 | * Constants for Hardware ECC |
| 146 | */ | 169 | */ |
| 147 | /* Reset Hardware ECC for read */ | 170 | /* Reset Hardware ECC for read */ |
| 148 | #define NAND_ECC_READ 0 | 171 | #define NAND_ECC_READ 0 |
| 149 | /* Reset Hardware ECC for write */ | 172 | /* Reset Hardware ECC for write */ |
| @@ -151,6 +174,10 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 151 | /* Enable Hardware ECC before syndrom is read back from flash */ | 174 | /* Enable Hardware ECC before syndrom is read back from flash */ |
| 152 | #define NAND_ECC_READSYN 2 | 175 | #define NAND_ECC_READSYN 2 |
| 153 | 176 | ||
| 177 | /* Bit mask for flags passed to do_nand_read_ecc */ | ||
| 178 | #define NAND_GET_DEVICE 0x80 | ||
| 179 | |||
| 180 | |||
| 154 | /* Option constants for bizarre disfunctionality and real | 181 | /* Option constants for bizarre disfunctionality and real |
| 155 | * features | 182 | * features |
| 156 | */ | 183 | */ |
| @@ -170,6 +197,10 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 170 | /* Chip has a array of 4 pages which can be read without | 197 | /* Chip has a array of 4 pages which can be read without |
| 171 | * additional ready /busy waits */ | 198 | * additional ready /busy waits */ |
| 172 | #define NAND_4PAGE_ARRAY 0x00000040 | 199 | #define NAND_4PAGE_ARRAY 0x00000040 |
| 200 | /* Chip requires that BBT is periodically rewritten to prevent | ||
| 201 | * bits from adjacent blocks from 'leaking' in altering data. | ||
| 202 | * This happens with the Renesas AG-AND chips, possibly others. */ | ||
| 203 | #define BBT_AUTO_REFRESH 0x00000080 | ||
| 173 | 204 | ||
| 174 | /* Options valid for Samsung large page devices */ | 205 | /* Options valid for Samsung large page devices */ |
| 175 | #define NAND_SAMSUNG_LP_OPTIONS \ | 206 | #define NAND_SAMSUNG_LP_OPTIONS \ |
| @@ -192,7 +223,8 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
| 192 | * This can only work if we have the ecc bytes directly behind the | 223 | * This can only work if we have the ecc bytes directly behind the |
| 193 | * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ | 224 | * data bytes. Applies for DOC and AG-AND Renesas HW Reed Solomon generators */ |
| 194 | #define NAND_HWECC_SYNDROME 0x00020000 | 225 | #define NAND_HWECC_SYNDROME 0x00020000 |
| 195 | 226 | /* This option skips the bbt scan during initialization. */ | |
| 227 | #define NAND_SKIP_BBTSCAN 0x00040000 | ||
| 196 | 228 | ||
| 197 | /* Options set by nand scan */ | 229 | /* Options set by nand scan */ |
| 198 | /* Nand scan has allocated oob_buf */ | 230 | /* Nand scan has allocated oob_buf */ |
| @@ -221,10 +253,13 @@ struct nand_chip; | |||
| 221 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices | 253 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independend devices |
| 222 | * @lock: protection lock | 254 | * @lock: protection lock |
| 223 | * @active: the mtd device which holds the controller currently | 255 | * @active: the mtd device which holds the controller currently |
| 256 | * @wq: wait queue to sleep on if a NAND operation is in progress | ||
| 257 | * used instead of the per chip wait queue when a hw controller is available | ||
| 224 | */ | 258 | */ |
| 225 | struct nand_hw_control { | 259 | struct nand_hw_control { |
| 226 | spinlock_t lock; | 260 | spinlock_t lock; |
| 227 | struct nand_chip *active; | 261 | struct nand_chip *active; |
| 262 | wait_queue_head_t wq; | ||
| 228 | }; | 263 | }; |
| 229 | 264 | ||
| 230 | /** | 265 | /** |
| @@ -283,6 +318,8 @@ struct nand_hw_control { | |||
| 283 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan | 318 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan |
| 284 | * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices | 319 | * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices |
| 285 | * @priv: [OPTIONAL] pointer to private chip date | 320 | * @priv: [OPTIONAL] pointer to private chip date |
| 321 | * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks | ||
| 322 | * (determine if errors are correctable) | ||
| 286 | */ | 323 | */ |
| 287 | 324 | ||
| 288 | struct nand_chip { | 325 | struct nand_chip { |
| @@ -338,6 +375,7 @@ struct nand_chip { | |||
| 338 | struct nand_bbt_descr *badblock_pattern; | 375 | struct nand_bbt_descr *badblock_pattern; |
| 339 | struct nand_hw_control *controller; | 376 | struct nand_hw_control *controller; |
| 340 | void *priv; | 377 | void *priv; |
| 378 | int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page); | ||
| 341 | }; | 379 | }; |
| 342 | 380 | ||
| 343 | /* | 381 | /* |
| @@ -349,6 +387,7 @@ struct nand_chip { | |||
| 349 | #define NAND_MFR_NATIONAL 0x8f | 387 | #define NAND_MFR_NATIONAL 0x8f |
| 350 | #define NAND_MFR_RENESAS 0x07 | 388 | #define NAND_MFR_RENESAS 0x07 |
| 351 | #define NAND_MFR_STMICRO 0x20 | 389 | #define NAND_MFR_STMICRO 0x20 |
| 390 | #define NAND_MFR_HYNIX 0xad | ||
| 352 | 391 | ||
| 353 | /** | 392 | /** |
| 354 | * struct nand_flash_dev - NAND Flash Device ID Structure | 393 | * struct nand_flash_dev - NAND Flash Device ID Structure |
| @@ -459,6 +498,9 @@ extern int nand_update_bbt (struct mtd_info *mtd, loff_t offs); | |||
| 459 | extern int nand_default_bbt (struct mtd_info *mtd); | 498 | extern int nand_default_bbt (struct mtd_info *mtd); |
| 460 | extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); | 499 | extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); |
| 461 | extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); | 500 | extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); |
| 501 | extern int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, | ||
| 502 | size_t * retlen, u_char * buf, u_char * oob_buf, | ||
| 503 | struct nand_oobinfo *oobsel, int flags); | ||
| 462 | 504 | ||
| 463 | /* | 505 | /* |
| 464 | * Constants for oob configuration | 506 | * Constants for oob configuration |
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h new file mode 100644 index 000000000000..2332eda07e0e --- /dev/null +++ b/include/linux/mtd/plat-ram.h | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* linux/include/mtd/plat-ram.h | ||
| 2 | * | ||
| 3 | * (c) 2004 Simtec Electronics | ||
| 4 | * http://www.simtec.co.uk/products/SWLINUX/ | ||
| 5 | * Ben Dooks <ben@simtec.co.uk> | ||
| 6 | * | ||
| 7 | * Generic platform device based RAM map | ||
| 8 | * | ||
| 9 | * $Id: plat-ram.h,v 1.2 2005/01/24 00:37:40 bjd Exp $ | ||
| 10 | * | ||
| 11 | * This program is free software; you can redistribute it and/or modify | ||
| 12 | * it under the terms of the GNU General Public License version 2 as | ||
| 13 | * published by the Free Software Foundation. | ||
| 14 | * | ||
| 15 | */ | ||
| 16 | |||
| 17 | #ifndef __LINUX_MTD_PLATRAM_H | ||
| 18 | #define __LINUX_MTD_PLATRAM_H __FILE__ | ||
| 19 | |||
| 20 | #define PLATRAM_RO (0) | ||
| 21 | #define PLATRAM_RW (1) | ||
| 22 | |||
| 23 | struct platdata_mtd_ram { | ||
| 24 | char *mapname; | ||
| 25 | char **probes; | ||
| 26 | struct mtd_partition *partitions; | ||
| 27 | int nr_partitions; | ||
| 28 | int bankwidth; | ||
| 29 | |||
| 30 | /* control callbacks */ | ||
| 31 | |||
| 32 | void (*set_rw)(struct device *dev, int to); | ||
| 33 | }; | ||
| 34 | |||
| 35 | #endif /* __LINUX_MTD_PLATRAM_H */ | ||
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h index fc071125cbcc..7b7deef6b180 100644 --- a/include/linux/mtd/xip.h +++ b/include/linux/mtd/xip.h | |||
| @@ -58,22 +58,16 @@ | |||
| 58 | * returned value is <= the real elapsed time. | 58 | * returned value is <= the real elapsed time. |
| 59 | * note 2: this should be able to cope with a few seconds without | 59 | * note 2: this should be able to cope with a few seconds without |
| 60 | * overflowing. | 60 | * overflowing. |
| 61 | * | ||
| 62 | * xip_iprefetch() | ||
| 63 | * | ||
| 64 | * Macro to fill instruction prefetch | ||
| 65 | * e.g. a series of nops: asm volatile (".rep 8; nop; .endr"); | ||
| 61 | */ | 66 | */ |
| 62 | 67 | ||
| 63 | #if defined(CONFIG_ARCH_SA1100) || defined(CONFIG_ARCH_PXA) | 68 | #include <asm/mtd-xip.h> |
| 64 | |||
| 65 | #include <asm/hardware.h> | ||
| 66 | #ifdef CONFIG_ARCH_PXA | ||
| 67 | #include <asm/arch/pxa-regs.h> | ||
| 68 | #endif | ||
| 69 | |||
| 70 | #define xip_irqpending() (ICIP & ICMR) | ||
| 71 | |||
| 72 | /* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */ | ||
| 73 | #define xip_currtime() (OSCR) | ||
| 74 | #define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4) | ||
| 75 | 69 | ||
| 76 | #else | 70 | #ifndef xip_irqpending |
| 77 | 71 | ||
| 78 | #warning "missing IRQ and timer primitives for XIP MTD support" | 72 | #warning "missing IRQ and timer primitives for XIP MTD support" |
| 79 | #warning "some of the XIP MTD support code will be disabled" | 73 | #warning "some of the XIP MTD support code will be disabled" |
| @@ -85,16 +79,17 @@ | |||
| 85 | 79 | ||
| 86 | #endif | 80 | #endif |
| 87 | 81 | ||
| 82 | #ifndef xip_iprefetch | ||
| 83 | #define xip_iprefetch() do { } while (0) | ||
| 84 | #endif | ||
| 85 | |||
| 88 | /* | 86 | /* |
| 89 | * xip_cpu_idle() is used when waiting for a delay equal or larger than | 87 | * xip_cpu_idle() is used when waiting for a delay equal or larger than |
| 90 | * the system timer tick period. This should put the CPU into idle mode | 88 | * the system timer tick period. This should put the CPU into idle mode |
| 91 | * to save power and to be woken up only when some interrupts are pending. | 89 | * to save power and to be woken up only when some interrupts are pending. |
| 92 | * As above, this should not rely upon standard kernel code. | 90 | * This should not rely upon standard kernel code. |
| 93 | */ | 91 | */ |
| 94 | 92 | #ifndef xip_cpu_idle | |
| 95 | #if defined(CONFIG_CPU_XSCALE) | ||
| 96 | #define xip_cpu_idle() asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1)) | ||
| 97 | #else | ||
| 98 | #define xip_cpu_idle() do { } while (0) | 93 | #define xip_cpu_idle() do { } while (0) |
| 99 | #endif | 94 | #endif |
| 100 | 95 | ||
