sh: convert processor device setup functions to arch_initcall()
[safe/jmp/linux-2.6] / arch / sh / kernel / cpu / sh4a / setup-sh7366.c
index 2a0fbc3..1a956b1 100644 (file)
@@ -14,6 +14,9 @@
 #include <linux/serial.h>
 #include <linux/serial_sci.h>
 #include <linux/uio_driver.h>
+#include <linux/sh_timer.h>
+#include <linux/usb/r8a66597.h>
+#include <asm/clock.h>
 
 static struct resource iic_resources[] = {
        [0] = {
@@ -31,10 +34,40 @@ static struct resource iic_resources[] = {
 
 static struct platform_device iic_device = {
        .name           = "i2c-sh_mobile",
+       .id             = 0, /* "i2c0" clock */
        .num_resources  = ARRAY_SIZE(iic_resources),
        .resource       = iic_resources,
 };
 
+static struct r8a66597_platdata r8a66597_data = {
+       /* This set zero to all members */
+};
+
+static struct resource usb_host_resources[] = {
+       [0] = {
+               .start  = 0xa4d80000,
+               .end    = 0xa4d800ff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = 65,
+               .end    = 65,
+               .flags  = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
+       },
+};
+
+static struct platform_device usb_host_device = {
+       .name   = "r8a66597_hcd",
+       .id     = -1,
+       .dev = {
+               .dma_mask               = NULL,
+               .coherent_dma_mask      = 0xffffffff,
+               .platform_data          = &r8a66597_data,
+       },
+       .num_resources  = ARRAY_SIZE(usb_host_resources),
+       .resource       = usb_host_resources,
+};
+
 static struct uio_info vpu_platform_data = {
        .name = "VPU5",
        .version = "0",
@@ -48,6 +81,9 @@ static struct resource vpu_resources[] = {
                .end    = 0xfe902807,
                .flags  = IORESOURCE_MEM,
        },
+       [1] = {
+               /* place holder for contiguous memory */
+       },
 };
 
 static struct platform_device vpu_device = {
@@ -73,6 +109,9 @@ static struct resource veu0_resources[] = {
                .end    = 0xfe9200b7,
                .flags  = IORESOURCE_MEM,
        },
+       [1] = {
+               /* place holder for contiguous memory */
+       },
 };
 
 static struct platform_device veu0_device = {
@@ -98,6 +137,9 @@ static struct resource veu1_resources[] = {
                .end    = 0xfe9240b7,
                .flags  = IORESOURCE_MEM,
        },
+       [1] = {
+               /* place holder for contiguous memory */
+       },
 };
 
 static struct platform_device veu1_device = {
@@ -110,12 +152,137 @@ static struct platform_device veu1_device = {
        .num_resources  = ARRAY_SIZE(veu1_resources),
 };
 
+static struct sh_timer_config cmt_platform_data = {
+       .name = "CMT",
+       .channel_offset = 0x60,
+       .timer_bit = 5,
+       .clk = "cmt0",
+       .clockevent_rating = 125,
+       .clocksource_rating = 200,
+};
+
+static struct resource cmt_resources[] = {
+       [0] = {
+               .name   = "CMT",
+               .start  = 0x044a0060,
+               .end    = 0x044a006b,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = 104,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device cmt_device = {
+       .name           = "sh_cmt",
+       .id             = 0,
+       .dev = {
+               .platform_data  = &cmt_platform_data,
+       },
+       .resource       = cmt_resources,
+       .num_resources  = ARRAY_SIZE(cmt_resources),
+};
+
+static struct sh_timer_config tmu0_platform_data = {
+       .name = "TMU0",
+       .channel_offset = 0x04,
+       .timer_bit = 0,
+       .clk = "tmu0",
+       .clockevent_rating = 200,
+};
+
+static struct resource tmu0_resources[] = {
+       [0] = {
+               .name   = "TMU0",
+               .start  = 0xffd80008,
+               .end    = 0xffd80013,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = 16,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device tmu0_device = {
+       .name           = "sh_tmu",
+       .id             = 0,
+       .dev = {
+               .platform_data  = &tmu0_platform_data,
+       },
+       .resource       = tmu0_resources,
+       .num_resources  = ARRAY_SIZE(tmu0_resources),
+};
+
+static struct sh_timer_config tmu1_platform_data = {
+       .name = "TMU1",
+       .channel_offset = 0x10,
+       .timer_bit = 1,
+       .clk = "tmu0",
+       .clocksource_rating = 200,
+};
+
+static struct resource tmu1_resources[] = {
+       [0] = {
+               .name   = "TMU1",
+               .start  = 0xffd80014,
+               .end    = 0xffd8001f,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = 17,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device tmu1_device = {
+       .name           = "sh_tmu",
+       .id             = 1,
+       .dev = {
+               .platform_data  = &tmu1_platform_data,
+       },
+       .resource       = tmu1_resources,
+       .num_resources  = ARRAY_SIZE(tmu1_resources),
+};
+
+static struct sh_timer_config tmu2_platform_data = {
+       .name = "TMU2",
+       .channel_offset = 0x1c,
+       .timer_bit = 2,
+       .clk = "tmu0",
+};
+
+static struct resource tmu2_resources[] = {
+       [0] = {
+               .name   = "TMU2",
+               .start  = 0xffd80020,
+               .end    = 0xffd8002b,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = 18,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device tmu2_device = {
+       .name           = "sh_tmu",
+       .id             = 2,
+       .dev = {
+               .platform_data  = &tmu2_platform_data,
+       },
+       .resource       = tmu2_resources,
+       .num_resources  = ARRAY_SIZE(tmu2_resources),
+};
+
 static struct plat_sci_port sci_platform_data[] = {
        {
                .mapbase        = 0xffe00000,
                .flags          = UPF_BOOT_AUTOCONF,
                .type           = PORT_SCIF,
                .irqs           = { 80, 80, 80, 80 },
+               .clk            = "scif0",
        }, {
                .flags = 0,
        }
@@ -130,8 +297,13 @@ static struct platform_device sci_device = {
 };
 
 static struct platform_device *sh7366_devices[] __initdata = {
+       &cmt_device,
+       &tmu0_device,
+       &tmu1_device,
+       &tmu2_device,
        &iic_device,
        &sci_device,
+       &usb_host_device,
        &vpu_device,
        &veu0_device,
        &veu1_device,
@@ -139,10 +311,27 @@ static struct platform_device *sh7366_devices[] __initdata = {
 
 static int __init sh7366_devices_setup(void)
 {
+       platform_resource_setup_memory(&vpu_device, "vpu", 2 << 20);
+       platform_resource_setup_memory(&veu0_device, "veu0", 2 << 20);
+       platform_resource_setup_memory(&veu1_device, "veu1", 2 << 20);
+
        return platform_add_devices(sh7366_devices,
                                    ARRAY_SIZE(sh7366_devices));
 }
-__initcall(sh7366_devices_setup);
+arch_initcall(sh7366_devices_setup);
+
+static struct platform_device *sh7366_early_devices[] __initdata = {
+       &cmt_device,
+       &tmu0_device,
+       &tmu1_device,
+       &tmu2_device,
+};
+
+void __init plat_early_device_setup(void)
+{
+       early_platform_add_devices(sh7366_early_devices,
+                                  ARRAY_SIZE(sh7366_early_devices));
+}
 
 enum {
        UNUSED=0,