aboutsummaryrefslogtreecommitdiff
path: root/drivers/clk/at91/pmc.c
diff options
context:
space:
mode:
authorBoris Brezillon2014-09-05 09:54:13 +0200
committerAlexandre Belloni2016-02-17 17:52:58 +0100
commit863a81c3be1d931bdae6426e231add9334311f13 (patch)
tree425f5509a766c4025821457a5c10cb258fc343f7 /drivers/clk/at91/pmc.c
parent92e963f50fc74041b5e9e744c330dca48e04f08d (diff)
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.c')
-rw-r--r--drivers/clk/at91/pmc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index 8476b570779b..481146029b2e 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c
@@ -19,6 +19,7 @@
#include <linux/irqchip/chained_irq.h>
#include <linux/irqdomain.h>
#include <linux/of_irq.h>
+#include <linux/mfd/syscon.h>
#include <asm/proc-fns.h>
@@ -223,6 +224,7 @@ static const struct at91_pmc_caps sama5d3_caps = {
};
static struct at91_pmc *__init at91_pmc_init(struct device_node *np,
+ struct regmap *regmap,
void __iomem *regbase, int virq,
const struct at91_pmc_caps *caps)
{
@@ -238,7 +240,7 @@ static struct at91_pmc *__init at91_pmc_init(struct device_node *np,
return NULL;
spin_lock_init(&pmc->lock);
- pmc->regbase = regbase;
+ pmc->regmap = regmap;
pmc->virq = virq;
pmc->caps = caps;
@@ -394,16 +396,18 @@ static void __init of_at91_pmc_setup(struct device_node *np,
void (*clk_setup)(struct device_node *, struct at91_pmc *);
const struct of_device_id *clk_id;
void __iomem *regbase = of_iomap(np, 0);
+ struct regmap *regmap;
int virq;
- if (!regbase)
- return;
+ regmap = syscon_node_to_regmap(np);
+ if (IS_ERR(regmap))
+ panic("Could not retrieve syscon regmap");
virq = irq_of_parse_and_map(np, 0);
if (!virq)
return;
- pmc = at91_pmc_init(np, regbase, virq, caps);
+ pmc = at91_pmc_init(np, regmap, regbase, virq, caps);
if (!pmc)
return;
for_each_child_of_node(np, childnp) {