Re: mtd: nand: raw: Possible bug in nand_onfi_detect()?
From: Miquel Raynal
Date: Mon Mar 25 2024 - 09:52:39 EST
Hello Alexander,
> > > > The condition is true and nand_change_read_column_op() returns with
> > > > -EINVAL, because mtd->writesize and mtd->oobsize are not set yet in
> > > > that code path. Those are probably initialized later, maybe with
> > > > parameters read from that ONFI param page?
> > > >
> > > > Returning with error from nand_change_read_column_op() leads to
> > > > jumping out of nand_onfi_detect() early, and no ONFI param page is
> > > > evaluated at all, although the second or third page could be intact.
> > > >
> > > > I guess this would also fail with any other reason for not matching
> > > > CRCs in the first page, but I have not faulty NAND flash chip to
> > > > confirm that.
> > >
> > > Thanks for the whole report, it is interesting and should lead to fixes:
> > > - why does the controller refuses the datain op?
> >
> > See above.
> >
> > > - why nand_soft_waitrdy is not enough?
> >
> > I don't know. That's one reason I asked here.
> >
> > > - changing the condition in nand_change_read_column_op()
> > >
> > > Can you take care of these?
Now would be a perfect time to send these fixes. Could you work on them?
Thanks!
Miquèl