From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932213AbVHKCSX (ORCPT ); Wed, 10 Aug 2005 22:18:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932214AbVHKCSX (ORCPT ); Wed, 10 Aug 2005 22:18:23 -0400 Received: from e35.co.us.ibm.com ([32.97.110.133]:15291 "EHLO e35.co.us.ibm.com") by vger.kernel.org with ESMTP id S932213AbVHKCSW (ORCPT ); Wed, 10 Aug 2005 22:18:22 -0400 Subject: [PATCH 3/9] Generic timekeeping i386 arch specific changes, part 1 From: john stultz To: lkml Cc: George Anzinger , frank@tuxrocks.com, Anton Blanchard , benh@kernel.crashing.org, Nishanth Aravamudan , Roman Zippel , Ulrich Windl In-Reply-To: <1123726619.32531.38.camel@cog.beaverton.ibm.com> References: <1123723279.30963.267.camel@cog.beaverton.ibm.com> <1123726394.32531.33.camel@cog.beaverton.ibm.com> <1123726463.32531.35.camel@cog.beaverton.ibm.com> <1123726619.32531.38.camel@cog.beaverton.ibm.com> Content-Type: text/plain Date: Wed, 10 Aug 2005 19:18:18 -0700 Message-Id: <1123726698.32531.41.camel@cog.beaverton.ibm.com> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-4) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org All, The conversion of i386 to use the generic timekeeping subsystem has been split into 6 parts. This patch, the first of six, is just a simple cleanup for the i386 arch in preperation of moving the the generic timekeeping infrastructure. It simply moves some code from timer_pit.c to i8259.c. It applies on top of my timeofday-core patch. This patch is part the timeofday-arch-i386 patchset, so without the following parts it is not expected to compile (although just this one should). thanks -john linux-2.6.13-rc6_timeofday-arch-i386-part1_B5.patch ============================================ diff --git a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c --- a/arch/i386/kernel/i8259.c +++ b/arch/i386/kernel/i8259.c @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -399,6 +400,45 @@ void __init init_ISA_irqs (void) } } +void setup_pit_timer(void) +{ + 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_pit"), + .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; diff --git a/arch/i386/kernel/timers/timer_pit.c b/arch/i386/kernel/timers/timer_pit.c --- a/arch/i386/kernel/timers/timer_pit.c +++ b/arch/i386/kernel/timers/timer_pit.c @@ -162,43 +162,3 @@ struct init_timer_opts __initdata timer_ .init = init_pit, .opts = &timer_pit, }; - -void setup_pit_timer(void) -{ - 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_pit"), - .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); -