diff options
author | Stephen Warren <swarren@nvidia.com> | 2012-04-09 15:40:24 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-10 06:01:18 -0400 |
commit | f01ee60fffa4dc6c77122121233a793f7f696e67 (patch) | |
tree | 5072955487b9e4c80f5c6f6454358d80e8f23a48 /drivers/base/regmap/regmap-debugfs.c | |
parent | c0cc6fe1d09e3f1baecbdf8922473c8e7d3a5317 (diff) |
regmap: implement register striding
regmap_config.reg_stride is introduced. All extant register addresses
are a multiple of this value. Users of serial-oriented regmap busses will
typically set this to 1. Users of the MMIO regmap bus will typically set
this based on the value size of their registers, in bytes, so 4 for a
32-bit register.
Throughout the regmap code, actual register addresses are used. Wherever
the register address is used to index some array of values, the address
is divided by the stride to determine the index, or vice-versa. Error-
checking is added to all entry-points for register address data to ensure
that register addresses actually satisfy the specified stride. The MMIO
bus ensures that the specified stride is large enough for the register
size.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/regmap-debugfs.c')
-rw-r--r-- | drivers/base/regmap/regmap-debugfs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c index df97c93efa8e..bb1ff175b962 100644 --- a/drivers/base/regmap/regmap-debugfs.c +++ b/drivers/base/regmap/regmap-debugfs.c | |||
@@ -80,7 +80,7 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, | |||
80 | val_len = 2 * map->format.val_bytes; | 80 | val_len = 2 * map->format.val_bytes; |
81 | tot_len = reg_len + val_len + 3; /* : \n */ | 81 | tot_len = reg_len + val_len + 3; /* : \n */ |
82 | 82 | ||
83 | for (i = 0; i < map->max_register + 1; i++) { | 83 | for (i = 0; i <= map->max_register; i += map->reg_stride) { |
84 | if (!regmap_readable(map, i)) | 84 | if (!regmap_readable(map, i)) |
85 | continue; | 85 | continue; |
86 | 86 | ||
@@ -197,7 +197,7 @@ static ssize_t regmap_access_read_file(struct file *file, | |||
197 | reg_len = regmap_calc_reg_len(map->max_register, buf, count); | 197 | reg_len = regmap_calc_reg_len(map->max_register, buf, count); |
198 | tot_len = reg_len + 10; /* ': R W V P\n' */ | 198 | tot_len = reg_len + 10; /* ': R W V P\n' */ |
199 | 199 | ||
200 | for (i = 0; i < map->max_register + 1; i++) { | 200 | for (i = 0; i <= map->max_register; i += map->reg_stride) { |
201 | /* Ignore registers which are neither readable nor writable */ | 201 | /* Ignore registers which are neither readable nor writable */ |
202 | if (!regmap_readable(map, i) && !regmap_writeable(map, i)) | 202 | if (!regmap_readable(map, i) && !regmap_writeable(map, i)) |
203 | continue; | 203 | continue; |