Commit df00c79f authored by Laxman Dewangan's avatar Laxman Dewangan Committed by Mark Brown

regmap: Bypassing cache when initializing cache

During regcache_init, if client has not passed the
default data of cached register then it is directly
read from the hw to initialize cache. This hw register
read happens before cache ops are initialized and hence
avoiding register read to check for the data available
on cache or not by enabling flag of cache_bypass.
Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 8eaeb219
...@@ -35,12 +35,17 @@ static int regcache_hw_init(struct regmap *map) ...@@ -35,12 +35,17 @@ static int regcache_hw_init(struct regmap *map)
return -EINVAL; return -EINVAL;
if (!map->reg_defaults_raw) { if (!map->reg_defaults_raw) {
u32 cache_bypass = map->cache_bypass;
dev_warn(map->dev, "No cache defaults, reading back from HW\n"); dev_warn(map->dev, "No cache defaults, reading back from HW\n");
/* Bypass the cache access till data read from HW*/
map->cache_bypass = 1;
tmp_buf = kmalloc(map->cache_size_raw, GFP_KERNEL); tmp_buf = kmalloc(map->cache_size_raw, GFP_KERNEL);
if (!tmp_buf) if (!tmp_buf)
return -EINVAL; return -EINVAL;
ret = regmap_bulk_read(map, 0, tmp_buf, ret = regmap_bulk_read(map, 0, tmp_buf,
map->num_reg_defaults_raw); map->num_reg_defaults_raw);
map->cache_bypass = cache_bypass;
if (ret < 0) { if (ret < 0) {
kfree(tmp_buf); kfree(tmp_buf);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment