From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
To: Brian Norris <computersforpeace@gmail.com>
Cc: bpqw@micron.com, "Qi Wang 王起" <qiwang@micron.com>,
"Ionela Voinescu" <ionela.voinescu@imgtec.com>,
frankliu@micron.com, "Andrew Bresticker" <abrestic@chromium.org>,
linux-mtd@lists.infradead.org, arnaud.mouiche@invoxia.com,
"James Hartley" <james.hartley@imgtec.com>,
"\"Peter Pan 潘栋 (peterpandong)\"" <peterpandong@micron.com>
Subject: Re: [PATCH 0/6] SPI NAND for everyone
Date: Tue, 06 Jan 2015 18:03:25 -0300 [thread overview]
Message-ID: <54AC4D9D.2050900@imgtec.com> (raw)
In-Reply-To: <20150106033012.GH9759@ld-irv-0074>
On 01/06/2015 12:30 AM, Brian Norris wrote:
> Hi Ezequiel,
>
> On Tue, Dec 02, 2014 at 09:58:50AM -0300, Ezequiel Garcia wrote:
>> During the discussion of Ionela Voinescu's patch to support GD5F SPI NAND
>> devices [1], it was decided that a proper SPI NAND framework was needed
>> to support the mt29f device (driver currently in staging area) and the new
>> gd5f.
>>
>> This patchset is a first attempt to address this.
>
> Thanks for this effort. I've finally had a better chance to look through
> your implementation and to give it some better thought.
>
Great, thanks for the review.
>> The SPI NAND framework allows devices to register as NAND drivers. This is
>> useful to take advantage of the bad block management code.
>
> I'm not so sure about this choice, but then I'm not so sure about the
> alternatives earlier. I understand that you and Qi Wang might have had
> some discussion off-list (please feel free to fill me and others in
> here, and I can add my thoughts).
>
Indeed, I believe Qi Wang have these same concerns.
> The BBT code is something we definitely want to share, but it's actually
> not very closely tied to nand_base.c, and it looks pretty easy to adapt
> to any MTD that implements mtd_read_oob()/mtd_write_oob(). We'd just
> need to parameterize a few relevant device details into a new nand_bbt
> struct, rather than using struct nand_chip directly.
>
> It also looks like the identification code (read ID, ONFI / JEDEC
> parameter pages) may differ, and SPI NAND may continue to evolve
> differently. For instance, I see that Micron SPI NAND has a
> (non-standardized) ONFI-like parameter page. It's mostly compatible with
> ONFI, except it leaves out N/A fields and doesn't use an official
> 'revision' bitfield. This probably isn't 100% shareable with parallel
> NAND code, if we use it at all.
>
> So, I think we'll need to weigh the options of which one gives more bang
> for the buck.
>
> FWIW, I don't think the implementation in this series is that bad. Even
> if we want to migrate to have less dependence on the current nand_base
> implementation for non-parallel-NAND code, I think it's doable after
> merging. We'd just need to keep the drivers/spi/ and DT binding formats
> stable, while remaining free to refactor internally.
>
Well, the DT binding itself looks pretty simple, it's just a compatible
and the usual SPI child properties. Regarding the SPI interface, that's
not related to the "based on NAND or not" discussion.
The SPI API is called only in the spi-nand-device.c file, through the
spi-nand hooks. These hooks would remain, as they mirror the SPI NAND
commands I've seen in Micron and Gigadevice flashes.
On the other side, I'm not convinced about merging the driver knowing
we will have to refactor it to make it independent of the NAND core.
Perhaps I should give it a shot and see how hard is it to make it
based on MTD, yet use the BBT code.
>> Given the
>> SPI NAND and the bare NAND commands are different, the SPI NAND framework
>> implements its own .cmdfunc callback, which is in charge of calling
>> device-specific hooks for each of the flash operations (read, program, erase,
>> etc).
>
> I'm not really a big fan of the switch/case remapping of one command set
> into another (in this case, translating parallel NAND commands into
> their SPI NAND equivalents). At times they may be necessary, but as food
> for thought, we might consider alternatives, like additional replaceable
> hooks in struct nand_chip.
>
>> The SPI NAND framework does not deal with SPI transactions per-se. Instead,
>> the SPI messages should be prepared by the users of the SPI NAND framework
>> (those that implement the device-specific hooks).
>
> Sounds reasonable. Does this leave room for hardware that is optimized
> for SPI NAND, without implementing a full SPI controller, and therefore
> does not use the drivers/spi/ infrastructure? Not sure if such a thing
> exists yet (or will exist), but it does pop up in SPI NOR.
>
Exactly, this separation is meant not only to properly split
responsabilities, but also to allow to introduce such drivers in an
elegante fashion.
>> The result can be expressed in the following hierarchy:
>>
>> Userspace
>> ------------------
>> MTD
>> ------------------
>> NAND core
>> ------------------
>> SPI NAND core
>> ------------------
>> SPI NAND device
>> ------------------
>> SPI core
>> ------------------
>> SPI master
>> ------------------
>> Hardware
>
> This is a pretty good description, but some details are not quite right.
> e.g., "userspace" should probably be removed or elaborated -- the
> hierarchy could just stop at the "MTD API" (mtd_read(), mtd_write(),
> mtd_erase(), etc.). Its users might be user-space (via mtdchar) or UBI,
> JFFS2, etc.
>
> Also, it might help to either flesh out what these hierarchies actually
> mean by pointing to specific files, by additional commentary, or both.
> It helps if you can also use the same language as the SPI documentation
> for the lower levels of this hierarchy.
>
> We might want to add something like this as official documentation,
> possibly to Documentation/mtd/. Short and sweet is fine (i.e., not much
> more than a cleaned up version of this cover letter).
>
OK, that's certainly doable, once we agree on the overall approach.
[..]
>
> I have some more code review comments, but those aren't as important at
> the moment if we're still not sure about the overall approach.
>
Sure.
BTW, regarding the compatible string, I was thinking about using
a generic spi-nand compatible, if at all possible, and let the probe
routine detect the specific device and pick hooks, set flags, etc.
How does this sound?
--
Ezequiel
next prev parent reply other threads:[~2015-01-06 21:05 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-02 12:58 [PATCH 0/6] SPI NAND for everyone Ezequiel Garcia
2014-12-02 12:58 ` [PATCH 1/6] mtd: nand: Check length of ID before reading bits per cell Ezequiel Garcia
2014-12-13 0:51 ` Daniel Ehrenberg
2015-01-05 20:38 ` Brian Norris
2014-12-02 12:58 ` [PATCH 2/6] mtd: nand: Add JEDEC manufacturer ID for Gigadevice Ezequiel Garcia
2014-12-13 0:49 ` Daniel Ehrenberg
2015-04-21 23:04 ` Ezequiel Garcia
2015-04-22 17:47 ` Brian Norris
2014-12-02 12:58 ` [PATCH 3/6] mtd: nand: Allow to set a per-device ECC layout Ezequiel Garcia
2014-12-13 0:34 ` Daniel Ehrenberg
2014-12-02 12:58 ` [PATCH 4/6] mtd: Introduce SPI NAND framework Ezequiel Garcia
2014-12-15 21:18 ` Daniel Ehrenberg
2014-12-16 0:08 ` Ezequiel Garcia
[not found] ` <87F60714EC601C4C83DFF1D2E3D390A049EE77@NTXXIAMBX02.xacn.micron.com>
2014-12-22 4:34 ` Qi Wang 王起 (qiwang)
2014-12-22 15:44 ` Ezequiel Garcia
2015-01-05 20:47 ` Brian Norris
2014-12-02 12:58 ` [PATCH 5/6] mtd: spi-nand: Add devicetree binding Ezequiel Garcia
2014-12-13 1:27 ` Daniel Ehrenberg
2014-12-02 12:58 ` [PATCH 6/6] mtd: spi-nand: Support common SPI NAND devices Ezequiel Garcia
2014-12-13 1:27 ` Daniel Ehrenberg
2014-12-15 19:36 ` Ezequiel Garcia
2014-12-15 20:17 ` Daniel Ehrenberg
[not found] ` <87F60714EC601C4C83DFF1D2E3D390A049EE65@NTXXIAMBX02.xacn.micron.com>
2014-12-22 4:34 ` Qi Wang 王起 (qiwang)
2014-12-22 16:16 ` Ezequiel Garcia
2014-12-10 17:41 ` [PATCH 0/6] SPI NAND for everyone Ezequiel Garcia
2015-01-06 3:30 ` Brian Norris
2015-01-06 21:03 ` Ezequiel Garcia [this message]
2015-01-07 0:55 ` Qi Wang 王起 (qiwang)
2015-01-07 12:13 ` Ezequiel Garcia
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=54AC4D9D.2050900@imgtec.com \
--to=ezequiel@vanguardiasur.com.ar \
--cc=abrestic@chromium.org \
--cc=arnaud.mouiche@invoxia.com \
--cc=bpqw@micron.com \
--cc=computersforpeace@gmail.com \
--cc=frankliu@micron.com \
--cc=ionela.voinescu@imgtec.com \
--cc=james.hartley@imgtec.com \
--cc=linux-mtd@lists.infradead.org \
--cc=peterpandong@micron.com \
--cc=qiwang@micron.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.