]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - arch/mips/alchemy/mtx-1/board_setup.c
MIPS: Alchemy: get rid of common/reset.c
[mv-sheeva.git] / arch / mips / alchemy / mtx-1 / board_setup.c
index 45b61c9b82b9a8672d658df5fd2d9be842ccc578..e2838c6185d33ab835c74ac3f802b1af426571c7 100644 (file)
 
 #include <linux/gpio.h>
 #include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/pm.h>
 
+#include <asm/reboot.h>
 #include <asm/mach-au1x00/au1000.h>
 
 #include <prom.h>
 
+char irq_tab_alchemy[][5] __initdata = {
+       [0] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTA, 0xff, 0xff }, /* IDSEL 00 - AdapterA-Slot0 (top) */
+       [1] = { -1, AU1500_PCI_INTB, AU1500_PCI_INTA, 0xff, 0xff }, /* IDSEL 01 - AdapterA-Slot1 (bottom) */
+       [2] = { -1, AU1500_PCI_INTC, AU1500_PCI_INTD, 0xff, 0xff }, /* IDSEL 02 - AdapterB-Slot0 (top) */
+       [3] = { -1, AU1500_PCI_INTD, AU1500_PCI_INTC, 0xff, 0xff }, /* IDSEL 03 - AdapterB-Slot1 (bottom) */
+       [4] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff }, /* IDSEL 04 - AdapterC-Slot0 (top) */
+       [5] = { -1, AU1500_PCI_INTB, AU1500_PCI_INTA, 0xff, 0xff }, /* IDSEL 05 - AdapterC-Slot1 (bottom) */
+       [6] = { -1, AU1500_PCI_INTC, AU1500_PCI_INTD, 0xff, 0xff }, /* IDSEL 06 - AdapterD-Slot0 (top) */
+       [7] = { -1, AU1500_PCI_INTD, AU1500_PCI_INTC, 0xff, 0xff }, /* IDSEL 07 - AdapterD-Slot1 (bottom) */
+};
+
 extern int (*board_pci_idsel)(unsigned int devsel, int assert);
 int mtx1_pci_idsel(unsigned int devsel, int assert);
 
-void board_reset(void)
+static void mtx1_reset(char *c)
 {
        /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
        au_writel(0x00000000, 0xAE00001C);
 }
 
+static void mtx1_power_off(void)
+{
+       printk(KERN_ALERT "It's now safe to remove power\n");
+       while (1)
+               asm volatile (".set mips3 ; wait ; .set mips1");
+}
+
 void __init board_setup(void)
 {
 #ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -86,6 +107,10 @@ void __init board_setup(void)
        alchemy_gpio_direction_output(211, 1);  /* green on */
        alchemy_gpio_direction_output(212, 0);  /* red off */
 
+       pm_power_off = mtx1_power_off;
+       _machine_halt = mtx1_power_off;
+       _machine_restart = mtx1_reset;
+
        printk(KERN_INFO "4G Systems MTX-1 Board\n");
 }
 
@@ -109,3 +134,15 @@ mtx1_pci_idsel(unsigned int devsel, int assert)
        au_sync_udelay(1);
        return 1;
 }
+
+static int __init mtx1_init_irq(void)
+{
+       set_irq_type(AU1500_GPIO204_INT, IRQF_TRIGGER_HIGH);
+       set_irq_type(AU1500_GPIO201_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO202_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO203_INT, IRQF_TRIGGER_LOW);
+       set_irq_type(AU1500_GPIO205_INT, IRQF_TRIGGER_LOW);
+
+       return 0;
+}
+arch_initcall(mtx1_init_irq);