summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>2014-05-14 13:58:08 -0400
committerBrian Norris <computersforpeace@gmail.com>2014-05-21 15:55:09 -0400
commit5b3e507820c6e120bc2680c0d35f9d9d81fcb98d (patch)
tree77cbc581cbdf88e0d91bb16e477718a5dce2b3d5 /drivers/mtd
parenteee0166d8ead9d719d794df3e66acd8f83630e05 (diff)
mtd: nand: pxa3xx: Use ECC strength and step size devicetree binding
This commit adds support for the user to specify the ECC strength and step size through the devicetree. We keep the previous behavior, when there is no DT parameter provided. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/pxa3xx_nand.c17
1 files changed, 15 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;