diff options
author | Haojian Zhuang <haojian.zhuang@marvell.com> | 2011-04-08 08:15:38 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2011-07-12 07:45:19 -0400 |
commit | 52585ccd93d75e368382af09ae336ed8f231642c (patch) | |
tree | 34104e267dc7e219285f2c48c190c05f2f02a69e | |
parent | 4e234cc0ee9db31d5b16b58d7c09af17246b2466 (diff) |
ARM: pxa: add clk_set_rate()
Since there're mulitple clock rates in some device controllers, enable
clk_set_rate() for this usage.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
-rw-r--r-- | arch/arm/mach-mmp/clock.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-mmp/clock.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/clock.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-pxa/clock.h | 1 |
4 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/mach-mmp/clock.c b/arch/arm/mach-mmp/clock.c index 886e05648f08..7c6f95f29142 100644 --- a/arch/arm/mach-mmp/clock.c +++ b/arch/arm/mach-mmp/clock.c | |||
@@ -88,3 +88,18 @@ unsigned long clk_get_rate(struct clk *clk) | |||
88 | return rate; | 88 | return rate; |
89 | } | 89 | } |
90 | EXPORT_SYMBOL(clk_get_rate); | 90 | EXPORT_SYMBOL(clk_get_rate); |
91 | |||
92 | int clk_set_rate(struct clk *clk, unsigned long rate) | ||
93 | { | ||
94 | unsigned long flags; | ||
95 | int ret = -EINVAL; | ||
96 | |||
97 | if (clk->ops->setrate) { | ||
98 | spin_lock_irqsave(&clocks_lock, flags); | ||
99 | ret = clk->ops->setrate(clk, rate); | ||
100 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
101 | } | ||
102 | |||
103 | return ret; | ||
104 | } | ||
105 | EXPORT_SYMBOL(clk_set_rate); | ||
diff --git a/arch/arm/mach-mmp/clock.h b/arch/arm/mach-mmp/clock.h index 9b027d7491f5..3143e994e672 100644 --- a/arch/arm/mach-mmp/clock.h +++ b/arch/arm/mach-mmp/clock.h | |||
@@ -12,6 +12,7 @@ struct clkops { | |||
12 | void (*enable)(struct clk *); | 12 | void (*enable)(struct clk *); |
13 | void (*disable)(struct clk *); | 13 | void (*disable)(struct clk *); |
14 | unsigned long (*getrate)(struct clk *); | 14 | unsigned long (*getrate)(struct clk *); |
15 | int (*setrate)(struct clk *, unsigned long); | ||
15 | }; | 16 | }; |
16 | 17 | ||
17 | struct clk { | 18 | struct clk { |
diff --git a/arch/arm/mach-pxa/clock.c b/arch/arm/mach-pxa/clock.c index d5152220ce94..4d466102a027 100644 --- a/arch/arm/mach-pxa/clock.c +++ b/arch/arm/mach-pxa/clock.c | |||
@@ -53,6 +53,21 @@ unsigned long clk_get_rate(struct clk *clk) | |||
53 | } | 53 | } |
54 | EXPORT_SYMBOL(clk_get_rate); | 54 | EXPORT_SYMBOL(clk_get_rate); |
55 | 55 | ||
56 | int clk_set_rate(struct clk *clk, unsigned long rate) | ||
57 | { | ||
58 | unsigned long flags; | ||
59 | int ret = -EINVAL; | ||
60 | |||
61 | if (clk->ops->setrate) { | ||
62 | spin_lock_irqsave(&clocks_lock, flags); | ||
63 | ret = clk->ops->setrate(clk, rate); | ||
64 | spin_unlock_irqrestore(&clocks_lock, flags); | ||
65 | } | ||
66 | |||
67 | return ret; | ||
68 | } | ||
69 | EXPORT_SYMBOL(clk_set_rate); | ||
70 | |||
56 | void clk_dummy_enable(struct clk *clk) | 71 | void clk_dummy_enable(struct clk *clk) |
57 | { | 72 | { |
58 | } | 73 | } |
diff --git a/arch/arm/mach-pxa/clock.h b/arch/arm/mach-pxa/clock.h index 1f2fb9c43f06..3a258b1bf1aa 100644 --- a/arch/arm/mach-pxa/clock.h +++ b/arch/arm/mach-pxa/clock.h | |||
@@ -5,6 +5,7 @@ struct clkops { | |||
5 | void (*enable)(struct clk *); | 5 | void (*enable)(struct clk *); |
6 | void (*disable)(struct clk *); | 6 | void (*disable)(struct clk *); |
7 | unsigned long (*getrate)(struct clk *); | 7 | unsigned long (*getrate)(struct clk *); |
8 | int (*setrate)(struct clk *, unsigned long); | ||
8 | }; | 9 | }; |
9 | 10 | ||
10 | struct clk { | 11 | struct clk { |