[PATCH] regcache: disable cache_only before rewriting paging registers

From: phucduc . bui

Date: Mon Jul 13 2026 - 03:31:37 EST


From: bui duc phuc <phucduc.bui@xxxxxxxxx>

cache_only must be disabled before re-writing the paging selector
registers. Otherwise, _regmap_write() would update only the cache
and return without calling map->reg_write(), leaving the selector
register on the hardware unwritten and out of sync with the cache.

Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---

Note: This patch was created while working on the following patch series:
https://lore.kernel.org/all/20260713050312.38729-1-phucduc.bui@xxxxxxxxx/

drivers/base/regmap/regcache.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c
index 96cdae25b9c4..43ee7c6c32d8 100644
--- a/drivers/base/regmap/regcache.c
+++ b/drivers/base/regmap/regcache.c
@@ -406,6 +406,7 @@ int regcache_sync(struct regmap *map)
unsigned int i;
const char *name;
bool bypass;
+ bool cache_only;
struct rb_node *node;

if (WARN_ON(map->cache_type == REGCACHE_NONE))
@@ -455,6 +456,9 @@ int regcache_sync(struct regmap *map)
* have gone out of sync, force writes of all the paging
* registers.
*/
+ cache_only = map->cache_only;
+ map->cache_only = false;
+
rb_for_each(node, NULL, &map->range_tree, rbtree_all) {
struct regmap_range_node *this =
rb_entry(node, struct regmap_range_node, node);
@@ -472,6 +476,8 @@ int regcache_sync(struct regmap *map)
}
}

+ map->cache_only = cache_only;
+
map->unlock(map->lock_arg);

regmap_async_complete(map);
--
2.43.0