[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH 5.15 017/846] mtd: rawnand: davinci: Avoid duplicated page read
    From: Paul Cercueil <>

    commit 9c9d709965385de5a99f84b14bd5860e1541729e upstream.

    The function nand_davinci_read_page_hwecc_oob_first() first reads the
    OOB data, extracts the ECC information, programs the ECC hardware before
    reading the actual data in a loop.

    Right after the OOB data was read, it called nand_read_page_op() to
    reset the read cursor to the beginning of the page. This caused the
    first page to be read twice: in that call, and later in the loop.

    Address that issue by changing the call to nand_read_page_op() to
    nand_change_read_column_op(), which will only reset the read cursor.

    Cc: <> # v5.2
    Fixes: a0ac778eb82c ("mtd: rawnand: ingenic: Add support for the JZ4740")
    Signed-off-by: Paul Cercueil <>
    Signed-off-by: Miquel Raynal <>
    Signed-off-by: Greg Kroah-Hartman <>
    drivers/mtd/nand/raw/davinci_nand.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    --- a/drivers/mtd/nand/raw/davinci_nand.c
    +++ b/drivers/mtd/nand/raw/davinci_nand.c
    @@ -401,7 +401,8 @@ static int nand_davinci_read_page_hwecc_
    if (ret)
    return ret;

    - ret = nand_read_page_op(chip, page, 0, NULL, 0);
    + /* Move read cursor to start of page */
    + ret = nand_change_read_column_op(chip, 0, NULL, 0, false);
    if (ret)
    return ret;

     \ /
      Last update: 2022-01-24 23:40    [W:3.015 / U:0.660 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site