Skip to content

Commit 2f6cf7b

Browse files
Mike FrysingerBryan Wu
authored andcommitted
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>
1 parent b0a68dc commit 2f6cf7b

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎arch/blackfin/kernel/setup.c‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static u_long get_vco(void)
459459
return vco;
460460
}
461461

462-
/*Get the Core clock*/
462+
/* Get the Core clock */
463463
u_long get_cclk(void)
464464
{
465465
u_long csel, ssel;
@@ -493,6 +493,18 @@ u_long get_sclk(void)
493493
}
494494
EXPORT_SYMBOL(get_sclk);
495495

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+
496508
/*
497509
* Get CPU information for use by the procfs.
498510
*/

‎include/asm-blackfin/bfin-global.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747

4848
extern unsigned long get_cclk(void);
4949
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);
5052

5153
extern void dump_thread(struct pt_regs *regs, struct user *dump);
5254
extern void dump_bfin_regs(struct pt_regs *fp, void *retaddr);

0 commit comments

Comments
 (0)