vserver 1.9.3
[linux-2.6.git] / arch / arm / mach-s3c2410 / s3c2410.c
index bfd843c..7709e8d 100644 (file)
@@ -1,6 +1,6 @@
 /* linux/arch/arm/mach-s3c2410/s3c2410.c
  *
- * Copyright (c) 2003 Simtec Electronics
+ * Copyright (c) 2003,2004 Simtec Electronics
  * Ben Dooks <ben@simtec.co.uk>
  *
  * http://www.simtec.co.uk/products/EB2410ITX/
@@ -13,7 +13,8 @@
  *     16-May-2003 BJD  Created initial version
  *     16-Aug-2003 BJD  Fixed header files and copyright, added URL
  *     05-Sep-2003 BJD  Moved to kernel v2.6
- *     18-Jan-2003 BJD  Added serial port configuration
+ *     18-Jan-2004 BJD  Added serial port configuration
+ *     21-Aug-2004 BJD  Added new struct s3c2410_board handler
 */
 
 #include <linux/kernel.h>
@@ -35,6 +36,9 @@
 #include <asm/arch/regs-clock.h>
 #include <asm/arch/regs-serial.h>
 
+#include "s3c2410.h"
+#include "cpu.h"
+
 int s3c2410_clock_tick_rate = 12*1000*1000;  /* current timers at 12MHz */
 
 /* serial port setup */
@@ -47,33 +51,14 @@ unsigned long s3c2410_fclk;
 unsigned long s3c2410_hclk;
 unsigned long s3c2410_pclk;
 
-#ifndef MHZ
-#define MHZ (1000*1000)
-#endif
-
-#define print_mhz(m) ((m) / MHZ), ((m / 1000) % 1000)
-
-#define IODESC_ENT(x) { S3C2410_VA_##x, S3C2410_PA_##x, S3C2410_SZ_##x, MT_DEVICE }
-
 static struct map_desc s3c2410_iodesc[] __initdata = {
-  IODESC_ENT(IRQ),
-  IODESC_ENT(MEMCTRL),
-  IODESC_ENT(USBHOST),
-  IODESC_ENT(DMA),
-  IODESC_ENT(CLKPWR),
-  IODESC_ENT(LCD),
-  IODESC_ENT(NAND),
-  IODESC_ENT(UART),
-  IODESC_ENT(TIMER),
-  IODESC_ENT(USBDEV),
-  IODESC_ENT(WATCHDOG),
-  IODESC_ENT(IIC),
-  IODESC_ENT(IIS),
-  IODESC_ENT(GPIO),
-  IODESC_ENT(RTC),
-  IODESC_ENT(ADC),
-  IODESC_ENT(SPI),
-  IODESC_ENT(SDI)
+       IODESC_ENT(USBHOST),
+       IODESC_ENT(CLKPWR),
+       IODESC_ENT(LCD),
+       IODESC_ENT(UART),
+       IODESC_ENT(TIMER),
+       IODESC_ENT(ADC),
+       IODESC_ENT(WATCHDOG)
 };
 
 static struct resource s3c_uart0_resource[] = {
@@ -146,14 +131,16 @@ static struct platform_device *uart_devices[] __initdata = {
        &s3c_uart2
 };
 
-void __init s3c2410_map_io(struct map_desc *mach_desc, int size)
+void __init s3c2410_map_io(struct map_desc *mach_desc, int mach_size)
 {
        unsigned long tmp;
 
        /* register our io-tables */
 
        iotable_init(s3c2410_iodesc, ARRAY_SIZE(s3c2410_iodesc));
-       iotable_init(mach_desc, size);
+       iotable_init(mach_desc, mach_size);
+
+       printk("machine_initted %p,%d\n", mach_desc, mach_size);
 
        /* now we've got our machine bits initialised, work out what
         * clocks we've got */
@@ -175,16 +162,41 @@ void __init s3c2410_map_io(struct map_desc *mach_desc, int size)
               print_mhz(s3c2410_pclk));
 }
 
+static struct s3c2410_board *board;
+
+void s3c2410_set_board(struct s3c2410_board *b)
+{
+       board = b;
+}
+
+void s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
+{
+       s3c2410_uartcfgs = cfg;
+}
 
-static int __init s3c2410_init(void)
+int __init s3c2410_init(void)
 {
        int ret;
 
        printk("S3C2410: Initialising architecture\n");
 
        ret = platform_add_devices(uart_devices, ARRAY_SIZE(uart_devices));
+       if (ret)
+               return ret;
+
+       if (board != NULL) {
+               if (board->devices != NULL) {
+                       ret = platform_add_devices(board->devices,
+                                                  board->devices_count);
+
+                       if (ret) {
+                               printk(KERN_ERR "s3c2410: failed to add board devices (%d)\n", ret);
+                       }
+               }
+
+               /* not adding board devices may not be fatal */
+               ret = 0;
+       }
 
        return ret;
 }
-
-arch_initcall(s3c2410_init);