blob: ea4791e3a55759c77ac3dd4fe17b2c9b016a0983 [file] [log] [blame]
Steven Kingbea8bcb2012-06-06 14:28:31 -07001/*
2 * mcfclk.h -- coldfire specific clock structure
3 */
4
5
6#ifndef mcfclk_h
7#define mcfclk_h
8
9struct clk;
10
Steven Kingbea8bcb2012-06-06 14:28:31 -070011struct clk_ops {
12 void (*enable)(struct clk *);
13 void (*disable)(struct clk *);
14};
15
16struct clk {
17 const char *name;
18 struct clk_ops *clk_ops;
19 unsigned long rate;
20 unsigned long enabled;
21 u8 slot;
22};
23
24extern struct clk *mcf_clks[];
Greg Ungerer610ac932012-07-13 14:48:23 +100025
26#ifdef MCFPM_PPMCR0
Steven Kingbea8bcb2012-06-06 14:28:31 -070027extern struct clk_ops clk_ops0;
28#ifdef MCFPM_PPMCR1
29extern struct clk_ops clk_ops1;
30#endif /* MCFPM_PPMCR1 */
31
32#define DEFINE_CLK(clk_bank, clk_name, clk_slot, clk_rate) \
33static struct clk __clk_##clk_bank##_##clk_slot = { \
34 .name = clk_name, \
35 .clk_ops = &clk_ops##clk_bank, \
36 .rate = clk_rate, \
37 .slot = clk_slot, \
38}
39
40void __clk_init_enabled(struct clk *);
41void __clk_init_disabled(struct clk *);
Greg Ungerer610ac932012-07-13 14:48:23 +100042#else
43#define DEFINE_CLK(clk_ref, clk_name, clk_rate) \
44 static struct clk clk_##clk_ref = { \
45 .name = clk_name, \
46 .rate = clk_rate, \
47 }
Steven Kingbea8bcb2012-06-06 14:28:31 -070048#endif /* MCFPM_PPMCR0 */
49
50#endif /* mcfclk_h */