]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/arm/mach-shmobile/clock.h
power_supply: Add support for tps65217-charger.
[karo-tx-linux.git] / arch / arm / mach-shmobile / clock.h
1 #ifndef CLOCK_H
2 #define CLOCK_H
3
4 /* legacy clock implementation */
5
6 struct clk;
7 unsigned long shmobile_fixed_ratio_clk_recalc(struct clk *clk);
8 extern struct sh_clk_ops shmobile_fixed_ratio_clk_ops;
9
10 /* clock ratio */
11 struct clk_ratio {
12         int mul;
13         int div;
14 };
15
16 #define SH_CLK_RATIO(name, m, d)                \
17 static struct clk_ratio name ##_ratio = {       \
18         .mul = m,                               \
19         .div = d,                               \
20 }
21
22 #define SH_FIXED_RATIO_CLKg(name, p, r) \
23 struct clk name = {                     \
24         .parent = &p,                           \
25         .ops    = &shmobile_fixed_ratio_clk_ops,\
26         .priv   = &r ## _ratio,                 \
27 }
28
29 #define SH_FIXED_RATIO_CLK(name, p, r)          \
30 static SH_FIXED_RATIO_CLKg(name, p, r)
31
32 #define SH_FIXED_RATIO_CLK_SET(name, p, m, d)   \
33         SH_CLK_RATIO(name, m, d);               \
34         SH_FIXED_RATIO_CLK(name, p, name)
35
36 #define SH_CLK_SET_RATIO(p, m, d)       \
37 do {                    \
38         (p)->mul = m;   \
39         (p)->div = d;   \
40 } while (0)
41
42 #endif