Pull percpu-dtc into release branch
[pandora-kernel.git] / arch / arm / mach-pxa / tosa.c
index 76c0e7f..7273877 100644 (file)
 #include <linux/fs.h>
 #include <linux/interrupt.h>
 #include <linux/mmc/host.h>
+#include <linux/pm.h>
+#include <linux/delay.h>
 
 #include <asm/setup.h>
 #include <asm/memory.h>
 #include <asm/mach-types.h>
 #include <asm/hardware.h>
 #include <asm/irq.h>
+#include <asm/system.h>
+#include <asm/arch/pxa-regs.h>
 #include <asm/arch/irda.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/udc.h>
@@ -32,8 +36,6 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include <asm/mach/irq.h>
-
-#include <asm/arch/pxa-regs.h>
 #include <asm/arch/tosa.h>
 
 #include <asm/hardware/scoop.h>
@@ -171,7 +173,7 @@ static struct pxa2xx_udc_mach_info udc_info __initdata = {
  */
 static struct pxamci_platform_data tosa_mci_platform_data;
 
-static int tosa_mci_init(struct device *dev, irqreturn_t (*tosa_detect_int)(int, void *, struct pt_regs *), void *data)
+static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void *data)
 {
        int err;
 
@@ -182,7 +184,7 @@ static int tosa_mci_init(struct device *dev, irqreturn_t (*tosa_detect_int)(int,
 
        tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250);
 
-       err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, SA_INTERRUPT,
+       err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, IRQF_DISABLED,
                                "MMC/SD card detect", data);
        if (err) {
                printk(KERN_ERR "tosa_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
@@ -266,8 +268,31 @@ static struct platform_device *devices[] __initdata = {
        &tosaled_device,
 };
 
+static void tosa_poweroff(void)
+{
+       RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR;
+
+       pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_OUT);
+       GPSR(TOSA_GPIO_ON_RESET) = GPIO_bit(TOSA_GPIO_ON_RESET);
+
+       mdelay(1000);
+       arm_machine_restart('h');
+}
+
+static void tosa_restart(char mode)
+{
+       /* Bootloader magic for a reboot */
+       if((MSC0 & 0xffff0000) == 0x7ff00000)
+               MSC0 = (MSC0 & 0xffff) | 0x7ee00000;
+
+       tosa_poweroff();
+}
+
 static void __init tosa_init(void)
 {
+       pm_power_off = tosa_poweroff;
+       arm_pm_restart = tosa_restart;
+
        pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN);
        pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN);
        pxa_gpio_mode(TOSA_GPIO_USB_IN | GPIO_IN);