提交 137b8334 编写于 作者: M Mark Brown

regmap: cache: Use raw I/O to sync rbtrees if we can

This will bring no meaningful benefit by itself, it is done as a separate
commit to aid bisection if there are problems with the following commits
adding support for coalescing adjacent writes.
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 221ad7f2
...@@ -55,6 +55,12 @@ static unsigned int regcache_rbtree_get_register(struct regmap *map, ...@@ -55,6 +55,12 @@ static unsigned int regcache_rbtree_get_register(struct regmap *map,
return regcache_get_val(map, rbnode->block, idx); return regcache_get_val(map, rbnode->block, idx);
} }
static const void *regcache_rbtree_get_reg_addr(struct regmap *map,
struct regcache_rbtree_node *rbnode, unsigned int idx)
{
return regcache_get_val_addr(map, rbnode->block, idx);
}
static void regcache_rbtree_set_register(struct regmap *map, static void regcache_rbtree_set_register(struct regmap *map,
struct regcache_rbtree_node *rbnode, struct regcache_rbtree_node *rbnode,
unsigned int idx, unsigned int val) unsigned int idx, unsigned int val)
...@@ -442,6 +448,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min, ...@@ -442,6 +448,7 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
struct regcache_rbtree_node *rbnode; struct regcache_rbtree_node *rbnode;
unsigned int regtmp; unsigned int regtmp;
unsigned int val; unsigned int val;
const void *addr;
int ret; int ret;
int i, base, end; int i, base, end;
...@@ -480,7 +487,17 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min, ...@@ -480,7 +487,17 @@ static int regcache_rbtree_sync(struct regmap *map, unsigned int min,
continue; continue;
map->cache_bypass = 1; map->cache_bypass = 1;
if (regmap_can_raw_write(map)) {
addr = regcache_rbtree_get_reg_addr(map,
rbnode, i);
ret = _regmap_raw_write(map, regtmp, addr,
map->format.val_bytes,
false);
} else {
ret = _regmap_write(map, regtmp, val); ret = _regmap_write(map, regtmp, val);
}
map->cache_bypass = 0; map->cache_bypass = 0;
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册