2 * Lager board support - Reference DT implementation
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Simon Horman
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <linux/clk.h>
22 #include <linux/clkdev.h>
23 #include <linux/dma-mapping.h>
24 #include <linux/init.h>
25 #include <linux/of_platform.h>
26 #include <linux/platform_data/rcar-du.h>
27 #include <mach/common.h>
28 #include <mach/irqs.h>
29 #include <mach/rcar-gen2.h>
30 #include <mach/r8a7790.h>
31 #include <asm/mach/arch.h>
34 static struct rcar_du_encoder_data lager_du_encoders[] = {
36 .type = RCAR_DU_ENCODER_VGA,
37 .output = RCAR_DU_OUTPUT_DPAD0,
39 .type = RCAR_DU_ENCODER_NONE,
40 .output = RCAR_DU_OUTPUT_LVDS1,
41 .connector.lvds.panel = {
60 static struct rcar_du_platform_data lager_du_pdata = {
61 .encoders = lager_du_encoders,
62 .num_encoders = ARRAY_SIZE(lager_du_encoders),
65 static const struct resource du_resources[] __initconst = {
66 DEFINE_RES_MEM(0xfeb00000, 0x70000),
67 DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
68 DEFINE_RES_MEM_NAMED(0xfeb94000, 0x1c, "lvds.1"),
69 DEFINE_RES_IRQ(gic_spi(256)),
70 DEFINE_RES_IRQ(gic_spi(268)),
71 DEFINE_RES_IRQ(gic_spi(269)),
74 static void __init lager_add_du_device(void)
76 struct platform_device_info info = {
77 .name = "rcar-du-r8a7790",
80 .num_res = ARRAY_SIZE(du_resources),
81 .data = &lager_du_pdata,
82 .size_data = sizeof(lager_du_pdata),
83 .dma_mask = DMA_BIT_MASK(32),
86 platform_device_register_full(&info);
89 static void __init lager_add_standard_devices(void)
92 * This is a really crude hack to provide clkdev support to platform
93 * devices until they get moved to DT.
95 static const struct clk_name {
100 { "cmt0", NULL, "sh_cmt.0" },
101 { "scifa0", NULL, "sh-sci.0" },
102 { "scifa1", NULL, "sh-sci.1" },
103 { "scifb0", NULL, "sh-sci.2" },
104 { "scifb1", NULL, "sh-sci.3" },
105 { "scifb2", NULL, "sh-sci.4" },
106 { "scifa2", NULL, "sh-sci.5" },
107 { "scif0", NULL, "sh-sci.6" },
108 { "scif1", NULL, "sh-sci.7" },
109 { "hscif0", NULL, "sh-sci.8" },
110 { "hscif1", NULL, "sh-sci.9" },
111 { "du0", "du.0", "rcar-du-r8a7790" },
112 { "du1", "du.1", "rcar-du-r8a7790" },
113 { "du2", "du.2", "rcar-du-r8a7790" },
114 { "lvds0", "lvds.0", "rcar-du-r8a7790" },
115 { "lvds1", "lvds.1", "rcar-du-r8a7790" },
120 for (i = 0; i < ARRAY_SIZE(clk_names); ++i) {
121 clk = clk_get(NULL, clk_names[i].clk);
123 clk_register_clkdev(clk, clk_names[i].con_id,
124 clk_names[i].dev_id);
129 r8a7790_add_dt_devices();
130 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
132 lager_add_du_device();
135 static const char *lager_boards_compat_dt[] __initdata = {
137 "renesas,lager-reference",
141 DT_MACHINE_START(LAGER_DT, "lager")
142 .smp = smp_ops(r8a7790_smp_ops),
143 .init_early = r8a7790_init_early,
144 .init_time = rcar_gen2_timer_init,
145 .init_machine = lager_add_standard_devices,
146 .init_late = shmobile_init_late,
147 .dt_compat = lager_boards_compat_dt,