• Miquel Raynal's avatar
    mtd: nand: fix interpretation of NAND_CMD_NONE in nand_command[_lp]() · df467899
    Miquel Raynal authored
    Some drivers (like nand_hynix.c) call ->cmdfunc() with NAND_CMD_NONE
    and a column address and expect the controller to only send address
    cycles. Right now, the default ->cmdfunc() implementations provided by
    the core do not filter out the command cycle in this case and forwards
    the request to the controller driver through the ->cmd_ctrl() method.
    The thing is, NAND controller drivers can get this wrong and send a
    command cycle with a NAND_CMD_NONE opcode and since NAND_CMD_NONE is
    -1, and the command field is usually casted to an u8, we end up sending
    the 0xFF command which is actually a RESET operation.
    
    Add conditions in nand_command[_lp]() functions to sending the initial
    command cycle when command == NAND_CMD_NONE.
    Signed-off-by: default avatarMiquel Raynal <miquel.raynal@free-electrons.com>
    Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
    df467899
nand_base.c 131 KB