aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-09-09 13:33:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-09 13:33:19 -0400
commitef9a61bef917e38f8e096f6df303329aed6cf467 (patch)
tree31cfe2444d0270e77ff8ef792df11591fed6075c /include/linux
parentb5f0998cae3d7ea56d3d8377e46328fe972b9546 (diff)
parent6c3b88970175e18a67eb8e55c4eba10614d0d5dc (diff)
Merge tag 'for-linus-20130909' of git://git.infradead.org/linux-mtd
Pull mtd updates from David Woodhouse: - factor out common code from MTD tests - nand-gpio cleanup and portability to non-ARM - m25p80 support for 4-byte addressing chips, other new chips - pxa3xx cleanup and support for new platforms - remove obsolete alauda, octagon-5066 drivers - erase/write support for bcm47xxsflash - improve detection of ECC requirements for NAND, controller setup - NFC acceleration support for atmel-nand, read/write via SRAM - etc * tag 'for-linus-20130909' of git://git.infradead.org/linux-mtd: (184 commits) mtd: chips: Add support for PMC SPI Flash chips in m25p80.c mtd: ofpart: use for_each_child_of_node() macro mtd: mtdswap: replace strict_strtoul() with kstrtoul() mtd cs553x_nand: use kzalloc() instead of memset mtd: atmel_nand: fix error return code in atmel_nand_probe() mtd: bcm47xxsflash: writing support mtd: bcm47xxsflash: implement erasing support mtd: bcm47xxsflash: convert to module_platform_driver instead of init/exit mtd: bcm47xxsflash: convert kzalloc to avoid invalid access mtd: remove alauda driver mtd: nand: mxc_nand: mark 'const' properly mtd: maps: cfi_flagadm: add missing __iomem annotation mtd: spear_smi: add missing __iomem annotation mtd: r852: Staticize local symbols mtd: nandsim: Staticize local symbols mtd: impa7: add missing __iomem annotation mtd: sm_ftl: Staticize local symbols mtd: m25p80: add support for mr25h10 mtd: m25p80: make CONFIG_M25PXX_USE_FAST_READ safe to enable mtd: m25p80: Pass flags through CAT25_INFO macro ...
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mtd/bbm.h2
-rw-r--r--include/linux/mtd/fsmc.h1
-rw-r--r--include/linux/mtd/mtd.h3
-rw-r--r--include/linux/mtd/nand.h83
-rw-r--r--include/linux/platform_data/atmel.h4
-rw-r--r--include/linux/platform_data/mtd-nand-pxa3xx.h13
6 files changed, 86 insertions, 20 deletions
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h
index 211ff67e8b0d..95fc482cef36 100644
--- a/include/linux/mtd/bbm.h
+++ b/include/linux/mtd/bbm.h
@@ -93,8 +93,6 @@ struct nand_bbt_descr {
93#define NAND_BBT_CREATE_EMPTY 0x00000400 93#define NAND_BBT_CREATE_EMPTY 0x00000400
94/* Search good / bad pattern through all pages of a block */ 94/* Search good / bad pattern through all pages of a block */
95#define NAND_BBT_SCANALLPAGES 0x00000800 95#define NAND_BBT_SCANALLPAGES 0x00000800
96/* Scan block empty during good / bad block scan */
97#define NAND_BBT_SCANEMPTY 0x00001000
98/* Write bbt if neccecary */ 96/* Write bbt if neccecary */
99#define NAND_BBT_WRITE 0x00002000 97#define NAND_BBT_WRITE 0x00002000
100/* Read and write back block contents when writing bbt */ 98/* Read and write back block contents when writing bbt */
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h
index d6ed61ef451d..c8be32e9fc49 100644
--- a/include/linux/mtd/fsmc.h
+++ b/include/linux/mtd/fsmc.h
@@ -137,6 +137,7 @@ enum access_mode {
137 137
138/** 138/**
139 * fsmc_nand_platform_data - platform specific NAND controller config 139 * fsmc_nand_platform_data - platform specific NAND controller config
140 * @nand_timings: timing setup for the physical NAND interface
140 * @partitions: partition table for the platform, use a default fallback 141 * @partitions: partition table for the platform, use a default fallback
141 * if this is NULL 142 * if this is NULL
142 * @nr_partitions: the number of partitions in the previous entry 143 * @nr_partitions: the number of partitions in the previous entry
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index a5cf4e8d6818..f9bfe526d310 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -173,6 +173,9 @@ struct mtd_info {
173 /* ECC layout structure pointer - read only! */ 173 /* ECC layout structure pointer - read only! */
174 struct nand_ecclayout *ecclayout; 174 struct nand_ecclayout *ecclayout;
175 175
176 /* the ecc step size. */
177 unsigned int ecc_step_size;
178
176 /* max number of correctible bit errors per ecc step */ 179 /* max number of correctible bit errors per ecc step */
177 unsigned int ecc_strength; 180 unsigned int ecc_strength;
178 181
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index ab6363443ce8..ac8e89d5a792 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -56,7 +56,7 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len);
56 * is supported now. If you add a chip with bigger oobsize/page 56 * is supported now. If you add a chip with bigger oobsize/page
57 * adjust this accordingly. 57 * adjust this accordingly.
58 */ 58 */
59#define NAND_MAX_OOBSIZE 640 59#define NAND_MAX_OOBSIZE 744
60#define NAND_MAX_PAGESIZE 8192 60#define NAND_MAX_PAGESIZE 8192
61 61
62/* 62/*
@@ -202,6 +202,10 @@ typedef enum {
202/* Keep gcc happy */ 202/* Keep gcc happy */
203struct nand_chip; 203struct nand_chip;
204 204
205/* ONFI features */
206#define ONFI_FEATURE_16_BIT_BUS (1 << 0)
207#define ONFI_FEATURE_EXT_PARAM_PAGE (1 << 7)
208
205/* ONFI timing mode, used in both asynchronous and synchronous mode */ 209/* ONFI timing mode, used in both asynchronous and synchronous mode */
206#define ONFI_TIMING_MODE_0 (1 << 0) 210#define ONFI_TIMING_MODE_0 (1 << 0)
207#define ONFI_TIMING_MODE_1 (1 << 1) 211#define ONFI_TIMING_MODE_1 (1 << 1)
@@ -217,6 +221,9 @@ struct nand_chip;
217/* ONFI subfeature parameters length */ 221/* ONFI subfeature parameters length */
218#define ONFI_SUBFEATURE_PARAM_LEN 4 222#define ONFI_SUBFEATURE_PARAM_LEN 4
219 223
224/* ONFI optional commands SET/GET FEATURES supported? */
225#define ONFI_OPT_CMD_SET_GET_FEATURES (1 << 2)
226
220struct nand_onfi_params { 227struct nand_onfi_params {
221 /* rev info and features block */ 228 /* rev info and features block */
222 /* 'O' 'N' 'F' 'I' */ 229 /* 'O' 'N' 'F' 'I' */
@@ -224,7 +231,10 @@ struct nand_onfi_params {
224 __le16 revision; 231 __le16 revision;
225 __le16 features; 232 __le16 features;
226 __le16 opt_cmd; 233 __le16 opt_cmd;
227 u8 reserved[22]; 234 u8 reserved0[2];
235 __le16 ext_param_page_length; /* since ONFI 2.1 */
236 u8 num_of_param_pages; /* since ONFI 2.1 */
237 u8 reserved1[17];
228 238
229 /* manufacturer information block */ 239 /* manufacturer information block */
230 char manufacturer[12]; 240 char manufacturer[12];
@@ -281,6 +291,40 @@ struct nand_onfi_params {
281 291
282#define ONFI_CRC_BASE 0x4F4E 292#define ONFI_CRC_BASE 0x4F4E
283 293
294/* Extended ECC information Block Definition (since ONFI 2.1) */
295struct onfi_ext_ecc_info {
296 u8 ecc_bits;
297 u8 codeword_size;
298 __le16 bb_per_lun;
299 __le16 block_endurance;
300 u8 reserved[2];
301} __packed;
302
303#define ONFI_SECTION_TYPE_0 0 /* Unused section. */
304#define ONFI_SECTION_TYPE_1 1 /* for additional sections. */
305#define ONFI_SECTION_TYPE_2 2 /* for ECC information. */
306struct onfi_ext_section {
307 u8 type;
308 u8 length;
309} __packed;
310
311#define ONFI_EXT_SECTION_MAX 8
312
313/* Extended Parameter Page Definition (since ONFI 2.1) */
314struct onfi_ext_param_page {
315 __le16 crc;
316 u8 sig[4]; /* 'E' 'P' 'P' 'S' */
317 u8 reserved0[10];
318 struct onfi_ext_section sections[ONFI_EXT_SECTION_MAX];
319
320 /*
321 * The actual size of the Extended Parameter Page is in
322 * @ext_param_page_length of nand_onfi_params{}.
323 * The following are the variable length sections.
324 * So we do not add any fields below. Please see the ONFI spec.
325 */
326} __packed;
327
284/** 328/**
285 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 329 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
286 * @lock: protection lock 330 * @lock: protection lock
@@ -390,8 +434,8 @@ struct nand_buffers {
390 * @write_buf: [REPLACEABLE] write data from the buffer to the chip 434 * @write_buf: [REPLACEABLE] write data from the buffer to the chip
391 * @read_buf: [REPLACEABLE] read data from the chip into the buffer 435 * @read_buf: [REPLACEABLE] read data from the chip into the buffer
392 * @select_chip: [REPLACEABLE] select chip nr 436 * @select_chip: [REPLACEABLE] select chip nr
393 * @block_bad: [REPLACEABLE] check, if the block is bad 437 * @block_bad: [REPLACEABLE] check if a block is bad, using OOB markers
394 * @block_markbad: [REPLACEABLE] mark the block bad 438 * @block_markbad: [REPLACEABLE] mark a block bad
395 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific function for controlling 439 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific function for controlling
396 * ALE/CLE/nCE. Also used to write command and address 440 * ALE/CLE/nCE. Also used to write command and address
397 * @init_size: [BOARDSPECIFIC] hardwarespecific function for setting 441 * @init_size: [BOARDSPECIFIC] hardwarespecific function for setting
@@ -434,6 +478,12 @@ struct nand_buffers {
434 * bad block marker position; i.e., BBM == 11110111b is 478 * bad block marker position; i.e., BBM == 11110111b is
435 * not bad when badblockbits == 7 479 * not bad when badblockbits == 7
436 * @cellinfo: [INTERN] MLC/multichip data from chip ident 480 * @cellinfo: [INTERN] MLC/multichip data from chip ident
481 * @ecc_strength_ds: [INTERN] ECC correctability from the datasheet.
482 * Minimum amount of bit errors per @ecc_step_ds guaranteed
483 * to be correctable. If unknown, set to zero.
484 * @ecc_step_ds: [INTERN] ECC step required by the @ecc_strength_ds,
485 * also from the datasheet. It is the recommended ECC step
486 * size, if known; if unknown, set to zero.
437 * @numchips: [INTERN] number of physical chips 487 * @numchips: [INTERN] number of physical chips
438 * @chipsize: [INTERN] the size of one chip for multichip arrays 488 * @chipsize: [INTERN] the size of one chip for multichip arrays
439 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 489 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
@@ -510,6 +560,8 @@ struct nand_chip {
510 unsigned int pagebuf_bitflips; 560 unsigned int pagebuf_bitflips;
511 int subpagesize; 561 int subpagesize;
512 uint8_t cellinfo; 562 uint8_t cellinfo;
563 uint16_t ecc_strength_ds;
564 uint16_t ecc_step_ds;
513 int badblockpos; 565 int badblockpos;
514 int badblockbits; 566 int badblockbits;
515 567
@@ -576,6 +628,11 @@ struct nand_chip {
576 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \ 628 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \
577 .options = (opts) } 629 .options = (opts) }
578 630
631#define NAND_ECC_INFO(_strength, _step) \
632 { .strength_ds = (_strength), .step_ds = (_step) }
633#define NAND_ECC_STRENGTH(type) ((type)->ecc.strength_ds)
634#define NAND_ECC_STEP(type) ((type)->ecc.step_ds)
635
579/** 636/**
580 * struct nand_flash_dev - NAND Flash Device ID Structure 637 * struct nand_flash_dev - NAND Flash Device ID Structure
581 * @name: a human-readable name of the NAND chip 638 * @name: a human-readable name of the NAND chip
@@ -593,6 +650,12 @@ struct nand_chip {
593 * @options: stores various chip bit options 650 * @options: stores various chip bit options
594 * @id_len: The valid length of the @id. 651 * @id_len: The valid length of the @id.
595 * @oobsize: OOB size 652 * @oobsize: OOB size
653 * @ecc.strength_ds: The ECC correctability from the datasheet, same as the
654 * @ecc_strength_ds in nand_chip{}.
655 * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the
656 * @ecc_step_ds in nand_chip{}, also from the datasheet.
657 * For example, the "4bit ECC for each 512Byte" can be set with
658 * NAND_ECC_INFO(4, 512).
596 */ 659 */
597struct nand_flash_dev { 660struct nand_flash_dev {
598 char *name; 661 char *name;
@@ -609,6 +672,10 @@ struct nand_flash_dev {
609 unsigned int options; 672 unsigned int options;
610 uint16_t id_len; 673 uint16_t id_len;
611 uint16_t oobsize; 674 uint16_t oobsize;
675 struct {
676 uint16_t strength_ds;
677 uint16_t step_ds;
678 } ecc;
612}; 679};
613 680
614/** 681/**
@@ -625,8 +692,8 @@ extern struct nand_flash_dev nand_flash_ids[];
625extern struct nand_manufacturers nand_manuf_ids[]; 692extern struct nand_manufacturers nand_manuf_ids[];
626 693
627extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd); 694extern int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd);
628extern int nand_update_bbt(struct mtd_info *mtd, loff_t offs);
629extern int nand_default_bbt(struct mtd_info *mtd); 695extern int nand_default_bbt(struct mtd_info *mtd);
696extern int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs);
630extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); 697extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt);
631extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, 698extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr,
632 int allowbbt); 699 int allowbbt);
@@ -708,6 +775,12 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
708 return chip->priv; 775 return chip->priv;
709} 776}
710 777
778/* return the supported features. */
779static inline int onfi_feature(struct nand_chip *chip)
780{
781 return chip->onfi_version ? le16_to_cpu(chip->onfi_params.features) : 0;
782}
783
711/* return the supported asynchronous timing mode. */ 784/* return the supported asynchronous timing mode. */
712static inline int onfi_get_async_timing_mode(struct nand_chip *chip) 785static inline int onfi_get_async_timing_mode(struct nand_chip *chip)
713{ 786{
diff --git a/include/linux/platform_data/atmel.h b/include/linux/platform_data/atmel.h
index 6a293b7fff3b..cea9f70133c5 100644
--- a/include/linux/platform_data/atmel.h
+++ b/include/linux/platform_data/atmel.h
@@ -71,6 +71,10 @@ struct atmel_nand_data {
71 u8 on_flash_bbt; /* bbt on flash */ 71 u8 on_flash_bbt; /* bbt on flash */
72 struct mtd_partition *parts; 72 struct mtd_partition *parts;
73 unsigned int num_parts; 73 unsigned int num_parts;
74 bool has_dma; /* support dma transfer */
75
76 /* default is false, only for at32ap7000 chip is true */
77 bool need_reset_workaround;
74}; 78};
75 79
76 /* Serial */ 80 /* Serial */
diff --git a/include/linux/platform_data/mtd-nand-pxa3xx.h b/include/linux/platform_data/mtd-nand-pxa3xx.h
index c42f39f20195..ffb801998e5d 100644
--- a/include/linux/platform_data/mtd-nand-pxa3xx.h
+++ b/include/linux/platform_data/mtd-nand-pxa3xx.h
@@ -16,19 +16,6 @@ struct pxa3xx_nand_timing {
16 unsigned int tAR; /* ND_ALE low to ND_nRE low delay */ 16 unsigned int tAR; /* ND_ALE low to ND_nRE low delay */
17}; 17};
18 18
19struct pxa3xx_nand_cmdset {
20 uint16_t read1;
21 uint16_t read2;
22 uint16_t program;
23 uint16_t read_status;
24 uint16_t read_id;
25 uint16_t erase;
26 uint16_t reset;
27 uint16_t lock;
28 uint16_t unlock;
29 uint16_t lock_status;
30};
31
32struct pxa3xx_nand_flash { 19struct pxa3xx_nand_flash {
33 char *name; 20 char *name;
34 uint32_t chip_id; 21 uint32_t chip_id;