diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2013-07-23 14:16:02 +0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-08-06 21:33:59 +0400 |
commit | f161d22081e9b81f0b35411c428af347ca3dd449 (patch) | |
tree | 2baf0f821d547749eb9f32b34fed75a38255bffd /drivers/base/regmap/regmap.c | |
parent | c095ba7224d8edc71dcef0d655911399a8bd4a3f (diff) | |
download | linux-f161d22081e9b81f0b35411c428af347ca3dd449.tar.xz |
regmap: core: allow a virtual range to cover its own data window
I see no reason why a virtual range shouldn't be allowed to cover its
own data window if the page selection register is in the same place
on every page.
For chips which use paged access for all of their registers, but only
when connected via I2C, and which can access the whole register space
directly when connected via SPI, this allows to avoid acrobatics with
the register ranges by simply mapping the I2C ranges over the data
window beginning at 0x0, and then using linear access for the SPI
variant.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/base/regmap/regmap.c')
-rw-r--r-- | drivers/base/regmap/regmap.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index e0d0c7d8a5c5..436fac05b3b6 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -687,6 +687,10 @@ skip_format_initialization: unsigned win_max = win_min + config->ranges[j].window_len - 1; + /* Allow data window inside its own virtual range */ + if (j == i) + continue; + if (range_cfg->range_min <= sel_reg && sel_reg <= range_cfg->range_max) { dev_err(map->dev, |