Re: [PATCH] mtd: rawnand: check nand support for cache reads

From: Miquel Raynal
Date: Fri Sep 22 2023 - 10:04:15 EST


Hi Rouven,

Thanks a lot for the investigation and the patch!

r.czerwinski@xxxxxxxxxxxxxx wrote on Fri, 22 Sep 2023 12:01:13 +0200:

Would you mind changing the title to
"mtd: rawnand: Ensure the nand chip supports cached reads"

> Both the JEDEC and ONFI specification say that read cache sequential
> support is an optional command.

I clearly overlooked that part, just checking the set/get_features()
entries as usual, good catch.

> This means that we not only need to
> check whether the individual controller implements the command, we also

The controller itself does not implement the command, but may or may
not support it (can you please update the sentence?).

> need to check the parameter pages for both ONFI and JEDEC NAND flashes
> before enabling sequential cache reads.
>
> This fixes support for NAND flashes which don't support enabling cache
> reads, i.e. Samsung K9F4G08U0F or Toshiba TC58NVG0S3HTA00.
>
> Sequential cache reads are no only available for ONFI and JEDEC devices,
> if individual vendors implement this, it needs to be enabled per vendor.

Agreed.

> Tested on i.MX6Q with a Samsung NAND flash chip that doesn't support
> sequential reads.
>
> Fixes: 003fe4b9545b ("mtd: rawnand: Support for sequential cache reads")
>

Please remove this empty line and instead add:

Cc: stable@xxxxxxxxxxxxxxx

> Signed-off-by: Rouven Czerwinski <r.czerwinski@xxxxxxxxxxxxxx>
> ---
> @Martin, Måns:
> I would appreciate if you could test this on your hardware.

That would me much appreciated!

I also added Alexander who also had troubles with this patchset, could
you check on your setup if that solves the issue?

> @Miguel:
> I didn't have the time to test this on ONFI/JEDEC devices with support
> yet, I'd be fine if you hold off merging this.

Of course. I was about to send a revert but that looks a promising fix,
let's see how it goes.

>
> drivers/mtd/nand/raw/nand_base.c | 3 +++
> drivers/mtd/nand/raw/nand_jedec.c | 3 +++
> drivers/mtd/nand/raw/nand_onfi.c | 3 +++
> include/linux/mtd/jedec.h | 3 +++
> include/linux/mtd/onfi.h | 1 +
> include/linux/mtd/rawnand.h | 1 +
> 6 files changed, 14 insertions(+)
>

Thanks,
Miquèl