public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikita Yushchenko <nyushchenko@dev.rtsoft.ru>
To: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Jingoo Han <jg1.han@samsung.com>,
	Grant Likely <grant.likely@linaro.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Prabhakar Kushwaha <prabhakar@freescale.com>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	lugovskoy@dev.rtsoft.ru,
	Nikita Yushchenko <nyushchenko@dev.rtsoft.ru>
Subject: [PATCH] mtd: fsl_elbc_nand: set NAND_NO_SUBPAGE_WRITE flag if using hardware ECC
Date: Tue,  6 May 2014 13:14:38 +0400	[thread overview]
Message-ID: <1399367678-31878-1-git-send-email-nyushchenko@dev.rtsoft.ru> (raw)

Per MPC8572E manual, sec 14.4.3.1.3: "Transfers shorter than a full page,
however, require software to prepare the appropriate ECC in the spare
region"

Need to set NAND_NO_SUBPAGE_WRITE flag. If this is not done, then
generic nand_write_subpage_hwecc() is called instead of driver's
write routine, which results into OOPS dereferencing NULL chip->ecc.hwctl
pointer.

Signed-off-by: Nikita Yushchenko <nyushchenko@dev.rtsoft.ru>
---
 drivers/mtd/nand/fsl_elbc_nand.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index ec549cd..bb146a0 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -766,6 +766,8 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
 	if ((in_be32(&lbc->bank[priv->bank].br) & BR_DECC) ==
 	    BR_DECC_CHK_GEN) {
 		chip->ecc.mode = NAND_ECC_HW;
+		/* hardware can't calculate ECC for subpages */
+		chip->options |= NAND_NO_SUBPAGE_WRITE;
 		/* put in small page settings and adjust later if needed */
 		chip->ecc.layout = (priv->fmr & FMR_ECCM) ?
 				&fsl_elbc_oob_sp_eccm1 : &fsl_elbc_oob_sp_eccm0;
-- 
1.7.10.4


             reply	other threads:[~2014-05-06  9:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06  9:14 Nikita Yushchenko [this message]
2014-05-06  9:57 ` [PATCH] mtd: fsl_elbc_nand: set NAND_NO_SUBPAGE_WRITE flag if using hardware ECC Gupta, Pekon

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=1399367678-31878-1-git-send-email-nyushchenko@dev.rtsoft.ru \
    --to=nyushchenko@dev.rtsoft.ru \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=grant.likely@linaro.org \
    --cc=jg1.han@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=lugovskoy@dev.rtsoft.ru \
    --cc=paul.gortmaker@windriver.com \
    --cc=prabhakar@freescale.com \
    --cc=rob.herring@calxeda.com \
    /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