Skip to contentSkip to conversation

mtd: gpmi: add a new DT property to use the datasheet's minimum required ECC

PATCH In review Huang Shijie 4 participants 4 messages Nov 7, 2013 – Nov 13, 2013 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 mtd: gpmi: add a new DT property to use the datasheet's minimum required ECC

In default way, we use the ecc_strength/ecc_step size calculated by ourselves and use all the OOB area.

This patch adds a new property : "fsl,use-minimum-ecc"

If we enable it, we will firstly try to use the datasheet's minimum required ECC provided by the MTD layer (the ecc_strength_ds/ecc_step_ds fields in the nand_chip{}). So we may have free space in the OOB area by using the minimum ECC, and we may support JFFS2 with some SLC NANDs, such as Micron's SLC NAND.

If we fail to use the minimum ECC, we will use the legacy method to calculate the ecc_strength and ecc_step size.

---
v1 -- > v2: rebase this patch on the latest l2-mtd. v2 -- > v3: change the descriptions.

---
 .../devicetree/bindings/mtd/gpmi-nand.txt          |    8 ++++++++
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c             |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/mtd/gpmi-nand.txt +8 -0
index 551b2a1..458d596 100644
@@ -17,6 +17,14 @@ Required properties:
 Optional properties:
   - nand-on-flash-bbt: boolean to enable on flash bbt option if not
                        present false
+  - fsl,use-minimum-ecc: Protect this NAND flash with the minimum ECC
+                       strength required. The required ECC strength is
+                       automatically discoverable for some flash
+                       (e.g., according to the ONFI standard).
+                       However, note that if this strength is not
+                       discoverable or this property is not enabled,
+                       the software may chooses an implementation-defined
+                       ECC scheme.
 
 The device tree may optionally contain sub-nodes describing partitions of the
 address space. See partition.txt for more detail.
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +3 -0
index 8f4e5b1..b849b92 100644
@@ -353,6 +353,9 @@ static int legacy_set_geometry(struct gpmi_nand_data *this)
 
 int common_nfc_set_geometry(struct gpmi_nand_data *this)
 {
+	if (of_property_read_bool(this->dev->of_node, "fsl,use-minimum-ecc")
+		&& set_geometry_by_ecc_info(this))
+		return 0;
 	return legacy_set_geometry(this);
 }
 
Signature · 7 lines
1.7.2.rc3


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw
Quoted 47 lines · Huang Shijie

In default way, we use the ecc_strength/ecc_step size calculated by ourselves and use all the OOB area.

This patch adds a new property : "fsl,use-minimum-ecc"

If we enable it, we will firstly try to use the datasheet's minimum required ECC provided by the MTD layer (the ecc_strength_ds/ecc_step_ds fields in the nand_chip{}). So we may have free space in the OOB area by using the minimum ECC, and we may support JFFS2 with some SLC NANDs, such as Micron's SLC NAND.

If we fail to use the minimum ECC, we will use the legacy method to calculate the ecc_strength and ecc_step size.

---
v1 --> v2: rebase this patch on the latest l2-mtd. v2 --> v3: change the descriptions.

---
  .../devicetree/bindings/mtd/gpmi-nand.txt          |    8 ++++++++
  drivers/mtd/nand/gpmi-nand/gpmi-nand.c             |    3 +++
  2 files changed, 11 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/mtd/gpmi-nand.txt +8 -0
index 551b2a1..458d596 100644
@@ -17,6 +17,14 @@ Required properties:
  Optional properties:
    - nand-on-flash-bbt: boolean to enable on flash bbt option if not
                         present false
+  - fsl,use-minimum-ecc: Protect this NAND flash with the minimum ECC
+                       strength required. The required ECC strength is
+                       automatically discoverable for some flash
+                       (e.g., according to the ONFI standard).
+                       However, note that if this strength is not
+                       discoverable or this property is not enabled,
+                       the software may chooses an implementation-defined
+                       ECC scheme.
 
  The device tree may optionally contain sub-nodes describing partitions of the
  address space. See partition.txt for more detail.
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +0 -0
index 8f4e5b1..b849b92 100644

drivers/mtd/nand/gpmi-nand/gpmi-nand.c static int legacy_set_geometry(struct gpmi_nand_data *this) · line 361

Quoted 9 lines
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +3 -0
@@ -353,6 +353,9 @@ static int legacy_set_geometry(struct gpmi_nand_data *this)
 
  int common_nfc_set_geometry(struct gpmi_nand_data *this)
  {
+	if (of_property_read_bool(this->dev->of_node, "fsl,use-minimum-ecc")
+		&&  set_geometry_by_ecc_info(this))
+		return 0;
  	return legacy_set_geometry(this);
  }
 

Hi Brian:
Is this patch ok now? I hope it can be accepted at this merge-window.

thanks
Huang Shijie

#2 lore raw

+ DT maintainers, since they haven't responded

Quoted 59 lines · Huang Shijie
Quoted 57 lines · Huang Shijie

In default way, we use the ecc_strength/ecc_step size calculated by ourselves
and use all the OOB area.

This patch adds a new property : "fsl,use-minimum-ecc"

If we enable it, we will firstly try to use the datasheet's minimum required
ECC provided by the MTD layer (the ecc_strength_ds/ecc_step_ds fields in the nand_chip{}). So we may have free space in the OOB area by using the
minimum ECC, and we may support JFFS2 with some SLC NANDs, such as Micron's
SLC NAND.

If we fail to use the minimum ECC, we will use the legacy method to calculate
the ecc_strength and ecc_step size.

---
v1 --> v2: rebase this patch on the latest l2-mtd. v2 --> v3: change the descriptions.

---
  .../devicetree/bindings/mtd/gpmi-nand.txt          |    8 ++++++++
  drivers/mtd/nand/gpmi-nand/gpmi-nand.c             |    3 +++
  2 files changed, 11 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/mtd/gpmi-nand.txt +8 -0
index 551b2a1..458d596 100644
@@ -17,6 +17,14 @@ Required properties:
  Optional properties:
    - nand-on-flash-bbt: boolean to enable on flash bbt option if not
                         present false
+  - fsl,use-minimum-ecc: Protect this NAND flash with the minimum ECC
+                       strength required. The required ECC strength is
+                       automatically discoverable for some flash
+                       (e.g., according to the ONFI standard).
+                       However, note that if this strength is not
+                       discoverable or this property is not enabled,
+                       the software may chooses an implementation-defined
+                       ECC scheme.
 
  The device tree may optionally contain sub-nodes describing partitions

of the
address space. See partition.txt for more detail.

drivers/mtd/nand/gpmi-nand/gpmi-nand.c +0 -0
index 8f4e5b1..b849b92 100644
@@ -353,6 +353,9 @@ static int legacy_set_geometry(struct gpmi_nand_data
 *this)
 
Quoted 11 lines
Quoted 9 lines
drivers/mtd/nand/gpmi-nand/gpmi-nand.c +3 -0
  int common_nfc_set_geometry(struct gpmi_nand_data *this)
  {
+       if (of_property_read_bool(this->dev->of_node,
 "fsl,use-minimum-ecc")
+               &&  set_geometry_by_ecc_info(this))
+               return 0;
        return legacy_set_geometry(this);
  }

Hi Brian:
Is this patch ok now? I hope it can be accepted at this merge-window.

The patch is OK to me, but we haven't gotten any DT review. If we don't get any response in a few days, I'll take it anyway.

I'm not sure about taking it in 3.13 vs. 3.14, as this is traditionally a late merge for 3.13.

Brian

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#4 lore raw
In reply to a message not in the archive
Quoted 33 lines · Brian Norris

+ DT maintainers, since they haven't responded

Quoted 30 lines · Huang Shijie
Quoted 27 lines · Huang Shijie

In default way, we use the ecc_strength/ecc_step size calculated by ourselves
and use all the OOB area.

This patch adds a new property : "fsl,use-minimum-ecc"

If we enable it, we will firstly try to use the datasheet's minimum required
ECC provided by the MTD layer (the ecc_strength_ds/ecc_step_ds fields in the nand_chip{}). So we may have free space in the OOB area by using the
minimum ECC, and we may support JFFS2 with some SLC NANDs, such as Micron's
SLC NAND.

If we fail to use the minimum ECC, we will use the legacy method to calculate
the ecc_strength and ecc_step size.

---
v1 --> v2: rebase this patch on the latest l2-mtd. v2 --> v3: change the descriptions.

---
  .../devicetree/bindings/mtd/gpmi-nand.txt          |    8 ++++++++
  drivers/mtd/nand/gpmi-nand/gpmi-nand.c             |    3 +++
  2 files changed, 11 insertions(+), 0 deletions(-)
Quoted 4 lines
Quoted 1 line

Is this patch ok now? I hope it can be accepted at this merge-window.

The patch is OK to me, but we haven't gotten any DT review. If we don't get any response in a few days, I'll take it anyway.

I pushed this to l2-mtd.git/next and will get it into linux-next after the merge window closes. Let me know if there are further comments.

Quoted 2 lines

I'm not sure about taking it in 3.13 vs. 3.14, as this is traditionally a late merge for 3.13.

Queued for 3.14.

Thanks,
Brian
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html