diff options
author | Mike Frysinger <michael.frysinger@analog.com> | 2007-10-21 10:59:49 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@analog.com> | 2007-10-21 10:59:49 -0400 |
commit | 2f6cf7bfc64c44d760d53caf4b547e7729392e78 (patch) | |
tree | ecbd135d50cfc35f505f386cfbc9206b0e8cdfba | |
parent | b0a68dc07ec395d44849ce98eb417713ca333410 (diff) |
Blackfin arch: add functions for converting between sclks and usecs
Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
-rw-r--r-- | arch/blackfin/kernel/setup.c | 14 | ||||
-rw-r--r-- | include/asm-blackfin/bfin-global.h | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index 6b85145f8488..0e746449c29b 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c | |||
@@ -459,7 +459,7 @@ static u_long get_vco(void) | |||
459 | return vco; | 459 | return vco; |
460 | } | 460 | } |
461 | 461 | ||
462 | /*Get the Core clock*/ | 462 | /* Get the Core clock */ |
463 | u_long get_cclk(void) | 463 | u_long get_cclk(void) |
464 | { | 464 | { |
465 | u_long csel, ssel; | 465 | u_long csel, ssel; |
@@ -493,6 +493,18 @@ u_long get_sclk(void) | |||
493 | } | 493 | } |
494 | EXPORT_SYMBOL(get_sclk); | 494 | EXPORT_SYMBOL(get_sclk); |
495 | 495 | ||
496 | unsigned long sclk_to_usecs(unsigned long sclk) | ||
497 | { | ||
498 | return (USEC_PER_SEC * (u64)sclk) / get_sclk(); | ||
499 | } | ||
500 | EXPORT_SYMBOL(sclk_to_usecs); | ||
501 | |||
502 | unsigned long usecs_to_sclk(unsigned long usecs) | ||
503 | { | ||
504 | return get_sclk() / (USEC_PER_SEC * (u64)usecs); | ||
505 | } | ||
506 | EXPORT_SYMBOL(usecs_to_sclk); | ||
507 | |||
496 | /* | 508 | /* |
497 | * Get CPU information for use by the procfs. | 509 | * Get CPU information for use by the procfs. |
498 | */ | 510 | */ |
diff --git a/include/asm-blackfin/bfin-global.h b/include/asm-blackfin/bfin-global.h index a006353a4310..14cb8d35924e 100644 --- a/include/asm-blackfin/bfin-global.h +++ b/include/asm-blackfin/bfin-global.h | |||
@@ -47,6 +47,8 @@ | |||
47 | 47 | ||
48 | extern unsigned long get_cclk(void); | 48 | extern unsigned long get_cclk(void); |
49 | extern unsigned long get_sclk(void); | 49 | extern unsigned long get_sclk(void); |
50 | extern unsigned long sclk_to_usecs(unsigned long sclk); | ||
51 | extern unsigned long usecs_to_sclk(unsigned long usecs); | ||
50 | 52 | ||
51 | extern void dump_thread(struct pt_regs *regs, struct user *dump); | 53 | extern void dump_thread(struct pt_regs *regs, struct user *dump); |
52 | extern void dump_bfin_regs(struct pt_regs *fp, void *retaddr); | 54 | extern void dump_bfin_regs(struct pt_regs *fp, void *retaddr); |