linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Peter Pan <peterpansjtu@gmail.com>
Cc: Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
	karlzhang@micron.com, beanhuo@micron.com,
	Jiancheng Xue <xuejiancheng@huawei.com>,
	Peter Pan <peterpandong@micron.com>
Subject: Re: [PATCH 02/11] mtd: nand_bbt: introduce BBT related data structure
Date: Wed, 4 May 2016 22:33:09 +0200	[thread overview]
Message-ID: <20160504223309.2da46b02@bbrezillon> (raw)
In-Reply-To: <CAAyFORKWTKmBZNx22NaOwHUzH+FW34PNxMuEqejXvBSwru9FoA@mail.gmail.com>

Hi Peter,

On Wed, 4 May 2016 09:36:05 +0800
Peter Pan <peterpansjtu@gmail.com> wrote:

> Hi Boris,
> 
> On Tue, Apr 19, 2016 at 3:34 PM, Boris Brezillon
> <boris.brezillon@free-electrons.com> wrote:
> > Hi Peter,
> >
> > On Tue, 19 Apr 2016 08:40:40 +0800
> > Peter Pan <peterpansjtu@gmail.com> wrote:  
> >>  
> >> >  
> >> >> So it's true, it
> >> >> should still be numchips in nand_bbt.c?  I just came out this question when
> >> >> making v4. :)  
> >> >
> >> > BTW, I have something for you [1]. I started to move things around to
> >> > allow spinand and onenand layers to lie under drivers/mtd/nand/, and I
> >> > wonder if we shouldn't do this move before reworking the nand_bbt code
> >> > to make it generic.
> >> > Note that this rework is not finished yet, but it gives a rough idea of
> >> > what I'd like to see.  
> >>
> >> I saw you also rework BBT in your git tree, which is a bit duplicate
> >> with my BBT patch,
> >> so should I continue my BBT patch by join part of your BBT rework code
> >> or continue
> >> your git tree ?  
> >
> > Well, if you ask me what I'd prefer, it's clearly the 2nd solution.
> > Note that my branch should just serve as a reference of what I expect,
> > it just a pile of rework that should probably be reordered and cleaned
> > up.
> >
> > Here's the sequencing I'd like to see:
> >
> > 1/ Move include/linux/mtd/nand.h into include/linux/mtd/rawnand.h and
> >    move all files under drivers/mtd/nand/ into
> >    drivers/mtd/nand/rawnand (including nand_bbt.c). This can be done in
> >    several patches
> >
> > 2/ Add the generic nand layer (include/linux/mtd/nand.h and
> >    drivers/mtd/nand/core.c). In my version I put everything in
> >    include/linux/mtd/nand.h, but maybe we'll need a few functions to be
> >    defined in drivers/mtd/nand/core.c.
> >
> > 3/ Create a rawnand_device structure inheriting from nand_device, and
> >    then make nand_chip inherit from rawnand_device. Patch the
> >    nand_base.c code to initialize all the nand_device fields properly,
> >    so that we'll be ready to switch to the generic BBT code.
> >
> > 4/ Modify the nand_bbt.c code to make use of the generic NAND interface
> >    instead of the MTD and rawnand one (this implies identifying all the
> >    generic helpers you might need, and implementing them in
> >    include/linux/mtd/nand.h or drivers/mtd/nand/core.c).
> >
> > 5/ Move drivers/mtd/nand/rawnand/nand_bbt.c into
> >    drivers/mtd/nand/bbt.c
> >
> > 6/[optional] Implement your spinand layer in drivers/mtd/nand/spinand
> >
> > I know I'm asking a lot, especially given that you already spent a lot
> > of time iterating on this BBT rework series. But your goal is to move
> > mt29f driver out of staging, and you'll need to do the generic NAND
> > layer to achieve that, so I'd really prefer having the BBT code use
> > this generic layer instead of directly using the MTD API + an extra set
> > of NAND specific structs (like the nand_chip_layout_info one).  
> 
> Yes, I want to upstreaming my SPI NAND frameworks and it's indeed better
> to have a nand core. In fact, I already finished a SPI NAND framework with
> the BBT patch I sent which is directly under MTD (don't have a NAND core layer).
> 
> Actually, I'm interested in this NAND framework refining work. And I
> know you already
> gave a speech on ELC about this. But due to the resource limitation, I may not
> to do all of the things. So how about I continue my BBT patch with
> your NAND refining
> ideas. I'll try to make the BBT patch compatible with the refining
> work. What do you
> think?

The thing is, I'm not happy with these intermediate reworks, which in my
opinion are adding more confusion and will make things even harder to
rework afterward.
You said you already developed your SPI NAND framework and it's not
based on the generic NAND layer, which means you (or someone else) will
have to migrate it to this approach at some point, and this extra work
is kind of useless, especially since we seem to agree that the generic
NAND layer is the way to go for SPI NAND (and other NAND based devices)
support.

Since I'm the one who pushed for this transition to an intermediate
"NAND core" layer, I'm willing to help you with this task. I actually
reworked my series [1] to move the BBT code in drivers/mtd/nand/bbt.c
and move raw NAND code into drivers/mtd/nand/rawnand/ (still have to
rework the commit logs, and test the implementation, but the different
steps are there and we end-up with something clean in
drivers/mtd/nand/).

Could you help me debug this code and base your SPI NAND framework on
top of it?

Again, I'm sorry that you had to be the one supporting this transition,
but I don't want to introduce any more quick-and-dirty hacks that we'll
have to maintain until someone decides to tackle the real problem.

Best Regards,

Boris

[1]https://github.com/bbrezillon/linux-0day/commits/nand/generic

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

  reply	other threads:[~2016-05-04 20:33 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14  2:47 [PATCH 00/11] mtd: nand_bbt: introduce independent nand BBT Peter Pan
2016-03-14  2:47 ` [PATCH 01/11] mtd: nand_bbt: new header for nand family BBT Peter Pan
2016-03-14  2:47 ` [PATCH 02/11] mtd: nand_bbt: introduce BBT related data structure Peter Pan
2016-03-25  8:35   ` Boris Brezillon
2016-03-28  8:09     ` Peter Pan
2016-03-29  8:16       ` Boris Brezillon
2016-04-18  6:22     ` Peter Pan
2016-04-18  7:44       ` Boris Brezillon
2016-04-19  0:40         ` Peter Pan
2016-04-19  7:34           ` Boris Brezillon
2016-05-04  1:36             ` Peter Pan
2016-05-04 20:33               ` Boris Brezillon [this message]
2016-05-17  1:03                 ` Peter Pan
2016-06-17  2:38                   ` Peter Pan
2016-06-21 13:27                     ` Boris Brezillon
2016-03-14  2:47 ` [PATCH 03/11] mtd: nand_bbt: add new API definitions Peter Pan
2016-03-14  3:47   ` kbuild test robot
2016-03-25  8:49   ` Boris Brezillon
2016-03-28  7:56     ` Peter Pan
2016-03-14  2:47 ` [PATCH 04/11] mtd: nand_bbt: add nand_bbt_markbad_factory() interface Peter Pan
2016-03-14  2:47 ` [PATCH 05/11] mtd: nand: use new BBT API instead of old ones Peter Pan
2016-03-25  8:51   ` Boris Brezillon
2016-03-28  8:12     ` Peter Pan
2016-03-29  8:07       ` Boris Brezillon
2016-03-14  2:47 ` [PATCH 06/11] mtd: nand_bbt: use struct nand_bbt_ops in BBT Peter Pan
2016-03-14  2:48 ` [PATCH 07/11] mtd: nand: make nand_erase_nand() static Peter Pan
2016-03-14  2:48 ` [PATCH 08/11] mtd: nand_bbt: remove struct nand_chip from nand_bbt.c Peter Pan
2016-03-14  2:48 ` [PATCH 09/11] mtd: nand_bbt: remove old API definitions Peter Pan
2016-03-14  2:48 ` [PATCH 10/11] mtd: nand_bbt: remove NAND_BBT_DYNAMICSTRUCT macro Peter Pan
2016-03-14  2:48 ` [PATCH 11/11] mtd: nand: remove nand_chip.bbt Peter Pan
2016-03-14  2:57 ` [PATCH 00/11] mtd: nand_bbt: introduce independent nand BBT Peter Pan
2016-03-16 12:57   ` Boris Brezillon
2016-03-23 20:57 ` Ezequiel Garcia
2016-03-28  8:20   ` Peter Pan
2016-03-29  8:02     ` Boris Brezillon
2016-03-25  8:50 ` Boris Brezillon
2016-03-28  7:56   ` 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=20160504223309.2da46b02@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=beanhuo@micron.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=karlzhang@micron.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=peterpandong@micron.com \
    --cc=peterpansjtu@gmail.com \
    --cc=xuejiancheng@huawei.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).