All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Kurt Kanzenbach <kurt.kanzenbach@linutronix.de>
Cc: Boris Brezillon <boris.brezillon@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Gregory CLEMENT <gregory.clement@bootlin.com>,
	Jane Wan <Jane.Wan@nokia.com>,
	Jagdish Gediya <jagdish.gediya@nxp.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mtd: nand: fsl-ifc: fixup SRAM init for newer ctrl versions
Date: Wed, 8 Aug 2018 14:33:52 +0200	[thread overview]
Message-ID: <20180808143352.2f5b999c@xps13> (raw)
In-Reply-To: <20180808100909.anfi3qlfjnzb74p2@linutronix.de>

Hi Kurt,


> > > @@ -769,6 +770,23 @@ static int fsl_ifc_sram_init(struct fsl_ifc_mtd *priv)
> > >  	uint32_t csor = 0, csor_8k = 0, csor_ext = 0;
> > >  	uint32_t cs = priv->bank;
> > >
> > > +	if (ctrl->version > FSL_IFC_VERSION_1_1_0) {  
> >
> > This is redundant and fsl_ifc_sram_init() is called only if
> > "ctrl->version > FSL_FC_VERSION_1_1_0".  
> 
> No, it's not. It's called when ctrl->version >=
> FSL_IFC_VERSION_1_1_0. Therefore, this check is needed.

Oh right, I missed the "=".

> 
> >
> > So this means this function has never worked?  
> 
> It did work for e.g. IFC controller in version 1.1.0.
> 
> However, it worked for the newer versions by accident, because U-Boot
> already initialized the SRAM correctly. If you boot without NAND
> initialization in U-Boot, then you'll hit the issue.
> 
> >
> > If this is the case, there should be at least a Fixes: tag.
> >
> > Maybe it would be cleaner to always call fsl_ifc_sram_init() from the
> > probe(), and just exit with a "return 0" here if the version is old?
> > (I'll let you choose the way you prefer).  
> 
> Sounds like a good idea. Otherwise we have to check the version twice.
> 
> >  
> > > +		u32 ncfgr, status;
> > > +		int ret;
> > > +
> > > +		/* Trigger auto initialization */
> > > +		ncfgr = ifc_in32(&ifc_runtime->ifc_nand.ncfgr);
> > > +		ifc_out32(ncfgr | IFC_NAND_NCFGR_SRAM_INIT_EN, &ifc_runtime->ifc_nand.ncfgr);
> > > +
> > > +		/* Wait until done */
> > > +		ret = readx_poll_timeout(ifc_in32, &ifc_runtime->ifc_nand.ncfgr,
> > > +					 status, !(status & IFC_NAND_NCFGR_SRAM_INIT_EN),
> > > +					 10, 1000);  
> >
> > Nit: I always prefer when delays/timeouts are defined (and may be
> > reused).  
> 
> Me too. I've missed that there is already a timeout constant
> IFC_TIMEOUT_MSECS (500). As it's huge, I'll add a second one.

Well, I'm not bothered with huge timeouts, it's in the error path so we
don't really care.

Thanks,
Miquèl

  reply	other threads:[~2018-08-08 12:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06  9:21 [PATCH 0/2] mtd: nand: fsl-ifc: fix SRAM initialization for newer controller Kurt Kanzenbach
2018-08-06  9:21 ` [PATCH 1/2] mtd: nand: fsl-ifc: check result of SRAM initialization Kurt Kanzenbach
2018-08-06  9:21 ` [PATCH 2/2] mtd: nand: fsl-ifc: fixup SRAM init for newer ctrl versions Kurt Kanzenbach
2018-08-08  9:48   ` Miquel Raynal
2018-08-08 10:09     ` Kurt Kanzenbach
2018-08-08 12:33       ` Miquel Raynal [this message]
2018-08-08 13:12         ` Kurt Kanzenbach

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=20180808143352.2f5b999c@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=Jane.Wan@nokia.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=gregory.clement@bootlin.com \
    --cc=jagdish.gediya@nxp.com \
    --cc=kurt.kanzenbach@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    --cc=yamada.masahiro@socionext.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.