#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>
};
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)
{
return NULL;
spin_lock_init(&pmc->lock);
- pmc->regbase = regbase;
+ pmc->regmap = regmap;
pmc->virq = virq;
pmc->caps = caps;
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) {
#include <linux/io.h>
#include <linux/irqdomain.h>
+#include <linux/regmap.h>
#include <linux/spinlock.h>
struct clk_range {
};
struct at91_pmc {
- void __iomem *regbase;
+ struct regmap *regmap;
int virq;
spinlock_t lock;
const struct at91_pmc_caps *caps;
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,