Commit 4dd3065f authored by Russell King's avatar Russell King

[ARM] Convert system ticker timer to sysdev model.

Machine support files are now expected to provide a sys_timer
structure which encapsulates everything to do with the kernels
system timer, and provides elegant with the system device model.
In addition, it provides the relevant power management hooks.
parent 52d9bf0b
......@@ -15,6 +15,7 @@
*/
#include <linux/timex.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/hardware.h>
#include <asm/io.h>
......@@ -22,7 +23,7 @@
#include <asm/mach/time.h>
static unsigned long ioctime_gettimeoffset(void)
unsigned long ioc_timer_gettimeoffset(void)
{
unsigned int count1, count2, status;
long offset;
......@@ -62,6 +63,33 @@ void __init ioctime_init(void)
ioc_writeb(LATCH & 255, IOC_T0LTCHL);
ioc_writeb(LATCH >> 8, IOC_T0LTCHH);
ioc_writeb(0, IOC_T0GO);
}
static irqreturn_t
ioc_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
timer_tick(regs);
gettimeoffset = ioctime_gettimeoffset;
return IRQ_HANDLED;
}
static struct irqaction ioc_timer_irq = {
.name = "timer",
.flags = SA_INTERRUPT,
.handler = ioc_timer_interrupt
};
/*
* Set up timer interrupt.
*/
static void __init ioc_timer_init(void)
{
ioctime_init();
setup_irq(IRQ_TIMER, &ioc_timer_irq);
}
struct sys_timer ioc_timer = {
.init = ioc_timer_init,
.offset = ioc_timer_gettimeoffset,
};
......@@ -726,7 +726,7 @@ void __init setup_arch(char **cmdline_p)
* Set up various architecture-specific pointers
*/
init_arch_irq = mdesc->init_irq;
init_arch_time = mdesc->init_time;
system_timer = mdesc->timer;
init_machine = mdesc->init_machine;
#ifdef CONFIG_VT
......
......@@ -40,6 +40,11 @@ u64 jiffies_64 = INITIAL_JIFFIES;
EXPORT_SYMBOL(jiffies_64);
/*
* Our system timer.
*/
struct sys_timer *system_timer;
extern unsigned long wall_jiffies;
/* this needs a better home */
......@@ -77,12 +82,6 @@ static unsigned long dummy_gettimeoffset(void)
return 0;
}
/*
* hook for getting the time offset. Note that it is
* always called with interrupts disabled.
*/
unsigned long (*gettimeoffset)(void) = dummy_gettimeoffset;
/*
* Scheduler clock - returns current time in nanosec units.
* This is the default implementation. Sub-architecture
......@@ -247,7 +246,7 @@ void do_gettimeofday(struct timeval *tv)
do {
seq = read_seqbegin_irqsave(&xtime_lock, flags);
usec = gettimeoffset();
usec = system_timer->offset();
lost = jiffies - wall_jiffies;
if (lost)
......@@ -284,7 +283,7 @@ int do_settimeofday(struct timespec *tv)
* wall time. Discover what correction gettimeofday() would have
* done, and then undo it!
*/
nsec -= gettimeoffset() * NSEC_PER_USEC;
nsec -= system_timer->offset() * NSEC_PER_USEC;
nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
......@@ -337,6 +336,9 @@ void restore_time_delta(struct timespec *delta, struct timespec *rtc)
}
EXPORT_SYMBOL(restore_time_delta);
/*
* Kernel system timer support.
*/
void timer_tick(struct pt_regs *regs)
{
profile_tick(CPU_PROFILING, regs);
......@@ -345,10 +347,47 @@ void timer_tick(struct pt_regs *regs)
do_timer(regs);
}
void (*init_arch_time)(void);
#ifdef CONFIG_PM
static int timer_suspend(struct sys_device *dev, u32 state)
{
struct sys_timer *timer = container_of(dev, struct sys_timer, dev);
timer->suspend();
return 0;
}
static int timer_resume(struct sys_device *dev)
{
struct sys_timer *timer = container_of(dev, struct sys_timer, dev);
timer->resume();
return 0;
}
#else
#define timer_suspend NULL
#define timer_resume NULL
#endif
static struct sysdev_class timer_sysclass = {
set_kset_name("timer"),
.suspend = timer_suspend,
.resume = timer_resume,
};
static int __init timer_init_sysfs(void)
{
int ret = sysdev_class_register(&timer_sysclass);
if (ret == 0) {
system_timer->dev.cls = &timer_sysclass;
ret = sysdev_register(&system_timer->dev);
}
return ret;
}
device_initcall(timer_init_sysfs);
void __init time_init(void)
{
init_arch_time();
if (system_timer->offset == NULL)
system_timer->offset = dummy_gettimeoffset;
system_timer->init();
}
......@@ -35,9 +35,7 @@
#include <asm/mach/map.h>
#include <asm/arch/autcpu12.h>
extern void clps711x_map_io(void);
extern void clps711x_init_irq(void);
extern void clps711x_init_time(void);
#include "common.h"
/*
* The on-chip registers are given a size of 1MB so that a section can
......@@ -66,6 +64,6 @@ MACHINE_START(AUTCPU12, "autronix autcpu12")
BOOT_PARAMS(0xc0020000)
MAPIO(autcpu12_map_io)
INITIRQ(clps711x_init_irq)
INITTIME(clps711x_init_time)
.timer = &clps711x_timer,
MACHINE_END
......@@ -32,9 +32,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
extern void clps711x_init_irq(void);
extern void clps711x_map_io(void);
extern void clps711x_init_time(void);
#include "common.h"
/*
* Map the CS89712 Ethernet port. That should be moved to the
......@@ -56,13 +54,5 @@ MACHINE_START(CDB89712, "Cirrus-CDB89712")
BOOT_PARAMS(0xc0000100)
MAPIO(cdb89712_map_io)
INITIRQ(clps711x_init_irq)
INITTIME(clps711x_init_time)
.timer = &clps711x_timer,
MACHINE_END
static int cdb89712_hw_init(void)
{
return 0;
}
__initcall(cdb89712_hw_init);
......@@ -34,8 +34,7 @@
#include <asm/mach/map.h>
extern void clps711x_init_irq(void);
extern void clps711x_init_time(void);
#include "common.h"
static struct map_desc ceiva_io_desc[] __initdata = {
/* virtual, physical, length, type */
......@@ -59,5 +58,5 @@ MACHINE_START(CEIVA, "CEIVA/Polaroid Photo MAX Digital Picture Frame")
BOOT_PARAMS(0xc0000100)
MAPIO(ceiva_map_io)
INITIRQ(clps711x_init_irq)
INITTIME(clps711x_init_time)
.timer = &clps711x_timer,
MACHINE_END
......@@ -23,9 +23,7 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
extern void clps711x_init_irq(void);
extern void clps711x_map_io(void);
extern void clps711x_init_time(void);
#include "common.h"
static void __init
fixup_clep7312(struct machine_desc *desc, struct tag *tags,
......@@ -45,6 +43,6 @@ MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
FIXUP(fixup_clep7312)
MAPIO(clps711x_map_io)
INITIRQ(clps711x_init_irq)
INITTIME(clps711x_init_time)
.timer = &clps711x_timer,
MACHINE_END
/*
* linux/arch/arm/mach-clps711x/common.h
*
* Common bits.
*/
struct sys_timer;
extern void clps711x_map_io(void);
extern void clps711x_init_irq(void);
extern struct sys_timer clps711x_timer;
......@@ -25,9 +25,9 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
extern void clps711x_init_irq(void);
#include "common.h"
extern void edb7211_map_io(void);
extern void clps711x_init_time(void);
static void __init
fixup_edb7211(struct machine_desc *desc, struct tag *tags,
......@@ -57,5 +57,5 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
FIXUP(fixup_edb7211)
MAPIO(edb7211_map_io)
INITIRQ(clps711x_init_irq)
INITTIME(clps711x_init_time)
.timer = &clps711x_timer,
MACHINE_END
......@@ -31,9 +31,7 @@
#include <asm/mach/arch.h>
extern void clps711x_map_io(void);
extern void clps711x_init_irq(void);
extern void clps711x_init_time(void);
#include "common.h"
struct meminfo memmap = {
.nr_banks = 1,
......@@ -83,5 +81,5 @@ MACHINE_START(FORTUNET, "ARM-FortuNet")
FIXUP(fortunet_fixup)
MAPIO(clps711x_map_io)
INITIRQ(clps711x_init_irq)
INITTIME(clps711x_init_time)
.timer = &clps711x_timer,
MACHINE_END
......@@ -34,9 +34,7 @@
#include <asm/mach/map.h>
#include <asm/arch/syspld.h>
extern void clps711x_init_irq(void);
extern void clps711x_map_io(void);
extern void clps711x_init_time(void);
#include "common.h"
/*
* Map the P720T system PLD. It occupies two address spaces:
......@@ -87,7 +85,7 @@ MACHINE_START(P720T, "ARM-Prospector720T")
FIXUP(fixup_p720t)
MAPIO(p720t_map_io)
INITIRQ(clps711x_init_irq)
INITTIME(clps711x_init_time)
.timer = &clps711x_timer,
MACHINE_END
static int p720t_hw_init(void)
......
......@@ -59,7 +59,7 @@ static struct irqaction clps711x_timer_irq = {
.handler = p720t_timer_interrupt
};
void __init clps711x_init_time(void)
static void __init clps711x_timer_init(void)
{
struct timespec tv;
unsigned int syscon;
......@@ -71,9 +71,13 @@ void __init clps711x_init_time(void)
clps_writel(LATCH-1, TC2D); /* 512kHz / 100Hz - 1 */
setup_irq(IRQ_TC2OI, &clps711x_timer_irq);
gettimeoffset = clps711x_gettimeoffset;
tv.tv_nsec = 0;
tv.tv_sec = clps_readl(RTCDR);
do_settimeofday(&tv);
}
struct sys_timer clps711x_timer = {
.init = clps711x_timer_init,
.offset = clps711x_gettimeoffset,
};
......@@ -267,6 +267,7 @@ static void __init clps7500_map_io(void)
}
extern void ioctime_init(void);
extern unsigned long ioc_timer_gettimeoffset(void);
static irqreturn_t
clps7500_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
......@@ -295,18 +296,23 @@ static struct irqaction clps7500_timer_irq = {
/*
* Set up timer interrupt.
*/
void __init clps7500_init_time(void)
static void __init clps7500_timer_init(void)
{
ioctime_init();
setup_irq(IRQ_TIMER, &clps7500_timer_irq);
}
static struct clps7500_timer = {
.init = clps7500_timer_init,
.offset = ioc_timer_gettimeoffset,
};
MACHINE_START(CLPS7500, "CL-PS7500")
MAINTAINER("Philip Blundell")
BOOT_MEM(0x10000000, 0x03000000, 0xe0000000)
MAPIO(clps7500_map_io)
INITIRQ(clps7500_init_irq)
INITTIME(clps7500_init_time)
.timer = &clps7500_timer,
MACHINE_END
......@@ -175,7 +175,7 @@ static struct irqaction ebsa110_timer_irq = {
/*
* Set up timer interrupt.
*/
static void __init ebsa110_init_time(void)
static void __init ebsa110_timer_init(void)
{
/*
* Timer 1, mode 2, LSB/MSB
......@@ -184,11 +184,14 @@ static void __init ebsa110_init_time(void)
__raw_writeb(COUNT & 0xff, PIT_T1);
__raw_writeb(COUNT >> 8, PIT_T1);
gettimeoffset = ebsa110_gettimeoffset;
setup_irq(IRQ_EBSA110_TIMER0, &ebsa110_timer_irq);
}
static struct sys_timer ebsa110_timer = {
.init = ebsa110_timer_init,
.offset = ebsa110_gettimeoffset,
};
MACHINE_START(EBSA110, "EBSA110")
MAINTAINER("Russell King")
BOOT_MEM(0x00000000, 0xe0000000, 0xe0000000)
......@@ -198,5 +201,5 @@ MACHINE_START(EBSA110, "EBSA110")
SOFT_REBOOT
MAPIO(ebsa110_map_io)
INITIRQ(ebsa110_init_irq)
INITTIME(ebsa110_init_time)
.timer = &ebsa110_timer,
MACHINE_END
......@@ -29,13 +29,13 @@
extern void epxa10db_map_io(void);
extern void epxa10db_init_irq(void);
extern void epxa10db_init_time(void);
extern struct sys_timer epxa10db_timer;
MACHINE_START(CAMELOT, "Altera Epxa10db")
MAINTAINER("Altera Corporation")
BOOT_MEM(0x00000000, 0x7fffc000, 0xffffc000)
MAPIO(epxa10db_map_io)
INITIRQ(epxa10db_init_irq)
INITTIME(epxa10db_init_time)
.timer = &epxa10db_timer,
MACHINE_END
......@@ -61,7 +61,7 @@ static struct irqaction epxa10db_timer_irq = {
/*
* Set up timer interrupt, and return the current time in seconds.
*/
void __init epxa10db_init_time(void)
static void __init epxa10db_timer_init(void)
{
/* Start the timer */
*TIMER0_LIMIT(IO_ADDRESS(EXC_TIMER00_BASE))=(unsigned int)(EXC_AHB2_CLK_FREQUENCY/200);
......@@ -71,3 +71,6 @@ void __init epxa10db_init_time(void)
setup_irq(IRQ_TIMER0, &epxa10db_timer_irq);
}
struct sys_timer epxa10db_timer = {
.init = epxa10db_timer_init,
};
......@@ -22,7 +22,8 @@
extern void footbridge_map_io(void);
extern void footbridge_init_irq(void);
extern void footbridge_init_time(void);
extern struct sys_timer footbridge_timer;
extern struct sys_timer isa_timer;
unsigned int mem_fclk_21285 = 50000000;
......@@ -44,7 +45,7 @@ MACHINE_START(EBSA285, "EBSA285")
VIDEO(0x000a0000, 0x000bffff)
MAPIO(footbridge_map_io)
INITIRQ(footbridge_init_irq)
INITTIME(footbridge_init_time)
.timer = &footbridge_timer,
MACHINE_END
#endif
......@@ -80,7 +81,7 @@ MACHINE_START(NETWINDER, "Rebel-NetWinder")
FIXUP(fixup_netwinder)
MAPIO(footbridge_map_io)
INITIRQ(footbridge_init_irq)
INITTIME(footbridge_init_time)
.timer = &isa_timer,
MACHINE_END
#endif
......@@ -106,7 +107,7 @@ MACHINE_START(CATS, "Chalice-CATS")
FIXUP(fixup_cats)
MAPIO(footbridge_map_io)
INITIRQ(footbridge_init_irq)
INITTIME(footbridge_init_time)
.timer = &isa_timer,
MACHINE_END
#endif
......@@ -133,7 +134,7 @@ MACHINE_START(CO285, "co-EBSA285")
FIXUP(fixup_coebsa285)
MAPIO(footbridge_map_io)
INITIRQ(footbridge_init_irq)
INITTIME(footbridge_init_time)
.timer = &footbridge_timer,
MACHINE_END
#endif
......@@ -144,6 +145,6 @@ MACHINE_START(PERSONAL_SERVER, "Compaq-PersonalServer")
BOOT_PARAMS(0x00000100)
MAPIO(footbridge_map_io)
INITIRQ(footbridge_init_irq)
INITTIME(footbridge_init_time)
.timer = &footbridge_timer,
MACHINE_END
#endif
......@@ -213,7 +213,7 @@ static struct irqaction footbridge_timer_irq = {
/*
* Set up timer interrupt.
*/
void __init footbridge_init_time(void)
static void __init footbridge_timer_init(void)
{
if (machine_is_co285() ||
machine_is_personal_server())
......@@ -266,8 +266,6 @@ void __init footbridge_init_time(void)
if (machine_is_ebsa285() ||
machine_is_co285() ||
machine_is_personal_server()) {
gettimeoffset = timer1_gettimeoffset;
timer1_latch = (mem_fclk_21285 + 8 * HZ) / (16 * HZ);
*CSR_TIMER1_CLR = 0;
......@@ -286,11 +284,19 @@ void __init footbridge_init_time(void)
outb((mSEC_10_from_14/6) & 0xFF, 0x40);
outb((mSEC_10_from_14/6) >> 8, 0x40);
gettimeoffset = isa_gettimeoffset;
footbridge_timer_irq.name = "ISA Timer Tick";
footbridge_timer_irq.handler = isa_timer_interrupt;
setup_irq(IRQ_ISA_TIMER, &footbridge_timer_irq);
}
}
struct sys_timer footbridge_timer = {
.init = footbridge_timer_init,
.offset = timer1_gettimeoffset,
};
struct sys_timer isa_timer = {
.init = footbridge_timer_init,
.offset = isa_gettimeoffset,
};
......@@ -11,4 +11,6 @@
extern void __init imx_map_io(void);
extern void __init imx_init_irq(void);
extern void __init imx_init_time(void);
struct sys_timer;
extern struct sys_timer imx_timer;
......@@ -83,6 +83,6 @@ MACHINE_START(MX1ADS, "Motorola MX1ADS")
BOOT_PARAMS(0x08000100)
MAPIO(mx1ads_map_io)
INITIRQ(imx_init_irq)
INITTIME(imx_init_time)
.timer = &imx_timer,
INIT_MACHINE(mx1ads_init)
MACHINE_END
......@@ -76,8 +76,8 @@ static struct irqaction imx_timer_irq = {
/*
* Set up timer interrupt, and return the current time in seconds.
*/
void __init
imx_init_time(void)
static void __init
imx_timer_init(void)
{
/*
* Initialise to a known state (all timers off, and timing reset)
......@@ -91,5 +91,9 @@ imx_init_time(void)
* Make irqs happen for the system timer
*/
setup_irq(TIM1_INT, &imx_timer_irq);
gettimeoffset = imx_gettimeoffset;
}
struct imx_timer = {
.init = imx_timer_init,
.offset = imx_gettimeoffset,
};
extern void integrator_time_init(unsigned long, unsigned int);
extern unsigned long integrator_gettimeoffset(void);
......@@ -24,6 +24,8 @@
#include <asm/leds.h>
#include <asm/mach/time.h>
#include "common.h"
static struct amba_device rtc_device = {
.dev = {
.bus_id = "mb:15",
......@@ -163,8 +165,6 @@ typedef struct TimerStruct {
unsigned long TimerClear;
} TimerStruct_t;
extern unsigned long (*gettimeoffset)(void);
static unsigned long timer_reload;
/*
......@@ -264,5 +264,4 @@ void __init integrator_time_init(unsigned long reload, unsigned int ctrl)
* Make irqs happen for the system timer
*/
setup_irq(IRQ_TIMERINT1, &integrator_timer_irq);
gettimeoffset = integrator_gettimeoffset;
}
......@@ -41,6 +41,7 @@
#include <asm/mach/irq.h>
#include <asm/mach/map.h>
#include "common.h"
/*
* All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
......@@ -281,17 +282,22 @@ static void __init ap_init(void)
}
}
static void ap_time_init(void)
static void __init ap_init_timer(void)
{
integrator_time_init(1000000 * TICKS_PER_uSEC / HZ, 0);
}
static struct sys_timer ap_timer = {
.init = ap_init_timer,
.offset = integrator_gettimeoffset,
};
MACHINE_START(INTEGRATOR, "ARM-Integrator")
MAINTAINER("ARM Ltd/Deep Blue Solutions Ltd")
BOOT_MEM(0x00000000, 0x16000000, 0xf1600000)
BOOT_PARAMS(0x00000100)
MAPIO(ap_map_io)
INITIRQ(ap_init_irq)
INITTIME(ap_time_init)
.timer = &ap_timer,
INIT_MACHINE(ap_init)
MACHINE_END
......@@ -36,6 +36,7 @@
#include <asm/mach/mmc.h>
#include <asm/mach/map.h>
#include "common.h"
#include "clock.h"
#define INTCP_PA_MMC_BASE 0x1c000000
......@@ -496,17 +497,22 @@ static void __init intcp_init(void)
#define TIMER_CTRL_IE (1 << 5) /* Interrupt Enable */
static void __init intcp_init_time(void)
static void __init intcp_timer_init(void)
{
integrator_time_init(1000000 / HZ, TIMER_CTRL_IE);
}
static struct sys_timer cp_timer = {
.init = intcp_timer_init,
.offset = integrator_gettimeoffset,
};
MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
MAINTAINER("ARM Ltd/Deep Blue Solutions Ltd")
BOOT_MEM(0x00000000, 0x16000000, 0xf1600000)
BOOT_PARAMS(0x00000100)
MAPIO(intcp_map_io)
INITIRQ(intcp_init_irq)
INITTIME(intcp_init_time)
.timer = &cp_timer,
INIT_MACHINE(intcp_init)
MACHINE_END
/*
* linux/arch/arm/mach-iop3xx/arch.c
*
* Author: Nicolas Pitre <nico@cam.org>
* Copyright (C) 2001 MontaVista Software, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/major.h>
#include <linux/fs.h>
#include <asm/setup.h>
#include <asm/system.h>
#include <asm/memory.h>
#include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#ifdef CONFIG_ARCH_IQ80331
extern void iq80331_map_io(void);
extern void iop331_init_irq(void);
extern void iop331_init_time(void);
#endif
#ifdef CONFIG_ARCH_IQ80331
static void __init
fixup_iop331(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
}
#endif
#if defined(CONFIG_ARCH_IQ80331)
MACHINE_START(IQ80331, "Intel IQ80331")
MAINTAINER("Intel Corp.")
BOOT_MEM(PHYS_OFFSET, 0xfff01000, 0xfffff000) // virtual, physical
// BOOT_MEM(PHYS_OFFSET, IQ80331_UART0_VIRT, IQ80331_UART0_PHYS)
MAPIO(iq80331_map_io)
INITIRQ(iop331_init_irq)
INITTIME(iop331_init_time)
BOOT_PARAMS(0x0100)
MACHINE_END
#else
#error No machine descriptor defined for this IOP3xx implementation
#endif
......@@ -23,13 +23,13 @@
#ifdef CONFIG_ARCH_IQ80321
extern void iq80321_map_io(void);
extern void iop321_init_irq(void);
extern struct sys_timer iop321_timer;
extern void iop321_init_time(void);
#endif
#ifdef CONFIG_ARCH_IQ31244
extern void iq31244_map_io(void);
extern void iop321_init_irq(void);
extern struct sys_timer iop321_timer;
extern void iop321_init_time(void);
#endif
......@@ -46,7 +46,7 @@ MACHINE_START(IQ80321, "Intel IQ80321")
FIXUP(fixup_iop321)
MAPIO(iq80321_map_io)
INITIRQ(iop321_init_irq)
INITTIME(iop321_init_time)
.timer = &iop331_timer,
BOOT_PARAMS(0xa0000100)
MACHINE_END
#elif defined(CONFIG_ARCH_IQ31244)
......@@ -55,7 +55,7 @@ MACHINE_END
BOOT_MEM(PHYS_OFFSET, IQ31244_UART, IQ31244_UART)
MAPIO(iq31244_map_io)
INITIRQ(iop321_init_irq)
INITTIME(iop321_init_time)
.timer = &iop331_timer,
BOOT_PARAMS(0xa0000100)
MACHINE_END
#else
......
......@@ -110,14 +110,11 @@ static struct irqaction iop321_timer_irq = {
.flags = SA_INTERRUPT
};
extern int setup_arm_irq(int, struct irqaction*);
void __init iop321_init_time(void)
static void __init iop321_timer_init(void)
{
u32 timer_ctl;
iop321_latch = (CLOCK_TICK_RATE + HZ / 2) / HZ;
gettimeoffset = iop321_gettimeoffset;
setup_irq(IRQ_IOP321_TIMER0, &iop321_timer_irq);
timer_ctl = IOP321_TMR_EN | IOP321_TMR_PRIVILEGED | IOP321_TMR_RELOAD |
......@@ -138,4 +135,7 @@ void __init iop321_init_time(void)
#endif
}
struct sys_timer iop321_timer = {
.init = &iop321_timer_init,
.offset = iop321_gettimeoffset,
};
......@@ -81,7 +81,7 @@ void __init iop331_map_io(void)
#ifdef CONFIG_ARCH_IQ80331
extern void iop331_init_irq(void);
extern void iop331_init_time(void);
extern struct sys_timer iop331_timer;
extern void iq80331_map_io(void);
#endif
......@@ -92,7 +92,7 @@ MACHINE_START(IQ80331, "Intel IQ80331")
//BOOT_MEM(PHYS_OFFSET, IQ80331_UART0_VIRT, IQ80331_UART0_PHYS)
MAPIO(iq80331_map_io)
INITIRQ(iop331_init_irq)
INITTIME(iop331_init_time)
.timer = &iop331_timer,
BOOT_PARAMS(0x0100)
MACHINE_END
#else
......
......@@ -110,14 +110,11 @@ static struct irqaction iop331_timer_irq = {
.flags = SA_INTERRUPT
};
extern int setup_arm_irq(int, struct irqaction*);
void __init iop331_init_time(void)
static void __init iop331_timer_init(void)
{
u32 timer_ctl;
iop331_latch = (CLOCK_TICK_RATE + HZ / 2) / HZ;
gettimeoffset = iop331_gettimeoffset;
setup_irq(IRQ_IOP331_TIMER0, &iop331_timer_irq);
timer_ctl = IOP331_TMR_EN | IOP331_TMR_PRIVILEGED | IOP331_TMR_RELOAD |
......@@ -138,4 +135,7 @@ void __init iop331_init_time(void)
#endif
}
struct sys_timer iop331_timer = {
.init = iop331_timer_init,
.offset = iop331_gettimeoffset,
};
......@@ -170,7 +170,7 @@ void __init ixp2000_map_io(void)
static unsigned ticks_per_jiffy;
static unsigned ticks_per_usec;
static unsigned long ixp2000_gettimeoffset (void)
unsigned long ixp2000_gettimeoffset (void)
{
unsigned long elapsed;
......@@ -198,8 +198,6 @@ static struct irqaction ixp2000_timer_irq = {
void __init ixp2000_init_time(unsigned long tick_rate)
{
gettimeoffset = ixp2000_gettimeoffset;
ixp2000_reg_write(IXP2000_T1_CLR, 0);
ixp2000_reg_write(IXP2000_T2_CLR, 0);
......
......@@ -55,11 +55,16 @@
/*************************************************************************
* ENP-2611 timer tick configuration
*************************************************************************/
static void __init enp2611_init_time(void)
static void __init enp2611_timer_init(void)
{
ixp2000_init_time(50 * 1000 * 1000);
}
static struct enp2611_timer = {
.init = enp2611_timer_init,
.offset = ixp2000_gettimeoffset,
};
/*************************************************************************
* ENP-2611 PCI
......@@ -202,7 +207,7 @@ MACHINE_START(ENP2611, "Radisys ENP-2611 PCI network processor board")
BOOT_PARAMS(0x00000100)
MAPIO(ixp2000_map_io)
INITIRQ(ixp2000_init_irq)
INITTIME(enp2611_init_time)
.timer = &enp2611_timer,
INIT_MACHINE(enp2611_init_machine)
MACHINE_END
#endif
......
......@@ -48,7 +48,7 @@
/*************************************************************************
* IXDP2400 timer tick
*************************************************************************/
static void __init ixdp2400_init_time(void)
static void __init ixdp2400_timer_init(void)
{
int numerator, denominator;
int denom_array[] = {2, 4, 8, 16, 1, 2, 4, 8};
......@@ -59,6 +59,11 @@ static void __init ixdp2400_init_time(void)
ixp2000_init_time(((3125000 * numerator) / (denominator)) / 2);
}
static struct timer ixdp2400_timer = {
.init = ixdp2400_timer_init,
.offset = ixp2000_gettimeoffset,
};
/*************************************************************************
* IXDP2400 PCI
*************************************************************************/
......@@ -171,7 +176,7 @@ MACHINE_START(IXDP2400, "Intel IXDP2400 Development Platform")
BOOT_PARAMS(0x00000100)
MAPIO(ixdp2x00_map_io)
INITIRQ(ixdp2400_init_irq)
INITTIME(ixdp2400_init_time)
.timer = &ixdp2400_timer,
INIT_MACHINE(ixdp2x00_init_machine)
MACHINE_END
......@@ -55,11 +55,16 @@ void ixdp2400_init_irq(void)
* IXDP2800 timer tick
*************************************************************************/
static void __init ixdp2800_init_time(void)
static void __init ixdp2800_timer_init(void)
{
ixp2000_init_time(50000000);
}
static struct sys_timer ixdp2800_timer = {
.init = ixdp2800_timer_init,
.offset = ixp2000_gettimeoffset,
};
/*************************************************************************
* IXDP2800 PCI
*************************************************************************/
......@@ -172,7 +177,7 @@ MACHINE_START(IXDP2800, "Intel IXDP2800 Development Platform")
BOOT_PARAMS(0x00000100)
MAPIO(ixdp2x00_map_io)
INITIRQ(ixdp2800_init_irq)
INITTIME(ixdp2800_init_time)
.timer = &ixdp2800_timer,
INIT_MACHINE(ixdp2x00_init_machine)
MACHINE_END
......@@ -193,7 +193,7 @@ static int __init ixdp2x01_clock_setup(char *str)
__setup("ixdp2x01_clock=", ixdp2x01_clock_setup);
static void __init ixdp2x01_init_time(void)
static void __init ixdp2x01_timer_init(void)
{
if (!ixdp2x01_clock)
ixdp2x01_clock = 50000000;
......@@ -201,6 +201,11 @@ static void __init ixdp2x01_init_time(void)
ixp2000_init_time(ixdp2x01_clock);
}
static struct sys_timer ixdp2x01_timer = {
.init = ixdp2x01_timer_init,
.offset = ixp2000_gettimeoffset,
};
/*************************************************************************
* IXDP2x01 PCI
*************************************************************************/
......@@ -361,7 +366,7 @@ MACHINE_START(IXDP2401, "Intel IXDP2401 Development Platform")
BOOT_PARAMS(0x00000100)
MAPIO(ixdp2x01_map_io)
INITIRQ(ixdp2x01_init_irq)
INITTIME(ixdp2x01_init_time)
.timer = &ixdp2x01_timer,
INIT_MACHINE(ixdp2x01_init_machine)
MACHINE_END
#endif
......@@ -373,7 +378,7 @@ MACHINE_START(IXDP2801, "Intel IXDP2801 Development Platform")
BOOT_PARAMS(0x00000100)
MAPIO(ixdp2x01_map_io)
INITIRQ(ixdp2x01_init_irq)
INITTIME(ixdp2x01_init_time)
.timer = &ixdp2x01_timer,
INIT_MACHINE(ixdp2x01_init_machine)
MACHINE_END
#endif
......
......@@ -241,10 +241,8 @@ static struct irqaction ixp4xx_timer_irq = {
.handler = ixp4xx_timer_interrupt
};
void __init ixp4xx_init_time(void)
static void __init ixp4xx_timer_init(void)
{
gettimeoffset = ixp4xx_gettimeoffset;
/* Clear Pending Interrupt by writing '1' to it */
*IXP4XX_OSST = IXP4XX_OSST_TIMER_1_PEND;
......@@ -259,4 +257,7 @@ void __init ixp4xx_init_time(void)
setup_irq(IRQ_IXP4XX_TIMER1, &ixp4xx_timer_irq);
}
struct ixp4xx_timer = {
.init = ixp4xx_timer_init,
.offset = ixp4xx_gettimeoffset,
};
......@@ -88,7 +88,7 @@ MACHINE_START(ADI_COYOTE, "ADI Engineering IXP4XX Coyote Development Platform")
IXP4XX_PERIPHERAL_BASE_VIRT)
MAPIO(coyote_map_io)
INITIRQ(ixp4xx_init_irq)
INITTIME(ixp4xx_init_time)
.timer = &ixp4xx_timer,
BOOT_PARAMS(0x0100)
INIT_MACHINE(coyote_init)
MACHINE_END
......
......@@ -117,7 +117,7 @@ MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
IXP4XX_PERIPHERAL_BASE_VIRT)
MAPIO(ixdp425_map_io)
INITIRQ(ixp4xx_init_irq)
INITTIME(ixp4xx_init_time)
.timer = &ixp4xx_timer,
BOOT_PARAMS(0x0100)
INIT_MACHINE(ixdp425_init)
MACHINE_END
......@@ -128,7 +128,7 @@ MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
IXP4XX_PERIPHERAL_BASE_VIRT)
MAPIO(ixdp425_map_io)
INITIRQ(ixp4xx_init_irq)
INITTIME(ixp4xx_init_time)
.timer = &ixp4xx_timer,
BOOT_PARAMS(0x0100)
INIT_MACHINE(ixdp425_init)
MACHINE_END
......@@ -146,7 +146,7 @@ MACHINE_START(AVILA, "Gateworks Avila Network Platform")
IXP4XX_PERIPHERAL_BASE_VIRT)
MAPIO(ixdp425_map_io)
INITIRQ(ixp4xx_init_irq)
INITTIME(ixp4xx_init_time)
.timer = &ixp4xx_timer,
BOOT_PARAMS(0x0100)
INIT_MACHINE(ixdp425_init)
MACHINE_END
......
......@@ -88,7 +88,7 @@ MACHINE_START(PRPMC1100, "Motorola PrPMC1100")
IXP4XX_PERIPHERAL_BASE_VIRT)
MAPIO(prpmc1100_map_io)
INITIRQ(ixp4xx_init_irq)
INITTIME(ixp4xx_init_time)
.timer = &ixp4xx_timer,
BOOT_PARAMS(0x0100)
INIT_MACHINE(prpmc1100_init)
MACHINE_END
......
......@@ -11,6 +11,7 @@
#include <linux/tty.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <asm/hardware.h>
#include <asm/setup.h>
......@@ -21,11 +22,9 @@
#include <asm/mach/irq.h>
#include <asm/mach/map.h>
#include <linux/interrupt.h>
#include "common.h"
/* This function calls the board specific IRQ initialization function. */
extern void lh7a400_init_irq (void);
extern void lh7a40x_init_time (void);
static struct map_desc kev7a400_io_desc[] __initdata = {
{ IO_VIRT, IO_PHYS, IO_SIZE, MT_DEVICE },
......@@ -109,5 +108,5 @@ MACHINE_START (KEV7A400, "Sharp KEV7a400")
BOOT_PARAMS (0xc0000100)
MAPIO (kev7a400_map_io)
INITIRQ (lh7a400_init_irq)
INITTIME (lh7a40x_init_time)
.timer = &lh7a40x_timer,
MACHINE_END
......@@ -11,6 +11,7 @@
#include <linux/tty.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <asm/hardware.h>
#include <asm/setup.h>
......@@ -21,7 +22,7 @@
#include <asm/mach/irq.h>
#include <asm/mach/map.h>
#include <linux/interrupt.h>
#include "common.h"
static struct resource smc91x_resources[] = {
[0] = {
......@@ -261,16 +262,13 @@ lpd7a400_map_io(void)
#ifdef CONFIG_MACH_LPD7A400
extern void lh7a400_init_irq (void);
extern void lh7a40x_init_time (void);
MACHINE_START (LPD7A400, "Logic Product Development LPD7A400-10")
MAINTAINER ("Marc Singer")
BOOT_MEM (0xc0000000, 0x80000000, io_p2v (0x80000000))
BOOT_PARAMS (0xc0000100)
MAPIO (lpd7a400_map_io)
INITIRQ (lh7a400_init_irq)
INITTIME (lh7a40x_init_time)
.timer = &lpd7a40x_timer,
INIT_MACHINE (lpd7a40x_init)
MACHINE_END
......@@ -278,16 +276,13 @@ MACHINE_END
#ifdef CONFIG_MACH_LPD7A404
extern void lh7a404_init_irq (void);
extern void lh7a40x_init_time (void);
MACHINE_START (LPD7A404, "Logic Product Development LPD7A404-10")
MAINTAINER ("Marc Singer")
BOOT_MEM (0xc0000000, 0x80000000, io_p2v (0x80000000))
BOOT_PARAMS (0xc0000100)
MAPIO (lpd7a400_map_io)
INITIRQ (lh7a404_init_irq)
INITTIME (lh7a40x_init_time)
.timer = &lpd7a40x_timer,
INIT_MACHINE (lpd7a40x_init)
MACHINE_END
......
/*
* linux/arch/arm/mach-lh7a40x/common.h
*
* Header file for common stuff.
*/
struct sys_timer;
extern struct sys_timer lh7a40x_timer;
extern void lh7a400_init_irq (void);
......@@ -20,6 +20,7 @@
#include <asm/leds.h>
#include <asm/mach/time.h>
#include "common.h"
#if HZ < 100
# define TIMER_CONTROL TIMER_CONTROL2
......@@ -52,7 +53,7 @@ static struct irqaction lh7a40x_timer_irq = {
.handler = lh7a40x_timer_interrupt
};
void __init lh7a40x_init_time(void)
static void __init lh7a40x_timer_init(void)
{
/* Stop/disable all timers */
TIMER_CONTROL1 = 0;
......@@ -65,3 +66,6 @@ void __init lh7a40x_init_time(void)
TIMER_CONTROL = TIMER_MODE;
}
struct sys_timer lh7a40x_timer = {
.init = &lh7a40x_timer,
};
......@@ -30,8 +30,6 @@
#include "common.h"
extern void __init omap_init_time(void);
static void __init omap_generic_init_irq(void)
{
omap_init_irq();
......@@ -118,5 +116,5 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
MAPIO(omap_generic_map_io)
INITIRQ(omap_generic_init_irq)
INIT_MACHINE(omap_generic_init)
INITTIME(omap_init_time)
.timer = &omap_timer,
MACHINE_END
......@@ -35,8 +35,6 @@
#include "common.h"
extern void __init omap_init_time(void);
static struct map_desc h2_io_desc[] __initdata = {
{ OMAP1610_ETHR_BASE, OMAP1610_ETHR_START, OMAP1610_ETHR_SIZE,MT_DEVICE },
{ OMAP1610_NOR_FLASH_BASE, OMAP1610_NOR_FLASH_START, OMAP1610_NOR_FLASH_SIZE,
......@@ -111,5 +109,5 @@ MACHINE_START(OMAP_H2, "TI-H2")
MAPIO(h2_map_io)
INITIRQ(h2_init_irq)
INIT_MACHINE(h2_init)
INITTIME(omap_init_time)
.timer = &omap_timer,
MACHINE_END
......@@ -32,8 +32,6 @@
#include <asm/mach-types.h>
#include "common.h"
extern void __init omap_init_time(void);
void h3_init_irq(void)
{
omap_init_irq();
......@@ -86,5 +84,5 @@ MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
MAPIO(h3_map_io)
INITIRQ(h3_init_irq)
INIT_MACHINE(h3_init)
INITTIME(omap_init_time)
.timer = &omap_timer,
MACHINE_END
......@@ -33,8 +33,6 @@
#include "common.h"
extern void __init omap_init_time(void);
#ifdef CONFIG_ARCH_OMAP1510
extern int omap_gpio_init(void);
......@@ -203,5 +201,5 @@ MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
MAPIO(innovator_map_io)
INITIRQ(innovator_init_irq)
INIT_MACHINE(innovator_init)
INITTIME(omap_init_time)
.timer = &omap_timer,
MACHINE_END
......@@ -41,8 +41,6 @@
#include "common.h"
extern void __init omap_init_time(void);
static struct map_desc osk5912_io_desc[] __initdata = {
{ OMAP_OSK_ETHR_BASE, OMAP_OSK_ETHR_START, OMAP_OSK_ETHR_SIZE,MT_DEVICE },
{ OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE,
......@@ -97,5 +95,5 @@ MACHINE_START(OMAP_OSK, "TI-OSK")
MAPIO(osk_map_io)
INITIRQ(osk_init_irq)
INIT_MACHINE(osk_init)
INITTIME(omap_init_time)
.timer = &omap_timer,
MACHINE_END
......@@ -27,8 +27,6 @@
#include "common.h"
extern void __init omap_init_time(void);
void omap_perseus2_init_irq(void)
{
omap_init_irq();
......@@ -115,5 +113,5 @@ MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
MAPIO(omap_perseus2_map_io)
INITIRQ(omap_perseus2_init_irq)
INIT_MACHINE(omap_perseus2_init)
INITTIME(omap_init_time)
.timer = &omap_timer,
MACHINE_END
......@@ -27,8 +27,9 @@
#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
#define __ARCH_ARM_MACH_OMAP_COMMON_H
struct sys_timer;
extern void omap_map_io(void);
extern struct sys_timer omap_timer;
#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
......@@ -199,11 +199,9 @@ static struct irqaction omap_timer_irq = {
.handler = omap_timer_interrupt
};
void __init omap_init_time(void)
static void __init omap_timer_init(void)
{
/* Since we don't call request_irq, we must init the structure */
gettimeoffset = omap_gettimeoffset;
#ifdef OMAP1510_USE_32KHZ_TIMER
timer32k_write(TIMER32k_CR, 0x0);
timer32k_write(TIMER32k_TVR,TIMER32k_PERIOD);
......@@ -215,3 +213,7 @@ void __init omap_init_time(void)
#endif
}
struct sys_timer omap_timer = {
.init = omap_timer_init,
.offset = omap_gettimeoffset,
};
......@@ -9,9 +9,11 @@
* published by the Free Software Foundation.
*/
struct sys_timer;
extern struct sys_timer pxa_timer;
extern void __init pxa_map_io(void);
extern void __init pxa_init_irq(void);
extern void __init pxa_init_time(void);
extern unsigned int get_clk_frequency_khz(int info);
......
......@@ -119,6 +119,6 @@ MACHINE_START(PXA_IDP, "Accelent Xscale IDP")
BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
MAPIO(idp_map_io)
INITIRQ(idp_init_irq)
INITTIME(pxa_init_time)
.timer = &pxa_timer,
INIT_MACHINE(idp_init)
MACHINE_END
......@@ -38,6 +38,8 @@
#include "generic.h"
#define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080)
void lubbock_set_misc_wr(unsigned int mask, unsigned int set)
{
unsigned long flags;
......@@ -221,6 +223,6 @@ MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)")
BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
MAPIO(lubbock_map_io)
INITIRQ(lubbock_init_irq)
INITTIME(pxa_init_time)
.timer = &pxa_timer,
INIT_MACHINE(lubbock_init)
MACHINE_END
......@@ -198,6 +198,6 @@ MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
MAPIO(mainstone_map_io)
INITIRQ(mainstone_init_irq)
INITTIME(pxa_init_time)
.timer = &pxa_timer,
INIT_MACHINE(mainstone_init)
MACHINE_END
......@@ -105,11 +105,10 @@ static struct irqaction pxa_timer_irq = {
.handler = pxa_timer_interrupt
};
void __init pxa_init_time(void)
static void __init pxa_timer_init(void)
{
struct timespec tv;
gettimeoffset = pxa_gettimeoffset;
set_rtc = pxa_set_rtc;
tv.tv_nsec = 0;
......@@ -123,3 +122,22 @@ void __init pxa_init_time(void)
OSCR = 0; /* initialize free-running timer, force first match */
}
#ifdef CONFIG_PM
static void pxa_timer_suspend(void)
{
}
static void pxa_timer_resume(void)
{
}
#else
#define pxa_timer_suspend NULL
#define pxa_timer_resume NULL
#endif
struct sys_timer pxa_timer = {
.init = pxa_timer_init,
.suspend = pxa_timer_suspend,
.resume = pxa_timer_resume,
.offset = pxa_gettimeoffset,
};
......@@ -15,7 +15,6 @@
#include <linux/pm.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <asm/elf.h>
#include <asm/io.h>
......@@ -85,30 +84,7 @@ void __init rpc_map_io(void)
elf_hwcap &= ~HWCAP_HALF;
}
static irqreturn_t
rpc_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
timer_tick(regs);
return IRQ_HANDLED;
}
static struct irqaction rpc_timer_irq = {
.name = "RiscPC Timer Tick",
.flags = SA_INTERRUPT,
.handler = rpc_timer_interrupt
};
/*
* Set up timer interrupt.
*/
void __init rpc_init_time(void)
{
extern void ioctime_init(void);
ioctime_init();
setup_irq(IRQ_TIMER, &rpc_timer_irq);
}
extern struct sys_timer ioc_timer;
MACHINE_START(RISCPC, "Acorn-RiscPC")
MAINTAINER("Russell King")
......@@ -118,5 +94,5 @@ MACHINE_START(RISCPC, "Acorn-RiscPC")
DISABLE_PARPORT(1)
MAPIO(rpc_map_io)
INITIRQ(rpc_init_irq)
INITTIME(rpc_init_time)
.timer = &ioc_timer,
MACHINE_END
......@@ -225,16 +225,11 @@ void __init bast_init_irq(void)
s3c2410_init_irq();
}
void __init bast_init_time(void)
{
s3c2410_init_time();
}
MACHINE_START(BAST, "Simtec-BAST")
MAINTAINER("Ben Dooks <ben@simtec.co.uk>")
BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, S3C2410_VA_UART)
BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
MAPIO(bast_map_io)
INITIRQ(bast_init_irq)
INITTIME(bast_init_time)
.timer = &s3c2410_timer,
MACHINE_END
......@@ -109,16 +109,11 @@ void __init h1940_init_irq(void)
}
void __init h1940_init_time(void)
{
s3c2410_init_time();
}
MACHINE_START(H1940, "IPAQ-H1940")
MAINTAINER("Ben Dooks <ben@fluff.org>")
BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, S3C2410_VA_UART)
BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
MAPIO(h1940_map_io)
INITIRQ(h1940_init_irq)
INITTIME(h1940_init_time)
.timer = &s3c2410_timer,
MACHINE_END
......@@ -113,11 +113,6 @@ void __init smdk2410_init_irq(void)
s3c2410_init_irq();
}
void __init smdk2410_init_time(void)
{
s3c2410_init_time();
}
MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch
* to SMDK2410 */
MAINTAINER("Jonas Dietsche")
......@@ -125,7 +120,7 @@ MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switc
BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
MAPIO(smdk2410_map_io)
INITIRQ(smdk2410_init_irq)
INITTIME(smdk2410_init_time)
.timer = &s3c2410_timer,
MACHINE_END
......@@ -170,16 +170,11 @@ void __init vr1000_init_irq(void)
s3c2410_init_irq();
}
void __init vr1000_init_time(void)
{
s3c2410_init_time();
}
MACHINE_START(VR1000, "Thorcom-VR1000")
MAINTAINER("Ben Dooks <ben@simtec.co.uk>")
BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, S3C2410_VA_UART)
BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
MAPIO(vr1000_map_io)
INITIRQ(vr1000_init_irq)
INITTIME(vr1000_init_time)
.timer = &s3c2410_timer,
MACHINE_END
......@@ -19,7 +19,8 @@ extern void s3c2410_map_io(struct map_desc *, int count);
extern void s3c2410_init_irq(void);
extern void s3c2410_init_time(void);
struct sys_timer;
extern struct sys_timer s3c2410_timer;
/* the board structure is used at first initialsation time
* to get info such as the devices to register for this
......
......@@ -104,15 +104,13 @@ static struct irqaction s3c2410_timer_irq = {
* Currently we only use timer4, as it is the only timer which has no
* other function that can be exploited externally
*/
void __init s3c2410_init_time (void)
static void __init s3c2410_timer_init (void)
{
unsigned long tcon;
unsigned long tcnt;
unsigned long tcfg1;
unsigned long tcfg0;
gettimeoffset = s3c2410_gettimeoffset;
tcnt = 0xffff; /* default value for tcnt */
/* read the current timer configuration bits */
......@@ -185,5 +183,7 @@ void __init s3c2410_init_time (void)
__raw_writel(tcon, S3C2410_TCON);
}
struct sys_timer s3c2410_timer = {
.init = s3c2410_timer_init,
.offset = s3c2410_gettimeoffset,
};
......@@ -147,5 +147,5 @@ MACHINE_START(ADSBITSY, "ADS Bitsy")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(adsbitsy_map_io)
INITIRQ(adsbitsy_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -324,6 +324,6 @@ MACHINE_START(ASSABET, "Intel-Assabet")
FIXUP(fixup_assabet)
MAPIO(assabet_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
INIT_MACHINE(assabet_init)
MACHINE_END
......@@ -245,5 +245,5 @@ MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4")
BOOT_PARAMS(0xc0000100)
MAPIO(badge4_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -37,5 +37,5 @@ MACHINE_START(BRUTUS, "Intel Brutus (SA1100 eval board)")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(brutus_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -92,5 +92,5 @@ MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(cerf_map_io)
INITIRQ(cerf_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -141,5 +141,5 @@ MACHINE_START(COLLIE, "Sharp-Collie")
MAPIO(collie_map_io)
INITIRQ(sa1100_init_irq)
INIT_MACHINE(collie_init)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -35,5 +35,5 @@ MACHINE_START(EMPEG, "empeg MP3 Car Audio Player")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(empeg_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -183,6 +183,6 @@ MACHINE_START(FLEXANET, "FlexaNet")
BOOT_PARAMS(0xc0000100)
MAPIO(flexanet_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -77,5 +77,5 @@ MACHINE_START(FREEBIRD, "Freebird-HPC-1.1")
#endif
MAPIO(freebird_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -4,9 +4,11 @@
* Author: Nicolas Pitre
*/
struct sys_timer;
extern struct sys_timer sa1100_timer;
extern void __init sa1100_map_io(void);
extern void __init sa1100_init_irq(void);
extern void __init sa1100_init_time(void);
#define SET_BANK(__nr,__start,__size) \
mi->bank[__nr].start = (__start), \
......
......@@ -198,5 +198,5 @@ MACHINE_START(GRAPHICSCLIENT, "ADS GraphicsClient")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(graphicsclient_map_io)
INITIRQ(graphicsclient_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -287,5 +287,5 @@ MACHINE_START(GRAPHICSMASTER, "ADS GraphicsMaster")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(graphicsmaster_map_io)
INITIRQ(graphicsmaster_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -286,7 +286,7 @@ MACHINE_START(H3100, "Compaq iPAQ H3100")
BOOT_PARAMS(0xc0000100)
MAPIO(h3100_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
#endif /* CONFIG_SA1100_H3100 */
......@@ -401,7 +401,7 @@ MACHINE_START(H3600, "Compaq iPAQ H3600")
BOOT_PARAMS(0xc0000100)
MAPIO(h3600_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
#endif /* CONFIG_SA1100_H3600 */
......@@ -785,7 +785,7 @@ MACHINE_START(H3800, "Compaq iPAQ H3800")
BOOT_PARAMS(0xc0000100)
MAPIO(h3800_map_io)
INITIRQ(h3800_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
#endif /* CONFIG_SA1100_H3800 */
......@@ -174,5 +174,5 @@ MACHINE_START(HACKKIT, "HackKit Cpu Board")
BOOT_PARAMS(0xc0000100)
MAPIO(hackkit_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -81,5 +81,5 @@ MACHINE_START(HUW_WEBPANEL, "HuW-Webpanel")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(huw_webpanel_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -37,5 +37,5 @@ MACHINE_START(ITSY, "Compaq Itsy")
BOOT_PARAMS(0xc0000100)
MAPIO(itsy_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -101,5 +101,5 @@ MACHINE_START(JORNADA720, "HP Jornada 720")
BOOT_PARAMS(0xc0000100)
MAPIO(jornada720_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -43,5 +43,5 @@ MACHINE_START(LART, "LART")
BOOT_PARAMS(0xc0000100)
MAPIO(lart_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -49,5 +49,5 @@ MACHINE_START(NANOENGINE, "BSE nanoEngine")
FIXUP(fixup_nanoengine)
MAPIO(nanoengine_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -59,5 +59,5 @@ MACHINE_START(OMNIMETER, "OmniMeter")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(omnimeter_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -40,5 +40,5 @@ MACHINE_START(PANGOLIN, "Dialogue-Pangolin")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(pangolin_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -112,5 +112,5 @@ MACHINE_START(PFS168, "Tulsa")
BOOT_PARAMS(0xc0000100)
MAPIO(pfs168_map_io)
INITIRQ(pfs168_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -31,5 +31,5 @@ MACHINE_START(PLEB, "PLEB")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(pleb_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -41,5 +41,5 @@ MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)")
BOOT_PARAMS(0xc0000100)
MAPIO(shannon_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -27,5 +27,5 @@ MACHINE_START(SHERMAN, "Blazie Engineering Sherman")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(sherman_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -231,5 +231,5 @@ MACHINE_START(SIMPAD, "Simpad")
BOOT_PARAMS(0xc0000100)
MAPIO(simpad_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -331,7 +331,7 @@ MACHINE_START(STORK, "Stork Technologies prototype")
BOOT_PARAMS(0xc0000100)
MAPIO(stork_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......
......@@ -470,5 +470,5 @@ MACHINE_START(PT_SYSTEM3, "PT System 3")
BOOT_PARAMS(0xc0000100)
MAPIO(system3_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -99,11 +99,10 @@ static struct irqaction sa1100_timer_irq = {
.handler = sa1100_timer_interrupt
};
void __init sa1100_init_time(void)
static void __init sa1100_timer_init(void)
{
struct timespec tv;
gettimeoffset = sa1100_gettimeoffset;
set_rtc = sa1100_set_rtc;
tv.tv_nsec = 0;
......@@ -117,3 +116,22 @@ void __init sa1100_init_time(void)
OSCR = 0; /* initialize free-running timer, force first match */
}
#ifdef CONFIG_PM
static void sa1100_timer_suspend(void)
{
}
static void sa1100_timer_resume(void)
{
}
#else
#define sa1100_timer_suspend NULL
#define sa1100_timer_resume NULL
#endif
struct sys_timer sa1100_timer = {
.init = sa1100_timer_init,
.suspend = sa1100_timer_suspend,
.resume = sa1100_timer_resume,
.offset = sa1100_gettimeoffset,
};
......@@ -228,5 +228,5 @@ MACHINE_START(TRIZEPS, "TRIZEPS")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(trizeps_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -89,5 +89,5 @@ MACHINE_START(XP860, "XP860")
BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
MAPIO(xp860_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -91,5 +91,5 @@ MACHINE_START(YOPY, "Yopy")
BOOT_PARAMS(0xc0000100)
MAPIO(yopy_map_io)
INITIRQ(sa1100_init_irq)
INITTIME(sa1100_init_time)
.timer = &sa1100_timer,
MACHINE_END
......@@ -49,7 +49,7 @@ static struct irqaction shark_timer_irq = {
/*
* Set up timer interrupt, and return the current time in seconds.
*/
void __init shark_init_time(void)
static void __init shark_timer_init(void)
{
unsigned long flags;
......@@ -60,6 +60,9 @@ void __init shark_init_time(void)
setup_irq(IRQ_TIMER, &shark_timer_irq);
}
static struct sys_timer shark_timer = {
.init = shark_timer_init,
};
MACHINE_START(SHARK, "Shark")
MAINTAINER("Alexander Schulz")
......@@ -67,5 +70,5 @@ MACHINE_START(SHARK, "Shark")
BOOT_PARAMS(0x08003000)
MAPIO(shark_map_io)
INITIRQ(shark_init_irq)
INITTIME(shark_init_time)
.timer = &shark_timer,
MACHINE_END
......@@ -760,8 +760,6 @@ typedef struct TimerStruct {
unsigned long TimerClear;
} TimerStruct_t;
extern unsigned long (*gettimeoffset)(void);
/*
* Returns number of ms since last clock interrupt. Note that interrupts
* will have been disabled by do_gettimeoffset()
......@@ -827,7 +825,7 @@ static struct irqaction versatile_timer_irq = {
/*
* Set up timer interrupt, and return the current time in seconds.
*/
void __init versatile_init_time(void)
static void __init versatile_timer_init(void)
{
volatile TimerStruct_t *timer0 = (volatile TimerStruct_t *)TIMER0_VA_BASE;
volatile TimerStruct_t *timer1 = (volatile TimerStruct_t *)TIMER1_VA_BASE;
......@@ -859,15 +857,19 @@ void __init versatile_init_time(void)
* Make irqs happen for the system timer
*/
setup_irq(IRQ_TIMERINT0_1, &versatile_timer_irq);
gettimeoffset = versatile_gettimeoffset;
}
static struct sys_timer versatile_timer = {
.init = versatile_timer_init,
.offset = versatile_gettimeoffset,
};
MACHINE_START(VERSATILE_PB, "ARM-Versatile PB")
MAINTAINER("ARM Ltd/Deep Blue Solutions Ltd")
BOOT_MEM(0x00000000, 0x101f1000, 0xf11f1000)
BOOT_PARAMS(0x00000100)
MAPIO(versatile_map_io)
INITIRQ(versatile_init_irq)
INITTIME(versatile_init_time)
.timer = &versatile_timer,
INIT_MACHINE(versatile_init)
MACHINE_END
......@@ -457,10 +457,6 @@
#define mSEC_25 (mSEC_1 * 25)
#define SEC_1 (mSEC_1 * 1000)
#ifndef __ASSEMBLY__
extern void integrator_time_init(unsigned long, unsigned int);
#endif
#define INTEGRATOR_CSR_BASE 0x10000000
#define INTEGRATOR_CSR_SIZE 0x10000000
......
/*
* linux/include/asm-arm/arch-integrator/time.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <asm/system.h>
#include <asm/leds.h>
#include <asm/mach-types.h>
/*
* Where is the timer (VA)?
*/
#define TIMER0_VA_BASE (IO_ADDRESS(INTEGRATOR_CT_BASE)+0x00000000)
#define TIMER1_VA_BASE (IO_ADDRESS(INTEGRATOR_CT_BASE)+0x00000100)
#define TIMER2_VA_BASE (IO_ADDRESS(INTEGRATOR_CT_BASE)+0x00000200)
#define VA_IC_BASE IO_ADDRESS(INTEGRATOR_IC_BASE)
/*
* How long is the timer interval?
*/
#define TIMER_INTERVAL (TICKS_PER_uSEC * mSEC_10)
#if TIMER_INTERVAL >= 0x100000
#define TICKS2USECS(x) (256 * (x) / TICKS_PER_uSEC)
#elif TIMER_INTERVAL >= 0x10000
#define TICKS2USECS(x) (16 * (x) / TICKS_PER_uSEC)
#else
#define TICKS2USECS(x) ((x) / TICKS_PER_uSEC)
#endif
#define TIMER_CTRL_IE (1 << 5) /* Interrupt Enable */
/*
* What does it look like?
*/
typedef struct TimerStruct {
unsigned long TimerLoad;
unsigned long TimerValue;
unsigned long TimerControl;
unsigned long TimerClear;
} TimerStruct_t;
extern unsigned long (*gettimeoffset)(void);
static unsigned long timer_reload;
/*
* Returns number of ms since last clock interrupt. Note that interrupts
* will have been disabled by do_gettimeoffset()
*/
static unsigned long integrator_gettimeoffset(void)
{
volatile TimerStruct_t *timer1 = (TimerStruct_t *)TIMER1_VA_BASE;
unsigned long ticks1, ticks2, status;
/*
* Get the current number of ticks. Note that there is a race
* condition between us reading the timer and checking for
* an interrupt. We get around this by ensuring that the
* counter has not reloaded between our two reads.
*/
ticks2 = timer1->TimerValue & 0xffff;
do {
ticks1 = ticks2;
status = __raw_readl(VA_IC_BASE + IRQ_RAW_STATUS);
ticks2 = timer1->TimerValue & 0xffff;
} while (ticks2 > ticks1);
/*
* Number of ticks since last interrupt.
*/
ticks1 = timer_reload - ticks2;
/*
* Interrupt pending? If so, we've reloaded once already.
*/
if (status & (1 << IRQ_TIMERINT1))
ticks1 += timer_reload;
/*
* Convert the ticks to usecs
*/
return TICKS2USECS(ticks1);
}
/*
* IRQ handler for the timer
*/
static irqreturn_t
integrator_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
volatile TimerStruct_t *timer1 = (volatile TimerStruct_t *)TIMER1_VA_BASE;
// ...clear the interrupt
timer1->TimerClear = 1;
do_leds();
do_timer(regs);
do_profile(regs);
return IRQ_HANDLED;
}
/*
* Set up timer interrupt, and return the current time in seconds.
*/
void __init time_init(void)
{
volatile TimerStruct_t *timer0 = (volatile TimerStruct_t *)TIMER0_VA_BASE;
volatile TimerStruct_t *timer1 = (volatile TimerStruct_t *)TIMER1_VA_BASE;
volatile TimerStruct_t *timer2 = (volatile TimerStruct_t *)TIMER2_VA_BASE;
unsigned int timer_ctrl = 0x80 | 0x40; /* periodic */
if (machine_is_integrator()) {
timer_reload = 1000000 * TICKS_PER_uSEC / HZ;
} else if (machine_is_cintegrator()) {
timer_reload = 1000000 / HZ;
timer_ctrl |= TIMER_CTRL_IE;
}
if (timer_reload > 0x100000) {
timer_reload >>= 8;
timer_ctrl |= 0x08; /* /256 */
} else if (timer_reload > 0x010000) {
timer_reload >>= 4;
timer_ctrl |= 0x04; /* /16 */
}
/*
* Initialise to a known state (all timers off)
*/
timer0->TimerControl = 0;
timer1->TimerControl = 0;
timer2->TimerControl = 0;
timer1->TimerLoad = timer_reload;
timer1->TimerValue = timer_reload;
timer1->TimerControl = timer_ctrl;
/*
* Make irqs happen for the system timer
*/
timer_irq.handler = integrator_timer_interrupt;
setup_irq(IRQ_TIMERINT1, &timer_irq);
gettimeoffset = integrator_gettimeoffset;
}
......@@ -117,6 +117,7 @@ static inline unsigned int ixp2000_is_pcimaster(void)
void ixp2000_map_io(void);
void ixp2000_init_irq(void);
void ixp2000_init_time(unsigned long);
unsigned long ixp2000_gettimeoffset(void);
struct pci_sys_data;
......
......@@ -53,12 +53,14 @@ struct ixp4xx_i2c_pins {
};
struct sys_timer;
/*
* Functions used by platform-level setup code
*/
extern void ixp4xx_map_io(void);
extern void ixp4xx_init_irq(void);
extern void ixp4xx_init_time(void);
extern struct sys_timer ixp4xx_timer;
extern void ixp4xx_pci_preinit(void);
struct pci_sys_data;
extern int ixp4xx_setup(int nr, struct pci_sys_data *sys);
......
......@@ -12,6 +12,7 @@
struct tag;
struct meminfo;
struct sys_timer;
struct machine_desc {
/*
......@@ -39,7 +40,7 @@ struct machine_desc {
struct meminfo *);
void (*map_io)(void);/* IO mapping function */
void (*init_irq)(void);
void (*init_time)(void);
struct sys_timer *timer; /* system tick timer */
void (*init_machine)(void);
};
......@@ -82,9 +83,6 @@ const struct machine_desc __mach_desc_##_type \
#define INITIRQ(_func) \
.init_irq = _func,
#define INITTIME(_func) \
.init_time = _func,
#define INIT_MACHINE(_func) \
.init_machine = _func,
......
......@@ -10,10 +10,22 @@
#ifndef __ASM_ARM_MACH_TIME_H
#define __ASM_ARM_MACH_TIME_H
extern void (*init_arch_time)(void);
#include <linux/sysdev.h>
/*
* This is our kernel timer structure.
*/
struct sys_timer {
struct sys_device dev;
void (*init)(void);
void (*suspend)(void);
void (*resume)(void);
unsigned long (*offset)(void);
};
extern struct sys_timer *system_timer;
extern int (*set_rtc)(void);
extern unsigned long (*gettimeoffset)(void);
extern void timer_tick(struct pt_regs *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment