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.
17 #include <linux/dma-mapping.h>
18 #include <linux/init.h>
19 #include <linux/of_platform.h>
20 #include <linux/platform_data/rcar-du.h>
22 #include <asm/mach/arch.h>
28 #include "rcar-gen2.h"
31 static struct rcar_du_encoder_data lager_du_encoders[] = {
33 .type = RCAR_DU_ENCODER_VGA,
34 .output = RCAR_DU_OUTPUT_DPAD0,
36 .type = RCAR_DU_ENCODER_NONE,
37 .output = RCAR_DU_OUTPUT_LVDS1,
38 .connector.lvds.panel = {
42 .pixelclock = 65000000,
56 static struct rcar_du_platform_data lager_du_pdata = {
57 .encoders = lager_du_encoders,
58 .num_encoders = ARRAY_SIZE(lager_du_encoders),
61 static const struct resource du_resources[] __initconst = {
62 DEFINE_RES_MEM(0xfeb00000, 0x70000),
63 DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
64 DEFINE_RES_MEM_NAMED(0xfeb94000, 0x1c, "lvds.1"),
65 DEFINE_RES_IRQ(gic_spi(256)),
66 DEFINE_RES_IRQ(gic_spi(268)),
67 DEFINE_RES_IRQ(gic_spi(269)),
70 static void __init lager_add_du_device(void)
72 struct platform_device_info info = {
73 .name = "rcar-du-r8a7790",
76 .num_res = ARRAY_SIZE(du_resources),
77 .data = &lager_du_pdata,
78 .size_data = sizeof(lager_du_pdata),
79 .dma_mask = DMA_BIT_MASK(32),
82 platform_device_register_full(&info);
86 * This is a really crude hack to provide clkdev support to platform
87 * devices until they get moved to DT.
89 static const struct clk_name clk_names[] __initconst = {
90 { "du0", "du.0", "rcar-du-r8a7790" },
91 { "du1", "du.1", "rcar-du-r8a7790" },
92 { "du2", "du.2", "rcar-du-r8a7790" },
93 { "lvds0", "lvds.0", "rcar-du-r8a7790" },
94 { "lvds1", "lvds.1", "rcar-du-r8a7790" },
97 static void __init lager_add_standard_devices(void)
99 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
100 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
102 lager_add_du_device();
105 static const char *lager_boards_compat_dt[] __initdata = {
107 "renesas,lager-reference",
111 DT_MACHINE_START(LAGER_DT, "lager")
112 .smp = smp_ops(r8a7790_smp_ops),
113 .init_early = shmobile_init_delay,
114 .init_time = rcar_gen2_timer_init,
115 .init_machine = lager_add_standard_devices,
116 .init_late = shmobile_init_late,
117 .reserve = rcar_gen2_reserve,
118 .dt_compat = lager_boards_compat_dt,