Kuninori Morimoto | f5942c7 | 2013-03-27 00:55:41 -0700 | [diff] [blame] | 1 | #ifndef CLOCK_H |
| 2 | #define CLOCK_H |
| 3 | |
Magnus Damm | 25f5550 | 2014-03-13 08:36:17 +0900 | [diff] [blame] | 4 | /* legacy clock implementation */ |
| 5 | |
Geert Uytterhoeven | 1f9c7a6 | 2014-05-14 03:10:16 +0200 | [diff] [blame] | 6 | struct clk; |
Kuninori Morimoto | f5942c7 | 2013-03-27 00:55:41 -0700 | [diff] [blame] | 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) \ |
Kuninori Morimoto | bdd5d28 | 2013-04-04 00:05:42 -0700 | [diff] [blame] | 30 | static SH_FIXED_RATIO_CLKg(name, p, r) |
Kuninori Morimoto | f5942c7 | 2013-03-27 00:55:41 -0700 | [diff] [blame] | 31 | |
| 32 | #define SH_FIXED_RATIO_CLK_SET(name, p, m, d) \ |
| 33 | SH_CLK_RATIO(name, m, d); \ |
Kuninori Morimoto | bdd5d28 | 2013-04-04 00:05:42 -0700 | [diff] [blame] | 34 | SH_FIXED_RATIO_CLK(name, p, name) |
Kuninori Morimoto | f5942c7 | 2013-03-27 00:55:41 -0700 | [diff] [blame] | 35 | |
| 36 | #define SH_CLK_SET_RATIO(p, m, d) \ |
Kuninori Morimoto | b6825a0 | 2013-04-12 00:41:07 -0700 | [diff] [blame] | 37 | do { \ |
Kuninori Morimoto | f5942c7 | 2013-03-27 00:55:41 -0700 | [diff] [blame] | 38 | (p)->mul = m; \ |
| 39 | (p)->div = d; \ |
Kuninori Morimoto | b6825a0 | 2013-04-12 00:41:07 -0700 | [diff] [blame] | 40 | } while (0) |
Kuninori Morimoto | f5942c7 | 2013-03-27 00:55:41 -0700 | [diff] [blame] | 41 | |
Kuninori Morimoto | f5942c7 | 2013-03-27 00:55:41 -0700 | [diff] [blame] | 42 | #endif |