diff options
author | Mike Dunn <mikedunn@newsguy.com> | 2012-03-11 17:21:11 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-03-26 19:56:46 -0400 |
commit | 6a918bade9dab40aaef80559bd1169c69e8d69cb (patch) | |
tree | 1be69789f9b6c6e064a36f4ef6e142a8ec0058b5 /drivers/mtd/nand/denali.c | |
parent | 1d0b95b0834087ba3653f69c24483d63a26d51a7 (diff) |
mtd: flash drivers set ecc strength
Flash device drivers initialize 'ecc_strength' in struct mtd_info, which is the
maximum number of bit errors that can be corrected in one writesize region.
Drivers using the nand interface intitialize 'strength' in struct nand_ecc_ctrl,
which is the maximum number of bit errors that can be corrected in one ecc step.
Nand infrastructure code translates this to 'ecc_strength'.
Also for nand drivers, the nand infrastructure code sets ecc.strength for ecc
modes NAND_ECC_SOFT, NAND_ECC_SOFT_BCH, and NAND_ECC_NONE. It is set in the
driver for all other modes.
Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/denali.c')
-rw-r--r-- | drivers/mtd/nand/denali.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c index 3984d488f9ab..a9e57d686297 100644 --- a/drivers/mtd/nand/denali.c +++ b/drivers/mtd/nand/denali.c | |||
@@ -1590,6 +1590,7 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1590 | ECC_15BITS * (denali->mtd.writesize / | 1590 | ECC_15BITS * (denali->mtd.writesize / |
1591 | ECC_SECTOR_SIZE)))) { | 1591 | ECC_SECTOR_SIZE)))) { |
1592 | /* if MLC OOB size is large enough, use 15bit ECC*/ | 1592 | /* if MLC OOB size is large enough, use 15bit ECC*/ |
1593 | denali->nand.ecc.strength = 15; | ||
1593 | denali->nand.ecc.layout = &nand_15bit_oob; | 1594 | denali->nand.ecc.layout = &nand_15bit_oob; |
1594 | denali->nand.ecc.bytes = ECC_15BITS; | 1595 | denali->nand.ecc.bytes = ECC_15BITS; |
1595 | iowrite32(15, denali->flash_reg + ECC_CORRECTION); | 1596 | iowrite32(15, denali->flash_reg + ECC_CORRECTION); |
@@ -1600,12 +1601,14 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
1600 | " contain 8bit ECC correction codes"); | 1601 | " contain 8bit ECC correction codes"); |
1601 | goto failed_req_irq; | 1602 | goto failed_req_irq; |
1602 | } else { | 1603 | } else { |
1604 | denali->nand.ecc.strength = 8; | ||
1603 | denali->nand.ecc.layout = &nand_8bit_oob; | 1605 | denali->nand.ecc.layout = &nand_8bit_oob; |
1604 | denali->nand.ecc.bytes = ECC_8BITS; | 1606 | denali->nand.ecc.bytes = ECC_8BITS; |
1605 | iowrite32(8, denali->flash_reg + ECC_CORRECTION); | 1607 | iowrite32(8, denali->flash_reg + ECC_CORRECTION); |
1606 | } | 1608 | } |
1607 | 1609 | ||
1608 | denali->nand.ecc.bytes *= denali->devnum; | 1610 | denali->nand.ecc.bytes *= denali->devnum; |
1611 | denali->nand.ecc.strength *= denali->devnum; | ||
1609 | denali->nand.ecc.layout->eccbytes *= | 1612 | denali->nand.ecc.layout->eccbytes *= |
1610 | denali->mtd.writesize / ECC_SECTOR_SIZE; | 1613 | denali->mtd.writesize / ECC_SECTOR_SIZE; |
1611 | denali->nand.ecc.layout->oobfree[0].offset = | 1614 | denali->nand.ecc.layout->oobfree[0].offset = |