aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorHuang Shijie <b32955@freescale.com>2013-05-16 23:17:31 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2013-08-30 16:34:45 -0400
commit2dc0bdd91bb63f7d5755137177315c49637f6a96 (patch)
tree0bc0bc8948d4f7d16515d3682316d0ea8914a3ee /include/linux
parente2985fc1d684927ce1dd5e5e6d35db8b52302685 (diff)
mtd: add ECC info for nand_flash_dev{}
Add an instance of an anonymous struct to store the ECC info for full id nand chips. @ecc.strength_ds: ECC correctability from the datasheet. @ecc.step_ds: ECC size required by the @ecc.strength_ds, These two fields are all from the datasheet. Also add the necessary macros to make the code simple and clean. Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mtd/nand.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index bf4c566f0647..ac8e89d5a792 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -628,6 +628,11 @@ struct nand_chip {
628 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \ 628 { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \
629 .options = (opts) } 629 .options = (opts) }
630 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
631/** 636/**
632 * struct nand_flash_dev - NAND Flash Device ID Structure 637 * struct nand_flash_dev - NAND Flash Device ID Structure
633 * @name: a human-readable name of the NAND chip 638 * @name: a human-readable name of the NAND chip
@@ -645,6 +650,12 @@ struct nand_chip {
645 * @options: stores various chip bit options 650 * @options: stores various chip bit options
646 * @id_len: The valid length of the @id. 651 * @id_len: The valid length of the @id.
647 * @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).
648 */ 659 */
649struct nand_flash_dev { 660struct nand_flash_dev {
650 char *name; 661 char *name;
@@ -661,6 +672,10 @@ struct nand_flash_dev {
661 unsigned int options; 672 unsigned int options;
662 uint16_t id_len; 673 uint16_t id_len;
663 uint16_t oobsize; 674 uint16_t oobsize;
675 struct {
676 uint16_t strength_ds;
677 uint16_t step_ds;
678 } ecc;
664}; 679};
665 680
666/** 681/**