2 * drivers/clk/at91/pmc.h
4 * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
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.
16 #include <linux/irqdomain.h>
17 #include <linux/spinlock.h>
24 #define CLK_RANGE(MIN, MAX) {.min = MIN, .max = MAX,}
26 struct at91_pmc_caps {
31 void __iomem *regbase;
34 const struct at91_pmc_caps *caps;
35 struct irq_domain *irqdomain;
38 static inline void pmc_lock(struct at91_pmc *pmc)
40 spin_lock(&pmc->lock);
43 static inline void pmc_unlock(struct at91_pmc *pmc)
45 spin_unlock(&pmc->lock);
48 static inline u32 pmc_read(struct at91_pmc *pmc, int offset)
50 return readl(pmc->regbase + offset);
53 static inline void pmc_write(struct at91_pmc *pmc, int offset, u32 value)
55 writel(value, pmc->regbase + offset);
58 int of_at91_get_clk_range(struct device_node *np, const char *propname,
59 struct clk_range *range);
61 extern void __init of_at91sam9260_clk_slow_setup(struct device_node *np,
62 struct at91_pmc *pmc);
64 extern void __init of_at91rm9200_clk_main_osc_setup(struct device_node *np,
65 struct at91_pmc *pmc);
66 extern void __init of_at91sam9x5_clk_main_rc_osc_setup(struct device_node *np,
67 struct at91_pmc *pmc);
68 extern void __init of_at91rm9200_clk_main_setup(struct device_node *np,
69 struct at91_pmc *pmc);
70 extern void __init of_at91sam9x5_clk_main_setup(struct device_node *np,
71 struct at91_pmc *pmc);
73 extern void __init of_at91rm9200_clk_pll_setup(struct device_node *np,
74 struct at91_pmc *pmc);
75 extern void __init of_at91sam9g45_clk_pll_setup(struct device_node *np,
76 struct at91_pmc *pmc);
77 extern void __init of_at91sam9g20_clk_pllb_setup(struct device_node *np,
78 struct at91_pmc *pmc);
79 extern void __init of_sama5d3_clk_pll_setup(struct device_node *np,
80 struct at91_pmc *pmc);
81 extern void __init of_at91sam9x5_clk_plldiv_setup(struct device_node *np,
82 struct at91_pmc *pmc);
84 extern void __init of_at91rm9200_clk_master_setup(struct device_node *np,
85 struct at91_pmc *pmc);
86 extern void __init of_at91sam9x5_clk_master_setup(struct device_node *np,
87 struct at91_pmc *pmc);
89 extern void __init of_at91rm9200_clk_sys_setup(struct device_node *np,
90 struct at91_pmc *pmc);
92 extern void __init of_at91rm9200_clk_periph_setup(struct device_node *np,
93 struct at91_pmc *pmc);
94 extern void __init of_at91sam9x5_clk_periph_setup(struct device_node *np,
95 struct at91_pmc *pmc);
97 extern void __init of_at91rm9200_clk_prog_setup(struct device_node *np,
98 struct at91_pmc *pmc);
99 extern void __init of_at91sam9g45_clk_prog_setup(struct device_node *np,
100 struct at91_pmc *pmc);
101 extern void __init of_at91sam9x5_clk_prog_setup(struct device_node *np,
102 struct at91_pmc *pmc);
104 #if defined(CONFIG_HAVE_AT91_UTMI)
105 extern void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np,
106 struct at91_pmc *pmc);
109 #if defined(CONFIG_HAVE_AT91_USB_CLK)
110 extern void __init of_at91rm9200_clk_usb_setup(struct device_node *np,
111 struct at91_pmc *pmc);
112 extern void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
113 struct at91_pmc *pmc);
114 extern void __init of_at91sam9n12_clk_usb_setup(struct device_node *np,
115 struct at91_pmc *pmc);
118 #if defined(CONFIG_HAVE_AT91_SMD)
119 extern void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
120 struct at91_pmc *pmc);
123 #if defined(CONFIG_HAVE_AT91_SMD)
124 extern void __init of_sama5d4_clk_h32mx_setup(struct device_node *np,
125 struct at91_pmc *pmc);
128 #endif /* __PMC_H_ */