]> git.baikalelectronics.ru Git - kernel.git/commit
mtd: nand: invalidate cache on unaligned reads
authorBrian Norris <computersforpeace@gmail.com>
Wed, 7 Sep 2011 20:13:40 +0000 (13:13 -0700)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 21 Sep 2011 06:19:08 +0000 (09:19 +0300)
commitf3b8ae39036cf12bc870af2a38cf37f5d1070acf
tree7229784e41ddbc35861bed96c3203e9d90e50e54
parentc72c492e84a6d70b6acae8388c5bd682f7f8df12
mtd: nand: invalidate cache on unaligned reads

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: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
drivers/mtd/nand/nand_base.c