sh: allow building for both r2d boards in same binary.
[sfrench/cifs-2.6.git] / arch / i386 / kernel / i8253.c
index f8a3c4054c702d592f4049d98f9791d4d938af0c..6d839f2f1b1a6e1abca311760ac89f6a6deec6af 100644 (file)
@@ -3,18 +3,17 @@
  *
  */
 #include <linux/clockchips.h>
-#include <linux/spinlock.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
 #include <linux/jiffies.h>
-#include <linux/sysdev.h>
 #include <linux/module.h>
-#include <linux/init.h>
+#include <linux/spinlock.h>
 
 #include <asm/smp.h>
 #include <asm/delay.h>
 #include <asm/i8253.h>
 #include <asm/io.h>
-
-#include "io_ports.h"
+#include <asm/timer.h>
 
 DEFINE_SPINLOCK(i8253_lock);
 EXPORT_SYMBOL(i8253_lock);
@@ -41,26 +40,27 @@ static void init_pit_timer(enum clock_event_mode mode,
        case CLOCK_EVT_MODE_PERIODIC:
                /* binary, mode 2, LSB/MSB, ch 0 */
                outb_p(0x34, PIT_MODE);
-               udelay(10);
                outb_p(LATCH & 0xff , PIT_CH0); /* LSB */
-               udelay(10);
                outb(LATCH >> 8 , PIT_CH0);     /* MSB */
                break;
 
-       /*
-        * Avoid unnecessary state transitions, as it confuses
-        * Geode / Cyrix based boxen.
-        */
        case CLOCK_EVT_MODE_SHUTDOWN:
-               if (evt->mode == CLOCK_EVT_MODE_UNUSED)
-                       break;
        case CLOCK_EVT_MODE_UNUSED:
-               if (evt->mode == CLOCK_EVT_MODE_SHUTDOWN)
-                       break;
+               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);
-               udelay(10);
+               break;
+
+       case CLOCK_EVT_MODE_RESUME:
+               /* Nothing to do here */
                break;
        }
        spin_unlock_irqrestore(&i8253_lock, flags);