Merge tag 'clk-for-linus-3.15' of git://git.linaro.org/people/mike.turquette/linux
[deliverable/linux.git] / drivers / clk / at91 / pmc.h
CommitLineData
0ad6125b
BB
1/*
2 * drivers/clk/at91/pmc.h
3 *
4 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __PMC_H_
13#define __PMC_H_
14
15#include <linux/io.h>
16#include <linux/irqdomain.h>
17#include <linux/spinlock.h>
18
19struct clk_range {
20 unsigned long min;
21 unsigned long max;
22};
23
24#define CLK_RANGE(MIN, MAX) {.min = MIN, .max = MAX,}
25
26struct at91_pmc_caps {
27 u32 available_irqs;
28};
29
30struct at91_pmc {
31 void __iomem *regbase;
32 int virq;
33 spinlock_t lock;
34 const struct at91_pmc_caps *caps;
35 struct irq_domain *irqdomain;
36};
37
38static inline void pmc_lock(struct at91_pmc *pmc)
39{
40 spin_lock(&pmc->lock);
41}
42
43static inline void pmc_unlock(struct at91_pmc *pmc)
44{
45 spin_unlock(&pmc->lock);
46}
47
48static inline u32 pmc_read(struct at91_pmc *pmc, int offset)
49{
50 return readl(pmc->regbase + offset);
51}
52
53static inline void pmc_write(struct at91_pmc *pmc, int offset, u32 value)
54{
55 writel(value, pmc->regbase + offset);
56}
57
58int of_at91_get_clk_range(struct device_node *np, const char *propname,
59 struct clk_range *range);
60
38d34c31
BB
61extern void __init of_at91rm9200_clk_main_setup(struct device_node *np,
62 struct at91_pmc *pmc);
63
1a748d2b
BB
64extern void __init of_at91rm9200_clk_pll_setup(struct device_node *np,
65 struct at91_pmc *pmc);
66extern void __init of_at91sam9g45_clk_pll_setup(struct device_node *np,
67 struct at91_pmc *pmc);
68extern void __init of_at91sam9g20_clk_pllb_setup(struct device_node *np,
69 struct at91_pmc *pmc);
70extern void __init of_sama5d3_clk_pll_setup(struct device_node *np,
71 struct at91_pmc *pmc);
72extern void __init of_at91sam9x5_clk_plldiv_setup(struct device_node *np,
73 struct at91_pmc *pmc);
74
e442d234
BB
75extern void __init of_at91rm9200_clk_master_setup(struct device_node *np,
76 struct at91_pmc *pmc);
77extern void __init of_at91sam9x5_clk_master_setup(struct device_node *np,
78 struct at91_pmc *pmc);
79
5fba62ea
BB
80extern void __init of_at91rm9200_clk_sys_setup(struct device_node *np,
81 struct at91_pmc *pmc);
82
6114067e
BB
83extern void __init of_at91rm9200_clk_periph_setup(struct device_node *np,
84 struct at91_pmc *pmc);
85extern void __init of_at91sam9x5_clk_periph_setup(struct device_node *np,
86 struct at91_pmc *pmc);
87
1f22f8bb
BB
88extern void __init of_at91rm9200_clk_prog_setup(struct device_node *np,
89 struct at91_pmc *pmc);
90extern void __init of_at91sam9g45_clk_prog_setup(struct device_node *np,
91 struct at91_pmc *pmc);
92extern void __init of_at91sam9x5_clk_prog_setup(struct device_node *np,
93 struct at91_pmc *pmc);
1f22f8bb 94
f090fb37
BB
95#if defined(CONFIG_HAVE_AT91_UTMI)
96extern void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np,
97 struct at91_pmc *pmc);
98#endif
99
c84a61d8
BB
100#if defined(CONFIG_HAVE_AT91_USB_CLK)
101extern void __init of_at91rm9200_clk_usb_setup(struct device_node *np,
102 struct at91_pmc *pmc);
103extern void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
104 struct at91_pmc *pmc);
105extern void __init of_at91sam9n12_clk_usb_setup(struct device_node *np,
106 struct at91_pmc *pmc);
107#endif
108
a9c0688f
BB
109#if defined(CONFIG_HAVE_AT91_SMD)
110extern void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
111 struct at91_pmc *pmc);
112#endif
113
0ad6125b 114#endif /* __PMC_H_ */
This page took 0.046324 seconds and 5 git commands to generate.