Merge tag 'v3.14.25' into backport/v3.14.24-ltsi-rc1+v3.14.25/snapshot-merge.wip
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / sh / kernel / cpu / sh3 / setup-sh7720.c
index 1d5729d..84df85a 100644 (file)
@@ -152,163 +152,38 @@ static struct platform_device usbf_device = {
        .resource       = usbf_resources,
 };
 
-static struct sh_timer_config cmt0_platform_data = {
-       .channel_offset = 0x10,
-       .timer_bit = 0,
-       .clockevent_rating = 125,
-       .clocksource_rating = 125,
+static struct sh_timer_config cmt_platform_data = {
+       .channels_mask = 0x1f,
 };
 
-static struct resource cmt0_resources[] = {
-       [0] = {
-               .start  = 0x044a0010,
-               .end    = 0x044a001b,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = evt2irq(0xf00),
-               .flags  = IORESOURCE_IRQ,
-       },
+static struct resource cmt_resources[] = {
+       DEFINE_RES_MEM(0x044a0000, 0x60),
+       DEFINE_RES_IRQ(evt2irq(0xf00)),
 };
 
-static struct platform_device cmt0_device = {
-       .name           = "sh_cmt",
+static struct platform_device cmt_device = {
+       .name           = "sh-cmt-32",
        .id             = 0,
        .dev = {
-               .platform_data  = &cmt0_platform_data,
-       },
-       .resource       = cmt0_resources,
-       .num_resources  = ARRAY_SIZE(cmt0_resources),
-};
-
-static struct sh_timer_config cmt1_platform_data = {
-       .channel_offset = 0x20,
-       .timer_bit = 1,
-};
-
-static struct resource cmt1_resources[] = {
-       [0] = {
-               .start  = 0x044a0020,
-               .end    = 0x044a002b,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = evt2irq(0xf00),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device cmt1_device = {
-       .name           = "sh_cmt",
-       .id             = 1,
-       .dev = {
-               .platform_data  = &cmt1_platform_data,
-       },
-       .resource       = cmt1_resources,
-       .num_resources  = ARRAY_SIZE(cmt1_resources),
-};
-
-static struct sh_timer_config cmt2_platform_data = {
-       .channel_offset = 0x30,
-       .timer_bit = 2,
-};
-
-static struct resource cmt2_resources[] = {
-       [0] = {
-               .start  = 0x044a0030,
-               .end    = 0x044a003b,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = evt2irq(0xf00),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device cmt2_device = {
-       .name           = "sh_cmt",
-       .id             = 2,
-       .dev = {
-               .platform_data  = &cmt2_platform_data,
-       },
-       .resource       = cmt2_resources,
-       .num_resources  = ARRAY_SIZE(cmt2_resources),
-};
-
-static struct sh_timer_config cmt3_platform_data = {
-       .channel_offset = 0x40,
-       .timer_bit = 3,
-};
-
-static struct resource cmt3_resources[] = {
-       [0] = {
-               .start  = 0x044a0040,
-               .end    = 0x044a004b,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = evt2irq(0xf00),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device cmt3_device = {
-       .name           = "sh_cmt",
-       .id             = 3,
-       .dev = {
-               .platform_data  = &cmt3_platform_data,
+               .platform_data  = &cmt_platform_data,
        },
-       .resource       = cmt3_resources,
-       .num_resources  = ARRAY_SIZE(cmt3_resources),
-};
-
-static struct sh_timer_config cmt4_platform_data = {
-       .channel_offset = 0x50,
-       .timer_bit = 4,
-};
-
-static struct resource cmt4_resources[] = {
-       [0] = {
-               .start  = 0x044a0050,
-               .end    = 0x044a005b,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = evt2irq(0xf00),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device cmt4_device = {
-       .name           = "sh_cmt",
-       .id             = 4,
-       .dev = {
-               .platform_data  = &cmt4_platform_data,
-       },
-       .resource       = cmt4_resources,
-       .num_resources  = ARRAY_SIZE(cmt4_resources),
+       .resource       = cmt_resources,
+       .num_resources  = ARRAY_SIZE(cmt_resources),
 };
 
 static struct sh_timer_config tmu0_platform_data = {
-       .channel_offset = 0x02,
-       .timer_bit = 0,
-       .clockevent_rating = 200,
+       .channels_mask = 7,
 };
 
 static struct resource tmu0_resources[] = {
-       [0] = {
-               .start  = 0xa412fe94,
-               .end    = 0xa412fe9f,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = evt2irq(0x400),
-               .flags  = IORESOURCE_IRQ,
-       },
+       DEFINE_RES_MEM(0xa412fe90, 0x28),
+       DEFINE_RES_IRQ(evt2irq(0x400)),
+       DEFINE_RES_IRQ(evt2irq(0x420)),
+       DEFINE_RES_IRQ(evt2irq(0x440)),
 };
 
 static struct platform_device tmu0_device = {
-       .name           = "sh_tmu",
+       .name           = "sh-tmu-sh3",
        .id             = 0,
        .dev = {
                .platform_data  = &tmu0_platform_data,
@@ -317,72 +192,11 @@ static struct platform_device tmu0_device = {
        .num_resources  = ARRAY_SIZE(tmu0_resources),
 };
 
-static struct sh_timer_config tmu1_platform_data = {
-       .channel_offset = 0xe,
-       .timer_bit = 1,
-       .clocksource_rating = 200,
-};
-
-static struct resource tmu1_resources[] = {
-       [0] = {
-               .start  = 0xa412fea0,
-               .end    = 0xa412feab,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = evt2irq(0x420),
-               .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 = {
-       .channel_offset = 0x1a,
-       .timer_bit = 2,
-};
-
-static struct resource tmu2_resources[] = {
-       [0] = {
-               .start  = 0xa412feac,
-               .end    = 0xa412feb5,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = evt2irq(0x440),
-               .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 platform_device *sh7720_devices[] __initdata = {
        &scif0_device,
        &scif1_device,
-       &cmt0_device,
-       &cmt1_device,
-       &cmt2_device,
-       &cmt3_device,
-       &cmt4_device,
+       &cmt_device,
        &tmu0_device,
-       &tmu1_device,
-       &tmu2_device,
        &rtc_device,
        &usb_ohci_device,
        &usbf_device,
@@ -398,14 +212,8 @@ arch_initcall(sh7720_devices_setup);
 static struct platform_device *sh7720_early_devices[] __initdata = {
        &scif0_device,
        &scif1_device,
-       &cmt0_device,
-       &cmt1_device,
-       &cmt2_device,
-       &cmt3_device,
-       &cmt4_device,
+       &cmt_device,
        &tmu0_device,
-       &tmu1_device,
-       &tmu2_device,
 };
 
 void __init plat_early_device_setup(void)