public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: 潘栋 <peterpansjtu@gmail.com>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Frans Klaver <fransklaver@gmail.com>,
	Peter Pan <peterpandong@micron.com>,
	beanhuo@micron.com,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	karlzhang@micron.com
Subject: Re: [PATCH v2 00/12] mtd: nand_bbt: introduce independent nand BBT
Date: Wed, 30 Dec 2015 09:31:06 +0100	[thread overview]
Message-ID: <20151230093106.6b1ee118@bbrezillon> (raw)
In-Reply-To: <CAAyFOR+J1VG9tZdahP=z=yth_om0O_58HH1BVScP3-rvsQj+VA@mail.gmail.com>

Hi Peter,

On Wed, 30 Dec 2015 15:18:39 +0800
潘栋 <peterpansjtu@gmail.com> wrote:

> Hi Boris and Ezequiel,
> 
> 2015-12-29 23:11 GMT+08:00 Boris Brezillon <boris.brezillon@free-electrons.com>:
> > On Tue, 29 Dec 2015 12:07:50 -0300
> > Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> wrote:
> >
> >> On 29 December 2015 at 06:35, Boris Brezillon
> >> <boris.brezillon@free-electrons.com> wrote:
> >> > Hi,
> >> >
> >> > On Mon, 28 Dec 2015 17:42:50 -0300
> >> > Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> wrote:
> >> >
> >> >> This is looking a lot better, thanks for the good work!
> >> >>
> >> >> On 15 December 2015 at 02:59, Peter Pan <peterpansjtu@gmail.com> wrote:
> >> >> > Currently nand_bbt.c is tied with struct nand_chip, and it makes other
> >> >> > NAND family chips hard to use nand_bbt.c. Maybe it's the reason why
> >> >> > onenand has own bbt(onenand_bbt.c).
> >> >> >
> >> >> > Separate struct nand_chip from BBT code can make current BBT shareable.
> >> >> > We create struct nand_bbt to take place of nand_chip in nand_bbt.c.
> >> >> > Struct nand_bbt contains all the information BBT needed from outside and
> >> >> > it should be embedded into NAND family chip struct (such as struct nand_chip).
> >> >> > NAND family driver should allocate, initialize and free struct nand_bbt.
> >> >> >
> >> >> > Below is mtd folder structure we want:
> >> >> >         mtd
> >> >> >         ├── Kconfig
> >> >> >         ├── Makefile
> >> >> >         ├── ...
> >> >> >         ├── nand_bbt.c
> >> >>
> >> >> Hm.. I'm not sure about having nand_bbt.c in drivers/mtd.
> >> >> What's wrong with drivers/mtd/nand ?
> >> >
> >> > I haven't reviewed the series yet, but I agree. If the BBT code is only
> >> > meant to be used on NAND based devices, it should probably stay in
> >> > drivers/mtd/nand.
> >> >
> >> >>
> >> >> In fact, I  was thinking we could go further and clean up the directories a bit
> >> >> by separating core code, from controllers code, from SPI NAND code:
> >> >>
> >> >> drivers/mtd/nand/
> >> >> drivers/mtd/nand/controllers
> >> >> drivers/mtd/nand/spi
> >> >>
> >> >> Makes any sense?
> >> >
> >> > Actually I had the secret plan of moving all (raw) NAND controller
> >> > drivers into the drivers/mtd/nand/controllers directory, though this
> >> > was for a different reason: I'd like to create another directory for
> >> > manufacturer specific code in order to support some advanced features
> >> > on NANDs that do not implement (or only partially implement) the ONFI
> >> > standard.
> >> >
> >> > The separation you're talking about here is more related to the
> >> > interface used to communicate with the NAND chip.
> >> >
> >> > How about using the following hierarchy?
> >> >
> >> > drivers/mtd/nand/<nand-core-code>
> >> > drivers/mtd/nand/interfaces/raw/<raw-nand-core-code>
> >> > drivers/mtd/nand/interfaces/raw/controllers/<raw-nand-controller-drivers>
> >> > drivers/mtd/nand/interfaces/spi/<spi-nand-code>
> >> > drivers/mtd/nand/interfaces/onenand/<onenand-code>
> >> > drivers/mtd/nand/chips/<manufacturer-spcific-code>
> >> >
> >> > What do you think?
> >> >
> >>
> >> I believe we are bikeshedding here, but what the heck.
> >>
> >> That seems too involved. A simpler hierarchy could be clear enough,
> >> and seems to follow what other subsystems do:
> >>
> >> drivers/mtd/nand/<all-nand-core-code>
> >> drivers/mtd/nand/raw/<raw-nand-controller-drivers>
> >
> > And probably some common logic in there too.
> >
> >> drivers/mtd/nand/spi/<spi-nand-code>
> >> drivers/mtd/nand/onenand/<onenand-code>
> >> drivers/mtd/nand/chips/<manufacturer-spcific-code>
> >>
> >
> > I'm fine with this one too ;-).
> 
> I'm fine with this structure too. drivers/mtd/nand folder becomes top folder for
> all NAND based devices. Because (raw)NAND, SPI-NAND and ONENAND have
> different command set and feature, each has its own core - nand_base.c
> spi-nand-base.c
> and onenand_base.c. So maybe it'll take a lot effort to abstract a
> all-nand-core-code
> (of course BBT should be one of them). What's your opinion?

Absolutely, that was the idea: move everything into the
drivers/mtd/nand directory (with the structure described above), keep
some specific logic for each interface type, and see if we can factor
out some common code (I noticed that SPI NAND devices have a parameter
page which looks similar to the one exposed by ONFI compliant devices,
except this parameter page is retrieved using a different command, the
same goes for the ->{set,get}_features() functions).
But let's focus on the nand_bbt code for now.

> 
> Also, please review the BBT patch if you have time. I think it's
> helpful on the new NAND code
> hierarchy.

I'll try to review it this week.

Best Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  reply	other threads:[~2015-12-30  8:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-15  5:59 [PATCH v2 00/12] mtd: nand_bbt: introduce independent nand BBT Peter Pan
2015-12-15  5:59 ` [PATCH v2 01/12] mtd: nand_bbt: new header for nand family BBT Peter Pan
2015-12-15  5:59 ` [PATCH v2 02/12] mtd: nand_bbt: introduce struct nand_bbt Peter Pan
2016-01-06 13:12   ` Boris Brezillon
2015-12-15  5:59 ` [PATCH v2 03/12] mtd: nand_bbt: add new API definitions Peter Pan
2015-12-15  5:59 ` [PATCH v2 04/12] mtd: nand_bbt: add nand_bbt_markbad_factory() interface Peter Pan
2015-12-15  5:59 ` [PATCH v2 05/12] mtd: nand: use new BBT API instead of old ones Peter Pan
2016-01-06 13:36   ` Boris Brezillon
2016-01-06 14:38   ` Boris Brezillon
2016-01-06 15:22   ` Boris Brezillon
2016-01-07  6:03     ` Peter Pan
2015-12-15  5:59 ` [PATCH v2 06/12] mtd: nand_bbt: use erase() and is_bad_bbm() hook in BBT Peter Pan
2016-01-06 13:49   ` Boris Brezillon
2015-12-15  5:59 ` [PATCH v2 07/12] mtd: nand: make nand_erase_nand() static Peter Pan
2015-12-15  5:59 ` [PATCH v2 08/12] mtd: nand_bbt: remove struct nand_chip from nand_bbt.c Peter Pan
2016-01-06 15:16   ` Boris Brezillon
2016-01-07  6:04     ` Peter Pan
2015-12-15  5:59 ` [PATCH v2 09/12] mtd: nand_bbt: remove old API definitions Peter Pan
2015-12-15  5:59 ` [PATCH v2 10/12] mtd: nand_bbt: remove NAND_BBT_DYNAMICSTRUCT macro Peter Pan
2015-12-15  5:59 ` [PATCH v2 11/12] mtd: nand: remove nand_chip.bbt Peter Pan
2015-12-15  5:59 ` [PATCH v2 12/12] mtd: nand-bbt: move nand_bbt.c to mtd folder Peter Pan
2015-12-28 20:42 ` [PATCH v2 00/12] mtd: nand_bbt: introduce independent nand BBT Ezequiel Garcia
2015-12-29  9:35   ` Boris Brezillon
2015-12-29 15:07     ` Ezequiel Garcia
2015-12-29 15:11       ` Boris Brezillon
2015-12-30  7:18         ` 潘栋
2015-12-30  8:31           ` Boris Brezillon [this message]
2016-01-06 14:29             ` Boris Brezillon
2016-01-07  5:53               ` Peter Pan

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=20151230093106.6b1ee118@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=beanhuo@micron.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=fransklaver@gmail.com \
    --cc=karlzhang@micron.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=peterpandong@micron.com \
    --cc=peterpansjtu@gmail.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