ZynqMP NAND

Introduction

This page gives an overview of Zynq Ultrascale+ MPSoC nand driver which is located at drivers/mtd/nand/raw/arasan_nand.c. link: nand source file
NAND driver provides basic functions that are required for accessing the nand flash memory including the support for hw ecc, on-die ecc and bad block management.

HW IP Features

Controller Features


  • Complies with the ONFI 3.1 specification
  • Supports interleaving operations
  • Supports BCH error correction code (ECC) data widths of 4, 8, 12, and 24 bits.
  • All ONFI 3.1 commands
  • PIO and MDMA support
  • SDR and NVDDR modes
  • supports only 8-bit bus support
  • Hardware ECC (Hamming code and BCH)
  • Page size up to 16K
  • Programmable timing modes
  • 64-bit dma support.
  • Supports multiple chip selects (up to 2)


Driver Features

  • Supports only the mandatory ONFI 3.1 commands. i.e Reset, Read status, Read ID, Read Parameter Page, Read Page, Program Page, Erase Block, Set/Get Features
  • Supports SDR/DDR modes
  • Supports timing modes 0-5
  • Supports PIO and MDMA support
  • Support for multiple chip selection
  • Support 64-bit dma
  • Support BBT management
  • Hardware ECC (Hamming code and BCH up to 24 bits)
  • Software ECC (Hamming code and BCH up to 24 bits correction and up to 32bit bits detection)

Missing features, Known Issues, limitations

  • No support for interleaved and all optional ONFI 3.1 commands.
  • Hardware ECC configuration limited to 24-bits of error correction and 24-bits of error detection.
  • Performance degradation with Software ECC when compared with Hardware ECC.

Important AR links

  • 2021.1 release on-wards Linux Arasan NAND driver uses the SW-ECC with BCH as the default ECC detection/correction, this results in a degradation of performance as compared to HW-ECC. -  AR-76631
  • 2021.x, 2022.x, 2023.1 BBT of NAND is different between U-boot and Linux kernel AR-Link

Bad Block management

Bad block management implementation is same as Linux MTD bad block management with the exception of reserving number of blocks to store Bad Block Table (BBT) from default 4 blocks to 64 blocks. This is because one of the Micron flash part MT29F32G08ABCDB has last 32 blocks as bad most of the times. Since it was difficult to store bad block table in last 4 blocks, the number of blocks are increased to 64 blocks.

Kernel Configuration Options

The following config options should be enabled in order to build Zynq Ultrascale+ MPSoC

CONFIG_MTD_NAND_ECC_SW_BCH
CONFIG_MTD_NAND_ARASAN
CONFIG_MTD_NAND

config MTD_NAND_ECC_SW_BCH
        bool "Support software BCH ECC"
        select BCH
        default n
        help
          This enables support for software BCH error correction. Binary BCH
          codes are more powerful and cpu intensive than traditional Hamming
          ECC codes. They are used with NAND devices requiring more than 1 bit
          of error correction.

config MTD_NAND_ARASAN
    tristate "Support for Arasan Nand Flash controller"
    depends on HAS_IOMEM && HAS_DMA
	select BCH
    help
      Enables the driver for the Arasan NAND flash controller on Zynq Ultrascale+ MPSoC.

Device Tree Settings

More information on nand device tree node details, refer the link Nand device tree
Example for device tree

nand0: nand@ff100000 {
compatible = "arasan,nfc-v3p10";
reg = <0x0 0xff100000 0x0 0x1000>;
clock-names = "clk_sys", "clk_flash";
interrupt-parent = <&gic>;
interrupts = <0 14 4>;
#address-cells = <2>;
#size-cells = <1>;
};
 
 

Nand Partition details


Below example list the dts properties for operating in Software-ECC mode and its also assumes that controller is using 2 chip select lines

&nand0 {
   status = "okay";
   arasan,has-mdma;
   
   nand@0 {
     reg = <0x0>;
     #address-cells = <0x2>;
     #size-cells = <0x1>;
	 nand-ecc-mode = "soft";
	 nand-ecc-algo = "bch";
	 nand-rb = <0x0>;
	 label = "main-storage-0";
  partition@0 { /* for testing purpose */
    label = "nand-fsbl-uboot";
    reg = <0x0 0x0 0x400000>;
  };
  partition@1 { /* for testing purpose */
    label = "nand-linux";
    reg = <0x0 0x400000 0x1400000>;
  };
  partition@2 { /* for testing purpose */
    label = "nand-device-tree";
    reg = <0x0 0x1800000 0x400000>;
  };
  partition@3 { /* for testing purpose */
    label = "nand-rootfs";
    reg = <0x0 0x1C00000 0x1400000>;
  };
  partition@4 { /* for testing purpose */
    label = "nand-bitstream";
    reg = <0x0 0x3000000 0x400000>;
  };
  partition@5 { /* for testing purpose */
    label = "nand-misc";
    reg = <0x0 0x3400000 0xFCC00000>;
  };
 };
 
nand@1 {
  reg = <0x1>;
  #address-cells = <0x2>;
  #size-cells = <0x1>;
  nand-ecc-mode = "soft";
  nand-ecc-algo = "bch";
  nand-rb = <0x0>;
  label = "main-storage-1";
  partition@0 { /* for testing purpose */
    label = "nand1-fsbl-uboot";
    reg = <0x1 0x0 0x400000>;
  };
  partition@1 { /* for testing purpose */
    label = "nand1-linux";
    reg = <0x1 0x400000 0x1400000>;
  };
  partition@2 { /* for testing purpose */
    label = "nand1-device-tree";
    reg = <0x1 0x1800000 0x400000>;
  };
  partition@3 { /* for testing purpose */
    label = "nand1-rootfs";
    reg = <0x1 0x1C00000 0x1400000>;
  };
  partition@4 { /* for testing purpose */
    label = "nand1-bitstream";
    reg = <0x1 0x3000000 0x400000>;
  };
  partition@5 { /* for testing purpose */
    label = "nand1-misc";
    reg = <0x1 0x3400000 0xFCC00000>;
  };
};
};


Below example list the dts properties for operating in Hardware-ECC mode and its also assumes that controller is using 2 chip select lines

&nand0 {
   status = "okay";
   arasan,has-mdma;
   
   nand@0 {
     reg = <0x0>;
     #address-cells = <0x2>;
     #size-cells = <0x1>;
	 nand-ecc-mode = "hw";
	 nand-rb = <0x0>;
	 label = "main-storage-0";
  partition@0 { /* for testing purpose */
    label = "nand-fsbl-uboot";
    reg = <0x0 0x0 0x400000>;
  };
  partition@1 { /* for testing purpose */
    label = "nand-linux";
    reg = <0x0 0x400000 0x1400000>;
  };
  partition@2 { /* for testing purpose */
    label = "nand-device-tree";
    reg = <0x0 0x1800000 0x400000>;
  };
  partition@3 { /* for testing purpose */
    label = "nand-rootfs";
    reg = <0x0 0x1C00000 0x1400000>;
  };
  partition@4 { /* for testing purpose */
    label = "nand-bitstream";
    reg = <0x0 0x3000000 0x400000>;
  };
  partition@5 { /* for testing purpose */
    label = "nand-misc";
    reg = <0x0 0x3400000 0xFCC00000>;
  };
 };
 
nand@1 {
  reg = <0x1>;
  #address-cells = <0x2>;
  #size-cells = <0x1>;
  nand-ecc-mode = "hw";
  nand-rb = <0x0>;
  label = "main-storage-1";
  partition@0 { /* for testing purpose */
    label = "nand1-fsbl-uboot";
    reg = <0x1 0x0 0x400000>;
  };
  partition@1 { /* for testing purpose */
    label = "nand1-linux";
    reg = <0x1 0x400000 0x1400000>;
  };
  partition@2 { /* for testing purpose */
    label = "nand1-device-tree";
    reg = <0x1 0x1800000 0x400000>;
  };
  partition@3 { /* for testing purpose */
    label = "nand1-rootfs";
    reg = <0x1 0x1C00000 0x1400000>;
  };
  partition@4 { /* for testing purpose */
    label = "nand1-bitstream";
    reg = <0x1 0x3000000 0x400000>;
  };
  partition@5 { /* for testing purpose */
    label = "nand1-misc";
    reg = <0x1 0x3400000 0xFCC00000>;
  };
};
};

Performance

Timing ModeECC ModeWrite SpeedRead Speed
NVDDR Mode 5Software-ECC24236 KiB/s16062 KiB/s
NVDDR Mode 5Hardware-ECC31751 KiB/s20480 KiB/s


Testing Procedure

Prerequisites

Kernel tools

mtd layer provides a rich set of tests for validating the nand access including the performance and stress tests
Following kernel config options should be enabled for mtd tests
CONFIG_MTD_TESTS

user space tools

Below test cases requires the following user space tools
mtd_debug, nandtest
All these tools are part of the mtd-utils and source is available from link http://git.infradead.org/mtd-utils.git

Note: expected output may not be same and its all depends on the flash device and configuration of the target system.

Driver Probe

Assuming the target has nand flash memory installed

How to Run

Boot the target till Linux and ensure that nand driver is enabled.

Expected Output

nand: device found, Manufacturer ID: 0x2c, Chip ID: 0x44
nand: Micron MT29F32G08ABCDBJ4

Block Erase test

How to Run

After linux boot,

root@zynqmp:~# mtd_debug erase /dev/mtd0 0x00000000 0x400000

Expected Output

Erased 4194304 bytes from address 0x00000000 in flash

Write Page test

How to Run

After linux boot,
Create a test image

root@zynqmp:~# dd if=/dev/urandom of=/tmp/test1.img bs=1024 count=16
 
root@zynqmp:~# mtd_debug write /dev/mtd0 0x00000000 0x4000 /tmp/test1.img
 

Expected Output

Copied 16384 bytes from /tmp/test1.img to address 0x00000000 in flash
 
 

Read Page and Data integrity test

How to Run

 After linux boot,


root@zynqmp:~# mtd_debug read /dev/mtd0 0x00000000 0x4000 /tmp/test2.img
 
root@zynqmp:~# cmp /tmp/test1.img /tmp/test2.img
 
root@zynqmp:~# md5sum /tmp/test1.img /tmp/test2.img
 
 
 

Expected Output

Copied 16384 bytes from address 0x00000000 in flash to /tmp/test2.img
 
7a0c68453dfb8028fca49f30d5cc798f  /tmp/test1.img
7a0c68453dfb8028fca49f30d5cc798f  /tmp/test2.img
 
 
 

Data integrity test using nandtest utility

How to Run

 After linux boot,


root@zynqmp:~# nandtest /dev/mtd0

Expected Output

ECC corrections: 0
ECC failures   : 0
Bad blocks     : 0
BBT blocks     : 0
 
00000000: erasing...
00000000: writing...
00000000: reading...[  403.220080] random: nonblocking pool is initialized
 
00000000: checking...
00400000: erasing...
00400000: writing...
00400000: reading...
 256 bit(s) ECC corrected at 00400000
 
00400000: checking...
00800000: erasing...
00800000: writing...
00800000: reading...
00800000: checking...
00c00000: erasing...
00c00000: writing...
00c00000: reading...
00c00000: checking...
01000000: erasing...
01000000: writing...
01000000: reading...
 256 bit(s) ECC corrected at 01000000
 
01000000: checking...
01400000: erasing...
01400000: writing...
01400000: reading...
 256 bit(s) ECC corrected at 01400000
 
01400000: checking...
01800000: erasing...
01800000: writing...
01800000: reading...
01800000: checking...
01c00000: erasing...
01c00000: writing...
01c00000: reading...
 256 bit(s) ECC corrected at 01c00000
 
01c00000: checking...
Finished pass 1 successfully.
 
 
 

MTD oob test

How to Run

 After linux boot,


root@zynqmp:~# insmod /lib64/modules/5.4/kernel/drivers/mtd/tests/mtd_oobtest.ko dev=0 bitflip_limit=2
 
 

Expected Output with Software-ECC

[ 1064.556109] =================================================
[ 1064.561855] mtd_oobtest: MTD device: 0
[ 1064.565604] mtd_oobtest: MTD device size 4194304, eraseblock size 4194304, page size 16384, count of eraseblocks 1, pages per eraseblock 256, OOB size 1216
[ 1064.579595] mtd_test: scanning for bad eraseblocks
[ 1064.585436] mtd_test: scanned 1 eraseblocks, 0 are bad
[ 1064.590585] mtd_oobtest: test 1 of 5
[ 1064.595378] mtd_oobtest: writing OOBs of whole device
[ 1064.696928] mtd_oobtest: written up to eraseblock 0
[ 1064.701927] mtd_oobtest: written 1 eraseblocks
[ 1064.706371] mtd_oobtest: verifying all eraseblocks
[ 1064.737074] mtd_oobtest: verified up to eraseblock 0
[ 1064.742122] mtd_oobtest: verified 1 eraseblocks
[ 1064.746650] mtd_oobtest: test 2 of 5
[ 1064.752192] mtd_oobtest: writing OOBs of whole device
[ 1064.854623] mtd_oobtest: written up to eraseblock 0
[ 1064.859597] mtd_oobtest: written 1 eraseblocks
[ 1064.864039] mtd_oobtest: verifying all eraseblocks
[ 1064.894393] mtd_oobtest: error @addr[0x33c000:0x41] 0x4a -> 0x6a diff 0x20
[ 1064.901274] mtd_oobtest: ignoring error as within bitflip_limit
[ 1064.907270] mtd_oobtest: error @addr[0x374000:0x3b4] 0x2c -> 0x3c diff 0x10
[ 1064.914229] mtd_oobtest: ignoring error as within bitflip_limit
[ 1064.920347] mtd_oobtest: verified up to eraseblock 0
[ 1064.925547] mtd_oobtest: verified 1 eraseblocks
[ 1064.930082] mtd_oobtest: test 3 of 5
[ 1064.936310] mtd_oobtest: writing OOBs of whole device
[ 1065.038812] mtd_oobtest: written up to eraseblock 0
[ 1065.043888] mtd_oobtest: written 1 eraseblocks
[ 1065.048325] mtd_oobtest: verifying all eraseblocks
[ 1065.103568] mtd_oobtest: verified up to eraseblock 0
[ 1065.108627] mtd_oobtest: verified 1 eraseblocks
[ 1065.113158] mtd_oobtest: test 4 of 5
[ 1065.118707] mtd_oobtest: attempting to start write past end of OOB
[ 1065.124885] mtd_oobtest: an error is expected...
[ 1065.129502] mtd_oobtest: error occurred as expected
[ 1065.134378] mtd_oobtest: attempting to start read past end of OOB
[ 1065.140463] mtd_oobtest: an error is expected...
[ 1065.145074] mtd_oobtest: error occurred as expected
[ 1065.149950] mtd_oobtest: attempting to write past end of device
[ 1065.155861] mtd_oobtest: an error is expected...
[ 1065.160472] mtd_oobtest: error occurred as expected
[ 1065.165340] mtd_oobtest: attempting to read past end of device
[ 1065.171167] mtd_oobtest: an error is expected...
[ 1065.175782] mtd_oobtest: error occurred as expected
[ 1065.181854] mtd_oobtest: attempting to write past end of device
[ 1065.187769] mtd_oobtest: an error is expected...
[ 1065.192378] mtd_oobtest: error occurred as expected
[ 1065.197247] mtd_oobtest: attempting to read past end of device
[ 1065.203075] mtd_oobtest: an error is expected...
[ 1065.207690] mtd_oobtest: error occurred as expected
[ 1065.212559] mtd_oobtest: test 5 of 5
[ 1065.218020] mtd_oobtest: writing OOBs of whole device
[ 1065.223066] mtd_oobtest: written 0 eraseblocks
[ 1065.227510] mtd_oobtest: verifying all eraseblocks
[ 1065.232299] mtd_oobtest: verified 0 eraseblocks
[ 1065.236820] mtd_oobtest: finished with 0 errors
[ 1065.241347] =================================================
 
 

Expected Output with Hardware-ECC

[  173.536121] =================================================
[  173.541868] mtd_oobtest: MTD device: 0
[  173.545616] mtd_oobtest: MTD device size 4194304, eraseblock size 4194304, page size 16384, count of eraseblocks 1, pages per eraseblock 256, OOB size 1216
[  173.559598] mtd_test: scanning for bad eraseblocks
[  173.565420] mtd_test: scanned 1 eraseblocks, 0 are bad
[  173.570572] mtd_oobtest: test 1 of 5
[  173.576150] mtd_oobtest: writing OOBs of whole device
[  173.675052] mtd_oobtest: written up to eraseblock 0
[  173.680044] mtd_oobtest: written 1 eraseblocks
[  173.684491] mtd_oobtest: verifying all eraseblocks
[  173.714131] mtd_oobtest: verified up to eraseblock 0
[  173.719184] mtd_oobtest: verified 1 eraseblocks
[  173.723712] mtd_oobtest: test 2 of 5
[  173.729260] mtd_oobtest: writing OOBs of whole device
[  173.828219] mtd_oobtest: written up to eraseblock 0
[  173.833186] mtd_oobtest: written 1 eraseblocks
[  173.837638] mtd_oobtest: verifying all eraseblocks
[  173.867209] mtd_oobtest: verified up to eraseblock 0
[  173.872377] mtd_oobtest: verified 1 eraseblocks
[  173.876907] mtd_oobtest: test 3 of 5
[  173.882468] mtd_oobtest: writing OOBs of whole device
[  173.980723] mtd_oobtest: written up to eraseblock 0
[  173.985688] mtd_oobtest: written 1 eraseblocks
[  173.990129] mtd_oobtest: verifying all eraseblocks
[  174.043722] mtd_oobtest: verified up to eraseblock 0
[  174.048780] mtd_oobtest: verified 1 eraseblocks
[  174.053312] mtd_oobtest: test 4 of 5
[  174.058860] mtd_oobtest: attempting to start write past end of OOB
[  174.065039] mtd_oobtest: an error is expected...
[  174.069657] mtd_oobtest: error occurred as expected
[  174.074532] mtd_oobtest: attempting to start read past end of OOB
[  174.080617] mtd_oobtest: an error is expected...
[  174.085225] mtd_oobtest: error occurred as expected
[  174.090098] mtd_oobtest: attempting to write past end of device
[  174.096016] mtd_oobtest: an error is expected...
[  174.100626] mtd_oobtest: error occurred as expected
[  174.105494] mtd_oobtest: attempting to read past end of device
[  174.111318] mtd_oobtest: an error is expected...
[  174.115930] mtd_oobtest: error occurred as expected
[  174.122007] mtd_oobtest: attempting to write past end of device
[  174.127924] mtd_oobtest: an error is expected...
[  174.132532] mtd_oobtest: error occurred as expected
[  174.137401] mtd_oobtest: attempting to read past end of device
[  174.143226] mtd_oobtest: an error is expected...
[  174.147835] mtd_oobtest: error occurred as expected
[  174.152705] mtd_oobtest: test 5 of 5
[  174.158262] mtd_oobtest: writing OOBs of whole device
[  174.163316] mtd_oobtest: written 0 eraseblocks
[  174.167759] mtd_oobtest: verifying all eraseblocks
[  174.172548] mtd_oobtest: verified 0 eraseblocks
[  174.177070] mtd_oobtest: finished with 0 errors
[  174.181595] =================================================

MTD speed test

How to Run

 After Linux boot,


root@zynqmp:~# insmod /lib64/modules/5.4/kernel/drivers/mtd/tests/mtd_speedtest.ko dev=1

Expected Output with Software-ECC

[ 132.224327] =================================================
[ 132.230074] mtd_speedtest: MTD device: 0
[ 132.233995] mtd_speedtest: MTD device size 4194304, eraseblock size 4194304, page size 16384, count of eraseblocks 1, pages per eraseblock 256, OOB size 1216
[ 132.267422] mtd_test: scanning for bad eraseblocks
[ 132.273525] mtd_test: scanned 1 eraseblocks, 0 are bad
[ 132.279962] mtd_speedtest: testing eraseblock write speed
[ 132.455386] mtd_speedtest: eraseblock write speed is 24236 KiB/s
[ 132.461410] mtd_speedtest: testing eraseblock read speed
[ 132.722160] mtd_speedtest: eraseblock read speed is 16062 KiB/s
[ 132.730690] mtd_speedtest: testing page write speed
[ 132.907146] mtd_speedtest: page write speed is 23953 KiB/s
[ 132.912644] mtd_speedtest: testing page read speed
[ 133.173203] mtd_speedtest: page read speed is 16062 KiB/s
[ 133.181274] mtd_speedtest: testing 2 page write speed
[ 133.357671] mtd_speedtest: 2 page write speed is 23953 KiB/s
[ 133.363354] mtd_speedtest: testing 2 page read speed
[ 133.623756] mtd_speedtest: 2 page read speed is 16062 KiB/s
[ 133.629351] mtd_speedtest: Testing erase speed
[ 133.636458] mtd_speedtest: erase speed is 2048000 KiB/s
[ 133.641678] mtd_speedtest: Testing 2x multi-block erase speed
[ 133.648716] mtd_speedtest: 2x multi-block erase speed is 4096000 KiB/s
[ 133.655245] mtd_speedtest: Testing 4x multi-block erase speed
[ 133.662279] mtd_speedtest: 4x multi-block erase speed is 4096000 KiB/s
[ 133.668804] mtd_speedtest: Testing 8x multi-block erase speed
[ 133.675844] mtd_speedtest: 8x multi-block erase speed is 4096000 KiB/s
[ 133.682378] mtd_speedtest: Testing 16x multi-block erase speed
[ 133.689496] mtd_speedtest: 16x multi-block erase speed is 4096000 KiB/s
[ 133.696111] mtd_speedtest: Testing 32x multi-block erase speed
[ 133.703926] mtd_speedtest: 32x multi-block erase speed is 4096000 KiB/s
[ 133.710537] mtd_speedtest: Testing 64x multi-block erase speed
[ 133.717657] mtd_speedtest: 64x multi-block erase speed is 4096000 KiB/s
[ 133.724272] mtd_speedtest: finished
[ 133.727756] =================================================

Expected Output with Hardware-ECC

[ 42.184167] =================================================
[ 42.189916] mtd_speedtest: MTD device: 0
[ 42.193837] mtd_speedtest: MTD device size 4194304, eraseblock size 4194304, page size 16384, count of eraseblocks 1, pages per eraseblock 256, OOB size 1216
[ 42.227264] mtd_test: scanning for bad eraseblocks
[ 42.232496] mtd_test: scanned 1 eraseblocks, 0 are bad
[ 42.238874] mtd_speedtest: testing eraseblock write speed
[ 42.373701] mtd_speedtest: eraseblock write speed is 31751 KiB/s
[ 42.379777] mtd_speedtest: testing eraseblock read speed
[ 42.585852] mtd_speedtest: eraseblock read speed is 20480 KiB/s
[ 42.594434] mtd_speedtest: testing page write speed
[ 42.729715] mtd_speedtest: page write speed is 31507 KiB/s
[ 42.735221] mtd_speedtest: testing page read speed
[ 42.941805] mtd_speedtest: page read speed is 20378 KiB/s
[ 42.949855] mtd_speedtest: testing 2 page write speed
[ 43.085502] mtd_speedtest: 2 page write speed is 31507 KiB/s
[ 43.091175] mtd_speedtest: testing 2 page read speed
[ 43.296757] mtd_speedtest: 2 page read speed is 20480 KiB/s
[ 43.302349] mtd_speedtest: Testing erase speed
[ 43.309460] mtd_speedtest: erase speed is 2048000 KiB/s
[ 43.314686] mtd_speedtest: Testing 2x multi-block erase speed
[ 43.321743] mtd_speedtest: 2x multi-block erase speed is 4096000 KiB/s
[ 43.328270] mtd_speedtest: Testing 4x multi-block erase speed
[ 43.335306] mtd_speedtest: 4x multi-block erase speed is 4096000 KiB/s
[ 43.341828] mtd_speedtest: Testing 8x multi-block erase speed
[ 43.348854] mtd_speedtest: 8x multi-block erase speed is 4096000 KiB/s
[ 43.355378] mtd_speedtest: Testing 16x multi-block erase speed
[ 43.363185] mtd_speedtest: 16x multi-block erase speed is 4096000 KiB/s
[ 43.369796] mtd_speedtest: Testing 32x multi-block erase speed
[ 43.376899] mtd_speedtest: 32x multi-block erase speed is 4096000 KiB/s
[ 43.383510] mtd_speedtest: Testing 64x multi-block erase speed
[ 43.390628] mtd_speedtest: 64x multi-block erase speed is 4096000 KiB/s
[ 43.397241] mtd_speedtest: finished
[ 43.400739] =================================================

MTD stress test

How to Run

 After Linux boot,


root@zynqmp:~# insmod /lib64/modules/5.4/kernel/drivers/mtd/tests/mtd_stresstest.ko count=100 dev=1

Expected Output

[   36.339646] =================================================
[   36.347710] mtd_stresstest: MTD device: 1
[   36.351722] mtd_stresstest: MTD device size 20971520, eraseblock size 4194304, page size 16384, count of eraseblocks 5, pages per eraseblock 256, OOB size 1216
[   36.402798] mtd_test: scanning for bad eraseblocks
[   36.407604] mtd_test: block 0 is bad
[   36.411204] mtd_test: block 2 is bad
[   36.414787] mtd_test: scanned 5 eraseblocks, 2 are bad
[   36.419917] mtd_stresstest: doing operations
[   36.424184] mtd_stresstest: 0 operations done
[   36.925795] random: crng init done
[   37.451376] mtd_stresstest: finished, 5 operations done
[   37.459647] =================================================
 
 

MTD page read test

How to Run

 After Linux boot,


root@zynqmp:~# insmod /lib64/modules/5.4/kernel/drivers/mtd/tests/mtd_readtest.ko dev=0

Expected Output

[  383.850772] =================================================
[  383.857809] mtd_readtest: MTD device: 1
[  383.861648] mtd_readtest: MTD device size 20971520, eraseblock size 4194304, page size 16384, count of eraseblocks 5, pages per eraseblock 256, OOB size 1216
[  383.875808] mtd_test: scanning for bad eraseblocks
[  383.880599] mtd_test: block 0 is bad
[  383.884204] mtd_test: block 2 is bad
[  383.887775] mtd_test: scanned 5 eraseblocks, 2 are bad
[  383.892915] mtd_readtest: testing page read
[  384.155680] mtd_readtest: finished
[  384.159103] =================================================
 
**Note:** Paths for the modules and tool names may vary from release to release. Please cross verify before starting the test.
 
 

Change Log

  • 2024.1

    • Summary
      • Include ECC syndrome along with in-band data while checking for ECC failure
    • Commits
  • 2023.2

    • Summary
      • Avoid overwriting valid data while checking for bitflips during HW-ECC read
    • Commits
  • 2023.1

    • Summary
      • Update NAND bus clock instead of system clock
      • Fix clock rate in NV-DDR
    • Commits
  • 2022.2

    • Summary
      • Update NAND bus clock instead of system clock
      • Fix clock rate in NV-DDR
      • Provide an additional ->exec_op() check
    • Commits
  • 2022.1

    • Summary
      • Prevent an unsupported configuration
    • Commits
  • 2021.2

    • Summary
      • Add a helper to check if a CHANGE_READ_COLUMN is possible.
      • Check if CHANGE_READ_COLUMN is supported.
    • Commits
  • 2021.1

    • Summary
      • Support the hardware BCH ECC engine.
      • Use the ECC framework OOB layouts.
      • Add NV-DDR Interface support.
      • Workaround a misbehaving prog type with NV-DDR.
    • Commits

Mainline status

Mainlined

Related Links


© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy