regmap: Support some more block operations on cached devices
Lars-Peter Clausen [Tue, 8 Nov 2011 17:37:26 +0000 (18:37 +0100)]
Commit 10a08d9f ("regmap: Support some block operations on cached devices")
allowed raw read operations without throwing a warning when using caches if
all registers are volatile. This patch does the same for raw write operations.

This is for example useful when loading a firmware in a predefined volatile
region on a chip where we otherwise want registers to be cached.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
(cherry picked from commit c48a9d74926c83f62b0251eff0a3dde259923856)

Change-Id: I97c056ab223e0d7de068a92fa43abdebce4dd2a8
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/87552

drivers/base/regmap/regmap.c

index 4afab61..e9eda8c 100644 (file)
@@ -389,9 +389,11 @@ EXPORT_SYMBOL_GPL(regmap_write);
 int regmap_raw_write(struct regmap *map, unsigned int reg,
                     const void *val, size_t val_len)
 {
+       size_t val_count = val_len / map->format.val_bytes;
        int ret;
 
-       WARN_ON(map->cache_type != REGCACHE_NONE);
+       WARN_ON(!regmap_volatile_range(map, reg, val_count) &&
+               map->cache_type != REGCACHE_NONE);
 
        mutex_lock(&map->lock);