Patchwork [1/2] mtd/nand: fixup for fmr initialization of Freescale NAND controller

login
register
mail settings
Submitter Shengzhou Liu
Date Dec. 12, 2011, 9:40 a.m.
Message ID <1323682853-10750-1-git-send-email-Shengzhou.Liu@freescale.com>
Download mbox | patch
Permalink /patch/130687/
State New
Headers show

Comments

Shengzhou Liu - Dec. 12, 2011, 9:40 a.m.
There was a bug for fmr initialization, which lead to  fmr was always 0x100
in fsl_elbc_chip_init() and caused FCM command timeout before calling
fsl_elbc_chip_init_tail(), now we initialize CWTO to maximum timeout value
and not relying on the setting of bootloader.

Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
---
v3: add more descriptions.
v2: make fmr not relying on the setting of bootloader.

 drivers/mtd/nand/fsl_elbc_nand.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
Artem Bityutskiy - Dec. 17, 2011, 2:44 p.m.
On Mon, 2011-12-12 at 17:40 +0800, Shengzhou Liu wrote:
> There was a bug for fmr initialization, which lead to  fmr was always 0x100
> in fsl_elbc_chip_init() and caused FCM command timeout before calling
> fsl_elbc_chip_init_tail(), now we initialize CWTO to maximum timeout value
> and not relying on the setting of bootloader.
> 
> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>

Pushed both to l2-mtd-2.6.git, thanks!
Liu Shengzhou-B36685 - Dec. 20, 2011, 6:40 a.m.
> -----Original Message-----
> From: Artem Bityutskiy [mailto:dedekind1@gmail.com]
> Sent: Saturday, December 17, 2011 10:45 PM
> To: Liu Shengzhou-B36685
> Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421;
> dwmw2@infradead.org; Gala Kumar-B11780; linux-mtd@lists.infradead.org
> Subject: Re: [PATCH 1/2] mtd/nand: fixup for fmr initialization of
> Freescale NAND controller
> 
> On Mon, 2011-12-12 at 17:40 +0800, Shengzhou Liu wrote:
> > There was a bug for fmr initialization, which lead to  fmr was always
> > 0x100 in fsl_elbc_chip_init() and caused FCM command timeout before
> > calling fsl_elbc_chip_init_tail(), now we initialize CWTO to maximum
> > timeout value and not relying on the setting of bootloader.
> >
> > Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> 
> Pushed both to l2-mtd-2.6.git, thanks!
> 
> --
> Best Regards,
> Artem Bityutskiy

I noted it had been applied in linux-next.git tree.
Does it still need to l2-mtd-2.6.git? 
Thanks.

Best Regards,
Shengzhou Liu
Artem Bityutskiy - Dec. 22, 2011, 10:24 a.m.
On Tue, 2011-12-20 at 06:40 +0000, Liu Shengzhou-B36685 wrote:
> > -----Original Message-----
> > From: Artem Bityutskiy [mailto:dedekind1@gmail.com]
> > Sent: Saturday, December 17, 2011 10:45 PM
> > To: Liu Shengzhou-B36685
> > Cc: linuxppc-dev@lists.ozlabs.org; Wood Scott-B07421;
> > dwmw2@infradead.org; Gala Kumar-B11780; linux-mtd@lists.infradead.org
> > Subject: Re: [PATCH 1/2] mtd/nand: fixup for fmr initialization of
> > Freescale NAND controller
> > 
> > On Mon, 2011-12-12 at 17:40 +0800, Shengzhou Liu wrote:
> > > There was a bug for fmr initialization, which lead to  fmr was always
> > > 0x100 in fsl_elbc_chip_init() and caused FCM command timeout before
> > > calling fsl_elbc_chip_init_tail(), now we initialize CWTO to maximum
> > > timeout value and not relying on the setting of bootloader.
> > >
> > > Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> > 
> > Pushed both to l2-mtd-2.6.git, thanks!
> > 
> > --
> > Best Regards,
> > Artem Bityutskiy
> 
> I noted it had been applied in linux-next.git tree.
> Does it still need to l2-mtd-2.6.git? 
> Thanks.

It is in linux-next because it is pulled there from l2-mtd-2.6.git.
Thanks for head up, but no, it should stay in the l2-mtd-2.6.git.
David Woodhouse then should take care of merging the l2 tree upstream.

Patch

diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index eedd8ee..4f405a0 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -659,9 +659,7 @@  static int fsl_elbc_chip_init_tail(struct mtd_info *mtd)
 	if (chip->pagemask & 0xff000000)
 		al++;
 
-	/* add to ECCM mode set in fsl_elbc_init */
-	priv->fmr |= (12 << FMR_CWTO_SHIFT) |  /* Timeout > 12 ms */
-	             (al << FMR_AL_SHIFT);
+	priv->fmr |= al << FMR_AL_SHIFT;
 
 	dev_dbg(priv->dev, "fsl_elbc_init: nand->numchips = %d\n",
 	        chip->numchips);
@@ -764,8 +762,10 @@  static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
 	priv->mtd.priv = chip;
 	priv->mtd.owner = THIS_MODULE;
 
-	/* Set the ECCM according to the settings in bootloader.*/
-	priv->fmr = in_be32(&lbc->fmr) & FMR_ECCM;
+	/* set timeout to maximum */
+	priv->fmr = 15 << FMR_CWTO_SHIFT;
+	if (in_be32(&lbc->bank[priv->bank].or) & OR_FCM_PGS)
+		priv->fmr |= FMR_ECCM;
 
 	/* fill in nand_chip structure */
 	/* set up function call table */