Skip to content

Commit

Permalink
ARM: 8365/1: introduce sp804_timer_disable and remove arm_timer.h inc…
Browse files Browse the repository at this point in the history
…lusion

The header asm/hardware/arm_timer.h is included in various machine
specific files to access TIMER_CTRL and initialise to a known state.

This patch introduces a new function sp804_timer_disable to disable
the SP804 timers and uses the same for initialising the timers to
known(off) state, thereby removing the dependency on the header
asm/hardware/arm_timer.h

This change is in prepartion to move sp804 timer support out of arch/arm
so that it can be used on ARM64 platforms.

Cc: Daniel Lezcano <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Olof Johansson <[email protected]>
Acked-by: Thomas Gleixner <[email protected]>
Signed-off-by: Sudeep Holla <[email protected]>
Signed-off-by: Russell King <[email protected]>
  • Loading branch information
sudeep-holla authored and Russell King committed Jun 2, 2015
1 parent 73c430b commit 1e5f051
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
5 changes: 5 additions & 0 deletions arch/arm/common/timer-sp.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ static u64 notrace sp804_read(void)
return ~readl_relaxed(sched_clock_base + TIMER_VALUE);
}

void __init sp804_timer_disable(void __iomem *base)
{
writel(0, base + TIMER_CTRL);
}

void __init __sp804_clocksource_and_sched_clock_init(void __iomem *base,
const char *name,
struct clk *clk,
Expand Down
1 change: 1 addition & 0 deletions arch/arm/include/asm/hardware/timer-sp.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ void __sp804_clocksource_and_sched_clock_init(void __iomem *,
const char *, struct clk *, int);
void __sp804_clockevents_init(void __iomem *, unsigned int,
struct clk *, const char *);
void sp804_timer_disable(void __iomem *);

static inline void sp804_clocksource_init(void __iomem *base, const char *name)
{
Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-integrator/integrator_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <linux/stat.h>
#include <linux/termios.h>

#include <asm/hardware/arm_timer.h>
#include <asm/setup.h>
#include <asm/param.h> /* HZ */
#include <asm/mach-types.h>
Expand Down
9 changes: 4 additions & 5 deletions arch/arm/mach-realview/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <mach/hardware.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <asm/hardware/arm_timer.h>
#include <asm/hardware/icst.h>

#include <asm/mach/arch.h>
Expand Down Expand Up @@ -381,10 +380,10 @@ void __init realview_timer_init(unsigned int timer_irq)
/*
* Initialise to a known state (all timers off)
*/
writel(0, timer0_va_base + TIMER_CTRL);
writel(0, timer1_va_base + TIMER_CTRL);
writel(0, timer2_va_base + TIMER_CTRL);
writel(0, timer3_va_base + TIMER_CTRL);
sp804_timer_disable(timer0_va_base);
sp804_timer_disable(timer1_va_base);
sp804_timer_disable(timer2_va_base);
sp804_timer_disable(timer3_va_base);

sp804_clocksource_init(timer3_va_base, "timer3");
sp804_clockevents_init(timer0_va_base, timer_irq, "timer0");
Expand Down
9 changes: 4 additions & 5 deletions arch/arm/mach-versatile/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include <linux/reboot.h>

#include <asm/irq.h>
#include <asm/hardware/arm_timer.h>
#include <asm/hardware/icst.h>
#include <asm/mach-types.h>

Expand Down Expand Up @@ -798,10 +797,10 @@ void __init versatile_timer_init(void)
/*
* Initialise to a known state (all timers off)
*/
writel(0, TIMER0_VA_BASE + TIMER_CTRL);
writel(0, TIMER1_VA_BASE + TIMER_CTRL);
writel(0, TIMER2_VA_BASE + TIMER_CTRL);
writel(0, TIMER3_VA_BASE + TIMER_CTRL);
sp804_timer_disable(TIMER0_VA_BASE);
sp804_timer_disable(TIMER1_VA_BASE);
sp804_timer_disable(TIMER2_VA_BASE);
sp804_timer_disable(TIMER3_VA_BASE);

sp804_clocksource_init(TIMER3_VA_BASE, "timer3");
sp804_clockevents_init(TIMER0_VA_BASE, IRQ_TIMERINT0_1, "timer0");
Expand Down

0 comments on commit 1e5f051

Please sign in to comment.