Commit f18ee501 authored by Mark Brown's avatar Mark Brown

regmap: Support paging for buses with reg_read()/reg_write()

We don't currently support paging for regmaps where the I/O happens through
bus provided reg_read() and reg_write() operatons, we simply ignore the
range since nothing is wired up properly. Wire things up.
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230324-regmap-reg-read-write-page-v1-1-1fbc0dac67ae@kernel.org
parent 2d38e861
......@@ -1945,6 +1945,15 @@ static int _regmap_bus_reg_write(void *context, unsigned int reg,
unsigned int val)
{
struct regmap *map = context;
struct regmap_range_node *range;
int ret;
range = _regmap_range_lookup(map, reg);
if (range) {
ret = _regmap_select_page(map, &reg, range, 1);
if (ret != 0)
return ret;
}
reg = regmap_reg_addr(map, reg);
return map->bus->reg_write(map->bus_context, reg, val);
......@@ -2842,6 +2851,15 @@ static int _regmap_bus_reg_read(void *context, unsigned int reg,
unsigned int *val)
{
struct regmap *map = context;
struct regmap_range_node *range;
int ret;
range = _regmap_range_lookup(map, reg);
if (range) {
ret = _regmap_select_page(map, &reg, range, 1);
if (ret != 0)
return ret;
}
reg = regmap_reg_addr(map, reg);
return map->bus->reg_read(map->bus_context, reg, val);
......
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