diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2020-02-18 15:23:02 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-02-19 09:03:31 +0100 |
commit | afb230077602b5a50f9661bd11b71f678dc2fe34 (patch) | |
tree | a66c1fe3f6f7c866afe54f0c7b07eaa3f124983b /include | |
parent | 7f51a52308ad8fa988bc9386a17fdaea318aef0d (diff) | |
download | barebox-afb230077602b5a50f9661bd11b71f678dc2fe34.tar.gz barebox-afb230077602b5a50f9661bd11b71f678dc2fe34.tar.xz |
regmap: add support for regmap_init_mmio_clk
regmap-mmio is used in Linux for clocked memory mapped I/O regions.
Port it over, so we can more easily port drivers using it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/regmap.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/include/regmap.h b/include/regmap.h index 718bb51979..3bcd9fe038 100644 --- a/include/regmap.h +++ b/include/regmap.h @@ -45,6 +45,56 @@ struct regmap *regmap_init(struct device_d *dev, const struct regmap_bus *bus, void *bus_context, const struct regmap_config *config); + +struct clk; + +/** + * of_regmap_init_mmio_clk() - Initialise register map with register clock + * + * @np: Device node that will be interacted with + * @clk_id: register clock consumer ID + * @regs: Pointer to memory-mapped IO region + * @config: Configuration for register map + * + * The return value will be an ERR_PTR() on error or a valid pointer to + * a struct regmap. + */ +struct regmap *of_regmap_init_mmio_clk(struct device_node *np, const char *clk_id, + void __iomem *regs, + const struct regmap_config *config); + +/** + * regmap_init_mmio_clk() - Initialise register map with register clock + * + * @dev: Device that will be interacted with + * @clk_id: register clock consumer ID + * @regs: Pointer to memory-mapped IO region + * @config: Configuration for register map + * + * The return value will be an ERR_PTR() on error or a valid pointer to + * a struct regmap. + */ +struct regmap *regmap_init_mmio_clk(struct device_d *dev, const char *clk_id, + void __iomem *regs, + const struct regmap_config *config); + +/** + * regmap_init_mmio() - Initialise register map + * + * @dev: Device that will be interacted with + * @regs: Pointer to memory-mapped IO region + * @config: Configuration for register map + * + * The return value will be an ERR_PTR() on error or a valid pointer to + * a struct regmap. + */ +#define regmap_init_mmio(dev, regs, config) \ + regmap_init_mmio_clk(dev, NULL, regs, config) + + +int regmap_mmio_attach_clk(struct regmap *map, struct clk *clk); +void regmap_mmio_detach_clk(struct regmap *map); + void regmap_exit(struct regmap *map); struct regmap *dev_get_regmap(struct device_d *dev, const char *name); |