diff options
| -rw-r--r-- | arch/sh/kernel/cpu/clock.c | 76 | ||||
| -rw-r--r-- | arch/sh/kernel/setup.c | 2 | ||||
| -rw-r--r-- | include/asm-sh/clock.h | 2 |
3 files changed, 46 insertions, 34 deletions
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c index 2075f90d76c7..014f318f5a05 100644 --- a/arch/sh/kernel/cpu/clock.c +++ b/arch/sh/kernel/cpu/clock.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * arch/sh/kernel/cpu/clock.c - SuperH clock framework | 2 | * arch/sh/kernel/cpu/clock.c - SuperH clock framework |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2005, 2006 Paul Mundt | 4 | * Copyright (C) 2005, 2006, 2007 Paul Mundt |
| 5 | * | 5 | * |
| 6 | * This clock framework is derived from the OMAP version by: | 6 | * This clock framework is derived from the OMAP version by: |
| 7 | * | 7 | * |
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/seq_file.h> | 23 | #include <linux/seq_file.h> |
| 24 | #include <linux/err.h> | 24 | #include <linux/err.h> |
| 25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
| 26 | #include <linux/proc_fs.h> | ||
| 26 | #include <asm/clock.h> | 27 | #include <asm/clock.h> |
| 27 | #include <asm/timer.h> | 28 | #include <asm/timer.h> |
| 28 | 29 | ||
| @@ -108,6 +109,7 @@ int __clk_enable(struct clk *clk) | |||
| 108 | 109 | ||
| 109 | return 0; | 110 | return 0; |
| 110 | } | 111 | } |
| 112 | EXPORT_SYMBOL_GPL(__clk_enable); | ||
| 111 | 113 | ||
| 112 | int clk_enable(struct clk *clk) | 114 | int clk_enable(struct clk *clk) |
| 113 | { | 115 | { |
| @@ -120,6 +122,7 @@ int clk_enable(struct clk *clk) | |||
| 120 | 122 | ||
| 121 | return ret; | 123 | return ret; |
| 122 | } | 124 | } |
| 125 | EXPORT_SYMBOL_GPL(clk_enable); | ||
| 123 | 126 | ||
| 124 | static void clk_kref_release(struct kref *kref) | 127 | static void clk_kref_release(struct kref *kref) |
| 125 | { | 128 | { |
| @@ -138,6 +141,7 @@ void __clk_disable(struct clk *clk) | |||
| 138 | clk->ops->disable(clk); | 141 | clk->ops->disable(clk); |
| 139 | } | 142 | } |
| 140 | } | 143 | } |
| 144 | EXPORT_SYMBOL_GPL(__clk_disable); | ||
| 141 | 145 | ||
| 142 | void clk_disable(struct clk *clk) | 146 | void clk_disable(struct clk *clk) |
| 143 | { | 147 | { |
| @@ -147,6 +151,7 @@ void clk_disable(struct clk *clk) | |||
| 147 | __clk_disable(clk); | 151 | __clk_disable(clk); |
| 148 | spin_unlock_irqrestore(&clock_lock, flags); | 152 | spin_unlock_irqrestore(&clock_lock, flags); |
| 149 | } | 153 | } |
| 154 | EXPORT_SYMBOL_GPL(clk_disable); | ||
| 150 | 155 | ||
| 151 | int clk_register(struct clk *clk) | 156 | int clk_register(struct clk *clk) |
| 152 | { | 157 | { |
| @@ -168,6 +173,7 @@ int clk_register(struct clk *clk) | |||
| 168 | 173 | ||
| 169 | return 0; | 174 | return 0; |
| 170 | } | 175 | } |
| 176 | EXPORT_SYMBOL_GPL(clk_register); | ||
| 171 | 177 | ||
| 172 | void clk_unregister(struct clk *clk) | 178 | void clk_unregister(struct clk *clk) |
| 173 | { | 179 | { |
| @@ -175,16 +181,19 @@ void clk_unregister(struct clk *clk) | |||
| 175 | list_del(&clk->node); | 181 | list_del(&clk->node); |
| 176 | mutex_unlock(&clock_list_sem); | 182 | mutex_unlock(&clock_list_sem); |
| 177 | } | 183 | } |
| 184 | EXPORT_SYMBOL_GPL(clk_unregister); | ||
| 178 | 185 | ||
| 179 | inline unsigned long clk_get_rate(struct clk *clk) | 186 | unsigned long clk_get_rate(struct clk *clk) |
| 180 | { | 187 | { |
| 181 | return clk->rate; | 188 | return clk->rate; |
| 182 | } | 189 | } |
| 190 | EXPORT_SYMBOL_GPL(clk_get_rate); | ||
| 183 | 191 | ||
| 184 | int clk_set_rate(struct clk *clk, unsigned long rate) | 192 | int clk_set_rate(struct clk *clk, unsigned long rate) |
| 185 | { | 193 | { |
| 186 | return clk_set_rate_ex(clk, rate, 0); | 194 | return clk_set_rate_ex(clk, rate, 0); |
| 187 | } | 195 | } |
| 196 | EXPORT_SYMBOL_GPL(clk_set_rate); | ||
| 188 | 197 | ||
| 189 | int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id) | 198 | int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id) |
| 190 | { | 199 | { |
| @@ -203,6 +212,7 @@ int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id) | |||
| 203 | 212 | ||
| 204 | return ret; | 213 | return ret; |
| 205 | } | 214 | } |
| 215 | EXPORT_SYMBOL_GPL(clk_set_rate_ex); | ||
| 206 | 216 | ||
| 207 | void clk_recalc_rate(struct clk *clk) | 217 | void clk_recalc_rate(struct clk *clk) |
| 208 | { | 218 | { |
| @@ -217,6 +227,7 @@ void clk_recalc_rate(struct clk *clk) | |||
| 217 | if (unlikely(clk->flags & CLK_RATE_PROPAGATES)) | 227 | if (unlikely(clk->flags & CLK_RATE_PROPAGATES)) |
| 218 | propagate_rate(clk); | 228 | propagate_rate(clk); |
| 219 | } | 229 | } |
| 230 | EXPORT_SYMBOL_GPL(clk_recalc_rate); | ||
| 220 | 231 | ||
| 221 | /* | 232 | /* |
| 222 | * Returns a clock. Note that we first try to use device id on the bus | 233 | * Returns a clock. Note that we first try to use device id on the bus |
| @@ -253,18 +264,43 @@ found: | |||
| 253 | 264 | ||
| 254 | return clk; | 265 | return clk; |
| 255 | } | 266 | } |
| 267 | EXPORT_SYMBOL_GPL(clk_get); | ||
| 256 | 268 | ||
| 257 | void clk_put(struct clk *clk) | 269 | void clk_put(struct clk *clk) |
| 258 | { | 270 | { |
| 259 | if (clk && !IS_ERR(clk)) | 271 | if (clk && !IS_ERR(clk)) |
| 260 | module_put(clk->owner); | 272 | module_put(clk->owner); |
| 261 | } | 273 | } |
| 274 | EXPORT_SYMBOL_GPL(clk_put); | ||
| 262 | 275 | ||
| 263 | void __init __attribute__ ((weak)) | 276 | void __init __attribute__ ((weak)) |
| 264 | arch_init_clk_ops(struct clk_ops **ops, int type) | 277 | arch_init_clk_ops(struct clk_ops **ops, int type) |
| 265 | { | 278 | { |
| 266 | } | 279 | } |
| 267 | 280 | ||
| 281 | static int show_clocks(char *buf, char **start, off_t off, | ||
| 282 | int len, int *eof, void *data) | ||
| 283 | { | ||
| 284 | struct clk *clk; | ||
| 285 | char *p = buf; | ||
| 286 | |||
| 287 | list_for_each_entry_reverse(clk, &clock_list, node) { | ||
| 288 | unsigned long rate = clk_get_rate(clk); | ||
| 289 | |||
| 290 | /* | ||
| 291 | * Don't bother listing dummy clocks with no ancestry | ||
| 292 | * that only support enable and disable ops. | ||
| 293 | */ | ||
| 294 | if (unlikely(!rate && !clk->parent)) | ||
| 295 | continue; | ||
| 296 | |||
| 297 | p += sprintf(p, "%-12s\t: %ld.%02ldMHz\n", clk->name, | ||
| 298 | rate / 1000000, (rate % 1000000) / 10000); | ||
| 299 | } | ||
| 300 | |||
| 301 | return p - buf; | ||
| 302 | } | ||
| 303 | |||
| 268 | int __init clk_init(void) | 304 | int __init clk_init(void) |
| 269 | { | 305 | { |
| 270 | int i, ret = 0; | 306 | int i, ret = 0; |
| @@ -285,36 +321,14 @@ int __init clk_init(void) | |||
| 285 | return ret; | 321 | return ret; |
| 286 | } | 322 | } |
| 287 | 323 | ||
| 288 | int show_clocks(struct seq_file *m) | 324 | static int __init clk_proc_init(void) |
| 289 | { | 325 | { |
| 290 | struct clk *clk; | 326 | struct proc_dir_entry *p; |
| 291 | 327 | p = create_proc_read_entry("clocks", S_IRUSR, NULL, | |
| 292 | list_for_each_entry_reverse(clk, &clock_list, node) { | 328 | show_clocks, NULL); |
| 293 | unsigned long rate = clk_get_rate(clk); | 329 | if (unlikely(!p)) |
| 294 | 330 | return -EINVAL; | |
| 295 | /* | ||
| 296 | * Don't bother listing dummy clocks with no ancestry | ||
| 297 | * that only support enable and disable ops. | ||
| 298 | */ | ||
| 299 | if (unlikely(!rate && !clk->parent)) | ||
| 300 | continue; | ||
| 301 | |||
| 302 | seq_printf(m, "%-12s\t: %ld.%02ldMHz\n", clk->name, | ||
| 303 | rate / 1000000, (rate % 1000000) / 10000); | ||
| 304 | } | ||
| 305 | 331 | ||
| 306 | return 0; | 332 | return 0; |
| 307 | } | 333 | } |
| 308 | 334 | subsys_initcall(clk_proc_init); | |
| 309 | EXPORT_SYMBOL_GPL(clk_register); | ||
| 310 | EXPORT_SYMBOL_GPL(clk_unregister); | ||
| 311 | EXPORT_SYMBOL_GPL(clk_get); | ||
| 312 | EXPORT_SYMBOL_GPL(clk_put); | ||
| 313 | EXPORT_SYMBOL_GPL(clk_enable); | ||
| 314 | EXPORT_SYMBOL_GPL(clk_disable); | ||
| 315 | EXPORT_SYMBOL_GPL(__clk_enable); | ||
| 316 | EXPORT_SYMBOL_GPL(__clk_disable); | ||
| 317 | EXPORT_SYMBOL_GPL(clk_get_rate); | ||
| 318 | EXPORT_SYMBOL_GPL(clk_set_rate); | ||
| 319 | EXPORT_SYMBOL_GPL(clk_recalc_rate); | ||
| 320 | EXPORT_SYMBOL_GPL(clk_set_rate_ex); | ||
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index 60cc2161438f..cab91a7665da 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
| @@ -501,7 +501,7 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 501 | c->loops_per_jiffy/(500000/HZ), | 501 | c->loops_per_jiffy/(500000/HZ), |
| 502 | (c->loops_per_jiffy/(5000/HZ)) % 100); | 502 | (c->loops_per_jiffy/(5000/HZ)) % 100); |
| 503 | 503 | ||
| 504 | return show_clocks(m); | 504 | return 0; |
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | static void *c_start(struct seq_file *m, loff_t *pos) | 507 | static void *c_start(struct seq_file *m, loff_t *pos) |
diff --git a/include/asm-sh/clock.h b/include/asm-sh/clock.h index a5d629f090d4..386d797d86b7 100644 --- a/include/asm-sh/clock.h +++ b/include/asm-sh/clock.h | |||
| @@ -48,8 +48,6 @@ void clk_recalc_rate(struct clk *); | |||
| 48 | int clk_register(struct clk *); | 48 | int clk_register(struct clk *); |
| 49 | void clk_unregister(struct clk *); | 49 | void clk_unregister(struct clk *); |
| 50 | 50 | ||
| 51 | int show_clocks(struct seq_file *m); | ||
| 52 | |||
| 53 | /* the exported API, in addition to clk_set_rate */ | 51 | /* the exported API, in addition to clk_set_rate */ |
| 54 | /** | 52 | /** |
| 55 | * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter | 53 | * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter |
