Re: [PATCH v2] mtd: nand: spi: rework detect procedure for different read id op
From: Boris Brezillon
Date: Fri Jan 10 2020 - 03:04:28 EST
On Fri, 10 Jan 2020 15:34:28 +0800
Chuanhong Guo <gch981213@xxxxxxxxx> wrote:
> Hi!
>
> On Fri, Jan 10, 2020 at 2:59 PM Boris Brezillon
> <boris.brezillon@xxxxxxxxxxxxx> wrote:
> > [...]
> > > + ret = spinand_read_id_op(spinand, 1, 0, id);
> > > + if (ret)
> > > + return ret;
> > > + ret = spinand_manufacturer_match(spinand,
> > > + SPINAND_READID_METHOD_OPCODE_ADDR);
> > > + if (!ret)
> > > + return 0;
> > > +
> > > + ret = spinand_read_id_op(spinand, 0, 1, id);
> >
> > Hm, we should probably do only one of each read_id and iterate over all
> > manufacturers/chips each time instead of doing 3 read_ids per
> > manufacturer.
>
> This actually do the former instead of the latter. Maybe the function
> names are a bit
> misleading. spinand_manufacturer_match iterates over all manufacturers
> in one call,
> and spinand_manufacturer_detect is called once in spinand_detect.
> Do you have suggestions on function naming?
Maybe you can just inline the content of this function in
spinand_detect().