mtd: nand: fix off-by-one read retry mode counting
authorBrian Norris <computersforpeace@gmail.com>
Thu, 13 Feb 2014 00:08:28 +0000 (16:08 -0800)
committerBrian Norris <computersforpeace@gmail.com>
Fri, 14 Feb 2014 20:08:20 +0000 (12:08 -0800)
commit28fa65e643ed7cf753e89db20745e264c41f3682
tree6e317f9bde6c3e21a955bb75ad7c37669d88243c
parentb28a960c42fcd9cfc987441fa6d1c1a471f0f9ed
mtd: nand: fix off-by-one read retry mode counting

A flash may support N read retry voltage threshold modes, numbered 0
through N-1 (where mode 0 represents the initial state). However,
nand_do_read_ops() tries to use mode 0 through N.

This off-by-one error shows up, for instance, when using nanddump, and
we have cycled through available modes:

    nand: setting READ RETRY mode 0
    nand: setting READ RETRY mode 1
    nand: setting READ RETRY mode 2
    nand: setting READ RETRY mode 3
    nand: setting READ RETRY mode 4
    nand: setting READ RETRY mode 5
    nand: setting READ RETRY mode 6
    nand: setting READ RETRY mode 7
    nand: setting READ RETRY mode 8
    libmtd: error!: cannot read 8192 bytes from mtd0 (eraseblock 20, offset 0)
            error 22 (Invalid argument)
    nanddump: error!: mtd_read

Tested on Micron MT29F64G08CBCBBH1, with 8 retry modes.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Huang Shijie <b32955@freescale.com>
drivers/mtd/nand/nand_base.c
This page took 0.039183 seconds and 5 git commands to generate.