Merge branch 'timers-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: mips: Fix i8253 clockevent fallout i8253: Cleanup outb/inb magic arm: Footbridge: Use common i8253 clockevent mips: Use common i8253 clockevent x86: Use common i8253 clockevent i8253: Create common clockevent implementation i8253: Export i8253_lock unconditionally pcpskr: MIPS: Make config dependencies finer grained pcspkr: Cleanup Kconfig dependencies i8253: Move remaining content and delete asm/i8253.h i8253: Consolidate definitions of PIT_LATCH x86: i8253: Consolidate definitions of global_clock_event i8253: Alpha, PowerPC: Remove unused asm/8253pit.h alpha: i8253: Cleanup remaining users of i8253pit.h i8253: Remove I8253_LOCK config i8253: Make pcsp sound driver use the shared i8253_lock i8253: Make pcspkr input driver use the shared i8253_lock i8253: Consolidate all kernel definitions of i8253_lock i8253: Unify all kernel declarations of i8253_lock i8253: Create linux/i8253.h and use it in all 8253 related files
This commit is contained in:
Коммит
a99a7d1436
|
@ -6,6 +6,7 @@ config ALPHA
|
||||||
select HAVE_OPROFILE
|
select HAVE_OPROFILE
|
||||||
select HAVE_SYSCALL_WRAPPERS
|
select HAVE_SYSCALL_WRAPPERS
|
||||||
select HAVE_IRQ_WORK
|
select HAVE_IRQ_WORK
|
||||||
|
select HAVE_PCSPKR_PLATFORM
|
||||||
select HAVE_PERF_EVENTS
|
select HAVE_PERF_EVENTS
|
||||||
select HAVE_DMA_ATTRS
|
select HAVE_DMA_ATTRS
|
||||||
select HAVE_GENERIC_HARDIRQS
|
select HAVE_GENERIC_HARDIRQS
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*
|
|
||||||
* 8253/8254 Programmable Interval Timer
|
|
||||||
*/
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
||||||
#include <asm/core_cia.h>
|
#include <asm/core_cia.h>
|
||||||
#include <asm/tlbflush.h>
|
#include <asm/tlbflush.h>
|
||||||
#include <asm/8253pit.h>
|
|
||||||
|
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
#include "irq_impl.h"
|
#include "irq_impl.h"
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/hwrpb.h>
|
#include <asm/hwrpb.h>
|
||||||
#include <asm/8253pit.h>
|
|
||||||
#include <asm/rtc.h>
|
#include <asm/rtc.h>
|
||||||
|
|
||||||
#include <linux/mc146818rtc.h>
|
#include <linux/mc146818rtc.h>
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
#ifndef __ASMARM_I8253_H
|
|
||||||
#define __ASMARM_I8253_H
|
|
||||||
|
|
||||||
/* i8253A PIT registers */
|
|
||||||
#define PIT_MODE 0x43
|
|
||||||
#define PIT_CH0 0x40
|
|
||||||
|
|
||||||
#define PIT_LATCH ((PIT_TICK_RATE + HZ / 2) / HZ)
|
|
||||||
|
|
||||||
extern raw_spinlock_t i8253_lock;
|
|
||||||
|
|
||||||
#define outb_pit outb_p
|
|
||||||
#define inb_pit inb_p
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -5,6 +5,7 @@ menu "Footbridge Implementations"
|
||||||
config ARCH_CATS
|
config ARCH_CATS
|
||||||
bool "CATS"
|
bool "CATS"
|
||||||
select CLKSRC_I8253
|
select CLKSRC_I8253
|
||||||
|
select CLKEVT_I8253
|
||||||
select FOOTBRIDGE_HOST
|
select FOOTBRIDGE_HOST
|
||||||
select ISA
|
select ISA
|
||||||
select ISA_DMA
|
select ISA_DMA
|
||||||
|
|
|
@ -5,64 +5,18 @@
|
||||||
* Copyright (C) 1998 Phil Blundell
|
* Copyright (C) 1998 Phil Blundell
|
||||||
*/
|
*/
|
||||||
#include <linux/clockchips.h>
|
#include <linux/clockchips.h>
|
||||||
#include <linux/clocksource.h>
|
#include <linux/i8253.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
#include <linux/io.h>
|
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/timex.h>
|
#include <linux/timex.h>
|
||||||
|
|
||||||
#include <asm/irq.h>
|
#include <asm/irq.h>
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/mach/time.h>
|
#include <asm/mach/time.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
DEFINE_RAW_SPINLOCK(i8253_lock);
|
|
||||||
|
|
||||||
static void pit_set_mode(enum clock_event_mode mode,
|
|
||||||
struct clock_event_device *evt)
|
|
||||||
{
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
raw_local_irq_save(flags);
|
|
||||||
|
|
||||||
switch (mode) {
|
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
|
||||||
outb_p(0x34, PIT_MODE);
|
|
||||||
outb_p(PIT_LATCH & 0xff, PIT_CH0);
|
|
||||||
outb_p(PIT_LATCH >> 8, PIT_CH0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
|
||||||
outb_p(0x30, PIT_MODE);
|
|
||||||
outb_p(0, PIT_CH0);
|
|
||||||
outb_p(0, PIT_CH0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
|
||||||
case CLOCK_EVT_MODE_RESUME:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
local_irq_restore(flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int pit_set_next_event(unsigned long delta,
|
|
||||||
struct clock_event_device *evt)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct clock_event_device pit_ce = {
|
|
||||||
.name = "pit",
|
|
||||||
.features = CLOCK_EVT_FEAT_PERIODIC,
|
|
||||||
.set_mode = pit_set_mode,
|
|
||||||
.set_next_event = pit_set_next_event,
|
|
||||||
.shift = 32,
|
|
||||||
};
|
|
||||||
|
|
||||||
static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
|
static irqreturn_t pit_timer_interrupt(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
struct clock_event_device *ce = dev_id;
|
struct clock_event_device *ce = dev_id;
|
||||||
|
@ -74,20 +28,15 @@ static struct irqaction pit_timer_irq = {
|
||||||
.name = "pit",
|
.name = "pit",
|
||||||
.handler = pit_timer_interrupt,
|
.handler = pit_timer_interrupt,
|
||||||
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
|
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
|
||||||
.dev_id = &pit_ce,
|
.dev_id = &i8253_clockevent,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init isa_timer_init(void)
|
static void __init isa_timer_init(void)
|
||||||
{
|
{
|
||||||
pit_ce.cpumask = cpumask_of(smp_processor_id());
|
|
||||||
pit_ce.mult = div_sc(PIT_TICK_RATE, NSEC_PER_SEC, pit_ce.shift);
|
|
||||||
pit_ce.max_delta_ns = clockevent_delta2ns(0x7fff, &pit_ce);
|
|
||||||
pit_ce.min_delta_ns = clockevent_delta2ns(0x000f, &pit_ce);
|
|
||||||
|
|
||||||
clocksource_i8253_init();
|
clocksource_i8253_init();
|
||||||
|
|
||||||
setup_irq(pit_ce.irq, &pit_timer_irq);
|
setup_irq(i8253_clockevent.irq, &pit_timer_irq);
|
||||||
clockevents_register_device(&pit_ce);
|
clockevent_i8253_init(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sys_timer isa_timer = {
|
struct sys_timer isa_timer = {
|
||||||
|
|
|
@ -185,6 +185,7 @@ config MACH_JAZZ
|
||||||
select CSRC_R4K
|
select CSRC_R4K
|
||||||
select DEFAULT_SGI_PARTITION if CPU_BIG_ENDIAN
|
select DEFAULT_SGI_PARTITION if CPU_BIG_ENDIAN
|
||||||
select GENERIC_ISA_DMA
|
select GENERIC_ISA_DMA
|
||||||
|
select HAVE_PCSPKR_PLATFORM
|
||||||
select IRQ_CPU
|
select IRQ_CPU
|
||||||
select I8253
|
select I8253
|
||||||
select I8259
|
select I8259
|
||||||
|
@ -266,6 +267,7 @@ config MIPS_MALTA
|
||||||
select CSRC_R4K
|
select CSRC_R4K
|
||||||
select DMA_NONCOHERENT
|
select DMA_NONCOHERENT
|
||||||
select GENERIC_ISA_DMA
|
select GENERIC_ISA_DMA
|
||||||
|
select HAVE_PCSPKR_PLATFORM
|
||||||
select IRQ_CPU
|
select IRQ_CPU
|
||||||
select IRQ_GIC
|
select IRQ_GIC
|
||||||
select HW_HAS_PCI
|
select HW_HAS_PCI
|
||||||
|
@ -640,6 +642,7 @@ config SNI_RM
|
||||||
select DEFAULT_SGI_PARTITION if CPU_BIG_ENDIAN
|
select DEFAULT_SGI_PARTITION if CPU_BIG_ENDIAN
|
||||||
select DMA_NONCOHERENT
|
select DMA_NONCOHERENT
|
||||||
select GENERIC_ISA_DMA
|
select GENERIC_ISA_DMA
|
||||||
|
select HAVE_PCSPKR_PLATFORM
|
||||||
select HW_HAS_EISA
|
select HW_HAS_EISA
|
||||||
select HW_HAS_PCI
|
select HW_HAS_PCI
|
||||||
select IRQ_CPU
|
select IRQ_CPU
|
||||||
|
@ -2388,6 +2391,7 @@ config MMU
|
||||||
config I8253
|
config I8253
|
||||||
bool
|
bool
|
||||||
select CLKSRC_I8253
|
select CLKSRC_I8253
|
||||||
|
select CLKEVT_I8253
|
||||||
select MIPS_EXTERNAL_TIMER
|
select MIPS_EXTERNAL_TIMER
|
||||||
|
|
||||||
config ZONE_DMA32
|
config ZONE_DMA32
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
#include <linux/i8253.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
|
||||||
#include <asm/gt64120.h>
|
#include <asm/gt64120.h>
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/time.h>
|
#include <asm/time.h>
|
||||||
|
|
||||||
#define GT641XX_BASE_CLOCK 50000000 /* 50MHz */
|
#define GT641XX_BASE_CLOCK 50000000 /* 50MHz */
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
/*
|
|
||||||
* Machine specific IO port address definition for generic.
|
|
||||||
* Written by Osamu Tomita <tomita@cinet.co.jp>
|
|
||||||
*/
|
|
||||||
#ifndef __ASM_I8253_H
|
|
||||||
#define __ASM_I8253_H
|
|
||||||
|
|
||||||
#include <linux/spinlock.h>
|
|
||||||
|
|
||||||
/* i8253A PIT registers */
|
|
||||||
#define PIT_MODE 0x43
|
|
||||||
#define PIT_CH0 0x40
|
|
||||||
#define PIT_CH2 0x42
|
|
||||||
|
|
||||||
#define PIT_LATCH LATCH
|
|
||||||
|
|
||||||
extern raw_spinlock_t i8253_lock;
|
|
||||||
|
|
||||||
extern void setup_pit_timer(void);
|
|
||||||
|
|
||||||
#define inb_pit inb_p
|
|
||||||
#define outb_pit outb_p
|
|
||||||
|
|
||||||
#endif /* __ASM_I8253_H */
|
|
|
@ -7,6 +7,7 @@
|
||||||
* Copyright (C) 1994 - 2001, 2003, 07 Ralf Baechle
|
* Copyright (C) 1994 - 2001, 2003, 07 Ralf Baechle
|
||||||
*/
|
*/
|
||||||
#include <linux/clockchips.h>
|
#include <linux/clockchips.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
@ -15,7 +16,6 @@
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
|
|
||||||
#include <asm/irq_cpu.h>
|
#include <asm/irq_cpu.h>
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/i8259.h>
|
#include <asm/i8259.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/jazz.h>
|
#include <asm/jazz.h>
|
||||||
|
|
|
@ -3,96 +3,16 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <linux/clockchips.h>
|
#include <linux/clockchips.h>
|
||||||
#include <linux/init.h>
|
#include <linux/i8253.h>
|
||||||
#include <linux/interrupt.h>
|
|
||||||
#include <linux/jiffies.h>
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
#include <linux/spinlock.h>
|
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
|
|
||||||
#include <asm/delay.h>
|
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/io.h>
|
|
||||||
#include <asm/time.h>
|
#include <asm/time.h>
|
||||||
|
|
||||||
DEFINE_RAW_SPINLOCK(i8253_lock);
|
|
||||||
EXPORT_SYMBOL(i8253_lock);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize the PIT timer.
|
|
||||||
*
|
|
||||||
* This is also called after resume to bring the PIT into operation again.
|
|
||||||
*/
|
|
||||||
static void init_pit_timer(enum clock_event_mode mode,
|
|
||||||
struct clock_event_device *evt)
|
|
||||||
{
|
|
||||||
raw_spin_lock(&i8253_lock);
|
|
||||||
|
|
||||||
switch(mode) {
|
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
|
||||||
/* binary, mode 2, LSB/MSB, ch 0 */
|
|
||||||
outb_p(0x34, PIT_MODE);
|
|
||||||
outb_p(LATCH & 0xff , PIT_CH0); /* LSB */
|
|
||||||
outb(LATCH >> 8 , PIT_CH0); /* MSB */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
|
||||||
if (evt->mode == CLOCK_EVT_MODE_PERIODIC ||
|
|
||||||
evt->mode == CLOCK_EVT_MODE_ONESHOT) {
|
|
||||||
outb_p(0x30, PIT_MODE);
|
|
||||||
outb_p(0, PIT_CH0);
|
|
||||||
outb_p(0, PIT_CH0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
|
||||||
/* One shot setup */
|
|
||||||
outb_p(0x38, PIT_MODE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_RESUME:
|
|
||||||
/* Nothing to do here */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
raw_spin_unlock(&i8253_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Program the next event in oneshot mode
|
|
||||||
*
|
|
||||||
* Delta is given in PIT ticks
|
|
||||||
*/
|
|
||||||
static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
|
|
||||||
{
|
|
||||||
raw_spin_lock(&i8253_lock);
|
|
||||||
outb_p(delta & 0xff , PIT_CH0); /* LSB */
|
|
||||||
outb(delta >> 8 , PIT_CH0); /* MSB */
|
|
||||||
raw_spin_unlock(&i8253_lock);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* On UP the PIT can serve all of the possible timer functions. On SMP systems
|
|
||||||
* it can be solely used for the global tick.
|
|
||||||
*
|
|
||||||
* The profiling and update capabilites are switched off once the local apic is
|
|
||||||
* registered. This mechanism replaces the previous #ifdef LOCAL_APIC -
|
|
||||||
* !using_apic_timer decisions in do_timer_interrupt_hook()
|
|
||||||
*/
|
|
||||||
static struct clock_event_device pit_clockevent = {
|
|
||||||
.name = "pit",
|
|
||||||
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
|
|
||||||
.set_mode = init_pit_timer,
|
|
||||||
.set_next_event = pit_next_event,
|
|
||||||
.irq = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
static irqreturn_t timer_interrupt(int irq, void *dev_id)
|
static irqreturn_t timer_interrupt(int irq, void *dev_id)
|
||||||
{
|
{
|
||||||
pit_clockevent.event_handler(&pit_clockevent);
|
i8253_clockevent.event_handler(&i8253_clockevent);
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
@ -103,25 +23,9 @@ static struct irqaction irq0 = {
|
||||||
.name = "timer"
|
.name = "timer"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize the conversion factor and the min/max deltas of the clock event
|
|
||||||
* structure and register the clock event source with the framework.
|
|
||||||
*/
|
|
||||||
void __init setup_pit_timer(void)
|
void __init setup_pit_timer(void)
|
||||||
{
|
{
|
||||||
struct clock_event_device *cd = &pit_clockevent;
|
clockevent_i8253_init(true);
|
||||||
unsigned int cpu = smp_processor_id();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Start pit with the boot cpu mask and make it global after the
|
|
||||||
* IO_APIC has been initialized.
|
|
||||||
*/
|
|
||||||
cd->cpumask = cpumask_of(cpu);
|
|
||||||
clockevent_set_clock(cd, CLOCK_TICK_RATE);
|
|
||||||
cd->max_delta_ns = clockevent_delta2ns(0x7FFF, cd);
|
|
||||||
cd->min_delta_ns = clockevent_delta2ns(0xF, cd);
|
|
||||||
clockevents_register_device(cd);
|
|
||||||
|
|
||||||
setup_irq(0, &irq0);
|
setup_irq(0, &irq0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/kernel_stat.h>
|
#include <linux/kernel_stat.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
|
@ -31,7 +32,6 @@
|
||||||
#include <asm/mipsregs.h>
|
#include <asm/mipsregs.h>
|
||||||
#include <asm/mipsmtregs.h>
|
#include <asm/mipsmtregs.h>
|
||||||
#include <asm/hardirq.h>
|
#include <asm/hardirq.h>
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/irq.h>
|
#include <asm/irq.h>
|
||||||
#include <asm/div64.h>
|
#include <asm/div64.h>
|
||||||
#include <asm/cpu.h>
|
#include <asm/cpu.h>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
* Copyright (C) 2003, 06 Ralf Baechle (ralf@linux-mips.org)
|
* Copyright (C) 2003, 06 Ralf Baechle (ralf@linux-mips.org)
|
||||||
*/
|
*/
|
||||||
#include <linux/bcd.h>
|
#include <linux/bcd.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
@ -20,7 +21,6 @@
|
||||||
|
|
||||||
#include <asm/cpu.h>
|
#include <asm/cpu.h>
|
||||||
#include <asm/mipsregs.h>
|
#include <asm/mipsregs.h>
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/irq.h>
|
#include <asm/irq.h>
|
||||||
#include <asm/time.h>
|
#include <asm/time.h>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
#include <linux/time.h>
|
#include <linux/time.h>
|
||||||
#include <linux/clockchips.h>
|
#include <linux/clockchips.h>
|
||||||
|
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/sni.h>
|
#include <asm/sni.h>
|
||||||
#include <asm/time.h>
|
#include <asm/time.h>
|
||||||
#include <asm-generic/rtc.h>
|
#include <asm-generic/rtc.h>
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*
|
|
||||||
* 8253/8254 Programmable Interval Timer
|
|
||||||
*/
|
|
|
@ -8,7 +8,7 @@ config AMIGAONE
|
||||||
select NOT_COHERENT_CACHE
|
select NOT_COHERENT_CACHE
|
||||||
select CHECK_CACHE_COHERENCY
|
select CHECK_CACHE_COHERENCY
|
||||||
select DEFAULT_UIMAGE
|
select DEFAULT_UIMAGE
|
||||||
select PCSPKR_PLATFORM
|
select HAVE_PCSPKR_PLATFORM
|
||||||
help
|
help
|
||||||
Select AmigaOne for the following machines:
|
Select AmigaOne for the following machines:
|
||||||
- AmigaOne SE/Teron CX (G3 only)
|
- AmigaOne SE/Teron CX (G3 only)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
config PPC_CHRP
|
config PPC_CHRP
|
||||||
bool "Common Hardware Reference Platform (CHRP) based machines"
|
bool "Common Hardware Reference Platform (CHRP) based machines"
|
||||||
depends on 6xx
|
depends on 6xx
|
||||||
|
select HAVE_PCSPKR_PLATFORM
|
||||||
select MPIC
|
select MPIC
|
||||||
select PPC_I8259
|
select PPC_I8259
|
||||||
select PPC_INDIRECT_PCI
|
select PPC_INDIRECT_PCI
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
config PPC_PREP
|
config PPC_PREP
|
||||||
bool "PowerPC Reference Platform (PReP) based machines"
|
bool "PowerPC Reference Platform (PReP) based machines"
|
||||||
depends on 6xx && BROKEN
|
depends on 6xx && BROKEN
|
||||||
|
select HAVE_PCSPKR_PLATFORM
|
||||||
select MPIC
|
select MPIC
|
||||||
select PPC_I8259
|
select PPC_I8259
|
||||||
select PPC_INDIRECT_PCI
|
select PPC_INDIRECT_PCI
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
config PPC_PSERIES
|
config PPC_PSERIES
|
||||||
depends on PPC64 && PPC_BOOK3S
|
depends on PPC64 && PPC_BOOK3S
|
||||||
bool "IBM pSeries & new (POWER5-based) iSeries"
|
bool "IBM pSeries & new (POWER5-based) iSeries"
|
||||||
|
select HAVE_PCSPKR_PLATFORM
|
||||||
select MPIC
|
select MPIC
|
||||||
select PCI_MSI
|
select PCI_MSI
|
||||||
select PPC_XICS
|
select PPC_XICS
|
||||||
|
|
|
@ -20,6 +20,7 @@ config X86
|
||||||
select HAVE_UNSTABLE_SCHED_CLOCK
|
select HAVE_UNSTABLE_SCHED_CLOCK
|
||||||
select HAVE_IDE
|
select HAVE_IDE
|
||||||
select HAVE_OPROFILE
|
select HAVE_OPROFILE
|
||||||
|
select HAVE_PCSPKR_PLATFORM
|
||||||
select HAVE_PERF_EVENTS
|
select HAVE_PERF_EVENTS
|
||||||
select HAVE_IRQ_WORK
|
select HAVE_IRQ_WORK
|
||||||
select HAVE_IOREMAP_PROT
|
select HAVE_IOREMAP_PROT
|
||||||
|
@ -70,6 +71,7 @@ config X86
|
||||||
select IRQ_FORCED_THREADING
|
select IRQ_FORCED_THREADING
|
||||||
select USE_GENERIC_SMP_HELPERS if SMP
|
select USE_GENERIC_SMP_HELPERS if SMP
|
||||||
select HAVE_BPF_JIT if (X86_64 && NET)
|
select HAVE_BPF_JIT if (X86_64 && NET)
|
||||||
|
select CLKEVT_I8253
|
||||||
|
|
||||||
config INSTRUCTION_DECODER
|
config INSTRUCTION_DECODER
|
||||||
def_bool (KPROBES || PERF_EVENTS)
|
def_bool (KPROBES || PERF_EVENTS)
|
||||||
|
|
|
@ -50,7 +50,6 @@
|
||||||
#define APBT_DEV_USED 1
|
#define APBT_DEV_USED 1
|
||||||
|
|
||||||
extern void apbt_time_init(void);
|
extern void apbt_time_init(void);
|
||||||
extern struct clock_event_device *global_clock_event;
|
|
||||||
extern unsigned long apbt_quick_calibrate(void);
|
extern unsigned long apbt_quick_calibrate(void);
|
||||||
extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu);
|
extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu);
|
||||||
extern void apbt_setup_secondary_clock(void);
|
extern void apbt_setup_secondary_clock(void);
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef _ASM_X86_I8253_H
|
|
||||||
#define _ASM_X86_I8253_H
|
|
||||||
|
|
||||||
/* i8253A PIT registers */
|
|
||||||
#define PIT_MODE 0x43
|
|
||||||
#define PIT_CH0 0x40
|
|
||||||
#define PIT_CH2 0x42
|
|
||||||
|
|
||||||
#define PIT_LATCH LATCH
|
|
||||||
|
|
||||||
extern raw_spinlock_t i8253_lock;
|
|
||||||
|
|
||||||
extern struct clock_event_device *global_clock_event;
|
|
||||||
|
|
||||||
extern void setup_pit_timer(void);
|
|
||||||
|
|
||||||
#define inb_pit inb_p
|
|
||||||
#define outb_pit outb_p
|
|
||||||
|
|
||||||
#endif /* _ASM_X86_I8253_H */
|
|
|
@ -1,10 +1,12 @@
|
||||||
#ifndef _ASM_X86_TIME_H
|
#ifndef _ASM_X86_TIME_H
|
||||||
#define _ASM_X86_TIME_H
|
#define _ASM_X86_TIME_H
|
||||||
|
|
||||||
extern void hpet_time_init(void);
|
#include <linux/clocksource.h>
|
||||||
|
|
||||||
#include <asm/mc146818rtc.h>
|
#include <asm/mc146818rtc.h>
|
||||||
|
|
||||||
|
extern void hpet_time_init(void);
|
||||||
extern void time_init(void);
|
extern void time_init(void);
|
||||||
|
|
||||||
|
extern struct clock_event_device *global_clock_event;
|
||||||
|
|
||||||
#endif /* _ASM_X86_TIME_H */
|
#endif /* _ASM_X86_TIME_H */
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <asm/fixmap.h>
|
#include <asm/fixmap.h>
|
||||||
#include <asm/apb_timer.h>
|
#include <asm/apb_timer.h>
|
||||||
#include <asm/mrst.h>
|
#include <asm/mrst.h>
|
||||||
|
#include <asm/time.h>
|
||||||
|
|
||||||
#define APBT_MASK CLOCKSOURCE_MASK(32)
|
#define APBT_MASK CLOCKSOURCE_MASK(32)
|
||||||
#define APBT_SHIFT 22
|
#define APBT_SHIFT 22
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <linux/syscore_ops.h>
|
#include <linux/syscore_ops.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/timex.h>
|
#include <linux/timex.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
#include <linux/dmar.h>
|
#include <linux/dmar.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/cpu.h>
|
#include <linux/cpu.h>
|
||||||
|
@ -39,7 +40,6 @@
|
||||||
#include <asm/pgalloc.h>
|
#include <asm/pgalloc.h>
|
||||||
#include <asm/atomic.h>
|
#include <asm/atomic.h>
|
||||||
#include <asm/mpspec.h>
|
#include <asm/mpspec.h>
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/i8259.h>
|
#include <asm/i8259.h>
|
||||||
#include <asm/proto.h>
|
#include <asm/proto.h>
|
||||||
#include <asm/apic.h>
|
#include <asm/apic.h>
|
||||||
|
@ -48,6 +48,7 @@
|
||||||
#include <asm/hpet.h>
|
#include <asm/hpet.h>
|
||||||
#include <asm/idle.h>
|
#include <asm/idle.h>
|
||||||
#include <asm/mtrr.h>
|
#include <asm/mtrr.h>
|
||||||
|
#include <asm/time.h>
|
||||||
#include <asm/smp.h>
|
#include <asm/smp.h>
|
||||||
#include <asm/mce.h>
|
#include <asm/mce.h>
|
||||||
#include <asm/tsc.h>
|
#include <asm/tsc.h>
|
||||||
|
|
|
@ -229,11 +229,11 @@
|
||||||
#include <linux/jiffies.h>
|
#include <linux/jiffies.h>
|
||||||
#include <linux/acpi.h>
|
#include <linux/acpi.h>
|
||||||
#include <linux/syscore_ops.h>
|
#include <linux/syscore_ops.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
|
|
||||||
#include <asm/system.h>
|
#include <asm/system.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/desc.h>
|
#include <asm/desc.h>
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/olpc.h>
|
#include <asm/olpc.h>
|
||||||
#include <asm/paravirt.h>
|
#include <asm/paravirt.h>
|
||||||
#include <asm/reboot.h>
|
#include <asm/reboot.h>
|
||||||
|
@ -1220,11 +1220,11 @@ static void reinit_timer(void)
|
||||||
|
|
||||||
raw_spin_lock_irqsave(&i8253_lock, flags);
|
raw_spin_lock_irqsave(&i8253_lock, flags);
|
||||||
/* set the clock to HZ */
|
/* set the clock to HZ */
|
||||||
outb_pit(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */
|
outb_p(0x34, PIT_MODE); /* binary, mode 2, LSB/MSB, ch 0 */
|
||||||
udelay(10);
|
udelay(10);
|
||||||
outb_pit(LATCH & 0xff, PIT_CH0); /* LSB */
|
outb_p(LATCH & 0xff, PIT_CH0); /* LSB */
|
||||||
udelay(10);
|
udelay(10);
|
||||||
outb_pit(LATCH >> 8, PIT_CH0); /* MSB */
|
outb_p(LATCH >> 8, PIT_CH0); /* MSB */
|
||||||
udelay(10);
|
udelay(10);
|
||||||
raw_spin_unlock_irqrestore(&i8253_lock, flags);
|
raw_spin_unlock_irqrestore(&i8253_lock, flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <linux/sysdev.h>
|
#include <linux/sysdev.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/hpet.h>
|
#include <linux/hpet.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
@ -12,8 +13,8 @@
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
|
||||||
#include <asm/fixmap.h>
|
#include <asm/fixmap.h>
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/hpet.h>
|
#include <asm/hpet.h>
|
||||||
|
#include <asm/time.h>
|
||||||
|
|
||||||
#define HPET_MASK CLOCKSOURCE_MASK(32)
|
#define HPET_MASK CLOCKSOURCE_MASK(32)
|
||||||
|
|
||||||
|
|
|
@ -3,113 +3,24 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <linux/clockchips.h>
|
#include <linux/clockchips.h>
|
||||||
#include <linux/interrupt.h>
|
|
||||||
#include <linux/spinlock.h>
|
|
||||||
#include <linux/jiffies.h>
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/timex.h>
|
#include <linux/timex.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/i8253.h>
|
||||||
#include <linux/init.h>
|
|
||||||
#include <linux/io.h>
|
|
||||||
|
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/hpet.h>
|
#include <asm/hpet.h>
|
||||||
|
#include <asm/time.h>
|
||||||
#include <asm/smp.h>
|
#include <asm/smp.h>
|
||||||
|
|
||||||
DEFINE_RAW_SPINLOCK(i8253_lock);
|
|
||||||
EXPORT_SYMBOL(i8253_lock);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* HPET replaces the PIT, when enabled. So we need to know, which of
|
* HPET replaces the PIT, when enabled. So we need to know, which of
|
||||||
* the two timers is used
|
* the two timers is used
|
||||||
*/
|
*/
|
||||||
struct clock_event_device *global_clock_event;
|
struct clock_event_device *global_clock_event;
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize the PIT timer.
|
|
||||||
*
|
|
||||||
* This is also called after resume to bring the PIT into operation again.
|
|
||||||
*/
|
|
||||||
static void init_pit_timer(enum clock_event_mode mode,
|
|
||||||
struct clock_event_device *evt)
|
|
||||||
{
|
|
||||||
raw_spin_lock(&i8253_lock);
|
|
||||||
|
|
||||||
switch (mode) {
|
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
|
||||||
/* binary, mode 2, LSB/MSB, ch 0 */
|
|
||||||
outb_pit(0x34, PIT_MODE);
|
|
||||||
outb_pit(LATCH & 0xff , PIT_CH0); /* LSB */
|
|
||||||
outb_pit(LATCH >> 8 , PIT_CH0); /* MSB */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
|
||||||
if (evt->mode == CLOCK_EVT_MODE_PERIODIC ||
|
|
||||||
evt->mode == CLOCK_EVT_MODE_ONESHOT) {
|
|
||||||
outb_pit(0x30, PIT_MODE);
|
|
||||||
outb_pit(0, PIT_CH0);
|
|
||||||
outb_pit(0, PIT_CH0);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
|
||||||
/* One shot setup */
|
|
||||||
outb_pit(0x38, PIT_MODE);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_RESUME:
|
|
||||||
/* Nothing to do here */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
raw_spin_unlock(&i8253_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Program the next event in oneshot mode
|
|
||||||
*
|
|
||||||
* Delta is given in PIT ticks
|
|
||||||
*/
|
|
||||||
static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
|
|
||||||
{
|
|
||||||
raw_spin_lock(&i8253_lock);
|
|
||||||
outb_pit(delta & 0xff , PIT_CH0); /* LSB */
|
|
||||||
outb_pit(delta >> 8 , PIT_CH0); /* MSB */
|
|
||||||
raw_spin_unlock(&i8253_lock);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* On UP the PIT can serve all of the possible timer functions. On SMP systems
|
|
||||||
* it can be solely used for the global tick.
|
|
||||||
*
|
|
||||||
* The profiling and update capabilities are switched off once the local apic is
|
|
||||||
* registered. This mechanism replaces the previous #ifdef LOCAL_APIC -
|
|
||||||
* !using_apic_timer decisions in do_timer_interrupt_hook()
|
|
||||||
*/
|
|
||||||
static struct clock_event_device pit_ce = {
|
|
||||||
.name = "pit",
|
|
||||||
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
|
|
||||||
.set_mode = init_pit_timer,
|
|
||||||
.set_next_event = pit_next_event,
|
|
||||||
.irq = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize the conversion factor and the min/max deltas of the clock event
|
|
||||||
* structure and register the clock event source with the framework.
|
|
||||||
*/
|
|
||||||
void __init setup_pit_timer(void)
|
void __init setup_pit_timer(void)
|
||||||
{
|
{
|
||||||
/*
|
clockevent_i8253_init(true);
|
||||||
* Start pit with the boot cpu mask and make it global after the
|
global_clock_event = &i8253_clockevent;
|
||||||
* IO_APIC has been initialized.
|
|
||||||
*/
|
|
||||||
pit_ce.cpumask = cpumask_of(smp_processor_id());
|
|
||||||
|
|
||||||
clockevents_config_and_register(&pit_ce, CLOCK_TICK_RATE, 0xF, 0x7FFF);
|
|
||||||
global_clock_event = &pit_ce;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_X86_64
|
#ifndef CONFIG_X86_64
|
||||||
|
@ -123,7 +34,7 @@ static int __init init_pit_clocksource(void)
|
||||||
* - when local APIC timer is active (PIT is switched off)
|
* - when local APIC timer is active (PIT is switched off)
|
||||||
*/
|
*/
|
||||||
if (num_possible_cpus() > 1 || is_hpet_enabled() ||
|
if (num_possible_cpus() > 1 || is_hpet_enabled() ||
|
||||||
pit_ce.mode != CLOCK_EVT_MODE_PERIODIC)
|
i8253_clockevent.mode != CLOCK_EVT_MODE_PERIODIC)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return clocksource_i8253_init();
|
return clocksource_i8253_init();
|
||||||
|
|
|
@ -11,13 +11,13 @@
|
||||||
|
|
||||||
#include <linux/clockchips.h>
|
#include <linux/clockchips.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
#include <linux/time.h>
|
#include <linux/time.h>
|
||||||
#include <linux/mca.h>
|
#include <linux/mca.h>
|
||||||
|
|
||||||
#include <asm/vsyscall.h>
|
#include <asm/vsyscall.h>
|
||||||
#include <asm/x86_init.h>
|
#include <asm/x86_init.h>
|
||||||
#include <asm/i8259.h>
|
#include <asm/i8259.h>
|
||||||
#include <asm/i8253.h>
|
|
||||||
#include <asm/timer.h>
|
#include <asm/timer.h>
|
||||||
#include <asm/hpet.h>
|
#include <asm/hpet.h>
|
||||||
#include <asm/time.h>
|
#include <asm/time.h>
|
||||||
|
|
|
@ -155,7 +155,7 @@ else \
|
||||||
|
|
||||||
#if (HD_DELAY > 0)
|
#if (HD_DELAY > 0)
|
||||||
|
|
||||||
#include <asm/i8253.h>
|
#include <linux/i8253.h>
|
||||||
|
|
||||||
unsigned long last_req;
|
unsigned long last_req;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
config CLKSRC_I8253
|
config CLKSRC_I8253
|
||||||
bool
|
bool
|
||||||
|
|
||||||
|
config CLKEVT_I8253
|
||||||
|
bool
|
||||||
|
|
||||||
|
config I8253_LOCK
|
||||||
|
bool
|
||||||
|
|
||||||
|
config CLKBLD_I8253
|
||||||
|
def_bool y if CLKSRC_I8253 || CLKEVT_I8253 || I8253_LOCK
|
||||||
|
|
||||||
config CLKSRC_MMIO
|
config CLKSRC_MMIO
|
||||||
bool
|
bool
|
||||||
|
|
|
@ -6,5 +6,5 @@ obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC) += cs5535-clockevt.o
|
||||||
obj-$(CONFIG_SH_TIMER_CMT) += sh_cmt.o
|
obj-$(CONFIG_SH_TIMER_CMT) += sh_cmt.o
|
||||||
obj-$(CONFIG_SH_TIMER_MTU2) += sh_mtu2.o
|
obj-$(CONFIG_SH_TIMER_MTU2) += sh_mtu2.o
|
||||||
obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o
|
obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o
|
||||||
obj-$(CONFIG_CLKSRC_I8253) += i8253.o
|
obj-$(CONFIG_CLKBLD_I8253) += i8253.o
|
||||||
obj-$(CONFIG_CLKSRC_MMIO) += mmio.o
|
obj-$(CONFIG_CLKSRC_MMIO) += mmio.o
|
||||||
|
|
|
@ -1,14 +1,25 @@
|
||||||
/*
|
/*
|
||||||
* i8253 PIT clocksource
|
* i8253 PIT clocksource
|
||||||
*/
|
*/
|
||||||
#include <linux/clocksource.h>
|
#include <linux/clockchips.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/timex.h>
|
#include <linux/timex.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
|
#include <linux/smp.h>
|
||||||
|
|
||||||
#include <asm/i8253.h>
|
/*
|
||||||
|
* Protects access to I/O ports
|
||||||
|
*
|
||||||
|
* 0040-0043 : timer0, i8253 / i8254
|
||||||
|
* 0061-0061 : NMI Control Register which contains two speaker control bits.
|
||||||
|
*/
|
||||||
|
DEFINE_RAW_SPINLOCK(i8253_lock);
|
||||||
|
EXPORT_SYMBOL(i8253_lock);
|
||||||
|
|
||||||
|
#ifdef CONFIG_CLKSRC_I8253
|
||||||
/*
|
/*
|
||||||
* Since the PIT overflows every tick, its not very useful
|
* Since the PIT overflows every tick, its not very useful
|
||||||
* to just read by itself. So use jiffies to emulate a free
|
* to just read by itself. So use jiffies to emulate a free
|
||||||
|
@ -37,15 +48,15 @@ static cycle_t i8253_read(struct clocksource *cs)
|
||||||
* count), it cannot be newer.
|
* count), it cannot be newer.
|
||||||
*/
|
*/
|
||||||
jifs = jiffies;
|
jifs = jiffies;
|
||||||
outb_pit(0x00, PIT_MODE); /* latch the count ASAP */
|
outb_p(0x00, PIT_MODE); /* latch the count ASAP */
|
||||||
count = inb_pit(PIT_CH0); /* read the latched count */
|
count = inb_p(PIT_CH0); /* read the latched count */
|
||||||
count |= inb_pit(PIT_CH0) << 8;
|
count |= inb_p(PIT_CH0) << 8;
|
||||||
|
|
||||||
/* VIA686a test code... reset the latch if count > max + 1 */
|
/* VIA686a test code... reset the latch if count > max + 1 */
|
||||||
if (count > LATCH) {
|
if (count > LATCH) {
|
||||||
outb_pit(0x34, PIT_MODE);
|
outb_p(0x34, PIT_MODE);
|
||||||
outb_pit(PIT_LATCH & 0xff, PIT_CH0);
|
outb_p(PIT_LATCH & 0xff, PIT_CH0);
|
||||||
outb_pit(PIT_LATCH >> 8, PIT_CH0);
|
outb_p(PIT_LATCH >> 8, PIT_CH0);
|
||||||
count = PIT_LATCH - 1;
|
count = PIT_LATCH - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,3 +97,90 @@ int __init clocksource_i8253_init(void)
|
||||||
{
|
{
|
||||||
return clocksource_register_hz(&i8253_cs, PIT_TICK_RATE);
|
return clocksource_register_hz(&i8253_cs, PIT_TICK_RATE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_CLKEVT_I8253
|
||||||
|
/*
|
||||||
|
* Initialize the PIT timer.
|
||||||
|
*
|
||||||
|
* This is also called after resume to bring the PIT into operation again.
|
||||||
|
*/
|
||||||
|
static void init_pit_timer(enum clock_event_mode mode,
|
||||||
|
struct clock_event_device *evt)
|
||||||
|
{
|
||||||
|
raw_spin_lock(&i8253_lock);
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case CLOCK_EVT_MODE_PERIODIC:
|
||||||
|
/* binary, mode 2, LSB/MSB, ch 0 */
|
||||||
|
outb_p(0x34, PIT_MODE);
|
||||||
|
outb_p(LATCH & 0xff , PIT_CH0); /* LSB */
|
||||||
|
outb_p(LATCH >> 8 , PIT_CH0); /* MSB */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CLOCK_EVT_MODE_SHUTDOWN:
|
||||||
|
case CLOCK_EVT_MODE_UNUSED:
|
||||||
|
if (evt->mode == CLOCK_EVT_MODE_PERIODIC ||
|
||||||
|
evt->mode == CLOCK_EVT_MODE_ONESHOT) {
|
||||||
|
outb_p(0x30, PIT_MODE);
|
||||||
|
outb_p(0, PIT_CH0);
|
||||||
|
outb_p(0, PIT_CH0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CLOCK_EVT_MODE_ONESHOT:
|
||||||
|
/* One shot setup */
|
||||||
|
outb_p(0x38, PIT_MODE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CLOCK_EVT_MODE_RESUME:
|
||||||
|
/* Nothing to do here */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
raw_spin_unlock(&i8253_lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Program the next event in oneshot mode
|
||||||
|
*
|
||||||
|
* Delta is given in PIT ticks
|
||||||
|
*/
|
||||||
|
static int pit_next_event(unsigned long delta, struct clock_event_device *evt)
|
||||||
|
{
|
||||||
|
raw_spin_lock(&i8253_lock);
|
||||||
|
outb_p(delta & 0xff , PIT_CH0); /* LSB */
|
||||||
|
outb_p(delta >> 8 , PIT_CH0); /* MSB */
|
||||||
|
raw_spin_unlock(&i8253_lock);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On UP the PIT can serve all of the possible timer functions. On SMP systems
|
||||||
|
* it can be solely used for the global tick.
|
||||||
|
*/
|
||||||
|
struct clock_event_device i8253_clockevent = {
|
||||||
|
.name = "pit",
|
||||||
|
.features = CLOCK_EVT_FEAT_PERIODIC,
|
||||||
|
.set_mode = init_pit_timer,
|
||||||
|
.set_next_event = pit_next_event,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the conversion factor and the min/max deltas of the clock event
|
||||||
|
* structure and register the clock event source with the framework.
|
||||||
|
*/
|
||||||
|
void __init clockevent_i8253_init(bool oneshot)
|
||||||
|
{
|
||||||
|
if (oneshot)
|
||||||
|
i8253_clockevent.features |= CLOCK_EVT_FEAT_ONESHOT;
|
||||||
|
/*
|
||||||
|
* Start pit with the boot cpu mask. x86 might make it global
|
||||||
|
* when it is used as broadcast device later.
|
||||||
|
*/
|
||||||
|
i8253_clockevent.cpumask = cpumask_of(smp_processor_id());
|
||||||
|
|
||||||
|
clockevents_config_and_register(&i8253_clockevent, PIT_TICK_RATE,
|
||||||
|
0xF, 0x7FFF);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -47,7 +47,7 @@ static void gameport_disconnect_port(struct gameport *gameport);
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
|
|
||||||
#include <asm/i8253.h>
|
#include <linux/i8253.h>
|
||||||
|
|
||||||
#define DELTA(x,y) ((y)-(x)+((y)<(x)?1193182/HZ:0))
|
#define DELTA(x,y) ((y)-(x)+((y)<(x)?1193182/HZ:0))
|
||||||
#define GET_TIME(x) do { x = get_time_pit(); } while (0)
|
#define GET_TIME(x) do { x = get_time_pit(); } while (0)
|
||||||
|
|
|
@ -136,7 +136,7 @@ struct analog_port {
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
|
|
||||||
#include <asm/i8253.h>
|
#include <linux/i8253.h>
|
||||||
|
|
||||||
#define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)
|
#define GET_TIME(x) do { if (cpu_has_tsc) rdtscl(x); else x = get_time_pit(); } while (0)
|
||||||
#define DELTA(x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0)))
|
#define DELTA(x,y) (cpu_has_tsc ? ((y) - (x)) : ((x) - (y) + ((x) < (y) ? CLOCK_TICK_RATE / HZ : 0)))
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
@ -25,14 +26,6 @@ MODULE_DESCRIPTION("PC Speaker beeper driver");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_ALIAS("platform:pcspkr");
|
MODULE_ALIAS("platform:pcspkr");
|
||||||
|
|
||||||
#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
|
|
||||||
/* Use the global PIT lock ! */
|
|
||||||
#include <asm/i8253.h>
|
|
||||||
#else
|
|
||||||
#include <asm/8253pit.h>
|
|
||||||
static DEFINE_RAW_SPINLOCK(i8253_lock);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
|
static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
|
||||||
{
|
{
|
||||||
unsigned int count = 0;
|
unsigned int count = 0;
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
|
* License. See the file "COPYING" in the main directory of this archive
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* Machine specific IO port address definition for generic.
|
||||||
|
* Written by Osamu Tomita <tomita@cinet.co.jp>
|
||||||
|
*/
|
||||||
|
#ifndef __LINUX_I8253_H
|
||||||
|
#define __LINUX_I8253_H
|
||||||
|
|
||||||
|
#include <linux/param.h>
|
||||||
|
#include <linux/spinlock.h>
|
||||||
|
#include <linux/timex.h>
|
||||||
|
|
||||||
|
/* i8253A PIT registers */
|
||||||
|
#define PIT_MODE 0x43
|
||||||
|
#define PIT_CH0 0x40
|
||||||
|
#define PIT_CH2 0x42
|
||||||
|
|
||||||
|
#define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ)
|
||||||
|
|
||||||
|
extern raw_spinlock_t i8253_lock;
|
||||||
|
extern struct clock_event_device i8253_clockevent;
|
||||||
|
extern void clockevent_i8253_init(bool oneshot);
|
||||||
|
|
||||||
|
extern void setup_pit_timer(void);
|
||||||
|
|
||||||
|
#endif /* __LINUX_I8253_H */
|
|
@ -1007,14 +1007,19 @@ config ELF_CORE
|
||||||
help
|
help
|
||||||
Enable support for generating core dumps. Disabling saves about 4k.
|
Enable support for generating core dumps. Disabling saves about 4k.
|
||||||
|
|
||||||
|
|
||||||
config PCSPKR_PLATFORM
|
config PCSPKR_PLATFORM
|
||||||
bool "Enable PC-Speaker support" if EXPERT
|
bool "Enable PC-Speaker support" if EXPERT
|
||||||
depends on ALPHA || X86 || MIPS || PPC_PREP || PPC_CHRP || PPC_PSERIES
|
depends on HAVE_PCSPKR_PLATFORM
|
||||||
|
select I8253_LOCK
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
This option allows to disable the internal PC-Speaker
|
This option allows to disable the internal PC-Speaker
|
||||||
support, saving some memory.
|
support, saving some memory.
|
||||||
|
|
||||||
|
config HAVE_PCSPKR_PLATFORM
|
||||||
|
bool
|
||||||
|
|
||||||
config BASE_FULL
|
config BASE_FULL
|
||||||
default y
|
default y
|
||||||
bool "Enable full-sized data structures for core" if EXPERT
|
bool "Enable full-sized data structures for core" if EXPERT
|
||||||
|
|
|
@ -10,14 +10,8 @@
|
||||||
#define __PCSP_H__
|
#define __PCSP_H__
|
||||||
|
|
||||||
#include <linux/hrtimer.h>
|
#include <linux/hrtimer.h>
|
||||||
|
#include <linux/i8253.h>
|
||||||
#include <linux/timex.h>
|
#include <linux/timex.h>
|
||||||
#if defined(CONFIG_MIPS) || defined(CONFIG_X86)
|
|
||||||
/* Use the global PIT lock ! */
|
|
||||||
#include <asm/i8253.h>
|
|
||||||
#else
|
|
||||||
#include <asm/8253pit.h>
|
|
||||||
static DEFINE_RAW_SPINLOCK(i8253_lock);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define PCSP_SOUND_VERSION 0x400 /* read 4.00 */
|
#define PCSP_SOUND_VERSION 0x400 /* read 4.00 */
|
||||||
#define PCSP_DEBUG 0
|
#define PCSP_DEBUG 0
|
||||||
|
|
Загрузка…
Ссылка в новой задаче