Skip to content
Snippets Groups Projects
Commit f24869d3 authored by Che-Liang Chiou's avatar Che-Liang Chiou Committed by Minkyu Kang
Browse files

Exynos: Add timer_get_us function


timer_get_us returns the time in microseconds since a certain reference
point of history.  However, it does not guarantee to return an accurate
time after a long period; instead, it wraps around (that is, the
reference point is reset to some other point of history) after some
periods. The frequency of wrapping around is about an hour (or 2^32
microseconds).

Test with command "sf probe 1:0; time sf read 40008000 0 1000".
Try with different numbers of bytes and see that sane values are obtained

Signed-off-by: default avatarChe-Liang Chiou <clchiou@chromium.org>
Signed-off-by: default avatarAkshay Saraswat <akshay.s@samsung.com>
Acked-by: default avatarSimon Glass <sjg@chromium.org>
Signed-off-by: default avatarMinkyu Kang <mk7.kang@samsung.com>
parent 3d00c0cb
No related branches found
No related tags found
No related merge requests found
...@@ -90,6 +90,21 @@ unsigned long get_timer(unsigned long base) ...@@ -90,6 +90,21 @@ unsigned long get_timer(unsigned long base)
return gd->arch.timer_reset_value / 1000 - base; return gd->arch.timer_reset_value / 1000 - base;
} }
unsigned long timer_get_us(void)
{
static unsigned long base_time_us;
struct s5p_timer *const timer =
(struct s5p_timer *)samsung_get_base_timer();
unsigned long now_downward_us = readl(&timer->tcnto4);
if (!base_time_us)
base_time_us = now_downward_us;
/* Note that this timer counts downward. */
return base_time_us - now_downward_us;
}
/* delay x useconds */ /* delay x useconds */
void __udelay(unsigned long usec) void __udelay(unsigned long usec)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment