patch-2.2.0-pre7 linux/arch/alpha/kernel/time.c
Next file: linux/arch/i386/kernel/ioport.c
Previous file: linux/arch/alpha/kernel/sys_rx164.c
Back to the patch index
Back to the overall index
- Lines: 120
- Date:
Sat Jan 9 19:08:27 1999
- Orig file:
v2.2.0-pre6/linux/arch/alpha/kernel/time.c
- Orig date:
Mon Dec 28 15:00:52 1998
diff -u --recursive --new-file v2.2.0-pre6/linux/arch/alpha/kernel/time.c linux/arch/alpha/kernel/time.c
@@ -158,43 +158,28 @@
* drivers depend on them being initialized (e.g., joystick driver).
*/
-/* It is (normally) only counter 0 that presents config problems, so
- provide this support function to do the rest of the job. */
-
-void inline
-init_pit_rest(void)
-{
-#if 0
- /* Leave refresh timer alone---nobody should depend on a
- particular value anyway. */
- outb(0x54, 0x43); /* counter 1: refresh timer */
- outb(0x18, 0x41);
-#endif
-
- outb(0xb6, 0x43); /* counter 2: speaker */
- outb(0x31, 0x42);
- outb(0x13, 0x42);
-}
-
#ifdef CONFIG_RTC
-static inline void
+void
rtc_init_pit (void)
{
unsigned char control;
- /* Setup interval timer if /dev/rtc is being used */
+ /* Turn off RTC interrupts before /dev/rtc is initialized */
+ control = CMOS_READ(RTC_CONTROL);
+ control &= ~(RTC_PIE | RTC_AIE | RTC_UIE);
+ CMOS_WRITE(control, RTC_CONTROL);
+ (void) CMOS_READ(RTC_INTR_FLAGS);
+
+ request_region(0x40, 0x20, "timer"); /* reserve pit */
+
+ /* Setup interval timer. */
outb(0x34, 0x43); /* binary, mode 2, LSB/MSB, ch 0 */
outb(LATCH & 0xff, 0x40); /* LSB */
outb(LATCH >> 8, 0x40); /* MSB */
- request_region(0x40, 0x20, "timer"); /* reserve pit */
- /* Turn off RTC interrupts before /dev/rtc is initialized */
- control = CMOS_READ(RTC_CONTROL);
- control &= ~(RTC_PIE | RTC_AIE | RTC_UIE);
- CMOS_WRITE(control, RTC_CONTROL);
- CMOS_READ(RTC_INTR_FLAGS);
-
- init_pit_rest();
+ outb(0xb6, 0x43); /* pit counter 2: speaker */
+ outb(0x31, 0x42);
+ outb(0x13, 0x42);
}
#endif
@@ -203,7 +188,7 @@
{
unsigned char x;
- /* Reset periodic interrupt frequency. */
+ /* Reset periodic interrupt frequency. */
x = CMOS_READ(RTC_FREQ_SELECT) & 0x3f;
if (x != 0x26 && x != 0x19 && x != 0x06) {
printk("Setting RTC_FREQ to 1024 Hz (%x)\n", x);
@@ -218,36 +203,26 @@
x &= ~(RTC_AIE | RTC_UIE);
CMOS_WRITE(x, RTC_CONTROL);
}
- CMOS_READ(RTC_INTR_FLAGS);
+ (void) CMOS_READ(RTC_INTR_FLAGS);
request_region(RTC_PORT(0), 0x10, "timer"); /* reserve rtc */
- /* Turn off the PIT. */
- outb(0x36, 0x43); /* counter 0: system timer */
+ outb(0x36, 0x43); /* pit counter 0: system timer */
outb(0x00, 0x40);
outb(0x00, 0x40);
- init_pit_rest();
+ outb(0xb6, 0x43); /* pit counter 2: speaker */
+ outb(0x31, 0x42);
+ outb(0x13, 0x42);
}
-/* This probably isn't Right, but it is what the old code did. */
-#if defined(CONFIG_RTC)
-# define init_pit rtc_init_pit
-#else
-# define init_pit alpha_mv.init_pit
-#endif
-
-
void
time_init(void)
{
- void (*irq_handler)(int, void *, struct pt_regs *);
+ void (*irq_handler)(int, void *, struct pt_regs *);
unsigned int year, mon, day, hour, min, sec, cc1, cc2;
unsigned long cycle_freq;
- /* Initialize the timers. */
- init_pit();
-
/*
* The Linux interpretation of the CMOS clock register contents:
* When the Update-In-Progress (UIP) flag goes from 1 to 0, the
@@ -322,8 +297,8 @@
state.partial_tick = 0L;
/* setup timer */
- irq_handler = timer_interrupt;
- if (request_irq(TIMER_IRQ, irq_handler, 0, "timer", NULL))
+ irq_handler = timer_interrupt;
+ if (request_irq(TIMER_IRQ, irq_handler, 0, "timer", NULL))
panic("Could not allocate timer IRQ!");
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov