summaryrefslogtreecommitdiff
path: root/include/regmap.h
diff options
context:
space:
mode:
authorJean-Jacques Hiblot <jjhiblot@ti.com>2020-09-24 10:04:10 +0530
committerTom Rini <trini@konsulko.com>2020-09-30 11:55:22 -0400
commitffb22f6b847d21b30831c91294ec21d6a5e80ed4 (patch)
treec47b83505480d280dddb4b2ad2401df7268b11f8 /include/regmap.h
parent88e6a60e4aeed2fec059e513572d191ce9387b07 (diff)
regmap: Add devm_regmap_init()
Most of new linux drivers are using managed-API to allocate resources. To ease porting drivers from linux to U-Boot, introduce devm_regmap_init() as a managed API to get a regmap from the device tree. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Diffstat (limited to 'include/regmap.h')
-rw-r--r--include/regmap.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/regmap.h b/include/regmap.h
index 30183c5e71..c7dd240a74 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -75,6 +75,9 @@ struct regmap_range {
ulong size;
};
+struct regmap_bus;
+struct regmap_config;
+
/**
* struct regmap - a way of accessing hardware/bus registers
*
@@ -336,6 +339,21 @@ 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);
/**
+ * devm_regmap_init() - Initialise register map (device managed)
+ *
+ * @dev: Device that will be interacted with
+ * @bus: Bus-specific callbacks to use with device (IGNORED)
+ * @bus_context: Data passed to bus-specific callbacks (IGNORED)
+ * @config: Configuration for register map (IGNORED)
+ *
+ * @Return a valid pointer to a struct regmap or a ERR_PTR() on error.
+ * The structure is automatically freed when the device is unbound
+ */
+struct regmap *devm_regmap_init(struct udevice *dev,
+ const struct regmap_bus *bus,
+ void *bus_context,
+ const struct regmap_config *config);
+/**
* regmap_get_range() - Obtain the base memory address of a regmap range
*
* @map: Regmap to query