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-sh73a0.c
index f74ab53..b7bd8e5 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/platform_data/sh_ipmmu.h>
 #include <linux/platform_data/irq-renesas-intc-irqpin.h>
-#include <mach/dma-register.h>
-#include <mach/irqs.h>
-#include <mach/sh73a0.h>
-#include <mach/common.h>
+
 #include <asm/mach-types.h>
 #include <asm/mach/map.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 "sh73a0.h"
+
 static struct map_desc sh73a0_io_desc[] __initdata = {
        /* create a 1:1 entity map for 0xe6xxxxxx
         * used by CPGA, INTC and PFC.
@@ -104,86 +106,45 @@ SH73A0_SCIF(PORT_SCIFA, 6, 0xe6cc0000, gic_spi(156));
 SH73A0_SCIF(PORT_SCIFA, 7, 0xe6cd0000, gic_spi(143));
 SH73A0_SCIF(PORT_SCIFB, 8, 0xe6c30000, gic_spi(80));
 
-static struct sh_timer_config cmt10_platform_data = {
-       .name = "CMT10",
-       .channel_offset = 0x10,
-       .timer_bit = 0,
-       .clockevent_rating = 80,
-       .clocksource_rating = 125,
+static struct sh_timer_config cmt1_platform_data = {
+       .channels_mask = 0x3f,
 };
 
-static struct resource cmt10_resources[] = {
-       [0] = {
-               .name   = "CMT10",
-               .start  = 0xe6138010,
-               .end    = 0xe613801b,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = gic_spi(65),
-               .flags  = IORESOURCE_IRQ,
-       },
+static struct resource cmt1_resources[] = {
+       DEFINE_RES_MEM(0xe6138000, 0x200),
+       DEFINE_RES_IRQ(gic_spi(65)),
 };
 
-static struct platform_device cmt10_device = {
-       .name           = "sh_cmt",
-       .id             = 10,
+static struct platform_device cmt1_device = {
+       .name           = "sh-cmt-48",
+       .id             = 1,
        .dev = {
-               .platform_data  = &cmt10_platform_data,
+               .platform_data  = &cmt1_platform_data,
        },
-       .resource       = cmt10_resources,
-       .num_resources  = ARRAY_SIZE(cmt10_resources),
+       .resource       = cmt1_resources,
+       .num_resources  = ARRAY_SIZE(cmt1_resources),
 };
 
 /* 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] = DEFINE_RES_MEM(0xfff60008, 0xc),
-       [1] = {
-               .start  = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */
-               .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,
+               .platform_data  = &tmu0_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] = DEFINE_RES_MEM(0xfff60014, 0xc),
-       [1] = {
-               .start  = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device tmu01_device = {
-       .name           = "sh_tmu",
-       .id             = 1,
-       .dev = {
-               .platform_data  = &tmu01_platform_data,
-       },
-       .resource       = tmu01_resources,
-       .num_resources  = ARRAY_SIZE(tmu01_resources),
+       .resource       = tmu0_resources,
+       .num_resources  = ARRAY_SIZE(tmu0_resources),
 };
 
 static struct resource i2c0_resources[] = {
@@ -736,7 +697,7 @@ static struct platform_device irqpin3_device = {
        },
 };
 
-static struct platform_device *sh73a0_devices_dt[] __initdata = {
+static struct platform_device *sh73a0_early_devices[] __initdata = {
        &scif0_device,
        &scif1_device,
        &scif2_device,
@@ -746,13 +707,9 @@ static struct platform_device *sh73a0_devices_dt[] __initdata = {
        &scif6_device,
        &scif7_device,
        &scif8_device,
-       &cmt10_device,
-};
-
-static struct platform_device *sh73a0_early_devices[] __initdata = {
-       &tmu00_device,
-       &tmu01_device,
+       &tmu0_device,
        &ipmmu_device,
+       &cmt1_device,
 };
 
 static struct platform_device *sh73a0_late_devices[] __initdata = {
@@ -777,8 +734,6 @@ void __init sh73a0_add_standard_devices(void)
        /* Clear software reset bit on SY-DMAC module */
        __raw_writel(__raw_readl(SRCR2) & ~(1 << 18), SRCR2);
 
-       platform_add_devices(sh73a0_devices_dt,
-                           ARRAY_SIZE(sh73a0_devices_dt));
        platform_add_devices(sh73a0_early_devices,
                            ARRAY_SIZE(sh73a0_early_devices));
        platform_add_devices(sh73a0_late_devices,
@@ -787,7 +742,7 @@ void __init sh73a0_add_standard_devices(void)
 
 void __init sh73a0_init_delay(void)
 {
-       shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */
+       shmobile_init_delay();
 }
 
 /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
@@ -803,8 +758,6 @@ void __init sh73a0_earlytimer_init(void)
 
 void __init sh73a0_add_early_devices(void)
 {
-       early_platform_add_devices(sh73a0_devices_dt,
-                                  ARRAY_SIZE(sh73a0_devices_dt));
        early_platform_add_devices(sh73a0_early_devices,
                                   ARRAY_SIZE(sh73a0_early_devices));
 
@@ -816,17 +769,10 @@ void __init sh73a0_add_early_devices(void)
 
 void __init sh73a0_add_standard_devices_dt(void)
 {
-       struct platform_device_info devinfo = { .name = "cpufreq-cpu0", .id = -1, };
-
        /* clocks are setup late during boot in the case of DT */
        sh73a0_clock_init();
 
-       platform_add_devices(sh73a0_devices_dt,
-                            ARRAY_SIZE(sh73a0_devices_dt));
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-
-       /* Instantiate cpufreq-cpu0 */
-       platform_device_register_full(&devinfo);
 }
 
 static const char *sh73a0_boards_compat_dt[] __initdata = {
@@ -838,8 +784,8 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
        .smp            = smp_ops(sh73a0_smp_ops),
        .map_io         = sh73a0_map_io,
        .init_early     = sh73a0_init_delay,
-       .nr_irqs        = NR_IRQS_LEGACY,
        .init_machine   = sh73a0_add_standard_devices_dt,
+       .init_late      = shmobile_init_late,
        .dt_compat      = sh73a0_boards_compat_dt,
 MACHINE_END
 #endif /* CONFIG_USE_OF */