From 08b17128a1856c8ba1f7c7286fdba2d993564cff Mon Sep 17 00:00:00 2001 From: florian Date: Sat, 8 Sep 2012 09:51:05 +0000 Subject: [mcs814x] use the recommended ARM I/O accessors use {read,write}l_relaxed instead of the plain __raw_{read,write}l variants. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33330 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../mcs814x/files-3.3/arch/arm/mach-mcs814x/timer.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'target/linux/mcs814x/files-3.3/arch/arm/mach-mcs814x/timer.c') 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 e1f373038..0947fb245 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 = { -- cgit v1.2.3