aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-09 13:15:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-09 13:15:46 -0400
commita637b0d45947df686979b85361ad5bfa9d19fdd3 (patch)
tree926207cdfbbde430d1e7b515f32fe1c740b15745 /include/linux/mtd
parentf78089e87e576f91396a5d428d14b552178dfb17 (diff)
parentcdb6404cc53a166a1e3b0179bd8d1f4070beff41 (diff)
Merge tag 'for-linus-20130509' of git://git.infradead.org/linux-mtd
Pull MTD update from David Woodhouse: - Lots of cleanups from Artem, including deletion of some obsolete drivers - Support partitions larger than 4GiB in device tree - Support for new SPI chips * tag 'for-linus-20130509' of git://git.infradead.org/linux-mtd: (83 commits) mtd: omap2: Use module_platform_driver() mtd: bf5xx_nand: Use module_platform_driver() mtd: denali_dt: Remove redundant use of of_match_ptr mtd: denali_dt: Change return value to fix smatch warning mtd: denali_dt: Use module_platform_driver() mtd: denali_dt: Fix incorrect error check mtd: nand: subpage write support for hardware based ECC schemes mtd: omap2: use msecs_to_jiffies() mtd: nand_ids: use size macros mtd: nand_ids: improve LEGACY_ID_NAND macro a bit mtd: add 4 Toshiba nand chips for the full-id case mtd: add the support to parse out the full-id nand type mtd: add new fields to nand_flash_dev{} mtd: sh_flctl: Use of_match_ptr() macro mtd: gpio: Use of_match_ptr() macro mtd: gpio: Use devm_kzalloc() mtd: davinci_nand: Use of_match_ptr() mtd: dataflash: Use of_match_ptr() macro mtd: remove h720x flash support mtd: onenand: remove OneNAND simulator ...
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/mtd.h8
-rw-r--r--include/linux/mtd/nand.h121
-rw-r--r--include/linux/mtd/physmap.h2
-rw-r--r--include/linux/mtd/plat-ram.h4
4 files changed, 68 insertions, 67 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index f9ac2897b86b..a5cf4e8d6818 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -362,10 +362,10 @@ struct mtd_partition;
362struct mtd_part_parser_data; 362struct mtd_part_parser_data;
363 363
364extern int mtd_device_parse_register(struct mtd_info *mtd, 364extern int mtd_device_parse_register(struct mtd_info *mtd,
365 const char **part_probe_types, 365 const char * const *part_probe_types,
366 struct mtd_part_parser_data *parser_data, 366 struct mtd_part_parser_data *parser_data,
367 const struct mtd_partition *defparts, 367 const struct mtd_partition *defparts,
368 int defnr_parts); 368 int defnr_parts);
369#define mtd_device_register(master, parts, nr_parts) \ 369#define mtd_device_register(master, parts, nr_parts) \
370 mtd_device_parse_register(master, NULL, NULL, parts, nr_parts) 370 mtd_device_parse_register(master, NULL, NULL, parts, nr_parts)
371extern int mtd_device_unregister(struct mtd_info *master); 371extern int mtd_device_unregister(struct mtd_info *master);
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ef52d9c91459..ab6363443ce8 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -86,7 +86,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
86#define NAND_CMD_READOOB 0x50 86#define NAND_CMD_READOOB 0x50
87#define NAND_CMD_ERASE1 0x60 87#define NAND_CMD_ERASE1 0x60
88#define NAND_CMD_STATUS 0x70 88#define NAND_CMD_STATUS 0x70
89#define NAND_CMD_STATUS_MULTI 0x71
90#define NAND_CMD_SEQIN 0x80 89#define NAND_CMD_SEQIN 0x80
91#define NAND_CMD_RNDIN 0x85 90#define NAND_CMD_RNDIN 0x85
92#define NAND_CMD_READID 0x90 91#define NAND_CMD_READID 0x90
@@ -105,25 +104,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
105#define NAND_CMD_RNDOUTSTART 0xE0 104#define NAND_CMD_RNDOUTSTART 0xE0
106#define NAND_CMD_CACHEDPROG 0x15 105#define NAND_CMD_CACHEDPROG 0x15
107 106
108/* Extended commands for AG-AND device */
109/*
110 * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but
111 * there is no way to distinguish that from NAND_CMD_READ0
112 * until the remaining sequence of commands has been completed
113 * so add a high order bit and mask it off in the command.
114 */
115#define NAND_CMD_DEPLETE1 0x100
116#define NAND_CMD_DEPLETE2 0x38
117#define NAND_CMD_STATUS_MULTI 0x71
118#define NAND_CMD_STATUS_ERROR 0x72
119/* multi-bank error status (banks 0-3) */
120#define NAND_CMD_STATUS_ERROR0 0x73
121#define NAND_CMD_STATUS_ERROR1 0x74
122#define NAND_CMD_STATUS_ERROR2 0x75
123#define NAND_CMD_STATUS_ERROR3 0x76
124#define NAND_CMD_STATUS_RESET 0x7f
125#define NAND_CMD_STATUS_CLEAR 0xff
126
127#define NAND_CMD_NONE -1 107#define NAND_CMD_NONE -1
128 108
129/* Status bits */ 109/* Status bits */
@@ -165,28 +145,8 @@ typedef enum {
165 */ 145 */
166/* Buswidth is 16 bit */ 146/* Buswidth is 16 bit */
167#define NAND_BUSWIDTH_16 0x00000002 147#define NAND_BUSWIDTH_16 0x00000002
168/* Device supports partial programming without padding */
169#define NAND_NO_PADDING 0x00000004
170/* Chip has cache program function */ 148/* Chip has cache program function */
171#define NAND_CACHEPRG 0x00000008 149#define NAND_CACHEPRG 0x00000008
172/* Chip has copy back function */
173#define NAND_COPYBACK 0x00000010
174/*
175 * AND Chip which has 4 banks and a confusing page / block
176 * assignment. See Renesas datasheet for further information.
177 */
178#define NAND_IS_AND 0x00000020
179/*
180 * Chip has a array of 4 pages which can be read without
181 * additional ready /busy waits.
182 */
183#define NAND_4PAGE_ARRAY 0x00000040
184/*
185 * Chip requires that BBT is periodically rewritten to prevent
186 * bits from adjacent blocks from 'leaking' in altering data.
187 * This happens with the Renesas AG-AND chips, possibly others.
188 */
189#define BBT_AUTO_REFRESH 0x00000080
190/* 150/*
191 * Chip requires ready check on read (for auto-incremented sequential read). 151 * Chip requires ready check on read (for auto-incremented sequential read).
192 * True only for small page devices; large page devices do not support 152 * True only for small page devices; large page devices do not support
@@ -207,13 +167,10 @@ typedef enum {
207#define NAND_SUBPAGE_READ 0x00001000 167#define NAND_SUBPAGE_READ 0x00001000
208 168
209/* Options valid for Samsung large page devices */ 169/* Options valid for Samsung large page devices */
210#define NAND_SAMSUNG_LP_OPTIONS \ 170#define NAND_SAMSUNG_LP_OPTIONS NAND_CACHEPRG
211 (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK)
212 171
213/* Macros to identify the above */ 172/* Macros to identify the above */
214#define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING))
215#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) 173#define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG))
216#define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK))
217#define NAND_HAS_SUBPAGE_READ(chip) ((chip->options & NAND_SUBPAGE_READ)) 174#define NAND_HAS_SUBPAGE_READ(chip) ((chip->options & NAND_SUBPAGE_READ))
218 175
219/* Non chip related options */ 176/* Non chip related options */
@@ -361,6 +318,7 @@ struct nand_hw_control {
361 * any single ECC step, 0 if bitflips uncorrectable, -EIO hw error 318 * any single ECC step, 0 if bitflips uncorrectable, -EIO hw error
362 * @read_subpage: function to read parts of the page covered by ECC; 319 * @read_subpage: function to read parts of the page covered by ECC;
363 * returns same as read_page() 320 * returns same as read_page()
321 * @write_subpage: function to write parts of the page covered by ECC.
364 * @write_page: function to write a page according to the ECC generator 322 * @write_page: function to write a page according to the ECC generator
365 * requirements. 323 * requirements.
366 * @write_oob_raw: function to write chip OOB data without ECC 324 * @write_oob_raw: function to write chip OOB data without ECC
@@ -392,6 +350,9 @@ struct nand_ecc_ctrl {
392 uint8_t *buf, int oob_required, int page); 350 uint8_t *buf, int oob_required, int page);
393 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, 351 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
394 uint32_t offs, uint32_t len, uint8_t *buf); 352 uint32_t offs, uint32_t len, uint8_t *buf);
353 int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
354 uint32_t offset, uint32_t data_len,
355 const uint8_t *data_buf, int oob_required);
395 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, 356 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
396 const uint8_t *buf, int oob_required); 357 const uint8_t *buf, int oob_required);
397 int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, 358 int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip,
@@ -527,8 +488,8 @@ struct nand_chip {
527 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, 488 int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state,
528 int status, int page); 489 int status, int page);
529 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, 490 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
530 const uint8_t *buf, int oob_required, int page, 491 uint32_t offset, int data_len, const uint8_t *buf,
531 int cached, int raw); 492 int oob_required, int page, int cached, int raw);
532 int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, 493 int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip,
533 int feature_addr, uint8_t *subfeature_para); 494 int feature_addr, uint8_t *subfeature_para);
534 int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, 495 int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip,
@@ -589,25 +550,65 @@ struct nand_chip {
589#define NAND_MFR_MACRONIX 0xc2 550#define NAND_MFR_MACRONIX 0xc2
590#define NAND_MFR_EON 0x92 551#define NAND_MFR_EON 0x92
591 552
553/* The maximum expected count of bytes in the NAND ID sequence */
554#define NAND_MAX_ID_LEN 8
555
556/*
557 * A helper for defining older NAND chips where the second ID byte fully
558 * defined the chip, including the geometry (chip size, eraseblock size, page
559 * size). All these chips have 512 bytes NAND page size.
560 */
561#define LEGACY_ID_NAND(nm, devid, chipsz, erasesz, opts) \
562 { .name = (nm), {{ .dev_id = (devid) }}, .pagesize = 512, \
563 .chipsize = (chipsz), .erasesize = (erasesz), .options = (opts) }
564
565/*
566 * A helper for defining newer chips which report their page size and
567 * eraseblock size via the extended ID bytes.
568 *
569 * The real difference between LEGACY_ID_NAND and EXTENDED_ID_NAND is that with
570 * EXTENDED_ID_NAND, manufacturers overloaded the same device ID so that the
571 * device ID now only represented a particular total chip size (and voltage,
572 * buswidth), and the page size, eraseblock size, and OOB size could vary while
573 * using the same device ID.
574 */
575#define EXTENDED_ID_NAND(nm, devid, chipsz, opts) \
576 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \
577 .options = (opts) }
578
592/** 579/**
593 * struct nand_flash_dev - NAND Flash Device ID Structure 580 * struct nand_flash_dev - NAND Flash Device ID Structure
594 * @name: Identify the device type 581 * @name: a human-readable name of the NAND chip
595 * @id: device ID code 582 * @dev_id: the device ID (the second byte of the full chip ID array)
596 * @pagesize: Pagesize in bytes. Either 256 or 512 or 0 583 * @mfr_id: manufecturer ID part of the full chip ID array (refers the same
597 * If the pagesize is 0, then the real pagesize 584 * memory address as @id[0])
598 * and the eraseize are determined from the 585 * @dev_id: device ID part of the full chip ID array (refers the same memory
599 * extended id bytes in the chip 586 * address as @id[1])
600 * @erasesize: Size of an erase block in the flash device. 587 * @id: full device ID array
601 * @chipsize: Total chipsize in Mega Bytes 588 * @pagesize: size of the NAND page in bytes; if 0, then the real page size (as
602 * @options: Bitfield to store chip relevant options 589 * well as the eraseblock size) is determined from the extended NAND
590 * chip ID array)
591 * @chipsize: total chip size in MiB
592 * @erasesize: eraseblock size in bytes (determined from the extended ID if 0)
593 * @options: stores various chip bit options
594 * @id_len: The valid length of the @id.
595 * @oobsize: OOB size
603 */ 596 */
604struct nand_flash_dev { 597struct nand_flash_dev {
605 char *name; 598 char *name;
606 int id; 599 union {
607 unsigned long pagesize; 600 struct {
608 unsigned long chipsize; 601 uint8_t mfr_id;
609 unsigned long erasesize; 602 uint8_t dev_id;
610 unsigned long options; 603 };
604 uint8_t id[NAND_MAX_ID_LEN];
605 };
606 unsigned int pagesize;
607 unsigned int chipsize;
608 unsigned int erasesize;
609 unsigned int options;
610 uint16_t id_len;
611 uint16_t oobsize;
611}; 612};
612 613
613/** 614/**
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index d2887e76b7f6..aa6a2633c2da 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -30,7 +30,7 @@ struct physmap_flash_data {
30 unsigned int pfow_base; 30 unsigned int pfow_base;
31 char *probe_type; 31 char *probe_type;
32 struct mtd_partition *parts; 32 struct mtd_partition *parts;
33 const char **part_probe_types; 33 const char * const *part_probe_types;
34}; 34};
35 35
36#endif /* __LINUX_MTD_PHYSMAP__ */ 36#endif /* __LINUX_MTD_PHYSMAP__ */
diff --git a/include/linux/mtd/plat-ram.h b/include/linux/mtd/plat-ram.h
index e07890aff1cf..44212d65aa97 100644
--- a/include/linux/mtd/plat-ram.h
+++ b/include/linux/mtd/plat-ram.h
@@ -20,8 +20,8 @@
20 20
21struct platdata_mtd_ram { 21struct platdata_mtd_ram {
22 const char *mapname; 22 const char *mapname;
23 const char **map_probes; 23 const char * const *map_probes;
24 const char **probes; 24 const char * const *probes;
25 struct mtd_partition *partitions; 25 struct mtd_partition *partitions;
26 int nr_partitions; 26 int nr_partitions;
27 int bankwidth; 27 int bankwidth;