fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / sh / boards / mpc1211 / setup.c
index 2bb581b..7c3d1d3 100644 (file)
@@ -1,24 +1,21 @@
 /*
- * linux/arch/sh/board/mpc1211/setup.c
+ * linux/arch/sh/boards/mpc1211/setup.c
  *
  * Copyright (C) 2002  Saito.K & Jeanne,  Fujii.Y
  *
  */
 
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/hdreg.h>
 #include <linux/ide.h>
 #include <linux/interrupt.h>
-
 #include <asm/io.h>
 #include <asm/machvec.h>
 #include <asm/mpc1211/mpc1211.h>
 #include <asm/mpc1211/pci.h>
 #include <asm/mpc1211/m1543c.h>
 
-
 /* ALI15X3 SMBus address offsets */
 #define SMBHSTSTS   (0 + 0x3100)
 #define SMBHSTCNT   (1 + 0x3100)
 #define ALI15X3_STS_TERM       0x80    /* terminated by abort */
 #define ALI15X3_STS_ERR                0xE0    /* all the bad error bits */
 
-const char *get_system_type(void)
-{
-       return "Interface MPC-1211(CTP/PCI/MPC-SH02)";
-}
-
 static void __init pci_write_config(unsigned long busNo,
                                    unsigned long devNo,
                                    unsigned long fncNo,
@@ -77,13 +69,9 @@ static void __init pci_write_config(unsigned long busNo,
 
 static unsigned char m_irq_mask = 0xfb;
 static unsigned char s_irq_mask = 0xff;
-volatile unsigned long irq_err_count;
 
 static void disable_mpc1211_irq(unsigned int irq)
 {
-       unsigned long flags;
-
-       save_and_cli(flags);
        if( irq < 8) {
                m_irq_mask |= (1 << irq);
                outb(m_irq_mask,I8259_M_MR);
@@ -91,16 +79,11 @@ static void disable_mpc1211_irq(unsigned int irq)
                s_irq_mask |= (1 << (irq - 8));
                outb(s_irq_mask,I8259_S_MR);
        }
-       restore_flags(flags);
 
 }
 
 static void enable_mpc1211_irq(unsigned int irq)
 {
-       unsigned long flags;
-
-       save_and_cli(flags);
-
        if( irq < 8) {
                m_irq_mask &= ~(1 << irq);
                outb(m_irq_mask,I8259_M_MR);
@@ -108,7 +91,6 @@ static void enable_mpc1211_irq(unsigned int irq)
                s_irq_mask &= ~(1 << (irq - 8));
                outb(s_irq_mask,I8259_S_MR);
        }
-       restore_flags(flags);
 }
 
 static inline int mpc1211_irq_real(unsigned int irq)
@@ -132,14 +114,10 @@ static inline int mpc1211_irq_real(unsigned int irq)
 
 static void mask_and_ack_mpc1211(unsigned int irq)
 {
-       unsigned long flags;
-
-       save_and_cli(flags);
-
        if(irq < 8) {
                if(m_irq_mask & (1<<irq)){
                  if(!mpc1211_irq_real(irq)){
-                   irq_err_count++;
+                   atomic_inc(&irq_err_count)
                    printk("spurious 8259A interrupt: IRQ %x\n",irq);
                   }
                } else {
@@ -152,7 +130,7 @@ static void mask_and_ack_mpc1211(unsigned int irq)
        } else {
                if(s_irq_mask & (1<<(irq - 8))){
                  if(!mpc1211_irq_real(irq)){
-                   irq_err_count++;
+                   atomic_inc(&irq_err_count);
                    printk("spurious 8259A interrupt: IRQ %x\n",irq);
                  }
                } else {
@@ -163,7 +141,6 @@ static void mask_and_ack_mpc1211(unsigned int irq)
                outb(0x60+(irq-8),I8259_S_CR);  /* EOI */
                outb(0x60+2,I8259_M_CR);
        }
-       restore_flags(flags);
 }
 
 static void end_mpc1211_irq(unsigned int irq)
@@ -194,7 +171,7 @@ static struct hw_interrupt_type mpc1211_irq_type = {
 
 static void make_mpc1211_irq(unsigned int irq)
 {
-       irq_desc[irq].handler = &mpc1211_irq_type;
+       irq_desc[irq].chip = &mpc1211_irq_type;
        irq_desc[irq].status  = IRQ_DISABLED;
        irq_desc[irq].action  = 0;
        irq_desc[irq].depth   = 1;
@@ -220,7 +197,7 @@ int mpc1211_irq_demux(int irq)
        return irq;
 }
 
-void __init init_mpc1211_IRQ(void)
+static void __init init_mpc1211_IRQ(void)
 {
        int i;
        /*
@@ -256,23 +233,12 @@ void __init init_mpc1211_IRQ(void)
        }
 }
 
-/*
-  Initialize the board
-*/
-
-
-static void delay (void)
-{
-       volatile unsigned short tmp;
-       tmp = *(volatile unsigned short *) 0xa0000000;
-}
-
-static void delay1000 (void)
+static void delay1000(void)
 {
        int i;
 
        for (i=0; i<1000; i++)
-               delay ();
+               ctrl_delay();
 }
 
 static int put_smb_blk(unsigned char *p, int address, int command, int no)
@@ -315,26 +281,10 @@ static int put_smb_blk(unsigned char *p, int address, int command, int no)
        return 0;
 }
 
-/*
- * The Machine Vector
- */
-
-struct sh_machine_vector mv_mpc1211 __initmv = {
-       .mv_nr_irqs             = 48,
-       .mv_irq_demux           = mpc1211_irq_demux,
-       .mv_init_irq            = init_mpc1211_IRQ,
-
-#ifdef CONFIG_HEARTBEAT
-       .mv_heartbeat           = heartbeat_mpc1211,
-#endif
-};
-
-ALIAS_MV(mpc1211)
-
 /* arch/sh/boards/mpc1211/rtc.c */
 void mpc1211_time_init(void);
 
-int __init platform_setup(void)
+static void __init mpc1211_setup(char **cmdline_p)
 {
        unsigned char spd_buf[128];
 
@@ -358,3 +308,18 @@ int __init platform_setup(void)
        return 0;
 }
 
+/*
+ * The Machine Vector
+ */
+struct sh_machine_vector mv_mpc1211 __initmv = {
+       .mv_name                = "Interface MPC-1211(CTP/PCI/MPC-SH02)",
+       .mv_setup               = mpc1211_setup,
+       .mv_nr_irqs             = 48,
+       .mv_irq_demux           = mpc1211_irq_demux,
+       .mv_init_irq            = init_mpc1211_IRQ,
+
+#ifdef CONFIG_HEARTBEAT
+       .mv_heartbeat           = heartbeat_mpc1211,
+#endif
+};
+ALIAS_MV(mpc1211)