|
@@ -21,6 +21,7 @@
|
|
|
#include <linux/init.h>
|
|
|
#include <linux/interrupt.h>
|
|
|
#include <linux/irq.h>
|
|
|
+#include <linux/of_platform.h>
|
|
|
#include <linux/platform_device.h>
|
|
|
#include <linux/delay.h>
|
|
|
#include <linux/input.h>
|
|
@@ -28,6 +29,7 @@
|
|
|
#include <linux/serial_sci.h>
|
|
|
#include <linux/sh_intc.h>
|
|
|
#include <linux/sh_timer.h>
|
|
|
+#include <linux/dma-mapping.h>
|
|
|
#include <mach/hardware.h>
|
|
|
#include <mach/irqs.h>
|
|
|
#include <mach/r8a7779.h>
|
|
@@ -91,7 +93,7 @@ static struct plat_sci_port scif0_platform_data = {
|
|
|
.scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
|
|
|
.scbrr_algo_id = SCBRR_ALGO_2,
|
|
|
.type = PORT_SCIF,
|
|
|
- .irqs = SCIx_IRQ_MUXED(gic_spi(88)),
|
|
|
+ .irqs = SCIx_IRQ_MUXED(gic_iid(0x78)),
|
|
|
};
|
|
|
|
|
|
static struct platform_device scif0_device = {
|
|
@@ -108,7 +110,7 @@ static struct plat_sci_port scif1_platform_data = {
|
|
|
.scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
|
|
|
.scbrr_algo_id = SCBRR_ALGO_2,
|
|
|
.type = PORT_SCIF,
|
|
|
- .irqs = SCIx_IRQ_MUXED(gic_spi(89)),
|
|
|
+ .irqs = SCIx_IRQ_MUXED(gic_iid(0x79)),
|
|
|
};
|
|
|
|
|
|
static struct platform_device scif1_device = {
|
|
@@ -125,7 +127,7 @@ static struct plat_sci_port scif2_platform_data = {
|
|
|
.scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
|
|
|
.scbrr_algo_id = SCBRR_ALGO_2,
|
|
|
.type = PORT_SCIF,
|
|
|
- .irqs = SCIx_IRQ_MUXED(gic_spi(90)),
|
|
|
+ .irqs = SCIx_IRQ_MUXED(gic_iid(0x7a)),
|
|
|
};
|
|
|
|
|
|
static struct platform_device scif2_device = {
|
|
@@ -142,7 +144,7 @@ static struct plat_sci_port scif3_platform_data = {
|
|
|
.scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
|
|
|
.scbrr_algo_id = SCBRR_ALGO_2,
|
|
|
.type = PORT_SCIF,
|
|
|
- .irqs = SCIx_IRQ_MUXED(gic_spi(91)),
|
|
|
+ .irqs = SCIx_IRQ_MUXED(gic_iid(0x7b)),
|
|
|
};
|
|
|
|
|
|
static struct platform_device scif3_device = {
|
|
@@ -159,7 +161,7 @@ static struct plat_sci_port scif4_platform_data = {
|
|
|
.scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
|
|
|
.scbrr_algo_id = SCBRR_ALGO_2,
|
|
|
.type = PORT_SCIF,
|
|
|
- .irqs = SCIx_IRQ_MUXED(gic_spi(92)),
|
|
|
+ .irqs = SCIx_IRQ_MUXED(gic_iid(0x7c)),
|
|
|
};
|
|
|
|
|
|
static struct platform_device scif4_device = {
|
|
@@ -176,7 +178,7 @@ static struct plat_sci_port scif5_platform_data = {
|
|
|
.scscr = SCSCR_RE | SCSCR_TE | SCSCR_CKE1,
|
|
|
.scbrr_algo_id = SCBRR_ALGO_2,
|
|
|
.type = PORT_SCIF,
|
|
|
- .irqs = SCIx_IRQ_MUXED(gic_spi(93)),
|
|
|
+ .irqs = SCIx_IRQ_MUXED(gic_iid(0x7d)),
|
|
|
};
|
|
|
|
|
|
static struct platform_device scif5_device = {
|
|
@@ -203,7 +205,7 @@ static struct resource tmu00_resources[] = {
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
},
|
|
|
[1] = {
|
|
|
- .start = gic_spi(32),
|
|
|
+ .start = gic_iid(0x40),
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
},
|
|
|
};
|
|
@@ -233,7 +235,7 @@ static struct resource tmu01_resources[] = {
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
},
|
|
|
[1] = {
|
|
|
- .start = gic_spi(33),
|
|
|
+ .start = gic_iid(0x41),
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
},
|
|
|
};
|
|
@@ -255,7 +257,7 @@ static struct resource rcar_i2c0_res[] = {
|
|
|
.end = 0xffc70fff,
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
}, {
|
|
|
- .start = gic_spi(79),
|
|
|
+ .start = gic_iid(0x6f),
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
},
|
|
|
};
|
|
@@ -273,7 +275,7 @@ static struct resource rcar_i2c1_res[] = {
|
|
|
.end = 0xffc71fff,
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
}, {
|
|
|
- .start = gic_spi(82),
|
|
|
+ .start = gic_iid(0x72),
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
},
|
|
|
};
|
|
@@ -291,7 +293,7 @@ static struct resource rcar_i2c2_res[] = {
|
|
|
.end = 0xffc72fff,
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
}, {
|
|
|
- .start = gic_spi(80),
|
|
|
+ .start = gic_iid(0x70),
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
},
|
|
|
};
|
|
@@ -309,7 +311,7 @@ static struct resource rcar_i2c3_res[] = {
|
|
|
.end = 0xffc73fff,
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
}, {
|
|
|
- .start = gic_spi(81),
|
|
|
+ .start = gic_iid(0x71),
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
},
|
|
|
};
|
|
@@ -321,7 +323,31 @@ static struct platform_device i2c3_device = {
|
|
|
.num_resources = ARRAY_SIZE(rcar_i2c3_res),
|
|
|
};
|
|
|
|
|
|
-static struct platform_device *r8a7779_early_devices[] __initdata = {
|
|
|
+static struct resource sata_resources[] = {
|
|
|
+ [0] = {
|
|
|
+ .name = "rcar-sata",
|
|
|
+ .start = 0xfc600000,
|
|
|
+ .end = 0xfc601fff,
|
|
|
+ .flags = IORESOURCE_MEM,
|
|
|
+ },
|
|
|
+ [1] = {
|
|
|
+ .start = gic_iid(0x84),
|
|
|
+ .flags = IORESOURCE_IRQ,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device sata_device = {
|
|
|
+ .name = "sata_rcar",
|
|
|
+ .id = -1,
|
|
|
+ .resource = sata_resources,
|
|
|
+ .num_resources = ARRAY_SIZE(sata_resources),
|
|
|
+ .dev = {
|
|
|
+ .dma_mask = &sata_device.dev.coherent_dma_mask,
|
|
|
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device *r8a7779_devices_dt[] __initdata = {
|
|
|
&scif0_device,
|
|
|
&scif1_device,
|
|
|
&scif2_device,
|
|
@@ -330,13 +356,14 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
|
|
|
&scif5_device,
|
|
|
&tmu00_device,
|
|
|
&tmu01_device,
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device *r8a7779_late_devices[] __initdata = {
|
|
|
&i2c0_device,
|
|
|
&i2c1_device,
|
|
|
&i2c2_device,
|
|
|
&i2c3_device,
|
|
|
-};
|
|
|
-
|
|
|
-static struct platform_device *r8a7779_late_devices[] __initdata = {
|
|
|
+ &sata_device,
|
|
|
};
|
|
|
|
|
|
void __init r8a7779_add_standard_devices(void)
|
|
@@ -349,8 +376,8 @@ void __init r8a7779_add_standard_devices(void)
|
|
|
|
|
|
r8a7779_init_pm_domains();
|
|
|
|
|
|
- platform_add_devices(r8a7779_early_devices,
|
|
|
- ARRAY_SIZE(r8a7779_early_devices));
|
|
|
+ platform_add_devices(r8a7779_devices_dt,
|
|
|
+ ARRAY_SIZE(r8a7779_devices_dt));
|
|
|
platform_add_devices(r8a7779_late_devices,
|
|
|
ARRAY_SIZE(r8a7779_late_devices));
|
|
|
}
|
|
@@ -367,8 +394,8 @@ void __init r8a7779_earlytimer_init(void)
|
|
|
|
|
|
void __init r8a7779_add_early_devices(void)
|
|
|
{
|
|
|
- early_platform_add_devices(r8a7779_early_devices,
|
|
|
- ARRAY_SIZE(r8a7779_early_devices));
|
|
|
+ early_platform_add_devices(r8a7779_devices_dt,
|
|
|
+ ARRAY_SIZE(r8a7779_devices_dt));
|
|
|
|
|
|
/* Early serial console setup is not included here due to
|
|
|
* memory map collisions. The SCIF serial ports in r8a7779
|
|
@@ -386,3 +413,40 @@ void __init r8a7779_add_early_devices(void)
|
|
|
* command line in case of the marzen board.
|
|
|
*/
|
|
|
}
|
|
|
+
|
|
|
+#ifdef CONFIG_USE_OF
|
|
|
+void __init r8a7779_init_delay(void)
|
|
|
+{
|
|
|
+ shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
|
|
|
+}
|
|
|
+
|
|
|
+static const struct of_dev_auxdata r8a7779_auxdata_lookup[] __initconst = {
|
|
|
+ {},
|
|
|
+};
|
|
|
+
|
|
|
+void __init r8a7779_add_standard_devices_dt(void)
|
|
|
+{
|
|
|
+ /* clocks are setup late during boot in the case of DT */
|
|
|
+ r8a7779_clock_init();
|
|
|
+
|
|
|
+ platform_add_devices(r8a7779_devices_dt,
|
|
|
+ ARRAY_SIZE(r8a7779_devices_dt));
|
|
|
+ of_platform_populate(NULL, of_default_bus_match_table,
|
|
|
+ r8a7779_auxdata_lookup, NULL);
|
|
|
+}
|
|
|
+
|
|
|
+static const char *r8a7779_compat_dt[] __initdata = {
|
|
|
+ "renesas,r8a7779",
|
|
|
+ NULL,
|
|
|
+};
|
|
|
+
|
|
|
+DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
|
|
|
+ .map_io = r8a7779_map_io,
|
|
|
+ .init_early = r8a7779_init_delay,
|
|
|
+ .nr_irqs = NR_IRQS_LEGACY,
|
|
|
+ .init_irq = r8a7779_init_irq_dt,
|
|
|
+ .init_machine = r8a7779_add_standard_devices_dt,
|
|
|
+ .init_time = shmobile_timer_init,
|
|
|
+ .dt_compat = r8a7779_compat_dt,
|
|
|
+MACHINE_END
|
|
|
+#endif /* CONFIG_USE_OF */
|