From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Marek Vasut <marek.vasut@gmail.com>
Cc: Richard Weinberger <richard@nod.at>,
linux-mtd@lists.infradead.org, Peter Pan <peterpansjtu@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Cyrille Pitchen <cyrille.pitchen@atmel.com>,
linux-kernel@vger.kernel.org,
Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
Kelvin Cheung <keguang.zhang@gmail.com>
Subject: Re: [PATCH v3 5/7] mtd: nand: raw: create struct rawnand_device
Date: Wed, 11 Jan 2017 08:48:37 +0100 [thread overview]
Message-ID: <20170111084837.381dd806@bbrezillon> (raw)
In-Reply-To: <480dca8c-993e-71ff-b37c-062a3de2f003@gmail.com>
On Tue, 10 Jan 2017 20:09:15 +0100
Marek Vasut <marek.vasut@gmail.com> wrote:
> On 11/21/2016 01:45 PM, Boris Brezillon wrote:
> > Create the rawnand_device struct inheriting from nand_device and make
> > nand_chip inherit from this struct.
> >
> > The rawnand_device object should be used for the new
> > rawnand-device/rawnand-controller model, and fields inside nand_chip
> > should progressively move to the future rawnand_controller or the existing
> > rawnand_device struct.
> >
> > In the meantime, we make sure nand_device fields are properly initialized
> > by converting information stored in mtd_info and nand_chip into the
> > nand_memory_organization format.
> >
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > ---
> > drivers/mtd/nand/raw/nand_base.c | 40 ++++++++++++++++++++++++++++++++++++++++
> > include/linux/mtd/rawnand.h | 26 ++++++++++++++++++++------
> > 2 files changed, 60 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> > index 893ec615332a..77ca2dbee341 100644
> > --- a/drivers/mtd/nand/raw/nand_base.c
> > +++ b/drivers/mtd/nand/raw/nand_base.c
> > @@ -3999,6 +3999,43 @@ static bool find_full_id_nand(struct mtd_info *mtd, struct nand_chip *chip,
> > return false;
> > }
> >
> > +static int rawnand_erase(struct nand_device *nand, struct erase_info *einfo)
> > +{
> > + struct mtd_info *mtd = nand_to_mtd(nand);
> > +
> > + return nand_erase_nand(mtd, einfo, 1);
> > +}
> > +
> > +static int rawnand_markbad(struct nand_device *nand, int block)
> > +{
> > + struct mtd_info *mtd = nand_to_mtd(nand);
> > + struct nand_chip *chip = mtd_to_nandc(mtd);
> > + loff_t offs = nand_eraseblock_to_offs(nand, block);
> > +
> > + return chip->block_markbad(mtd, offs);
> > +}
> > +
> > +static const struct nand_ops rawnand_ops = {
> > + .erase = rawnand_erase,
> > + .markbad = rawnand_markbad,
> > +};
> > +
> > +static void nandc_fill_nandd(struct nand_chip *chip)
> > +{
> > + struct mtd_info *mtd = nandc_to_mtd(chip);
> > + struct nand_device *nand = mtd_to_nand(mtd);
> > + struct nand_memory_organization *memorg = &nand->memorg;
> > +
> > + memorg->pagesize = mtd->writesize;
> > + memorg->oobsize = mtd->oobsize;
> > + memorg->eraseblocksize = mtd->erasesize;
> > + memorg->ndies = chip->numchips;
> > + memorg->diesize = chip->chipsize;
> > + /* TODO: fill ->planesize and ->nplanes */
>
> When will this be addressed ?
We first need to extract these information from the NAND ID or the
ONFI/JEDEC parameter page. I think I'll just drop those fields for now,
and add them back when we have the proper infrastructure to extract
this information.
>
> > + nand->ops = &rawnand_ops;
> > +}
>
> [...]
>
next prev parent reply other threads:[~2017-01-11 7:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-21 12:45 [PATCH v3 0/7] mtd: nand: Abstract away the NAND interface type Boris Brezillon
2016-11-21 12:45 ` [PATCH v3 1/7] mtd: nand: Rename nand.h into rawnand.h Boris Brezillon
2016-11-21 12:45 ` [PATCH v3 2/7] mtd: nand: move raw NAND related code to the raw/ subdir Boris Brezillon
2016-11-21 12:45 ` [PATCH v3 3/7] mtd: nand: add a nand.h file to expose basic NAND stuff Boris Brezillon
2016-11-21 12:45 ` [PATCH v3 4/7] mtd: nand: raw: prefix conflicting names with nandc instead of nand Boris Brezillon
2017-01-10 19:08 ` Marek Vasut
2017-01-11 7:46 ` Boris Brezillon
2017-01-11 12:09 ` Marek Vasut
2017-01-11 12:39 ` Boris Brezillon
2017-01-11 13:08 ` Marek Vasut
2017-01-11 13:14 ` Boris Brezillon
2017-01-11 13:21 ` Marek Vasut
2016-11-21 12:45 ` [PATCH v3 5/7] mtd: nand: raw: create struct rawnand_device Boris Brezillon
2017-01-10 19:09 ` Marek Vasut
2017-01-11 7:48 ` Boris Brezillon [this message]
2016-11-21 12:45 ` [PATCH v3 6/7] mtd: nand: raw: make BBT code more generic Boris Brezillon
2016-11-21 12:45 ` [PATCH v3 7/7] mtd: nand: move BBT code to drivers/mtd/nand/ Boris Brezillon
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=20170111084837.381dd806@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@atmel.com \
--cc=dwmw2@infradead.org \
--cc=ezequiel.garcia@free-electrons.com \
--cc=keguang.zhang@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=peterpansjtu@gmail.com \
--cc=richard@nod.at \
/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