blk: Invalidate block cache when switching hwpart
authorWeijie Gao <weijie.gao@mediatek.com>
Thu, 11 Jul 2019 07:10:23 +0000 (15:10 +0800)
committerTom Rini <trini@konsulko.com>
Thu, 18 Jul 2019 15:31:31 +0000 (11:31 -0400)
commit0ebe112d09b48230ba4be833cd3504b06997d9a4
tree6ef07a51f392f9d84bd2082550486b6f38cd13be
parent5490d6ad3b9f38aa26df36c37a1ffccad77bff7d
blk: Invalidate block cache when switching hwpart

Some storage devices have multiple hw partitions and both address from
zero, for example eMMC.
However currently block cache invalidation only applies to block
write/erase.
This can cause a problem that data of current hw partition is cached
before switching to another hw partition. And the following read
operation of the latter hw partition will get wrong data when reading
from the addresses that have been cached previously.

To solve this problem, invalidate block cache after a successful
select_hwpart operation.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
drivers/block/blk-uclass.c