[ARM] S3C24XX: Move files out of include/asm-arm/plat-s3c*
[safe/jmp/linux-2.6] / arch / arm / plat-s3c24xx / cpu.c
index 3e314a2..abddadd 100644 (file)
 #include <linux/ioport.h>
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
+#include <linux/delay.h>
 
-#include <asm/hardware.h>
+#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/io.h>
 #include <asm/delay.h>
+#include <asm/cacheflush.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
-#include <asm/arch/regs-gpio.h>
-#include <asm/arch/regs-serial.h>
+#include <mach/system-reset.h>
 
-#include <asm/plat-s3c24xx/cpu.h>
-#include <asm/plat-s3c24xx/devs.h>
+#include <mach/regs-gpio.h>
+#include <plat/regs-serial.h>
+
+#include <plat/cpu.h>
+#include <plat/devs.h>
 #include <asm/plat-s3c24xx/clock.h>
-#include <asm/plat-s3c24xx/s3c2400.h>
-#include <asm/plat-s3c24xx/s3c2410.h>
+#include <plat/s3c2400.h>
+#include <plat/s3c2410.h>
 #include <asm/plat-s3c24xx/s3c2412.h>
 #include "s3c244x.h"
-#include <asm/plat-s3c24xx/s3c2440.h>
-#include <asm/plat-s3c24xx/s3c2442.h>
-#include <asm/plat-s3c24xx/s3c2443.h>
+#include <plat/s3c2440.h>
+#include <plat/s3c2442.h>
+#include <plat/s3c2443.h>
 
 struct cpu_table {
        unsigned long   idcode;
@@ -165,9 +169,7 @@ static struct map_desc s3c_iodesc[] __initdata = {
        IODESC_ENT(UART)
 };
 
-
-static struct cpu_table *
-s3c_lookup_cpu(unsigned long idcode)
+static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode)
 {
        struct cpu_table *tab;
        int count;
@@ -181,15 +183,6 @@ s3c_lookup_cpu(unsigned long idcode)
        return NULL;
 }
 
-/* board information */
-
-static struct s3c24xx_board *board;
-
-void s3c24xx_set_board(struct s3c24xx_board *b)
-{
-       board = b;
-}
-
 /* cpu information */
 
 static struct cpu_table *cpu;
@@ -212,6 +205,27 @@ static unsigned long s3c24xx_read_idcode_v4(void)
 #endif
 }
 
+/* Hook for arm_pm_restart to ensure we execute the reset code
+ * with the caches enabled. It seems at least the S3C2440 has a problem
+ * resetting if there is bus activity interrupted by the reset.
+ */
+static void s3c24xx_pm_restart(char mode)
+{
+       if (mode != 's') {
+               unsigned long flags;
+
+               local_irq_save(flags);
+               __cpuc_flush_kern_all();
+               __cpuc_flush_user_all();
+
+               arch_reset(mode);
+               local_irq_restore(flags);
+       }
+
+       /* fallback, or unhandled */
+       arm_machine_restart(mode);
+}
+
 void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
 {
        unsigned long idcode = 0x0;
@@ -239,6 +253,8 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
                panic("Unsupported S3C24XX CPU");
        }
 
+       arm_pm_restart = s3c24xx_pm_restart;
+
        (cpu->map_io)(mach_desc, size);
 }
 
@@ -333,26 +349,6 @@ static int __init s3c_arch_init(void)
                return ret;
 
        ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts);
-       if (ret != 0)
-               return ret;
-
-       if (board != NULL) {
-               struct platform_device **ptr = board->devices;
-               int i;
-
-               for (i = 0; i < board->devices_count; i++, ptr++) {
-                       ret = platform_device_register(*ptr);
-
-                       if (ret) {
-                               printk(KERN_ERR "s3c24xx: failed to add board device %s (%d) @%p\n", (*ptr)->name, ret, *ptr);
-                       }
-               }
-
-               /* mask any error, we may not need all these board
-                * devices */
-               ret = 0;
-       }
-
        return ret;
 }