[PATCH v2 3/3] mtd: rawnand: Support for sequential cache reads

Zhihao Cheng chengzhihao1 at huawei.com
Fri Mar 3 04:26:26 PST 2023


Hi all,

> From: JaimeLiao <jaimeliao.tw at gmail.com>
> 
> Add support for sequential cache reads for controllers using the generic
> core helpers for their fast read/write helpers.
> 
> Sequential reads may reduce the overhead when accessing physically
> continuous data by loading in cache the next page while the previous
> page gets sent out on the NAND bus.
> 
> The ONFI specification provides the following additional commands to
> handle sequential cached reads:
> 
> * 0x31 - READ CACHE SEQUENTIAL:
>    Requires the NAND chip to load the next page into cache while keeping
>    the current cache available for host reads.
> * 0x3F - READ CACHE END:
>    Tells the NAND chip this is the end of the sequential cache read, the
>    current cache shall remain accessible for the host but no more
>    internal cache loading operation is required.
> 
> On the bus, a multi page read operation is currently handled like this:
> 
> 	00 -- ADDR1 -- 30 -- WAIT_RDY (tR+tRR) -- DATA1_IN
> 	00 -- ADDR2 -- 30 -- WAIT_RDY (tR+tRR) -- DATA2_IN
> 	00 -- ADDR3 -- 30 -- WAIT_RDY (tR+tRR) -- DATA3_IN
> 
> Sequential cached reads may instead be achieved with:
I find an ecc error problem in latest kernel(nandsim + ubi):

[   71.097739] [nandsim] error: write_byte: unknown command 0x31
[   71.100871] [nandsim] error: write_byte: unknown command 0x31
[   71.101508] [nandsim] warning: read_buf: unexpected data output 
cycle, current state is STATE_READY
[   71.102475] [nandsim] warning: read_buf: unexpected data output 
cycle, current state is STATE_READY
[   71.103427] ecc_sw_hamming_correct: uncorrectable ECC error
[   71.104018] ubi0 warning: ubi_io_read [ubi]: error -74 (ECC error) 
while reading 4096 bytes from PEB 180:2048, read only 4096 bytes, retry
[   71.105272] [nandsim] error: write_byte: unknown command 0x31
[   71.105901] [nandsim] error: write_byte: unknown command 0x31
[   71.106513] [nandsim] warning: read_buf: unexpected data output 
cycle, current state is STATE_READY
[   71.107392] [nandsim] warning: read_buf: unexpected data output 
cycle, current state is STATE_READY
[   71.108277] ecc_sw_hamming_correct: uncorrectable ECC error
[   71.108885] ubi0 warning: ubi_io_read [ubi]: error -74 (ECC error) 
while reading 4096 bytes from PEB 180:2048, read only 4096 bytes, retry
[   71.110230] [nandsim] error: write_byte: unknown command 0x31
[   71.110817] [nandsim] error: write_byte: unknown command 0x31
[   71.111433] [nandsim] warning: read_buf: unexpected data output 
cycle, current state is STATE_READY
[   71.112356] [nandsim] warning: read_buf: unexpected data output 
cycle, current state is STATE_READY
[   71.113232] ecc_sw_hamming_correct: uncorrectable ECC error

reproducer:
#!/bin/bash
set -e

TMP=/root/temp

mtd=/dev/mtd0
ubi=/dev/ubi0

ID="0xec,0xa1,0x00,0x15" # 128M 128KB 2KB
modprobe nandsim id_bytes=$ID
flash_eraseall /dev/mtd0
modprobe ubi mtd="0,0" fm_autoconvert
ubimkvol -N vol_a -m -n 0 /dev/ubi0
modprobe ubifs
mount -t ubifs /dev/ubi0_0 $TMP

After reverting 003fe4b9545b83cc("mtd: rawnand: Support for sequential 
cache reads") the mtd will work normally.



More information about the linux-mtd mailing list