Warning: That file was not part of the compilation database. It may have many parsing errors.

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/regmap.h>
18#include <linux/spinlock.h>
19
20extern spinlock_t pmc_pcr_lock;
21
22struct pmc_data {
23 unsigned int ncore;
24 struct clk_hw **chws;
25 unsigned int nsystem;
26 struct clk_hw **shws;
27 unsigned int nperiph;
28 struct clk_hw **phws;
29 unsigned int ngck;
30 struct clk_hw **ghws;
31};
32
33struct clk_range {
34 unsigned long min;
35 unsigned long max;
36};
37
38#define CLK_RANGE(MIN, MAX) {.min = MIN, .max = MAX,}
39
40struct clk_master_layout {
41 u32 mask;
42 u8 pres_shift;
43};
44
45extern const struct clk_master_layout at91rm9200_master_layout;
46extern const struct clk_master_layout at91sam9x5_master_layout;
47
48struct clk_master_characteristics {
49 struct clk_range output;
50 u32 divisors[4];
51 u8 have_div3_pres;
52};
53
54struct clk_pll_layout {
55 u32 pllr_mask;
56 u16 mul_mask;
57 u8 mul_shift;
58};
59
60extern const struct clk_pll_layout at91rm9200_pll_layout;
61extern const struct clk_pll_layout at91sam9g45_pll_layout;
62extern const struct clk_pll_layout at91sam9g20_pllb_layout;
63extern const struct clk_pll_layout sama5d3_pll_layout;
64
65struct clk_pll_characteristics {
66 struct clk_range input;
67 int num_output;
68 struct clk_range *output;
69 u16 *icpll;
70 u8 *out;
71};
72
73struct clk_programmable_layout {
74 u8 pres_shift;
75 u8 css_mask;
76 u8 have_slck_mck;
77};
78
79extern const struct clk_programmable_layout at91rm9200_programmable_layout;
80extern const struct clk_programmable_layout at91sam9g45_programmable_layout;
81extern const struct clk_programmable_layout at91sam9x5_programmable_layout;
82
83#define ndck(a, s) (a[s - 1].id + 1)
84#define nck(a) (a[ARRAY_SIZE(a) - 1].id + 1)
85struct pmc_data *pmc_data_allocate(unsigned int ncore, unsigned int nsystem,
86 unsigned int nperiph, unsigned int ngck);
87void pmc_data_free(struct pmc_data *pmc_data);
88
89int of_at91_get_clk_range(struct device_node *np, const char *propname,
90 struct clk_range *range);
91
92struct clk_hw *of_clk_hw_pmc_get(struct of_phandle_args *clkspec, void *data);
93
94struct clk_hw * __init
95at91_clk_register_audio_pll_frac(struct regmap *regmap, const char *name,
96 const char *parent_name);
97
98struct clk_hw * __init
99at91_clk_register_audio_pll_pad(struct regmap *regmap, const char *name,
100 const char *parent_name);
101
102struct clk_hw * __init
103at91_clk_register_audio_pll_pmc(struct regmap *regmap, const char *name,
104 const char *parent_name);
105
106struct clk_hw * __init
107at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
108 const char *name, const char **parent_names,
109 u8 num_parents, u8 id, bool pll_audio,
110 const struct clk_range *range);
111
112struct clk_hw * __init
113at91_clk_register_h32mx(struct regmap *regmap, const char *name,
114 const char *parent_name);
115
116struct clk_hw * __init
117at91_clk_i2s_mux_register(struct regmap *regmap, const char *name,
118 const char * const *parent_names,
119 unsigned int num_parents, u8 bus_id);
120
121struct clk_hw * __init
122at91_clk_register_main_rc_osc(struct regmap *regmap, const char *name,
123 u32 frequency, u32 accuracy);
124struct clk_hw * __init
125at91_clk_register_main_osc(struct regmap *regmap, const char *name,
126 const char *parent_name, bool bypass);
127struct clk_hw * __init
128at91_clk_register_rm9200_main(struct regmap *regmap,
129 const char *name,
130 const char *parent_name);
131struct clk_hw * __init
132at91_clk_register_sam9x5_main(struct regmap *regmap, const char *name,
133 const char **parent_names, int num_parents);
134
135struct clk_hw * __init
136at91_clk_register_master(struct regmap *regmap, const char *name,
137 int num_parents, const char **parent_names,
138 const struct clk_master_layout *layout,
139 const struct clk_master_characteristics *characteristics);
140
141struct clk_hw * __init
142at91_clk_register_peripheral(struct regmap *regmap, const char *name,
143 const char *parent_name, u32 id);
144struct clk_hw * __init
145at91_clk_register_sam9x5_peripheral(struct regmap *regmap, spinlock_t *lock,
146 const char *name, const char *parent_name,
147 u32 id, const struct clk_range *range);
148
149struct clk_hw * __init
150at91_clk_register_pll(struct regmap *regmap, const char *name,
151 const char *parent_name, u8 id,
152 const struct clk_pll_layout *layout,
153 const struct clk_pll_characteristics *characteristics);
154struct clk_hw * __init
155at91_clk_register_plldiv(struct regmap *regmap, const char *name,
156 const char *parent_name);
157
158struct clk_hw * __init
159at91_clk_register_programmable(struct regmap *regmap, const char *name,
160 const char **parent_names, u8 num_parents, u8 id,
161 const struct clk_programmable_layout *layout);
162
163struct clk_hw * __init
164at91_clk_register_sam9260_slow(struct regmap *regmap,
165 const char *name,
166 const char **parent_names,
167 int num_parents);
168
169struct clk_hw * __init
170at91sam9x5_clk_register_smd(struct regmap *regmap, const char *name,
171 const char **parent_names, u8 num_parents);
172
173struct clk_hw * __init
174at91_clk_register_system(struct regmap *regmap, const char *name,
175 const char *parent_name, u8 id);
176
177struct clk_hw * __init
178at91sam9x5_clk_register_usb(struct regmap *regmap, const char *name,
179 const char **parent_names, u8 num_parents);
180struct clk_hw * __init
181at91sam9n12_clk_register_usb(struct regmap *regmap, const char *name,
182 const char *parent_name);
183struct clk_hw * __init
184at91rm9200_clk_register_usb(struct regmap *regmap, const char *name,
185 const char *parent_name, const u32 *divisors);
186
187struct clk_hw * __init
188at91_clk_register_utmi(struct regmap *regmap_pmc, struct regmap *regmap_sfr,
189 const char *name, const char *parent_name);
190
191#ifdef CONFIG_PM
192void pmc_register_id(u8 id);
193void pmc_register_pck(u8 pck);
194#else
195static inline void pmc_register_id(u8 id) {}
196static inline void pmc_register_pck(u8 pck) {}
197#endif
198
199#endif /* __PMC_H_ */
200

Warning: That file was not part of the compilation database. It may have many parsing errors.