Merge branch 'CVE-2014-7975' of git://git.kernel.org/pub/scm/linux/kernel/git/luto...
[linux-2.6-block.git] / arch / arm / mach-shmobile / board-lager-reference.c
CommitLineData
6dace67f
SH
1/*
2 * Lager board support - Reference DT implementation
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Simon Horman
6 *
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.
10 *
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.
15 *
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
19 */
20
433aa851 21#include <linux/dma-mapping.h>
6dace67f 22#include <linux/init.h>
6dace67f 23#include <linux/of_platform.h>
433aa851 24#include <linux/platform_data/rcar-du.h>
fccae893 25
6dace67f 26#include <asm/mach/arch.h>
fccae893 27
ad6ffa0b 28#include "clock.h"
fd44aa5e 29#include "common.h"
b6bab126 30#include "irqs.h"
fccae893 31#include "r8a7790.h"
62872989 32#include "rcar-gen2.h"
6dace67f 33
433aa851
LP
34/* DU */
35static struct rcar_du_encoder_data lager_du_encoders[] = {
36 {
37 .type = RCAR_DU_ENCODER_VGA,
38 .output = RCAR_DU_OUTPUT_DPAD0,
39 }, {
40 .type = RCAR_DU_ENCODER_NONE,
41 .output = RCAR_DU_OUTPUT_LVDS1,
42 .connector.lvds.panel = {
43 .width_mm = 210,
44 .height_mm = 158,
45 .mode = {
46 .clock = 65000,
47 .hdisplay = 1024,
48 .hsync_start = 1048,
49 .hsync_end = 1184,
50 .htotal = 1344,
51 .vdisplay = 768,
52 .vsync_start = 771,
53 .vsync_end = 777,
54 .vtotal = 806,
55 .flags = 0,
56 },
57 },
58 },
59};
60
61static struct rcar_du_platform_data lager_du_pdata = {
62 .encoders = lager_du_encoders,
63 .num_encoders = ARRAY_SIZE(lager_du_encoders),
64};
65
66static 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)),
73};
74
75static void __init lager_add_du_device(void)
76{
77 struct platform_device_info info = {
78 .name = "rcar-du-r8a7790",
79 .id = -1,
80 .res = du_resources,
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),
85 };
86
87 platform_device_register_full(&info);
88}
89
e6597e0e
MD
90/*
91 * This is a really crude hack to provide clkdev support to platform
92 * devices until they get moved to DT.
93 */
f71c7728 94static const struct clk_name clk_names[] __initconst = {
e6597e0e
MD
95 { "du0", "du.0", "rcar-du-r8a7790" },
96 { "du1", "du.1", "rcar-du-r8a7790" },
97 { "du2", "du.2", "rcar-du-r8a7790" },
98 { "lvds0", "lvds.0", "rcar-du-r8a7790" },
99 { "lvds1", "lvds.1", "rcar-du-r8a7790" },
100};
101
d144f362 102static void __init lager_add_standard_devices(void)
6dace67f 103{
e6597e0e 104 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
20c6125f 105 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
433aa851
LP
106
107 lager_add_du_device();
6dace67f
SH
108}
109
110static const char *lager_boards_compat_dt[] __initdata = {
1fb68146 111 "renesas,lager",
6dace67f
SH
112 "renesas,lager-reference",
113 NULL,
114};
115
116DT_MACHINE_START(LAGER_DT, "lager")
ad09cb83 117 .smp = smp_ops(r8a7790_smp_ops),
a5d62681 118 .init_early = shmobile_init_delay,
50c517d9 119 .init_time = rcar_gen2_timer_init,
6dace67f 120 .init_machine = lager_add_standard_devices,
3fbbcbdf 121 .init_late = shmobile_init_late,
5f65c5bd 122 .reserve = rcar_gen2_reserve,
6dace67f
SH
123 .dt_compat = lager_boards_compat_dt,
124MACHINE_END