summaryrefslogtreecommitdiff
path: root/arch/arm/imx-common/timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/imx-common/timer.c')
-rw-r--r--arch/arm/imx-common/timer.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/arm/imx-common/timer.c b/arch/arm/imx-common/timer.c
index fb1b693161..1f7c671ebe 100644
--- a/arch/arm/imx-common/timer.c
+++ b/arch/arm/imx-common/timer.c
@@ -120,3 +120,19 @@ ulong get_tbclk(void)
{
return gpt_get_clk();
}
+
+/*
+ * This function is intended for SHORT delays only.
+ * It will overflow at around 10 seconds @ 400MHz,
+ * or 20 seconds @ 200MHz.
+ */
+unsigned long usec2ticks(unsigned long _usec)
+{
+ unsigned long long usec = _usec;
+
+ usec *= get_tbclk();
+ usec += 999999;
+ do_div(usec, 1000000);
+
+ return usec;
+}