RE: [EXT] Re: [PATCH v2] mtd: rawnand: Ensure the nand chip supports cached reads

From: Domenico Punzo
Date: Wed Sep 27 2023 - 02:28:16 EST


Micron Confidential

Hello Miquel,

The MPN mt29f4g08abadawp is a single LUN device and it is supposed to support cache read with the limitation reported into the datasheet.

Can you clarify about the IDs list you need?

Thanks.
Regards,
Domenico P.




Micron Confidential
-----Original Message-----
From: Miquel Raynal +ADw-miquel.raynal+AEA-bootlin.com+AD4-
Sent: Tuesday, September 26, 2023 1:27 PM
To: Martin Hundeb+APg-ll +ADw-martin+AEA-geanix.com+AD4-
Cc: Rouven Czerwinski +ADw-r.czerwinski+AEA-pengutronix.de+AD4AOw- M+AOU-ns Rullg+AOU-rd +ADw-mans+AEA-mansr.com+AD4AOw- Alexander Shiyan +ADw-eagle.alexander923+AEA-gmail.com+AD4AOw- Richard Weinberger +ADw-richard+AEA-nod.at+AD4AOw- Vignesh Raghavendra +ADw-vigneshr+AEA-ti.com+AD4AOw- JaimeLiao +ADw-jaimeliao.tw+AEA-gmail.com+AD4AOw- kernel+AEA-pengutronix.de+ADs- stable+AEA-vger.kernel.org+ADs- linux-mtd+AEA-lists.infradead.org+ADs- linux-kernel+AEA-vger.kernel.org+ADs- Sean Nyekj+AOY-r +ADw-sean+AEA-geanix.com+AD4AOw- Domenico Punzo +ADw-dpunzo+AEA-micron.com+AD4AOw- Bean Huo +ADw-beanhuo+AEA-micron.com+AD4-
Subject: +AFs-EXT+AF0- Re: +AFs-PATCH v2+AF0- mtd: rawnand: Ensure the nand chip supports cached reads

CAUTION: EXTERNAL EMAIL. Do not click links or open attachments unless you recognize the sender and were expecting this message.


Hi Martin,

+- Bean and Domenico, there is a question for you below.

martin+AEA-geanix.com wrote on Mon, 25 Sep 2023 13:01:06 +-0200:

+AD4- Hi Rouven,
+AD4-
+AD4- On Fri, 2023-09-22 at 16:17 +-0200, Rouven Czerwinski wrote:
+AD4- +AD4- Both the JEDEC and ONFI specification say that read cache sequential
+AD4- +AD4- support is an optional command. This means that we not only need to
+AD4- +AD4- check whether the individual controller supports the command, we
+AD4- +AD4- also need to check the parameter pages for both ONFI and JEDEC NAND
+AD4- +AD4- flashes before enabling sequential cache reads.
+AD4- +AD4-
+AD4- +AD4- This fixes support for NAND flashes which don't support enabling
+AD4- +AD4- cache reads, i.e. Samsung K9F4G08U0F or Toshiba TC58NVG0S3HTA00.
+AD4- +AD4-
+AD4- +AD4- Sequential cache reads are now only available for ONFI and JEDEC
+AD4- +AD4- devices, if individual vendors implement this, it needs to be
+AD4- +AD4- enabled per vendor.
+AD4- +AD4-
+AD4- +AD4- Tested on i.MX6Q with a Samsung NAND flash chip that doesn't support
+AD4- +AD4- sequential reads.
+AD4- +AD4-
+AD4- +AD4- Fixes: 003fe4b9545b (+ACI-mtd: rawnand: Support for sequential cache
+AD4- +AD4- reads+ACI-)
+AD4- +AD4- Cc: stable+AEA-vger.kernel.org
+AD4- +AD4- Signed-off-by: Rouven Czerwinski +ADw-r.czerwinski+AEA-pengutronix.de+AD4-
+AD4-
+AD4- Thanks for this. It works as expected for my Toshiba chip, obviously
+AD4- because it doesn't use ONFI or JEDEC.
+AD4-
+AD4- Unfortunately, my Micron chip does use ONFI, and it sets the cached-
+AD4- read-supported bit. It then fails when reading afterwords:
+AD4-
+AD4- kernel: ONFI+AF8-OPT+AF8-CMD+AF8-READ+AF8-CACHE +ACM- debug added by me
+AD4- kernel: nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc
+AD4- kernel: nand: Micron MT29F4G08ABAFAWP
+AD4- kernel: nand: 512 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB
+AD4- size: 256
+AD4- kernel: nand: continued read supported +ACM- debug added by me
+AD4- kernel: Bad block table found at page 131008, version 0x01
+AD4- kernel: Bad block table found at page 130944, version 0x01
+AD4- kernel: 2 fixed-partitions partitions found on MTD device gpmi-nand
+AD4- kernel: Creating 2 MTD partitions on +ACI-gpmi-nand+ACI-:
+AD4- kernel: 0x000000000000-0x000000800000 : +ACI-boot+ACI-
+AD4- kernel: 0x000000800000-0x000020000000 : +ACI-ubi+ACI-
+AD4- kernel: gpmi-nand 1806000.nand-controller: driver registered.
+AD4-
+AD4- ...
+AD4-
+AD4- kernel: ubi0: default fastmap pool size: 100
+AD4- kernel: ubi0: default fastmap WL pool size: 50
+AD4- kernel: ubi0: attaching mtd1
+AD4- kernel: ubi0: scanning is finished
+AD4- kernel: ubi0: attached mtd1 (name +ACI-ubi+ACI-, size 504 MiB)
+AD4- kernel: ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes
+AD4- kernel: ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
+AD4- kernel: ubi0: VID header offset: 4096 (aligned 4096), data offset:
+AD4- 8192
+AD4- kernel: ubi0: good PEBs: 2012, bad PEBs: 4, corrupted PEBs: 0
+AD4- kernel: ubi0: user volume: 9, internal volumes: 1, max. volumes count:
+AD4- 128
+AD4- kernel: ubi0: max/mean erase counter: 4/2, WL threshold: 4096, image
+AD4- sequence number: 1431497221
+AD4- kernel: ubi0: available PEBs: 12, total reserved PEBs: 2000, PEBs
+AD4- reserved for bad PEB handling: 36
+AD4- kernel: block ubiblock0+AF8-4: created from ubi0:4(rootfs.a)
+AD4- kernel: ubi0: background thread +ACI-ubi+AF8-bgt0d+ACI- started, PID 36
+AD4- kernel: block ubiblock0+AF8-6: created from ubi0:6(appfs.a)
+AD4- kernel: block ubiblock0+AF8-7: created from ubi0:7(appfs.b)
+AD4-
+AD4- ...
+AD4-
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b6d15c:ed1+AF0-
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b6f15e:125+AF0-
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b6d15c:1dae+AF0-
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b6d15c:ed1+AF0-
+AD4- (d-sysctl)+AFs-55+AF0-: systemd-sysctl.service: Failed to set up credentials:
+AD4- Protocol error
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b73162:14f0+AF0-
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b6f15e:838+AF0-
+AD4- systemd+AFs-1+AF0-: Starting Create Static Device Nodes in /dev...
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b6d15c:ed1+AF0-
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b6d15c:ed1+AF0-
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b6f15e:838+AF0-
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b6d15c:1dae+AF0-
+AD4- kernel: SQUASHFS error: Unable to read directory block +AFs-4b6f15e:125+AF0-
+AD4-
+AD4- I've briefly tried adding some error info the the squashfs error
+AD4- messages, but it looks like it's getting bad data. I.e. one failure a
+AD4- sanity check of +AGA-dir+AF8-count+AGA-:
+AD4-
+AD4- if (dir+AF8-count +AD4- SQUASHFS+AF8-DIR+AF8-COUNT)
+AD4- goto data+AF8-error+ADs-
+AD4-
+AD4- It fails with +AGA-dir+AF8-count+AGA- being 1952803684 ...
+AD4-
+AD4- So is this a case of wrong/bad timings?
+AD4-
+AD4- Miquel:
+AD4- I can tell from the code, that the READCACHESEQ operations are
+AD4- followed by NAND+AF8-OP+AF8-WAIT+AF8-RDY(tR+AF8-max, tRR+AF8-min). From the Micron
+AD4- datasheet+AFs-0+AF0-, it should be NAND+AF8-OP+AF8-WAIT+AF8-RDY(tRCBSY+AF8-max, tRR+AF8-min),
+AD4- where tRCBSY is defined to be between 3 and 25 +ALU-s.

I found a place in the ONFI spec states taht tRCBSY+AF8-max should be between 3 and tR+AF8-max, so indeed we should be fine on that regard.

However, I asked myself whether we could have issues when crossing boundaries. Block boundaries should be fine, however your device does not support crossing plane boundaries, as bit 4 (+ACI-read cache
supported+ACI-) of byte 114 (+ACI-Multi-plane operation attributes+ACI-) in the memory organization block of the parameter page is not set (the value of the byte should be 0x0E if I get it right.

Anyway, our main issue here does not seem related to the boundaries. It does not seem to be explicitly marked anywhere else but on the front
page:
Advanced command set
+IBM- Program page cache mode (4)
+IBM- Read page cache mode (4)
+IBM- Two-plane commands (4)

(4) These commands supported only with ECC disabled.

Read page cache mode without ECC makes the feature pretty useless IMHO.

Bean, Domenico, how do we know which devices allow ECC correction during sequential page reads and which don't? Is there a (vendor?) bit somewhere in the parameter page for that? Do we have any way to know besides a list of devices allowing that? If so, can you provide one with a few IDs?

Thanks,
Miqu+AOg-l