From: Scott Wood Date: Mon, 13 Jan 2014 12:18:45 -0600 Subject: [U-Boot] [PATCH] nand: fix reading after switching ecc In-Reply-To: <20980858CB6D3A4BAE95CA194937D5E73EA61001@DBDE04.ent.ti.com> References: <1389447588-17529-1-git-send-email-jeroen@myspectrum.nl> <20980858CB6D3A4BAE95CA194937D5E73EA61001@DBDE04.ent.ti.com> Message-ID: <1389637125.24905.32.camel@snotra.buserror.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Mon, 2014-01-13 at 08:29 +0000, Gupta, Pekon wrote: > Hi Jeroen, > > > > >The omap_gpmc allows switching ecc at runtime. Since > >the NAND_SUBPAGE_READ flag is only set, it is kept when > >switching to hw ecc, which is not correct. This leads to > >calling chip->ecc.read_subpage which is not a valid > >pointer. Therefore also clear the flag so reading in > >hw mode works again. > > > >Cc: Scott Wood > >Cc: Pekon Gupta > >Cc: Nikita Kiryanov > >Signed-off-by: Jeroen Hofstee > >--- > > drivers/mtd/nand/nand_base.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > >diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c > >index 1ce55fd..0762a19 100644 > >--- a/drivers/mtd/nand/nand_base.c > >+++ b/drivers/mtd/nand/nand_base.c > >@@ -3354,6 +3354,8 @@ int nand_scan_tail(struct mtd_info *mtd) > > /* Large page NAND with SOFT_ECC should support subpage reads */ > > if ((chip->ecc.mode == NAND_ECC_SOFT) && (chip->page_shift > 9)) > > chip->options |= NAND_SUBPAGE_READ; > >+ else > >+ chip->options &= ~NAND_SUBPAGE_READ; NACK; this breaks NAND_SUBPAGE_READ with hardware ECC for drivers that support it. > I don't think it's good to add OMAP specific changes to nand_base.c. > It's better if you can add this as part of omap_select_ecc_scheme() in omap_gpmc.c Yes, clear it from the OMAP switching code if OMAP can't do subpage reads with hardware ECC. -Scott