summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMike Frysinger <michael.frysinger@analog.com>2007-10-21 18:59:49 +0400
committerBryan Wu <bryan.wu@analog.com>2007-10-21 18:59:49 +0400
commit2f6cf7bfc64c44d760d53caf4b547e7729392e78 (patch)
treeecbd135d50cfc35f505f386cfbc9206b0e8cdfba /arch
parentb0a68dc07ec395d44849ce98eb417713ca333410 (diff)
downloadlinux-2f6cf7bfc64c44d760d53caf4b547e7729392e78.tar.xz
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/blackfin/kernel/setup.c14
1 files changed, 13 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)
return vco;
}
-/*Get the Core clock*/
+/* Get the Core clock */
u_long get_cclk(void)
{
u_long csel, ssel;
@@ -493,6 +493,18 @@ u_long get_sclk(void)
}
EXPORT_SYMBOL(get_sclk);
+unsigned long sclk_to_usecs(unsigned long sclk)
+{
+ return (USEC_PER_SEC * (u64)sclk) / get_sclk();
+}
+EXPORT_SYMBOL(sclk_to_usecs);
+
+unsigned long usecs_to_sclk(unsigned long usecs)
+{
+ return get_sclk() / (USEC_PER_SEC * (u64)usecs);
+}
+EXPORT_SYMBOL(usecs_to_sclk);
+
/*
* Get CPU information for use by the procfs.
*/