lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170111084837.381dd806@bbrezillon>
Date:   Wed, 11 Jan 2017 08:48:37 +0100
From:   Boris Brezillon <boris.brezillon@...e-electrons.com>
To:     Marek Vasut <marek.vasut@...il.com>
Cc:     Richard Weinberger <richard@....at>, linux-mtd@...ts.infradead.org,
        Peter Pan <peterpansjtu@...il.com>,
        David Woodhouse <dwmw2@...radead.org>,
        Brian Norris <computersforpeace@...il.com>,
        Cyrille Pitchen <cyrille.pitchen@...el.com>,
        linux-kernel@...r.kernel.org,
        Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>,
        Kelvin Cheung <keguang.zhang@...il.com>
Subject: Re: [PATCH v3 5/7] mtd: nand: raw: create struct rawnand_device

On Tue, 10 Jan 2017 20:09:15 +0100
Marek Vasut <marek.vasut@...il.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@...e-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;
> > +}  
> 
> [...]
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ