devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org
Cc: dedekind1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	tharvey-UMMOYl/HMS+akBO8gow8eQ@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Subject: [PATCH] mtd: gpmi: fix the ecc regression
Date: Tue, 22 Oct 2013 11:04:02 +0800	[thread overview]
Message-ID: <1382411042-30421-1-git-send-email-b32955@freescale.com> (raw)

The patch "2febcdf mtd: gpmi: set the BCHs geometry with the ecc info"
makes the gpmi to use the ECC info provided by the MTD code, and creates
a different NAND ecc layout for the BCH which brings a regression to us:
   We can not mount the ubifs which was created by the old NAND ecc layout.

This patch adds a new property : "fsl,use-mtd-ecc-info".

If we do not enable it, we will use the ecc strength calculated by ourselves
and use all the OOB area (this is the legacy method);

If we enable it, we will use the ecc strength provided by the MTD layer,
and create a new NAND ecc layout which may has free space in the OOB
(for some SLC nand, we may support the JFFS2 with the new NAND ecc layout).

Signed-off-by: Huang Shijie <b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
---
 .../devicetree/bindings/mtd/gpmi-nand.txt          |    4 ++++
 drivers/mtd/nand/gpmi-nand/gpmi-nand.c             |    7 ++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/mtd/gpmi-nand.txt b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
index 551b2a1..fe84a3d 100644
--- a/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/gpmi-nand.txt
@@ -17,6 +17,10 @@ Required properties:
 Optional properties:
   - nand-on-flash-bbt: boolean to enable on flash bbt option if not
                        present false
+  - fsl,use-mtd-ecc-info: By enabling this boolean property, the gpmi can uses
+                       the MTD's ECC info (if the MTD has). So we may have free
+                       space in the OOB area, and we may support the JFFS2 with
+                       some SLC nand, such as Micron's SLC nand.
 
 The device tree may optionally contain sub-nodes describing partitions of the
 address space. See partition.txt for more detail.
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 5a1bbc7..62c0712 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -271,7 +271,9 @@ static int legacy_set_geometry(struct gpmi_nand_data *this)
 		dev_err(this->dev,
 			"We can not support this nand chip."
 			" Its required ecc strength(%d) is beyond our"
-			" capability(%d).\n", geo->ecc_strength,
+			" capability(%d). If you have not enabled the"
+			"'fsl,use-mtd-ecc-info', enable it and try again.\n",
+			geo->ecc_strength,
 			(GPMI_IS_MX6Q(this) ? MX6_ECC_STRENGTH_MAX
 					: MXS_ECC_STRENGTH_MAX));
 		return -EINVAL;
@@ -352,6 +354,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-mtd-ecc-info"))
+		return legacy_set_geometry(this);
+
 	return set_geometry_by_ecc_info(this) ? 0 : legacy_set_geometry(this);
 }
 
-- 
1.7.2.rc3


--
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

             reply	other threads:[~2013-10-22  3:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22  3:04 Huang Shijie [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-10-22  5:10 [PATCH] mtd: gpmi: fix the ecc regression Huang Shijie
     [not found] ` <1382418628-4521-1-git-send-email-b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2013-10-22 13:34   ` Mark Rutland
2013-10-23 14:33     ` David Woodhouse
2013-10-22 18:56   ` Brian Norris
     [not found]     ` <20131022185639.GK23337-bU/DPfM3abD4WzifrMjOTkcViWtcw2C0@public.gmane.org>
2013-10-24  6:59       ` Huang Shijie
     [not found]         ` <5268C56E.8050806-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2013-10-24  7:52           ` Brian Norris
     [not found]             ` <20131024075249.GB9863-7ciq9WCbhwJWVhifINYOO1poFGfAdsVx5NbjCUgZEJk@public.gmane.org>
2013-10-24  8:38               ` Huang Shijie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382411042-30421-1-git-send-email-b32955@freescale.com \
    --to=b32955-kzfg59tc24xl57midrcfdg@public.gmane.org \
    --cc=computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=dedekind1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=tharvey-UMMOYl/HMS+akBO8gow8eQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).