]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/imx-common/timer.c
Merge branch 'master' of git://www.denx.de/git/u-boot-imx
[u-boot] / arch / arm / imx-common / timer.c
index fb1b693161eb719c6d4252b281265afd247c294c..1f7c671ebe2fc494f7eced6688e19910a24993e0 100644 (file)
@@ -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;
+}