• Brian Norris's avatar
    mtd: nand: invalidate cache on unaligned reads · 6d77b9d0
    Brian Norris authored
    In rare cases, we are given an unaligned parameter `from' in
    `nand_do_read_ops()'. In such cases, we use the page cache
    (chip->buffers->databuf) as an intermediate buffer before dumping to the
    client buffer. However, there are also cases where this buffer is not
    cleanly reusable. In those cases, we need to make sure that we
    explicitly invalidate the cache.
    
    This patch prevents accidental reusage of the page cache, and for me,
    this solves some problems I come across when reading a corrupted BBT
    from flash (NAND_BBT_USE_FLASH and NAND_BBT_NO_OOB).
    
    Note: the rare "unaligned" case is a result of the extra BBT pattern +
    version located in the data area instead of OOB.
    
    Also, this patch disables caching on raw reads, since we are reading
    without error correction. This is, obviously, prone to errors and should
    not be cached.
    Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
    Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@intel.com>
    6d77b9d0
nand_base.c 91.2 KB