Merge remote-tracking branch 'iwlwifi-fixes/master' into NEXT
[sfrench/cifs-2.6.git] / arch / arm / mach-shmobile / clock.h
1 #ifndef CLOCK_H
2 #define CLOCK_H
3
4 #ifdef CONFIG_COMMON_CLK
5 /* temporary clock configuration helper for platform devices */
6
7 struct clk_name {
8         const char *clk;
9         const char *con_id;
10         const char *dev_id;
11 };
12
13 void shmobile_clk_workaround(const struct clk_name *clks, int nr_clks,
14                              bool enable);
15
16 #else /* CONFIG_COMMON_CLK */
17 /* legacy clock implementation */
18
19 struct clk;
20 unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk);
21 extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops;
22
23 /* clock ratio */
24 struct clk_ratio {
25         int mul;
26         int div;
27 };
28
29 #define SH_CLK_RATIO(name, m, d)                \
30 static struct clk_ratio name ##_ratio = {       \
31         .mul = m,                               \
32         .div = d,                               \
33 }
34
35 #define SH_FIXED_RATIO_CLKg(name, p, r) \
36 struct clk name = {                     \
37         .parent = &p,                           \
38         .ops    = &shmobile_fixed_ratio_clk_ops,\
39         .priv   = &r ## _ratio,                 \
40 }
41
42 #define SH_FIXED_RATIO_CLK(name, p, r)          \
43 static SH_FIXED_RATIO_CLKg(name, p, r)
44
45 #define SH_FIXED_RATIO_CLK_SET(name, p, m, d)   \
46         SH_CLK_RATIO(name, m, d);               \
47         SH_FIXED_RATIO_CLK(name, p, name)
48
49 #define SH_CLK_SET_RATIO(p, m, d)       \
50 do {                    \
51         (p)->mul = m;   \
52         (p)->div = d;   \
53 } while (0)
54
55 #endif /* CONFIG_COMMON_CLK */
56 #endif