diff options
| author | Philipp Zabel <p.zabel@pengutronix.de> | 2013-02-14 11:39:08 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-14 11:40:28 -0500 |
| commit | 878ec67b3ac528a2b6d44055f049cdbb9cfda30c (patch) | |
| tree | e6907b938e9c77c84aed65f7a6f8b2d72f4eb0fd /include/linux | |
| parent | 836dc9e3fbbab0c30aa6e664417225f5c1fb1c39 (diff) | |
regmap: mmio: add register clock support
Some mmio devices have a dedicated interface clock that needs
to be enabled to access their registers. This patch optionally
enables a clock before accessing registers in the regmap_bus
callbacks.
I added (devm_)regmap_init_mmio_clk variants of the init
functions that have an added clk_id string parameter. This
is passed to clk_get to request the clock from the clk
framework.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/regmap.h | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index b7e95bf942c9..f0480a3297e4 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
| @@ -285,9 +285,9 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c, | |||
| 285 | const struct regmap_config *config); | 285 | const struct regmap_config *config); |
| 286 | struct regmap *regmap_init_spi(struct spi_device *dev, | 286 | struct regmap *regmap_init_spi(struct spi_device *dev, |
| 287 | const struct regmap_config *config); | 287 | const struct regmap_config *config); |
| 288 | struct regmap *regmap_init_mmio(struct device *dev, | 288 | struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, |
| 289 | void __iomem *regs, | 289 | void __iomem *regs, |
| 290 | const struct regmap_config *config); | 290 | const struct regmap_config *config); |
| 291 | 291 | ||
| 292 | struct regmap *devm_regmap_init(struct device *dev, | 292 | struct regmap *devm_regmap_init(struct device *dev, |
| 293 | const struct regmap_bus *bus, | 293 | const struct regmap_bus *bus, |
| @@ -297,9 +297,44 @@ struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, | |||
| 297 | const struct regmap_config *config); | 297 | const struct regmap_config *config); |
| 298 | struct regmap *devm_regmap_init_spi(struct spi_device *dev, | 298 | struct regmap *devm_regmap_init_spi(struct spi_device *dev, |
| 299 | const struct regmap_config *config); | 299 | const struct regmap_config *config); |
| 300 | struct regmap *devm_regmap_init_mmio(struct device *dev, | 300 | struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, |
| 301 | void __iomem *regs, | 301 | void __iomem *regs, |
| 302 | const struct regmap_config *config); | 302 | const struct regmap_config *config); |
| 303 | |||
| 304 | /** | ||
| 305 | * regmap_init_mmio(): Initialise register map | ||
| 306 | * | ||
| 307 | * @dev: Device that will be interacted with | ||
| 308 | * @regs: Pointer to memory-mapped IO region | ||
| 309 | * @config: Configuration for register map | ||
| 310 | * | ||
| 311 | * The return value will be an ERR_PTR() on error or a valid pointer to | ||
| 312 | * a struct regmap. | ||
| 313 | */ | ||
| 314 | static inline struct regmap *regmap_init_mmio(struct device *dev, | ||
| 315 | void __iomem *regs, | ||
| 316 | const struct regmap_config *config) | ||
| 317 | { | ||
| 318 | return regmap_init_mmio_clk(dev, NULL, regs, config); | ||
| 319 | } | ||
| 320 | |||
| 321 | /** | ||
| 322 | * devm_regmap_init_mmio(): Initialise managed register map | ||
| 323 | * | ||
| 324 | * @dev: Device that will be interacted with | ||
| 325 | * @regs: Pointer to memory-mapped IO region | ||
| 326 | * @config: Configuration for register map | ||
| 327 | * | ||
| 328 | * The return value will be an ERR_PTR() on error or a valid pointer | ||
| 329 | * to a struct regmap. The regmap will be automatically freed by the | ||
| 330 | * device management code. | ||
| 331 | */ | ||
| 332 | static inline struct regmap *devm_regmap_init_mmio(struct device *dev, | ||
| 333 | void __iomem *regs, | ||
| 334 | const struct regmap_config *config) | ||
| 335 | { | ||
| 336 | return devm_regmap_init_mmio_clk(dev, NULL, regs, config); | ||
| 337 | } | ||
| 303 | 338 | ||
| 304 | void regmap_exit(struct regmap *map); | 339 | void regmap_exit(struct regmap *map); |
| 305 | int regmap_reinit_cache(struct regmap *map, | 340 | int regmap_reinit_cache(struct regmap *map, |
