aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/pxa3xx_nand.c17
-rw-r--r--include/linux/platform_data/mtd-nand-pxa3xx.h3
2 files changed, 18 insertions, 2 deletions
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 3b66a6460d67..2a9add06c2d5 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -1519,8 +1519,13 @@ KEEP_CONFIG:
1519 } 1519 }
1520 } 1520 }
1521 1521
1522 ecc_strength = chip->ecc_strength_ds; 1522 if (pdata->ecc_strength && pdata->ecc_step_size) {
1523 ecc_step = chip->ecc_step_ds; 1523 ecc_strength = pdata->ecc_strength;
1524 ecc_step = pdata->ecc_step_size;
1525 } else {
1526 ecc_strength = chip->ecc_strength_ds;
1527 ecc_step = chip->ecc_step_ds;
1528 }
1524 1529
1525 /* Set default ECC strength requirements on non-ONFI devices */ 1530 /* Set default ECC strength requirements on non-ONFI devices */
1526 if (ecc_strength < 1 && ecc_step < 1) { 1531 if (ecc_strength < 1 && ecc_step < 1) {
@@ -1729,6 +1734,14 @@ static int pxa3xx_nand_probe_dt(struct platform_device *pdev)
1729 of_property_read_u32(np, "num-cs", &pdata->num_cs); 1734 of_property_read_u32(np, "num-cs", &pdata->num_cs);
1730 pdata->flash_bbt = of_get_nand_on_flash_bbt(np); 1735 pdata->flash_bbt = of_get_nand_on_flash_bbt(np);
1731 1736
1737 pdata->ecc_strength = of_get_nand_ecc_strength(np);
1738 if (pdata->ecc_strength < 0)
1739 pdata->ecc_strength = 0;
1740
1741 pdata->ecc_step_size = of_get_nand_ecc_step_size(np);
1742 if (pdata->ecc_step_size < 0)
1743 pdata->ecc_step_size = 0;
1744
1732 pdev->dev.platform_data = pdata; 1745 pdev->dev.platform_data = pdata;
1733 1746
1734 return 0; 1747 return 0;
diff --git a/include/linux/platform_data/mtd-nand-pxa3xx.h b/include/linux/platform_data/mtd-nand-pxa3xx.h
index a94147124929..ac4ea2e641c7 100644
--- a/include/linux/platform_data/mtd-nand-pxa3xx.h
+++ b/include/linux/platform_data/mtd-nand-pxa3xx.h
@@ -58,6 +58,9 @@ struct pxa3xx_nand_platform_data {
58 /* use an flash-based bad block table */ 58 /* use an flash-based bad block table */
59 bool flash_bbt; 59 bool flash_bbt;
60 60
61 /* requested ECC strength and ECC step size */
62 int ecc_strength, ecc_step_size;
63
61 const struct mtd_partition *parts[NUM_CHIP_SELECT]; 64 const struct mtd_partition *parts[NUM_CHIP_SELECT];
62 unsigned int nr_parts[NUM_CHIP_SELECT]; 65 unsigned int nr_parts[NUM_CHIP_SELECT];
63 66