diff options
author | Florian Fainelli <florian@openwrt.org> | 2012-09-08 09:51:05 +0000 |
---|---|---|
committer | Florian Fainelli <florian@openwrt.org> | 2012-09-08 09:51:05 +0000 |
commit | 6771d63284ee86924f5705a53953a50c4c43135a (patch) | |
tree | 94ce21298e99ba002240950105fc2d258dd77dd6 /target/linux/mcs814x/files-3.3/arch/arm/mach-mcs814x/timer.c | |
parent | 95f1b6d4157b93249cd6dd2a92b4116fabcff1f7 (diff) | |
download | upstream-6771d63284ee86924f5705a53953a50c4c43135a.tar.gz upstream-6771d63284ee86924f5705a53953a50c4c43135a.tar.bz2 upstream-6771d63284ee86924f5705a53953a50c4c43135a.zip |
use the recommended ARM I/O accessors
use {read,write}l_relaxed instead of the plain __raw_{read,write}l variants.
SVN-Revision: 33330
Diffstat (limited to 'target/linux/mcs814x/files-3.3/arch/arm/mach-mcs814x/timer.c')
-rw-r--r-- | target/linux/mcs814x/files-3.3/arch/arm/mach-mcs814x/timer.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/target/linux/mcs814x/files-3.3/arch/arm/mach-mcs814x/timer.c b/target/linux/mcs814x/files-3.3/arch/arm/mach-mcs814x/timer.c index e1f3730383..0947fb245f 100644 --- a/target/linux/mcs814x/files-3.3/arch/arm/mach-mcs814x/timer.c +++ b/target/linux/mcs814x/files-3.3/arch/arm/mach-mcs814x/timer.c @@ -22,6 +22,8 @@ /* Timer block registers */ #define TIMER_VAL 0x00 #define TIMER_CTL 0x04 +#define TIMER_CTL_EN 0x01 +#define TIMER_CTL_DBG 0x02 static u32 last_reload; static u32 timer_correct; @@ -40,7 +42,7 @@ static inline unsigned long ticks2usecs(u32 x) */ static unsigned long mcs814x_gettimeoffset(void) { - u32 ticks = __raw_readl(mcs814x_timer_base + TIMER_VAL); + u32 ticks = readl_relaxed(mcs814x_timer_base + TIMER_VAL); if (ticks < last_reload) return ticks2usecs(ticks + (u32)(0xffffffff - last_reload)); @@ -51,7 +53,7 @@ static unsigned long mcs814x_gettimeoffset(void) static irqreturn_t mcs814x_timer_interrupt(int irq, void *dev_id) { - u32 count = __raw_readl(mcs814x_timer_base + TIMER_VAL); + u32 count = readl_relaxed(mcs814x_timer_base + TIMER_VAL); /* take into account delay up to this moment */ last_reload = count + timer_correct + timer_reload_value; @@ -60,9 +62,9 @@ static irqreturn_t mcs814x_timer_interrupt(int irq, void *dev_id) last_reload = timer_reload_value; } else { if (timer_correct == 0) - timer_correct = __raw_readl(mcs814x_timer_base + TIMER_VAL) - count; + timer_correct = readl_relaxed(mcs814x_timer_base + TIMER_VAL) - count; } - __raw_writel(last_reload, mcs814x_timer_base + TIMER_VAL); + writel_relaxed(last_reload, mcs814x_timer_base + TIMER_VAL); timer_tick(); @@ -118,13 +120,14 @@ static void __init mcs814x_timer_init(void) timer_reload_value = 0xffffffff - (clock_rate / HZ); /* disable timer */ - __raw_writel(0, mcs814x_timer_base + TIMER_CTL); - __raw_writel(timer_reload_value, mcs814x_timer_base + TIMER_VAL); + writel_relaxed(~TIMER_CTL_EN, mcs814x_timer_base + TIMER_CTL); + writel_relaxed(timer_reload_value, mcs814x_timer_base + TIMER_VAL); last_reload = timer_reload_value; setup_irq(mcs814x_timer_irq.irq, &mcs814x_timer_irq); /* enable timer, stop timer in debug mode */ - __raw_writel(0x03, mcs814x_timer_base + TIMER_CTL); + writel_relaxed(TIMER_CTL_EN | TIMER_CTL_DBG, + mcs814x_timer_base + TIMER_CTL); } struct sys_timer mcs814x_timer = { |