* Using nand_change_read_column_op() in nand_onfi_detect()
@ 2024-05-14 11:48 Sascha Hauer
2024-05-14 11:53 ` Miquel Raynal
0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2024-05-14 11:48 UTC (permalink / raw)
To: linux-mtd; +Cc: Miquel Raynal
Hi all,
I am currently stumbling over this in nand_onfi_detect():
for (i = 0; i < ONFI_PARAM_PAGES; i++) {
if (!i)
ret = nand_read_param_page_op(chip, 0, &pbuf[i],
sizeof(*pbuf));
else if (use_datain)
ret = nand_read_data_op(chip, &pbuf[i], sizeof(*pbuf),
true, false);
else
ret = nand_change_read_column_op(chip, sizeof(*pbuf) * i,
&pbuf[i], sizeof(*pbuf),
true);
...
}
nand_change_read_column_op() heavily uses mtd->writesize and bails out
with an error when the writesize is 0. mtd->writesize is still
uninitialised at that point, it's initialized a few lines further down
in the same function. It looks like this code never worked as expected.
Also it seems use_datain is always 0, see 1), so existing code only ever
reads the first parameter page.
The same pattern is in nand_jedec_detect() as well.
Not sure what we make from this.
Sascha
1) https://lore.kernel.org/linux-mtd/20240514103355.817056-1-s.hauer@pengutronix.de/T/#u
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Using nand_change_read_column_op() in nand_onfi_detect()
2024-05-14 11:48 Using nand_change_read_column_op() in nand_onfi_detect() Sascha Hauer
@ 2024-05-14 11:53 ` Miquel Raynal
2024-05-14 13:42 ` Sascha Hauer
0 siblings, 1 reply; 3+ messages in thread
From: Miquel Raynal @ 2024-05-14 11:53 UTC (permalink / raw)
To: Sascha Hauer; +Cc: linux-mtd
Hi Sascha,
s.hauer@pengutronix.de wrote on Tue, 14 May 2024 13:48:35 +0200:
> Hi all,
>
> I am currently stumbling over this in nand_onfi_detect():
>
> for (i = 0; i < ONFI_PARAM_PAGES; i++) {
> if (!i)
> ret = nand_read_param_page_op(chip, 0, &pbuf[i],
> sizeof(*pbuf));
> else if (use_datain)
> ret = nand_read_data_op(chip, &pbuf[i], sizeof(*pbuf),
> true, false);
> else
> ret = nand_change_read_column_op(chip, sizeof(*pbuf) * i,
> &pbuf[i], sizeof(*pbuf),
> true);
> ...
> }
>
> nand_change_read_column_op() heavily uses mtd->writesize and bails out
> with an error when the writesize is 0. mtd->writesize is still
> uninitialised at that point, it's initialized a few lines further down
> in the same function. It looks like this code never worked as expected.
>
> Also it seems use_datain is always 0, see 1), so existing code only ever
> reads the first parameter page.
>
> The same pattern is in nand_jedec_detect() as well.
>
> Not sure what we make from this.
>
> Sascha
>
> 1) https://lore.kernel.org/linux-mtd/20240514103355.817056-1-s.hauer@pengutronix.de/T/#u
>
Sorry for not mentioning that before, I sent two fixes about that:
https://lore.kernel.org/linux-mtd/20240507160546.130255-1-miquel.raynal@bootlin.com/T/#t
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Using nand_change_read_column_op() in nand_onfi_detect()
2024-05-14 11:53 ` Miquel Raynal
@ 2024-05-14 13:42 ` Sascha Hauer
0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-05-14 13:42 UTC (permalink / raw)
To: Miquel Raynal; +Cc: linux-mtd
On Tue, May 14, 2024 at 01:53:16PM +0200, Miquel Raynal wrote:
> Hi Sascha,
>
> s.hauer@pengutronix.de wrote on Tue, 14 May 2024 13:48:35 +0200:
>
> > Hi all,
> >
> > I am currently stumbling over this in nand_onfi_detect():
> >
> > for (i = 0; i < ONFI_PARAM_PAGES; i++) {
> > if (!i)
> > ret = nand_read_param_page_op(chip, 0, &pbuf[i],
> > sizeof(*pbuf));
> > else if (use_datain)
> > ret = nand_read_data_op(chip, &pbuf[i], sizeof(*pbuf),
> > true, false);
> > else
> > ret = nand_change_read_column_op(chip, sizeof(*pbuf) * i,
> > &pbuf[i], sizeof(*pbuf),
> > true);
> > ...
> > }
> >
> > nand_change_read_column_op() heavily uses mtd->writesize and bails out
> > with an error when the writesize is 0. mtd->writesize is still
> > uninitialised at that point, it's initialized a few lines further down
> > in the same function. It looks like this code never worked as expected.
> >
> > Also it seems use_datain is always 0, see 1), so existing code only ever
> > reads the first parameter page.
> >
> > The same pattern is in nand_jedec_detect() as well.
> >
> > Not sure what we make from this.
> >
> > Sascha
> >
> > 1) https://lore.kernel.org/linux-mtd/20240514103355.817056-1-s.hauer@pengutronix.de/T/#u
> >
>
> Sorry for not mentioning that before, I sent two fixes about that:
> https://lore.kernel.org/linux-mtd/20240507160546.130255-1-miquel.raynal@bootlin.com/T/#t
Thanks for noting. This partly fixes my problem, see my mail there.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-14 13:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-14 11:48 Using nand_change_read_column_op() in nand_onfi_detect() Sascha Hauer
2024-05-14 11:53 ` Miquel Raynal
2024-05-14 13:42 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox