]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/arm/mach-pxa/tosa.c
[ARM] 3666/1: TRIZEPS4 [1/5] core
[linux-2.6-omap-h63xx.git] / arch / arm / mach-pxa / tosa.c
index e4f92efc616e58e038b4c649ef911163692b1169..7152bc13680fc14ec43072edf1883d1e4b6853e0 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/irda.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/udc.h>
@@ -34,7 +37,6 @@
 #include <asm/mach/irq.h>
 
 #include <asm/arch/pxa-regs.h>
-#include <asm/arch/irq.h>
 #include <asm/arch/tosa.h>
 
 #include <asm/hardware/scoop.h>
@@ -252,14 +254,46 @@ static struct platform_device tosakbd_device = {
        .id             = -1,
 };
 
+/*
+ * Tosa LEDs
+ */
+static struct platform_device tosaled_device = {
+    .name   = "tosa-led",
+    .id     = -1,
+};
+
 static struct platform_device *devices[] __initdata = {
        &tosascoop_device,
        &tosascoop_jc_device,
        &tosakbd_device,
+       &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);
@@ -295,7 +329,6 @@ static void __init fixup_tosa(struct machine_desc *desc,
 }
 
 MACHINE_START(TOSA, "SHARP Tosa")
-       .phys_ram       = 0xa0000000,
        .phys_io        = 0x40000000,
        .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
        .fixup          = fixup_tosa,