diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-03-01 11:18:39 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-02 04:35:38 -0400 |
commit | 9bf5b2ef673237e0e43161c56f70ac8bf24e43f9 (patch) | |
tree | 6b75855102d54da6ff6d7023ae00e25610e44f92 /arch/arm/plat-versatile | |
parent | 3081e43b97cb50a80ebd98ce4b60e4853ad38424 (diff) |
ARM: Indirect round/set_rate operations through clk structure
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-versatile')
-rw-r--r-- | arch/arm/plat-versatile/clock.c | 38 | ||||
-rw-r--r-- | arch/arm/plat-versatile/include/plat/clock.h | 15 |
2 files changed, 41 insertions, 12 deletions
diff --git a/arch/arm/plat-versatile/clock.c b/arch/arm/plat-versatile/clock.c index 2fa34de92325..5c8b6564fdc2 100644 --- a/arch/arm/plat-versatile/clock.c +++ b/arch/arm/plat-versatile/clock.c | |||
@@ -37,24 +37,38 @@ EXPORT_SYMBOL(clk_get_rate); | |||
37 | 37 | ||
38 | long clk_round_rate(struct clk *clk, unsigned long rate) | 38 | long clk_round_rate(struct clk *clk, unsigned long rate) |
39 | { | 39 | { |
40 | struct icst_vco vco; | 40 | long ret = -EIO; |
41 | vco = icst_hz_to_vco(clk->params, rate); | 41 | if (clk->ops && clk->ops->round) |
42 | return icst_hz(clk->params, vco); | 42 | ret = clk->ops->round(clk, rate); |
43 | return ret; | ||
43 | } | 44 | } |
44 | EXPORT_SYMBOL(clk_round_rate); | 45 | EXPORT_SYMBOL(clk_round_rate); |
45 | 46 | ||
46 | int clk_set_rate(struct clk *clk, unsigned long rate) | 47 | int clk_set_rate(struct clk *clk, unsigned long rate) |
47 | { | 48 | { |
48 | int ret = -EIO; | 49 | int ret = -EIO; |
49 | 50 | if (clk->ops && clk->ops->set) | |
50 | if (clk->setvco) { | 51 | ret = clk->ops->set(clk, rate); |
51 | struct icst_vco vco; | ||
52 | |||
53 | vco = icst_hz_to_vco(clk->params, rate); | ||
54 | clk->rate = icst_hz(clk->params, vco); | ||
55 | clk->setvco(clk, vco); | ||
56 | ret = 0; | ||
57 | } | ||
58 | return ret; | 52 | return ret; |
59 | } | 53 | } |
60 | EXPORT_SYMBOL(clk_set_rate); | 54 | EXPORT_SYMBOL(clk_set_rate); |
55 | |||
56 | long icst_clk_round(struct clk *clk, unsigned long rate) | ||
57 | { | ||
58 | struct icst_vco vco; | ||
59 | vco = icst_hz_to_vco(clk->params, rate); | ||
60 | return icst_hz(clk->params, vco); | ||
61 | } | ||
62 | EXPORT_SYMBOL(icst_clk_round); | ||
63 | |||
64 | int icst_clk_set(struct clk *clk, unsigned long rate) | ||
65 | { | ||
66 | struct icst_vco vco; | ||
67 | |||
68 | vco = icst_hz_to_vco(clk->params, rate); | ||
69 | clk->rate = icst_hz(clk->params, vco); | ||
70 | clk->ops->setvco(clk, vco); | ||
71 | |||
72 | return 0; | ||
73 | } | ||
74 | EXPORT_SYMBOL(icst_clk_set); | ||
diff --git a/arch/arm/plat-versatile/include/plat/clock.h b/arch/arm/plat-versatile/include/plat/clock.h new file mode 100644 index 000000000000..3cfb024ccd70 --- /dev/null +++ b/arch/arm/plat-versatile/include/plat/clock.h | |||
@@ -0,0 +1,15 @@ | |||
1 | #ifndef PLAT_CLOCK_H | ||
2 | #define PLAT_CLOCK_H | ||
3 | |||
4 | #include <asm/hardware/icst.h> | ||
5 | |||
6 | struct clk_ops { | ||
7 | long (*round)(struct clk *, unsigned long); | ||
8 | int (*set)(struct clk *, unsigned long); | ||
9 | void (*setvco)(struct clk *, struct icst_vco); | ||
10 | }; | ||
11 | |||
12 | int icst_clk_set(struct clk *, unsigned long); | ||
13 | long icst_clk_round(struct clk *, unsigned long); | ||
14 | |||
15 | #endif | ||