Commit 432818b9 authored by Zwane Mwaikambo's avatar Zwane Mwaikambo Committed by Linus Torvalds

[PATCH] x86: move PIT code to timer_pit

Now that things got cleaned up a bit, there is no real reason why the pit
initialisation code has to be in i8259.c. Move it to timer_pit.ca
Signed-off-by: default avatarZwane Mwaikambo <zwane@fsmlabs.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 063583c1
......@@ -4,7 +4,6 @@
#include <linux/sched.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/timex.h>
#include <linux/slab.h>
#include <linux/random.h>
#include <linux/smp_lock.h>
......@@ -12,10 +11,12 @@
#include <linux/kernel_stat.h>
#include <linux/sysdev.h>
#include <asm/8253pit.h>
#include <asm/atomic.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/timer.h>
#include <asm/bitops.h>
#include <asm/pgtable.h>
#include <asm/delay.h>
......@@ -387,46 +388,6 @@ void __init init_ISA_irqs (void)
}
}
static void setup_timer(void)
{
extern spinlock_t i8253_lock;
unsigned long flags;
spin_lock_irqsave(&i8253_lock, flags);
outb_p(0x34,PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */
udelay(10);
outb_p(LATCH & 0xff , PIT_CH0); /* LSB */
udelay(10);
outb(LATCH >> 8 , PIT_CH0); /* MSB */
spin_unlock_irqrestore(&i8253_lock, flags);
}
static int timer_resume(struct sys_device *dev)
{
setup_timer();
return 0;
}
static struct sysdev_class timer_sysclass = {
set_kset_name("timer"),
.resume = timer_resume,
};
static struct sys_device device_timer = {
.id = 0,
.cls = &timer_sysclass,
};
static int __init init_timer_sysfs(void)
{
int error = sysdev_class_register(&timer_sysclass);
if (!error)
error = sysdev_register(&device_timer);
return error;
}
device_initcall(init_timer_sysfs);
void __init init_IRQ(void)
{
int i;
......@@ -456,7 +417,7 @@ void __init init_IRQ(void)
* Set the clock to HZ Hz, we already have a valid
* vector now:
*/
setup_timer();
setup_pit_timer();
/*
* External FPU? Set up irq13 if so, for
......
......@@ -7,6 +7,9 @@
#include <linux/module.h>
#include <linux/device.h>
#include <linux/irq.h>
#include <linux/sysdev.h>
#include <linux/timex.h>
#include <asm/delay.h>
#include <asm/mpspec.h>
#include <asm/timer.h>
#include <asm/smp.h>
......@@ -156,3 +159,44 @@ struct timer_opts timer_pit = {
.monotonic_clock = monotonic_clock_pit,
.delay = delay_pit,
};
void setup_pit_timer(void)
{
extern spinlock_t i8253_lock;
unsigned long flags;
spin_lock_irqsave(&i8253_lock, flags);
outb_p(0x34,PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */
udelay(10);
outb_p(LATCH & 0xff , PIT_CH0); /* LSB */
udelay(10);
outb(LATCH >> 8 , PIT_CH0); /* MSB */
spin_unlock_irqrestore(&i8253_lock, flags);
}
static int timer_resume(struct sys_device *dev)
{
setup_pit_timer();
return 0;
}
static struct sysdev_class timer_sysclass = {
set_kset_name("timer"),
.resume = timer_resume,
};
static struct sys_device device_timer = {
.id = 0,
.cls = &timer_sysclass,
};
static int __init init_timer_sysfs(void)
{
int error = sysdev_class_register(&timer_sysclass);
if (!error)
error = sysdev_register(&device_timer);
return error;
}
device_initcall(init_timer_sysfs);
......@@ -28,6 +28,7 @@ struct timer_opts{
extern struct timer_opts* select_timer(void);
extern void clock_fallback(void);
void setup_pit_timer(void);
/* Modifiers for buggy PIT handling */
......
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