[PATCH v2 1/9] mtd: nand: rename the cellinfo to bits_per_cell

Huang Shijie shijie8 at gmail.com
Sat Aug 24 23:52:02 EDT 2013


On Fri, Aug 23, 2013 at 10:49:13PM -0700, Brian Norris wrote:
> On Mon, Aug 19, 2013 at 10:31:10AM +0800, Huang Shijie wrote:
> > +static int nand_get_bits_per_cell(u8 data)
> 
> Maybe make the parameter name 'cellinfo' to make it clearer? And maybe
> a short comment to say that it extracts this information from the 3rd
> byte of the extended ID de-facto standard?
yes, the "cellinfo" is better.

> 
> > +{
> > +	int bits;
> > +
> > +	bits = data & NAND_CI_CELLTYPE_MSK;
> > +	bits >>= NAND_CI_CELLTYPE_SHIFT;
> > +	return bits + 1;
> > +}
> > +
> >  /*
> >   * Many new NAND share similar device ID codes, which represent the size of the
> >   * chip. The rest of the parameters must be decoded according to generic or
> 
> [...]
> 
> > @@ -3224,6 +3232,7 @@ static void nand_decode_id(struct mtd_info *mtd, struct nand_chip *chip,
> >  	mtd->oobsize = mtd->writesize / 32;
> >  	*busw = type->options & NAND_BUSWIDTH_16;
> >  
> > +	chip->bits_per_cell = nand_get_bits_per_cell(id_data[2]);
> 
> This is wrong. The NAND covered by nand_decode_id() do not have an
> extended ID, so the third ID byte is not meaningful. But all of these
> should be SLC, so just:
> 
> 	/* All legacy ID NAND are small-page, SLC */
> 	chip->bits_per_cell = 1;

it is okay to me. Use this in the next version.

thanks
Huang Shijie



More information about the linux-mtd mailing list