LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Stefan Agner <stefan@agner.ch>
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
	pgaikwad@nvidia.com, dev@lynxeye.de, mirza.krak@gmail.com,
	benjamin.lindqvist@endian.se, pdeschrijver@nvidia.com,
	miquel.raynal@bootlin.com, linux-kernel@vger.kernel.org,
	krzk@kernel.org, jonathanh@nvidia.com, marek.vasut@gmail.com,
	robh+dt@kernel.org, thierry.reding@gmail.com,
	marcel@ziswiler.com, richard@nod.at, linux-tegra@vger.kernel.org,
	linux-mtd@lists.infradead.org, Dmitry Osipenko <digetx@gmail.com>,
	computersforpeace@gmail.com, dwmw2@infradead.org
Subject: Re: [PATCH v3 4/6] mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver
Date: Sat, 9 Jun 2018 08:55:44 +0200	[thread overview]
Message-ID: <20180609085544.073d803d@bbrezillon> (raw)
In-Reply-To: <20180609084615.6fba31ec@bbrezillon>

On Sat, 9 Jun 2018 08:46:15 +0200
Boris Brezillon <boris.brezillon@bootlin.com> wrote:

> On Sat, 9 Jun 2018 08:41:57 +0200
> Boris Brezillon <boris.brezillon@bootlin.com> wrote:
> 
> > On Sat, 09 Jun 2018 08:23:51 +0200
> > Stefan Agner <stefan@agner.ch> wrote:
> >   
> > > On 09.06.2018 07:52, Boris Brezillon wrote:  
> > > > On Fri, 08 Jun 2018 23:51:01 +0200
> > > > Stefan Agner <stefan@agner.ch> wrote:
> > > > 
> > > >     
> > > >> >
> > > >> > void tegra_nand_controller_reset(struct tegra_nand_controller *ctrl)
> > > >> > {
> > > >> > 	int err;
> > > >> >
> > > >> > 	disable_irq(ctrl->irq);
> > > >> >
> > > >> > 	err = reset_control_reset(ctrl->rst);
> > > >> > 	if (err) {
> > > >> > 		dev_err(ctrl->dev, "Failed to reset HW: %d\n", err);
> > > >> > 		msleep(HW_TIMEOUT);
> > > >> > 	}
> > > >> >
> > > >> > 	writel_relaxed(NAND_CMD_STATUS, ctrl->regs + HWSTATUS_CMD);
> > > >> > 	writel_relaxed(HWSTATUS_MASK, ctrl->regs + HWSTATUS_MASK);
> > > >> > 	writel_relaxed(INT_MASK, ctrl->regs + ISR);    
> > > >>
> > > >> If we do a controller reset, there is much more state than that which
> > > >> needs to be restored. A lot of it is not readily available currently
> > > >> (timing, ECC settings...)    
> > > > 
> > > > This is actually a good test to detect what is not properly initialized
> > > > by the driver. Timings should be configured correctly through    
> > > > ->setup_data_interface(). ECC engine should be disabled by default and    
> > > > only enabled when ->{read,write}_page() is called.
> > > >     
> > > 
> > > Is setup_data_interface guaranteed to be called after a failed  
> > > ->exec_op()/{read,write}_page()?  
> > 
> > No. Maybe I misunderstood when tegra_nand_controller_reset() was
> > supposed to be called. That's something I would call only once, early
> > in the probe function, so that the controller is placed in a well-known
> > state before we start using it. Definitely not something you should
> > call after each error.  
> 
> Note that if you really want to reset the controller after an error,
> you should also iterate over all chips and call nand_reset() on them.

And that's clearly not possible to call nand_reset() from ->exec_op(),
otherwise you might recurse indefinitely in ->exec_op() if it keeps
failing, because nand_reset() relies on ->exec_op() to reset the chip.
So, as you said initially, not a good idea to reset the controller in
this case. But maybe you can clear the interrupts, mask them and cancel
the current operation (if any).

  reply	other threads:[~2018-06-09  6:55 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31 22:16 [PATCH v3 0/6] mtd: rawnand: add NVIDIA Tegra NAND flash support Stefan Agner
2018-05-31 22:16 ` [PATCH v3 1/6] mtd: rawnand: add Reed-Solomon error correction algorithm Stefan Agner
2018-06-01  7:26   ` Boris Brezillon
2018-06-01  9:25     ` Boris Brezillon
2018-06-01 13:34       ` Stefan Agner
2018-06-01 13:43         ` Boris Brezillon
2018-05-31 22:16 ` [PATCH v3 2/6] mtd: rawnand: add an option to specify NAND chip as a boot device Stefan Agner
2018-06-01  7:26   ` Boris Brezillon
2018-06-05 20:11   ` Rob Herring
2018-06-06  7:28     ` Boris Brezillon
2018-05-31 22:16 ` [PATCH v3 3/6] mtd: rawnand: tegra: add devicetree binding Stefan Agner
2018-06-01  7:30   ` Boris Brezillon
2018-06-05 20:19     ` Dmitry Osipenko
2018-06-06 10:39       ` Thierry Reding
2018-06-06 10:45         ` Boris Brezillon
2018-06-06 11:07           ` Thierry Reding
2018-06-06 12:14             ` Stefan Agner
2018-06-06 12:31               ` Boris Brezillon
2018-06-05 20:13   ` Rob Herring
2018-05-31 22:16 ` [PATCH v3 4/6] mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver Stefan Agner
2018-06-01  9:20   ` Dmitry Osipenko
2018-06-08 21:51     ` Stefan Agner
2018-06-09  5:52       ` Boris Brezillon
2018-06-09  6:23         ` Stefan Agner
2018-06-09  6:41           ` Boris Brezillon
2018-06-09  6:46             ` Boris Brezillon
2018-06-09  6:55               ` Boris Brezillon [this message]
2018-06-09  6:51             ` Stefan Agner
2018-06-09 12:21       ` Dmitry Osipenko
2018-06-10 11:09         ` Stefan Agner
2018-06-10 15:00           ` Dmitry Osipenko
2018-06-10 15:32             ` Boris Brezillon
2018-06-11 11:45               ` Dmitry Osipenko
2018-06-11 11:50                 ` Boris Brezillon
2018-06-11 13:10                   ` Dmitry Osipenko
2018-06-04 17:16   ` Randolph Maaßen
2018-06-04 20:56     ` Stefan Agner
2018-06-09  5:55   ` Boris Brezillon
2018-06-09  7:18   ` Boris Brezillon
2018-05-31 22:16 ` [PATCH v3 5/6] ARM: dts: tegra: add Tegra20 NAND flash controller node Stefan Agner
2018-05-31 22:16 ` [PATCH v3 6/6] ARM: dts: tegra: enable NAND flash on Colibri T20 Stefan Agner

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=20180609085544.073d803d@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=benjamin.lindqvist@endian.se \
    --cc=computersforpeace@gmail.com \
    --cc=dev@lynxeye.de \
    --cc=devicetree@vger.kernel.org \
    --cc=digetx@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=jonathanh@nvidia.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=marcel@ziswiler.com \
    --cc=marek.vasut@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mirza.krak@gmail.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=pgaikwad@nvidia.com \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=stefan@agner.ch \
    --cc=thierry.reding@gmail.com \
    --subject='Re: [PATCH v3 4/6] mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).