aboutsummaryrefslogtreecommitdiff
path: root/include/regmap.h
diff options
context:
space:
mode:
authorMario Six <mario.six@gdsys.cc>2018-10-15 09:24:11 +0200
committerSimon Glass <sjg@chromium.org>2018-11-14 09:16:27 -0800
commitd5c7bd985d759b7aade2700c11890821e6187e4b (patch)
tree1ae2265b0c770b50524fb4e0655d74a866c24422 /include/regmap.h
parent84ff8f622d2e2aeb67c1cec1c2c814895648fca8 (diff)
downloadu-boot-d5c7bd985d759b7aade2700c11890821e6187e4b.zip
u-boot-d5c7bd985d759b7aade2700c11890821e6187e4b.tar.gz
u-boot-d5c7bd985d759b7aade2700c11890821e6187e4b.tar.bz2
regmap: Support reading from specific range
It is useful to be able to treat the different ranges of a regmap separately to be able to use distinct offset for them, but this is currently not implemented in the regmap API. To preserve backwards compatibility, add regmap_read_range and regmap_write_range functions that take an additional parameter 'range_num' that identifies the range to operate on. Reviewed-by: Anatolij Gustschin <agust@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'include/regmap.h')
-rw-r--r--include/regmap.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/regmap.h b/include/regmap.h
index f23664e..eba300d 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -115,6 +115,37 @@ int regmap_raw_write(struct regmap *map, uint offset, const void *val,
int regmap_raw_read(struct regmap *map, uint offset, void *valp,
size_t val_len);
+/**
+ * regmap_raw_write_range() - Write a value of specified length to a range of a
+ * regmap
+ *
+ * @map: Regmap to write to
+ * @range_num: Number of the range in the regmap to write to
+ * @offset: Offset in the regmap to write to
+ * @val: Value to write to the regmap at the specified offset
+ * @val_len: Length of the data to be written to the regmap
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int regmap_raw_write_range(struct regmap *map, uint range_num, uint offset,
+ const void *val, size_t val_len);
+
+/**
+ * regmap_raw_read_range() - Read a value of specified length from a range of a
+ * regmap
+ *
+ * @map: Regmap to read from
+ * @range_num: Number of the range in the regmap to write to
+ * @offset: Offset in the regmap to read from
+ * @valp: Pointer to the buffer to receive the data read from the regmap
+ * at the specified offset
+ * @val_len: Length of the data to be read from the regmap
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int regmap_raw_read_range(struct regmap *map, uint range_num, uint offset,
+ void *valp, size_t val_len);
+
#define regmap_write32(map, ptr, member, val) \
regmap_write(map, (uint32_t *)(ptr)->member - (uint32_t *)(ptr), val)