From: <mark.marshall@omicronenergy.com>
To: <computersforpeace@gmail.com>, <linux-mtd@lists.infradead.org>
Cc: <markmarshall14@gmail.com>, <raghav.dogra@nxp.com>,
<boris.brezillon@free-electrons.com>, <leoyang.li@nxp.com>,
<oss@buserror.net>, <prabhakar.kushwaha@nxp.com>,
<linuxppc-dev@lists.ozlabs.org>, <raghav@freescale.com>,
<b44839@freescale.com>,
Mark Marshall <mark.marshall@omicronenergy.com>,
<stable@vger.kernel.org>
Subject: [PATCH] mtd/ifc: Fix location of eccstat registers for IFC V1.0
Date: Tue, 24 Jan 2017 12:01:22 +0100 [thread overview]
Message-ID: <1485255682-2373-1-git-send-email-mark.marshall@omicronenergy.com> (raw)
From: Mark Marshall <mark.marshall@omicronenergy.com>
The commit 7a654172161c ("mtd/ifc: Add support for IFC controller
version 2.0") added support for version 2.0 of the IFC controller.
The version 2.0 controller has the ECC status registers at a different
location to the previous versions. This broke the code for IFC all
versions less than 2.0.
Correct the fsl_ifc_nand structure so that the ECC status can be read
from the correct location for both version 1.0 and 2.0 of the controller.
Cc: stable@vger.kernel.org
Signed-off-by: Mark Marshall <mark.marshall@omicronenergy.com>
---
drivers/mtd/nand/fsl_ifc_nand.c | 5 ++++-
include/linux/fsl_ifc.h | 8 ++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index 0a177b1..123c0f8 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -260,7 +260,10 @@ static void fsl_ifc_run_command(struct mtd_info *mtd)
int sector_end = sector + chip->ecc.steps - 1;
for (i = sector / 4; i <= sector_end / 4; i++)
- eccstat[i] = ifc_in32(&ifc->ifc_nand.nand_eccstat[i]);
+ eccstat[i] = ifc_in32(
+ (ctrl->version >= FSL_IFC_VERSION_2_0_0) ?
+ &ifc->ifc_nand.v2_nand_eccstat[i] :
+ &ifc->ifc_nand.v1_nand_eccstat[i]);
for (i = sector; i <= sector_end; i++) {
errors = check_read_ecc(mtd, ctrl, eccstat, i);
diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h
index 3f9778c..c332f0a 100644
--- a/include/linux/fsl_ifc.h
+++ b/include/linux/fsl_ifc.h
@@ -733,8 +733,12 @@ struct fsl_ifc_nand {
__be32 nand_erattr1;
u32 res19[0x10];
__be32 nand_fsr;
- u32 res20[0x3];
- __be32 nand_eccstat[6];
+ u32 res20;
+ /* The V1 nand_eccstat is actually 4 words that overlaps the
+ * V2 nand_eccstat.
+ */
+ __be32 v1_nand_eccstat[2];
+ __be32 v2_nand_eccstat[6];
u32 res21[0x1c];
__be32 nanndcr;
u32 res22[0x2];
--
2.7.4
next reply other threads:[~2017-01-24 11:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-24 11:01 mark.marshall [this message]
2017-01-24 11:14 ` [PATCH] mtd/ifc: Fix location of eccstat registers for IFC V1.0 Boris Brezillon
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=1485255682-2373-1-git-send-email-mark.marshall@omicronenergy.com \
--to=mark.marshall@omicronenergy.com \
--cc=b44839@freescale.com \
--cc=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=leoyang.li@nxp.com \
--cc=linux-mtd@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=markmarshall14@gmail.com \
--cc=oss@buserror.net \
--cc=prabhakar.kushwaha@nxp.com \
--cc=raghav.dogra@nxp.com \
--cc=raghav@freescale.com \
--cc=stable@vger.kernel.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).