ARM: shmobile: Move most of irqs.h, keep some for pinctl
[deliverable/linux.git] / arch / arm / mach-shmobile / board-koelsch-reference.c
1 /*
2 * Koelsch board support - Reference DT implementation
3 *
4 * Copyright (C) 2013 Renesas Electronics Corporation
5 * Copyright (C) 2013 Renesas Solutions Corp.
6 * Copyright (C) 2013 Magnus Damm
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include <linux/dma-mapping.h>
23 #include <linux/kernel.h>
24 #include <linux/of_platform.h>
25 #include <linux/platform_data/rcar-du.h>
26 #include <mach/common.h>
27 #include <mach/rcar-gen2.h>
28 #include <mach/r8a7791.h>
29 #include <asm/mach/arch.h>
30 #include "clock.h"
31 #include "irqs.h"
32
33 /* DU */
34 static struct rcar_du_encoder_data koelsch_du_encoders[] = {
35 {
36 .type = RCAR_DU_ENCODER_NONE,
37 .output = RCAR_DU_OUTPUT_LVDS0,
38 .connector.lvds.panel = {
39 .width_mm = 210,
40 .height_mm = 158,
41 .mode = {
42 .clock = 65000,
43 .hdisplay = 1024,
44 .hsync_start = 1048,
45 .hsync_end = 1184,
46 .htotal = 1344,
47 .vdisplay = 768,
48 .vsync_start = 771,
49 .vsync_end = 777,
50 .vtotal = 806,
51 .flags = 0,
52 },
53 },
54 },
55 };
56
57 static struct rcar_du_platform_data koelsch_du_pdata = {
58 .encoders = koelsch_du_encoders,
59 .num_encoders = ARRAY_SIZE(koelsch_du_encoders),
60 };
61
62 static const struct resource du_resources[] __initconst = {
63 DEFINE_RES_MEM(0xfeb00000, 0x40000),
64 DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
65 DEFINE_RES_IRQ(gic_spi(256)),
66 DEFINE_RES_IRQ(gic_spi(268)),
67 };
68
69 static void __init koelsch_add_du_device(void)
70 {
71 struct platform_device_info info = {
72 .name = "rcar-du-r8a7791",
73 .id = -1,
74 .res = du_resources,
75 .num_res = ARRAY_SIZE(du_resources),
76 .data = &koelsch_du_pdata,
77 .size_data = sizeof(koelsch_du_pdata),
78 .dma_mask = DMA_BIT_MASK(32),
79 };
80
81 platform_device_register_full(&info);
82 }
83
84 /*
85 * This is a really crude hack to provide clkdev support to platform
86 * devices until they get moved to DT.
87 */
88 static const struct clk_name clk_names[] __initconst = {
89 { "cmt0", "fck", "sh-cmt-48-gen2.0" },
90 { "du0", "du.0", "rcar-du-r8a7791" },
91 { "du1", "du.1", "rcar-du-r8a7791" },
92 { "lvds0", "lvds.0", "rcar-du-r8a7791" },
93 };
94
95 /*
96 * This is a really crude hack to work around core platform clock issues
97 */
98 static const struct clk_name clk_enables[] __initconst = {
99 { "ether", NULL, "ee700000.ethernet" },
100 { "i2c2", NULL, "e6530000.i2c" },
101 { "msiof0", NULL, "e6e20000.spi" },
102 { "qspi_mod", NULL, "e6b10000.spi" },
103 { "sdhi0", NULL, "ee100000.sd" },
104 { "sdhi1", NULL, "ee140000.sd" },
105 { "sdhi2", NULL, "ee160000.sd" },
106 { "thermal", NULL, "e61f0000.thermal" },
107 };
108
109 static void __init koelsch_add_standard_devices(void)
110 {
111 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
112 shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true);
113 r8a7791_add_dt_devices();
114 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
115
116 koelsch_add_du_device();
117 }
118
119 static const char * const koelsch_boards_compat_dt[] __initconst = {
120 "renesas,koelsch",
121 "renesas,koelsch-reference",
122 NULL,
123 };
124
125 DT_MACHINE_START(KOELSCH_DT, "koelsch")
126 .smp = smp_ops(r8a7791_smp_ops),
127 .init_early = shmobile_init_delay,
128 .init_time = rcar_gen2_timer_init,
129 .init_machine = koelsch_add_standard_devices,
130 .init_late = shmobile_init_late,
131 .dt_compat = koelsch_boards_compat_dt,
132 MACHINE_END
This page took 0.036367 seconds and 5 git commands to generate.