sh: convert processor device setup functions to arch_initcall()
[safe/jmp/linux-2.6] / arch / sh / kernel / cpu / sh4a / setup-sh7366.c
index 2f0905a..1a956b1 100644 (file)
@@ -14,6 +14,8 @@
 #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[] = {
@@ -37,18 +39,20 @@ static struct platform_device iic_device = {
        .resource       = iic_resources,
 };
 
+static struct r8a66597_platdata r8a66597_data = {
+       /* This set zero to all members */
+};
+
 static struct resource usb_host_resources[] = {
        [0] = {
-               .name   = "r8a66597_hcd",
                .start  = 0xa4d80000,
                .end    = 0xa4d800ff,
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
-               .name   = "r8a66597_hcd",
                .start  = 65,
                .end    = 65,
-               .flags  = IORESOURCE_IRQ,
+               .flags  = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
        },
 };
 
@@ -58,6 +62,7 @@ static struct platform_device usb_host_device = {
        .dev = {
                .dma_mask               = NULL,
                .coherent_dma_mask      = 0xffffffff,
+               .platform_data          = &r8a66597_data,
        },
        .num_resources  = ARRAY_SIZE(usb_host_resources),
        .resource       = usb_host_resources,
@@ -147,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,
        }
@@ -167,6 +297,10 @@ 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,
@@ -177,19 +311,6 @@ static struct platform_device *sh7366_devices[] __initdata = {
 
 static int __init sh7366_devices_setup(void)
 {
-       clk_always_enable("mstp031"); /* TLB */
-       clk_always_enable("mstp030"); /* IC */
-       clk_always_enable("mstp029"); /* OC */
-       clk_always_enable("mstp028"); /* RSMEM */
-       clk_always_enable("mstp026"); /* XYMEM */
-       clk_always_enable("mstp023"); /* INTC3 */
-       clk_always_enable("mstp022"); /* INTC */
-       clk_always_enable("mstp020"); /* SuperHyway */
-       clk_always_enable("mstp211"); /* USB */
-       clk_always_enable("mstp207"); /* VEU-2 */
-       clk_always_enable("mstp202"); /* VEU-1 */
-       clk_always_enable("mstp201"); /* VPU */
-
        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);
@@ -197,7 +318,20 @@ static int __init sh7366_devices_setup(void)
        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,