diff options
author | Huang Shijie <b32955@freescale.com> | 2013-05-16 23:17:31 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:06:03 -0400 |
commit | e2519d3a87c5f807e3d0b74e993911cb561e15d5 (patch) | |
tree | 90d562057f745cae4316111d829feed1d38bb9ce | |
parent | 4d514f6334482fa080c15c6395b6454db110f063 (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>
-rw-r--r-- | include/linux/mtd/nand.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 5a2605ae4645..8d7f506a791f 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -591,6 +591,11 @@ struct nand_chip { | |||
591 | { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \ | 591 | { .name = (nm), {{ .dev_id = (devid) }}, .chipsize = (chipsz), \ |
592 | .options = (opts) } | 592 | .options = (opts) } |
593 | 593 | ||
594 | #define NAND_ECC_INFO(_strength, _step) \ | ||
595 | { .strength_ds = (_strength), .step_ds = (_step) } | ||
596 | #define NAND_ECC_STRENGTH(type) ((type)->ecc.strength_ds) | ||
597 | #define NAND_ECC_STEP(type) ((type)->ecc.step_ds) | ||
598 | |||
594 | /** | 599 | /** |
595 | * struct nand_flash_dev - NAND Flash Device ID Structure | 600 | * struct nand_flash_dev - NAND Flash Device ID Structure |
596 | * @name: a human-readable name of the NAND chip | 601 | * @name: a human-readable name of the NAND chip |
@@ -608,6 +613,12 @@ struct nand_chip { | |||
608 | * @options: stores various chip bit options | 613 | * @options: stores various chip bit options |
609 | * @id_len: The valid length of the @id. | 614 | * @id_len: The valid length of the @id. |
610 | * @oobsize: OOB size | 615 | * @oobsize: OOB size |
616 | * @ecc.strength_ds: The ECC correctability from the datasheet, same as the | ||
617 | * @ecc_strength_ds in nand_chip{}. | ||
618 | * @ecc.step_ds: The ECC step required by the @ecc.strength_ds, same as the | ||
619 | * @ecc_step_ds in nand_chip{}, also from the datasheet. | ||
620 | * For example, the "4bit ECC for each 512Byte" can be set with | ||
621 | * NAND_ECC_INFO(4, 512). | ||
611 | */ | 622 | */ |
612 | struct nand_flash_dev { | 623 | struct nand_flash_dev { |
613 | char *name; | 624 | char *name; |
@@ -624,6 +635,10 @@ struct nand_flash_dev { | |||
624 | unsigned int options; | 635 | unsigned int options; |
625 | uint16_t id_len; | 636 | uint16_t id_len; |
626 | uint16_t oobsize; | 637 | uint16_t oobsize; |
638 | struct { | ||
639 | uint16_t strength_ds; | ||
640 | uint16_t step_ds; | ||
641 | } ecc; | ||
627 | }; | 642 | }; |
628 | 643 | ||
629 | /** | 644 | /** |