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 / arm / mach-shmobile / setup-sh7372.c
index 2730127..d646c8d 100644 (file)
 #include <linux/io.h>
 #include <linux/serial_sci.h>
 #include <linux/sh_dma.h>
-#include <linux/sh_intc.h>
 #include <linux/sh_timer.h>
 #include <linux/pm_domain.h>
 #include <linux/dma-mapping.h>
 #include <linux/platform_data/sh_ipmmu.h>
-#include <mach/dma-register.h>
-#include <mach/irqs.h>
-#include <mach/sh7372.h>
-#include <mach/common.h>
+
 #include <asm/mach/map.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 
+#include "common.h"
+#include "dma-register.h"
+#include "intc.h"
+#include "irqs.h"
+#include "pm-rmobile.h"
+#include "sh7372.h"
+
 static struct map_desc sh7372_io_desc[] __initdata = {
        /* create a 1:1 entity map for 0xe6xxxxxx
         * used by CPGA, INTC and PFC.
@@ -119,28 +122,16 @@ SH7372_SCIF(PORT_SCIFB, 6, 0xe6c30000, evt2irq(0x0d60));
 
 /* CMT */
 static struct sh_timer_config cmt2_platform_data = {
-       .name = "CMT2",
-       .channel_offset = 0x40,
-       .timer_bit = 5,
-       .clockevent_rating = 125,
-       .clocksource_rating = 125,
+       .channels_mask = 0x20,
 };
 
 static struct resource cmt2_resources[] = {
-       [0] = {
-               .name   = "CMT2",
-               .start  = 0xe6130040,
-               .end    = 0xe613004b,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = evt2irq(0x0b80), /* CMT2 */
-               .flags  = IORESOURCE_IRQ,
-       },
+       DEFINE_RES_MEM(0xe6130000, 0x50),
+       DEFINE_RES_IRQ(evt2irq(0x0b80)),
 };
 
 static struct platform_device cmt2_device = {
-       .name           = "sh_cmt",
+       .name           = "sh-cmt-32-fast",
        .id             = 2,
        .dev = {
                .platform_data  = &cmt2_platform_data,
@@ -150,64 +141,25 @@ static struct platform_device cmt2_device = {
 };
 
 /* TMU */
-static struct sh_timer_config tmu00_platform_data = {
-       .name = "TMU00",
-       .channel_offset = 0x4,
-       .timer_bit = 0,
-       .clockevent_rating = 200,
+static struct sh_timer_config tmu0_platform_data = {
+       .channels_mask = 7,
 };
 
-static struct resource tmu00_resources[] = {
-       [0] = {
-               .name   = "TMU00",
-               .start  = 0xfff60008,
-               .end    = 0xfff60013,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = intcs_evt2irq(0xe80), /* TMU_TUNI0 */
-               .flags  = IORESOURCE_IRQ,
-       },
+static struct resource tmu0_resources[] = {
+       DEFINE_RES_MEM(0xfff60000, 0x2c),
+       DEFINE_RES_IRQ(intcs_evt2irq(0xe80)),
+       DEFINE_RES_IRQ(intcs_evt2irq(0xea0)),
+       DEFINE_RES_IRQ(intcs_evt2irq(0xec0)),
 };
 
-static struct platform_device tmu00_device = {
-       .name           = "sh_tmu",
+static struct platform_device tmu0_device = {
+       .name           = "sh-tmu",
        .id             = 0,
        .dev = {
-               .platform_data  = &tmu00_platform_data,
-       },
-       .resource       = tmu00_resources,
-       .num_resources  = ARRAY_SIZE(tmu00_resources),
-};
-
-static struct sh_timer_config tmu01_platform_data = {
-       .name = "TMU01",
-       .channel_offset = 0x10,
-       .timer_bit = 1,
-       .clocksource_rating = 200,
-};
-
-static struct resource tmu01_resources[] = {
-       [0] = {
-               .name   = "TMU01",
-               .start  = 0xfff60014,
-               .end    = 0xfff6001f,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = intcs_evt2irq(0xea0), /* TMU_TUNI1 */
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device tmu01_device = {
-       .name           = "sh_tmu",
-       .id             = 1,
-       .dev = {
-               .platform_data  = &tmu01_platform_data,
+               .platform_data  = &tmu0_platform_data,
        },
-       .resource       = tmu01_resources,
-       .num_resources  = ARRAY_SIZE(tmu01_resources),
+       .resource       = tmu0_resources,
+       .num_resources  = ARRAY_SIZE(tmu0_resources),
 };
 
 /* I2C */
@@ -952,8 +904,7 @@ static struct platform_device *sh7372_early_devices[] __initdata = {
        &scif5_device,
        &scif6_device,
        &cmt2_device,
-       &tmu00_device,
-       &tmu01_device,
+       &tmu0_device,
        &ipmmu_device,
 };
 
@@ -977,7 +928,7 @@ static struct platform_device *sh7372_late_devices[] __initdata = {
 
 void __init sh7372_add_standard_devices(void)
 {
-       struct pm_domain_device domain_devices[] = {
+       static struct pm_domain_device domain_devices[] __initdata = {
                { "A3RV", &vpu_device, },
                { "A4MP", &spu0_device, },
                { "A4MP", &spu1_device, },
@@ -1000,8 +951,7 @@ void __init sh7372_add_standard_devices(void)
                { "A4R", &veu2_device, },
                { "A4R", &veu3_device, },
                { "A4R", &jpu_device, },
-               { "A4R", &tmu00_device, },
-               { "A4R", &tmu01_device, },
+               { "A4R", &tmu0_device, },
        };
 
        sh7372_init_pm_domains();
@@ -1035,13 +985,9 @@ void __init sh7372_add_early_devices(void)
 
 void __init sh7372_add_early_devices_dt(void)
 {
-       shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */
-
-       early_platform_add_devices(sh7372_early_devices,
-                                  ARRAY_SIZE(sh7372_early_devices));
+       shmobile_init_delay();
 
-       /* setup early console here as well */
-       shmobile_setup_console();
+       sh7372_add_early_devices();
 }
 
 void __init sh7372_add_standard_devices_dt(void)
@@ -1063,7 +1009,6 @@ static const char *sh7372_boards_compat_dt[] __initdata = {
 DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
        .map_io         = sh7372_map_io,
        .init_early     = sh7372_add_early_devices_dt,
-       .nr_irqs        = NR_IRQS_LEGACY,
        .init_irq       = sh7372_init_irq,
        .handle_irq     = shmobile_handle_irq_intc,
        .init_machine   = sh7372_add_standard_devices_dt,