From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TgW73-0004F4-AE for barebox@lists.infradead.org; Thu, 06 Dec 2012 07:43:18 +0000 Date: Thu, 6 Dec 2012 08:43:15 +0100 From: Sascha Hauer Message-ID: <20121206074315.GT10369@pengutronix.de> References: <20121205185036.GM10369@pengutronix.de> <1354734167-13486-1-git-send-email-w.sang@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1354734167-13486-1-git-send-email-w.sang@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH V2] mtd: nand: mxs: reset BCH earlier, too, to avoid NAND startup problems To: Wolfram Sang Cc: barebox@lists.infradead.org On Wed, Dec 05, 2012 at 08:02:47PM +0100, Wolfram Sang wrote: > It could happen (1 out of 100 times) that NAND did not start up > correctly after warm rebooting, so barebox could not find its > environment or DMA timed out due to a stalled BCH. When resetting BCH > together with GPMI, the issue could not be observed anymore. We probably > need the consistent state already before sending commands to NAND. > > Signed-off-by: Wolfram Sang Applied, thanks Sascha > --- > drivers/mtd/nand/nand_mxs.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c > index 975a44f..c4509d3 100644 > --- a/drivers/mtd/nand/nand_mxs.c > +++ b/drivers/mtd/nand/nand_mxs.c > @@ -1128,6 +1128,7 @@ int mxs_nand_alloc_buffers(struct mxs_nand_info *nand_info) > int mxs_nand_hw_init(struct mxs_nand_info *info) > { > void __iomem *gpmi_regs = (void *)MXS_GPMI_BASE; > + void __iomem *bch_regs = (void __iomem *)MXS_BCH_BASE; > int i = 0, ret; > u32 val; > > @@ -1153,6 +1154,15 @@ int mxs_nand_hw_init(struct mxs_nand_info *info) > if (ret) > return ret; > > + val = readl(gpmi_regs + GPMI_VERSION); > + info->version = val >> GPMI_VERSION_MINOR_OFFSET; > + > + /* Reset BCH. Don't use SFTRST on MX23 due to Errata #2847 */ > + ret = mxs_reset_block(bch_regs + BCH_CTRL, > + info->version == GPMI_VERSION_TYPE_MX23); > + if (ret) > + return ret; > + > /* > * Choose NAND mode, set IRQ polarity, disable write protection and > * select BCH ECC. > @@ -1163,9 +1173,6 @@ int mxs_nand_hw_init(struct mxs_nand_info *info) > GPMI_CTRL1_BCH_MODE; > writel(val, gpmi_regs + GPMI_CTRL1); > > - val = readl(gpmi_regs + GPMI_VERSION); > - info->version = val >> GPMI_VERSION_MINOR_OFFSET; > - > return 0; > > err2: > -- > 1.7.10.4 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox