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/dma-mapping.h>
22 #include <linux/init.h>
23 #include <linux/of_platform.h>
24 #include <linux/platform_data/rcar-du.h>
26 #include <asm/mach/arch.h>
32 #include "rcar-gen2.h"
35 static struct rcar_du_encoder_data lager_du_encoders[] = {
37 .type = RCAR_DU_ENCODER_VGA,
38 .output = RCAR_DU_OUTPUT_DPAD0,
40 .type = RCAR_DU_ENCODER_NONE,
41 .output = RCAR_DU_OUTPUT_LVDS1,
42 .connector.lvds.panel = {
61 static struct rcar_du_platform_data lager_du_pdata = {
62 .encoders = lager_du_encoders,
63 .num_encoders = ARRAY_SIZE(lager_du_encoders),
66 static const struct resource du_resources[] __initconst = {
67 DEFINE_RES_MEM(0xfeb00000, 0x70000),
68 DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
69 DEFINE_RES_MEM_NAMED(0xfeb94000, 0x1c, "lvds.1"),
70 DEFINE_RES_IRQ(gic_spi(256)),
71 DEFINE_RES_IRQ(gic_spi(268)),
72 DEFINE_RES_IRQ(gic_spi(269)),
75 static void __init lager_add_du_device(void)
77 struct platform_device_info info = {
78 .name = "rcar-du-r8a7790",
81 .num_res = ARRAY_SIZE(du_resources),
82 .data = &lager_du_pdata,
83 .size_data = sizeof(lager_du_pdata),
84 .dma_mask = DMA_BIT_MASK(32),
87 platform_device_register_full(&info);
91 * This is a really crude hack to provide clkdev support to platform
92 * devices until they get moved to DT.
94 static const struct clk_name clk_names[] __initconst = {
95 { "cmt0", "fck", "sh-cmt-48-gen2.0" },
96 { "du0", "du.0", "rcar-du-r8a7790" },
97 { "du1", "du.1", "rcar-du-r8a7790" },
98 { "du2", "du.2", "rcar-du-r8a7790" },
99 { "lvds0", "lvds.0", "rcar-du-r8a7790" },
100 { "lvds1", "lvds.1", "rcar-du-r8a7790" },
103 static void __init lager_add_standard_devices(void)
105 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
106 r8a7790_add_dt_devices();
107 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
109 lager_add_du_device();
112 static const char *lager_boards_compat_dt[] __initdata = {
114 "renesas,lager-reference",
118 DT_MACHINE_START(LAGER_DT, "lager")
119 .smp = smp_ops(r8a7790_smp_ops),
120 .init_early = shmobile_init_delay,
121 .init_time = rcar_gen2_timer_init,
122 .init_machine = lager_add_standard_devices,
123 .init_late = shmobile_init_late,
124 .reserve = rcar_gen2_reserve,
125 .dt_compat = lager_boards_compat_dt,