summaryrefslogtreecommitdiff
path: root/drivers/clk/at91/pmc.h
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2014-09-05 11:54:13 +0400
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2016-02-17 19:52:58 +0300
commit863a81c3be1d931bdae6426e231add9334311f13 (patch)
tree425f5509a766c4025821457a5c10cb258fc343f7 /drivers/clk/at91/pmc.h
parent92e963f50fc74041b5e9e744c330dca48e04f08d (diff)
downloadlinux-863a81c3be1d931bdae6426e231add9334311f13.tar.xz
clk: at91: make use of syscon to share PMC registers in several drivers
The PMC block is providing several functionnalities: - system clk management - cpuidle - platform suspend Replace the void __iomem *regs field by a regmap (retrieved using syscon) so that we can later share the regmap across several drivers without exporting a new specific API or a global void __iomem * variable. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/at91/pmc.h')
-rw-r--r--drivers/clk/at91/pmc.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h
index f65739272779..e1fc0b0e1d8c 100644
--- a/drivers/clk/at91/pmc.h
+++ b/drivers/clk/at91/pmc.h
@@ -14,6 +14,7 @@
#include <linux/io.h>
#include <linux/irqdomain.h>
+#include <linux/regmap.h>
#include <linux/spinlock.h>
struct clk_range {
@@ -28,7 +29,7 @@ struct at91_pmc_caps {
};
struct at91_pmc {
- void __iomem *regbase;
+ struct regmap *regmap;
int virq;
spinlock_t lock;
const struct at91_pmc_caps *caps;
@@ -48,12 +49,16 @@ static inline void pmc_unlock(struct at91_pmc *pmc)
static inline u32 pmc_read(struct at91_pmc *pmc, int offset)
{
- return readl(pmc->regbase + offset);
+ unsigned int ret = 0;
+
+ regmap_read(pmc->regmap, offset, &ret);
+
+ return ret;
}
static inline void pmc_write(struct at91_pmc *pmc, int offset, u32 value)
{
- writel(value, pmc->regbase + offset);
+ regmap_write(pmc->regmap, offset, value);
}
int of_at91_get_clk_range(struct device_node *np, const char *propname,