mtd: nand: support Micron READ RETRY
authorBrian Norris <computersforpeace@gmail.com>
Tue, 3 Dec 2013 23:51:09 +0000 (15:51 -0800)
committerBrian Norris <computersforpeace@gmail.com>
Tue, 14 Jan 2014 07:13:05 +0000 (23:13 -0800)
commit8429bb3975ef81c114cde4da111e64d224d19f83
treefffbb2465b0ac01d053ba2ba0087a0b0d9db1c8f
parentba84fb5952af114e28ac82adcdef75297701ccc1
mtd: nand: support Micron READ RETRY

Micron provides READ RETRY support via the ONFI vendor-specific
parameter block (to indicate how many read-retry modes are available)
and the ONFI {GET,SET}_FEATURES commands with a vendor-specific feature
address (to support reading/switching the current read-retry mode).

The recommended sequence is as follows:

  1. Perform PAGE_READ operation
  2. If no ECC error, we are done
  3. Run SET_FEATURES with feature address 89h, mode 1
  4. Retry PAGE_READ operation
  5. If ECC error and there are remaining supported modes, increment the
     mode and return to step 3. Otherwise, this is a true ECC error.
  6. Run SET_FEATURES with feature address 89h, mode 0, to return to the
     default state.

This patch implements the chip->setup_read_retry() callback for
Micron and fills in the chip->read_retries.

Tested on Micron MT29F32G08CBADA, which supports 8 read-retry modes.

The Micron vendor-specific table was checked against the datasheets for
the following Micron NAND:

Needs retry   Cell-type    Part number          Vendor revision    Byte 180
-----------   ---------    ----------------     ---------------    ------------
No            SLC          MT29F16G08ABABA      1                  Reserved (0)
No            MLC          MT29F32G08CBABA      1                  Reserved (0)
No            SLC          MT29F1G08AACWP       1                  0
Yes           MLC          MT29F32G08CBADA      1                  08h
Yes           MLC          MT29F64G08CBABA      2                  08h

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
drivers/mtd/nand/nand_base.c
include/linux/mtd/nand.h