aboutsummaryrefslogtreecommitdiff
path: root/include/regmap.h
diff options
context:
space:
mode:
authorPratyush Yadav <p.yadav@ti.com>2020-09-24 10:04:14 +0530
committerTom Rini <trini@konsulko.com>2020-09-30 11:55:22 -0400
commit0e01a7c3f4b6a42f768a19f7fc1df92d3e3b5d37 (patch)
tree1b7a060901775e87954bfcc9c3dff11b4de041c3 /include/regmap.h
parent7aa5ddffe7fbafe7ef828088ba1dbc76270300c5 (diff)
downloadu-boot-0e01a7c3f4b6a42f768a19f7fc1df92d3e3b5d37.zip
u-boot-0e01a7c3f4b6a42f768a19f7fc1df92d3e3b5d37.tar.gz
u-boot-0e01a7c3f4b6a42f768a19f7fc1df92d3e3b5d37.tar.bz2
regmap: Add regmap_init_mem_range()
Right now, the base of a regmap can only be obtained from the device tree. This makes it impossible for devices which calculate the base at runtime to use a regmap. An example of such a device is the Cadence Sierra PHY. Allow creating a regmap with one range whose start and size can be specified by the driver based on calculations at runtime. Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/regmap.h')
-rw-r--r--include/regmap.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/regmap.h b/include/regmap.h
index e6c59df..7c8ad04 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -351,6 +351,25 @@ int regmap_init_mem_platdata(struct udevice *dev, fdt_val_t *reg, int count,
int regmap_init_mem_index(ofnode node, struct regmap **mapp, int index);
/**
+ * regmap_init_mem_range() - Set up a new memory region for ofnode with the
+ * specified range.
+ *
+ * @node: The ofnode for the map.
+ * @r_start: Start of the range.
+ * @r_size: Size of the range.
+ * @mapp: Returns allocated map.
+ *
+ * Return: 0 in success, -errno otherwise
+ *
+ * This creates a regmap with one range where instead of extracting the range
+ * from 'node', it is created based on the parameters specified. This is
+ * useful when a driver needs to calculate the base of the regmap at runtime,
+ * and can't specify it in device tree.
+ */
+int regmap_init_mem_range(ofnode node, ulong r_start, ulong r_size,
+ struct regmap **mapp);
+
+/**
* devm_regmap_init() - Initialise register map (device managed)
*
* @dev: Device that will be interacted with