diff options
author | Stephen Warren <swarren@wwwdotorg.org> | 2013-03-27 18:43:23 +0000 |
---|---|---|
committer | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2013-04-04 08:14:54 +0200 |
commit | 5eaa215607c8668bfa6a7183407eba8fec63d648 (patch) | |
tree | 84315e219ce066489ef830231a595f2427470dde /arch/arm/cpu | |
parent | 009d75ccc11d27b9a083375a88bb93cb746b4800 (diff) | |
download | u-boot-imx-5eaa215607c8668bfa6a7183407eba8fec63d648.zip u-boot-imx-5eaa215607c8668bfa6a7183407eba8fec63d648.tar.gz u-boot-imx-5eaa215607c8668bfa6a7183407eba8fec63d648.tar.bz2 |
ARM: bcm2835: fix get_timer() to return ms
Apparently, CONFIG_SYS_HZ must be 1000. Change this, and fix the timer
driver to conform to this.
Have the timer implementation export a custom API get_timer_us() for use
by the BCM2835 MMC API, which needs us resolution for a HW workaround.
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r-- | arch/arm/cpu/arm1176/bcm2835/timer.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/arm/cpu/arm1176/bcm2835/timer.c b/arch/arm/cpu/arm1176/bcm2835/timer.c index d232d7e..2edd671 100644 --- a/arch/arm/cpu/arm1176/bcm2835/timer.c +++ b/arch/arm/cpu/arm1176/bcm2835/timer.c @@ -23,7 +23,7 @@ int timer_init(void) return 0; } -ulong get_timer(ulong base) +ulong get_timer_us(ulong base) { struct bcm2835_timer_regs *regs = (struct bcm2835_timer_regs *)BCM2835_TIMER_PHYSADDR; @@ -31,6 +31,14 @@ ulong get_timer(ulong base) return readl(®s->clo) - base; } +ulong get_timer(ulong base) +{ + ulong us = get_timer_us(0); + us /= (1000000 / CONFIG_SYS_HZ); + us -= base; + return us; +} + unsigned long long get_ticks(void) { return get_timer(0); @@ -46,10 +54,10 @@ void __udelay(unsigned long usec) ulong endtime; signed long diff; - endtime = get_timer(0) + usec; + endtime = get_timer_us(0) + usec; do { - ulong now = get_timer(0); + ulong now = get_timer_us(0); diff = endtime - now; } while (diff >= 0); } |