linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mychaela Falconia <mychaela.falconia@gmail.com>
To: Ricard Wanderlof <ricard.wanderlof@axis.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>,
	devicetree@vger.kernel.org, Tony Lindgren <tony@atomide.com>,
	linux-kernel@vger.kernel.org,
	Oleksij Rempel <linux@rempel-privat.de>,
	Linux mtd <linux-mtd@lists.infradead.org>,
	Benoit Cousson <bcousson@baylibre.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 3/4] mtd: nand: Add support for Evatronix NANDFLASH-CTRL
Date: Thu, 9 Jun 2016 09:24:19 -0800	[thread overview]
Message-ID: <CA+uuBqb4fG4nK7atrF7XOQ=ip2SfKrxU+KXqD3W+PA_ZA7cS3g@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1606071702220.19416@lnxricardw1.se.axis.com>

On 6/9/16, Ricard Wanderlof <ricard.wanderlof@axis.com> wrote:
> The designers of this IP apparantly did not have Linux in mind when they
> designed the controller, since it does all the low level stuff
> autonomously (in the right IP configuration it can even remap flash blocks
> transparently), with no way of intervening. For instance, when doing
> hardware ECC, the OOB data is not available anywhere to the user, and if
> one wants to actually read it a separate OOB write needs to be done. I
> think the target market for the IP is really a general real time OS where
> there is no NAND driver available, and you just want to fire off a single
> high level command, wait for an interrupt, and have your data waiting for
> you.

I expect to see more and more newer NAND flash controllers that are
like this. The one I am working with (FTNANDC024 from Faraday) is like
this too - very very high-level.

> This latter property is actually advantageous in Linux too as the driver
> doesn't have to do bit- and byte-banging against the NAND flash. I'm not
> sure what the gain in overhead is in practice, but at any rate there's not
> much of a choice.

It should be advantageous to any OS that uses the abstractions
provided by the hardware instead of fighting them. The problem is that
the Linux MTD system's current idea of what a NAND controller should
look like is now out of sync with the new hardware realities.

> Given that the controller does not have the transparency that the
> ->cmd_ctrl() approach requires, as noted above, I can't see how it could
> be simplified.
>
> I basically need to grab everything needed for a given operation and
> interpret it before handing it over to the controller. I considered using
> a higher level API, by replacing the default ->cmdfunc() (default
> nand_command/nand_command_lp) with a specific version, which would have
> avoided the need to interpret the NAND commands arriving via ->cmd_ctrl(),
> but that meant duplicating some of the logic in nand_base.c which seemed
> like a bad idea.

For my FTNANDC024 driver I went for an ever more radical approach: I
decided to forego the "nand" layer in Linux entirely and attach my
driver directly to the MTD layer. There is very little that
nand_base.c provides that is useful to a high-level controller whose
abstractions are "read these logical sectors", "write these logical
sectors" and "erase these blocks", it is really only useful for the
simpler NAND controllers that don't do all of the heavy lifting in
hardware.

And it is NOT a question of "optimization" - the problem is not that
going through the paradigm imposed by nand_base.c precludes the use of
some optional higher-performance features of smart controllers -
instead the controllers which you and I are working with *require* the
use of their highly abstracted interfaces, and *do not* provide any
kind of raw or transparent pass-through mode.

M~

  parent reply	other threads:[~2016-06-09 17:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02  7:48 [PATCH 3/4] mtd: nand: Add support for Evatronix NANDFLASH-CTRL Ricard Wanderlof
2016-06-03 14:59 ` Boris Brezillon
2016-06-09  8:19   ` Ricard Wanderlof
2016-06-09  9:08     ` Boris Brezillon
2016-06-10 14:40       ` Ricard Wanderlof
2016-06-10 15:34         ` Boris Brezillon
2016-06-10 16:00           ` Ricard Wanderlof
2016-06-09 17:24     ` Mychaela Falconia [this message]
2016-06-09 18:01       ` Boris Brezillon
2016-06-09 19:35         ` Mychaela Falconia
2016-06-09 20:23           ` Boris Brezillon
2016-06-10  5:07             ` Mychaela Falconia
2016-06-10 12:40               ` Boris Brezillon
2016-06-12 16:08                 ` Boris Brezillon
2016-06-10 14:22             ` Ricard Wanderlof
2016-06-10 16:07               ` Boris Brezillon
2016-06-10 16:51                 ` Ricard Wanderlof
2016-06-13  7:19                 ` Ricard Wanderlof

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='CA+uuBqb4fG4nK7atrF7XOQ=ip2SfKrxU+KXqD3W+PA_ZA7cS3g@mail.gmail.com' \
    --to=mychaela.falconia@gmail.com \
    --cc=bcousson@baylibre.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux@rempel-privat.de \
    --cc=ricard.wanderlof@axis.com \
    --cc=tony@atomide.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 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).