Thread (1 message) 1 message, 1 author, 2016-02-15

Re: [PATCH 2/3] mtd: nand: read (from DT) and store ECC algorithm

From: Kamal Dasu <hidden>
Date: 2016-02-15 21:31:30

On Fri, Feb 12, 2016 at 1:11 PM, Rafał Miłecki [off-list ref] wrote:
This will allow drivers handle ECC properly.

Signed-off-by: Rafał Miłecki <redacted>
Reviewed-by: Kamal Dasu <redacted>

Thanks Rafal
quoted hunk
---
 drivers/mtd/nand/nand_base.c | 6 +++++-
 include/linux/mtd/nand.h     | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index f2c8ff3..ef977f3 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3979,7 +3979,7 @@ ident_done:
 static int nand_dt_init(struct nand_chip *chip)
 {
        struct device_node *dn = nand_get_flash_node(chip);
-       int ecc_mode, ecc_strength, ecc_step;
+       int ecc_mode, ecc_algo, ecc_strength, ecc_step;

        if (!dn)
                return 0;
@@ -3991,6 +3991,7 @@ static int nand_dt_init(struct nand_chip *chip)
                chip->bbt_options |= NAND_BBT_USE_FLASH;

        ecc_mode = of_get_nand_ecc_mode(dn);
+       ecc_algo = of_get_nand_ecc_algo(dn);
        ecc_strength = of_get_nand_ecc_strength(dn);
        ecc_step = of_get_nand_ecc_step_size(dn);
@@ -4003,6 +4004,9 @@ static int nand_dt_init(struct nand_chip *chip)
        if (ecc_mode >= 0)
                chip->ecc.mode = ecc_mode;

+       if (ecc_algo >= 0)
+               chip->ecc.algo = ecc_algo;
+
        if (ecc_strength >= 0)
                chip->ecc.strength = ecc_strength;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 25854d2..8deca1b 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -513,6 +513,7 @@ struct nand_hw_control {
  */
 struct nand_ecc_ctrl {
        nand_ecc_modes_t mode;
+       enum nand_ecc_algo algo;
        int steps;
        int size;
        int bytes;
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help