1
2
3
4
5
6
7
8
9
10#ifndef __ARCH_ARM_MACH_OMAP1_CLOCK_H
11#define __ARCH_ARM_MACH_OMAP1_CLOCK_H
12
13#include <linux/clk.h>
14#include <linux/list.h>
15
16#include <linux/clkdev.h>
17
18struct module;
19struct clk;
20
21struct omap_clk {
22 u16 cpu;
23 struct clk_lookup lk;
24};
25
26#define CLK(dev, con, ck, cp) \
27 { \
28 .cpu = cp, \
29 .lk = { \
30 .dev_id = dev, \
31 .con_id = con, \
32 .clk = ck, \
33 }, \
34 }
35
36
37#define CK_310 (1 << 0)
38#define CK_7XX (1 << 1)
39#define CK_1510 (1 << 2)
40#define CK_16XX (1 << 3)
41#define CK_1710 (1 << 4)
42
43
44
45#define __clk_get_name(clk) (clk->name)
46#define __clk_get_parent(clk) (clk->parent)
47#define __clk_get_rate(clk) (clk->rate)
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67struct clkops {
68 int (*enable)(struct clk *);
69 void (*disable)(struct clk *);
70 void (*find_idlest)(struct clk *, void __iomem **,
71 u8 *, u8 *);
72 void (*find_companion)(struct clk *, void __iomem **,
73 u8 *);
74 void (*allow_idle)(struct clk *);
75 void (*deny_idle)(struct clk *);
76};
77
78
79
80
81
82
83
84
85
86
87
88
89
90#define ENABLE_REG_32BIT (1 << 0)
91#define CLOCK_IDLE_CONTROL (1 << 1)
92#define CLOCK_NO_IDLE_PARENT (1 << 2)
93#define ENABLE_ON_INIT (1 << 3)
94#define INVERT_ENABLE (1 << 4)
95#define CLOCK_CLKOUTX2 (1 << 5)
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138struct clk {
139 struct list_head node;
140 const struct clkops *ops;
141 const char *name;
142 struct clk *parent;
143 struct list_head children;
144 struct list_head sibling;
145 unsigned long rate;
146 void __iomem *enable_reg;
147 unsigned long (*recalc)(struct clk *);
148 int (*set_rate)(struct clk *, unsigned long);
149 long (*round_rate)(struct clk *, unsigned long);
150 void (*init)(struct clk *);
151 u8 enable_bit;
152 s8 usecount;
153 u8 fixed_div;
154 u8 flags;
155 u8 rate_offset;
156 u8 src_offset;
157#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
158 struct dentry *dent;
159#endif
160};
161
162struct clk_functions {
163 int (*clk_enable)(struct clk *clk);
164 void (*clk_disable)(struct clk *clk);
165 long (*clk_round_rate)(struct clk *clk, unsigned long rate);
166 int (*clk_set_rate)(struct clk *clk, unsigned long rate);
167 int (*clk_set_parent)(struct clk *clk, struct clk *parent);
168 void (*clk_allow_idle)(struct clk *clk);
169 void (*clk_deny_idle)(struct clk *clk);
170 void (*clk_disable_unused)(struct clk *clk);
171};
172
173extern int clk_init(struct clk_functions *custom_clocks);
174extern void clk_preinit(struct clk *clk);
175extern int clk_register(struct clk *clk);
176extern void clk_reparent(struct clk *child, struct clk *parent);
177extern void clk_unregister(struct clk *clk);
178extern void propagate_rate(struct clk *clk);
179extern void recalculate_root_clocks(void);
180extern unsigned long followparent_recalc(struct clk *clk);
181extern void clk_enable_init_clocks(void);
182unsigned long omap_fixed_divisor_recalc(struct clk *clk);
183extern struct clk *omap_clk_get_by_name(const char *name);
184extern int omap_clk_enable_autoidle_all(void);
185extern int omap_clk_disable_autoidle_all(void);
186
187extern const struct clkops clkops_null;
188
189extern struct clk dummy_ck;
190
191int omap1_clk_init(void);
192void omap1_clk_late_init(void);
193extern int omap1_clk_enable(struct clk *clk);
194extern void omap1_clk_disable(struct clk *clk);
195extern long omap1_clk_round_rate(struct clk *clk, unsigned long rate);
196extern int omap1_clk_set_rate(struct clk *clk, unsigned long rate);
197extern unsigned long omap1_ckctl_recalc(struct clk *clk);
198extern int omap1_set_sossi_rate(struct clk *clk, unsigned long rate);
199extern unsigned long omap1_sossi_recalc(struct clk *clk);
200extern unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk);
201extern int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate);
202extern int omap1_set_uart_rate(struct clk *clk, unsigned long rate);
203extern unsigned long omap1_uart_recalc(struct clk *clk);
204extern int omap1_set_ext_clk_rate(struct clk *clk, unsigned long rate);
205extern long omap1_round_ext_clk_rate(struct clk *clk, unsigned long rate);
206extern void omap1_init_ext_clk(struct clk *clk);
207extern int omap1_select_table_rate(struct clk *clk, unsigned long rate);
208extern long omap1_round_to_table_rate(struct clk *clk, unsigned long rate);
209extern int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate);
210extern long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate);
211extern unsigned long omap1_watchdog_recalc(struct clk *clk);
212
213#ifdef CONFIG_OMAP_RESET_CLOCKS
214extern void omap1_clk_disable_unused(struct clk *clk);
215#else
216#define omap1_clk_disable_unused NULL
217#endif
218
219struct uart_clk {
220 struct clk clk;
221 unsigned long sysc_addr;
222};
223
224
225struct arm_idlect1_clk {
226 struct clk clk;
227 unsigned long no_idle_count;
228 __u8 idlect_shift;
229};
230
231
232#define CKCTL_PERDIV_OFFSET 0
233#define CKCTL_LCDDIV_OFFSET 2
234#define CKCTL_ARMDIV_OFFSET 4
235#define CKCTL_DSPDIV_OFFSET 6
236#define CKCTL_TCDIV_OFFSET 8
237#define CKCTL_DSPMMUDIV_OFFSET 10
238
239#define EN_DSPCK 13
240
241
242#define CKCTL_DSPPERDIV_OFFSET 0
243
244
245#define EN_WDTCK 0
246#define EN_XORPCK 1
247#define EN_PERCK 2
248#define EN_LCDCK 3
249#define EN_LBCK 4
250
251#define EN_APICK 6
252#define EN_TIMCK 7
253#define DMACK_REQ 8
254#define EN_GPIOCK 9
255
256#define EN_CKOUT_ARM 11
257
258
259#define EN_OCPI_CK 0
260#define EN_TC1_CK 2
261#define EN_TC2_CK 4
262
263
264#define EN_DSPTIMCK 5
265
266
267#define SDW_MCLK_INV_BIT 2
268#define USB_MCLK_EN_BIT 4
269#define USB_HOST_HHC_UHOST_EN 9
270#define SWD_ULPD_PLL_CLK_REQ 1
271#define COM_ULPD_PLL_CLK_REQ 1
272#define SWD_CLK_DIV_CTRL_SEL 0xfffe0874
273#define COM_CLK_DIV_CTRL_SEL 0xfffe0878
274#define SOFT_REQ_REG 0xfffe0834
275#define SOFT_REQ_REG2 0xfffe0880
276
277extern __u32 arm_idlect1_mask;
278extern struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p;
279
280extern const struct clkops clkops_dspck;
281extern const struct clkops clkops_dummy;
282extern const struct clkops clkops_uart_16xx;
283extern const struct clkops clkops_generic;
284
285
286extern u32 cpu_mask;
287
288#endif
289