Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma
[linux-2.6-block.git] / arch / arm / mach-shmobile / board-koelsch-reference.c
CommitLineData
a2baf191
MD
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
14c5ce17 22#include <linux/dma-mapping.h>
a2baf191
MD
23#include <linux/kernel.h>
24#include <linux/of_platform.h>
14c5ce17 25#include <linux/platform_data/rcar-du.h>
5201b5a7 26
a2baf191 27#include <asm/mach/arch.h>
5201b5a7 28
ad6ffa0b 29#include "clock.h"
fd44aa5e 30#include "common.h"
b6bab126 31#include "irqs.h"
5201b5a7 32#include "r8a7791.h"
62872989 33#include "rcar-gen2.h"
a2baf191 34
14c5ce17
LP
35/* DU */
36static struct rcar_du_encoder_data koelsch_du_encoders[] = {
37 {
38 .type = RCAR_DU_ENCODER_NONE,
39 .output = RCAR_DU_OUTPUT_LVDS0,
40 .connector.lvds.panel = {
41 .width_mm = 210,
42 .height_mm = 158,
43 .mode = {
1d46fea7
LP
44 .pixelclock = 65000000,
45 .hactive = 1024,
46 .hfront_porch = 20,
47 .hback_porch = 160,
48 .hsync_len = 136,
49 .vactive = 768,
50 .vfront_porch = 3,
51 .vback_porch = 29,
52 .vsync_len = 6,
14c5ce17
LP
53 },
54 },
55 },
56};
57
58static struct rcar_du_platform_data koelsch_du_pdata = {
59 .encoders = koelsch_du_encoders,
60 .num_encoders = ARRAY_SIZE(koelsch_du_encoders),
61};
62
63static const struct resource du_resources[] __initconst = {
64 DEFINE_RES_MEM(0xfeb00000, 0x40000),
65 DEFINE_RES_MEM_NAMED(0xfeb90000, 0x1c, "lvds.0"),
66 DEFINE_RES_IRQ(gic_spi(256)),
67 DEFINE_RES_IRQ(gic_spi(268)),
68};
69
70static void __init koelsch_add_du_device(void)
71{
72 struct platform_device_info info = {
73 .name = "rcar-du-r8a7791",
74 .id = -1,
75 .res = du_resources,
76 .num_res = ARRAY_SIZE(du_resources),
77 .data = &koelsch_du_pdata,
78 .size_data = sizeof(koelsch_du_pdata),
79 .dma_mask = DMA_BIT_MASK(32),
80 };
81
82 platform_device_register_full(&info);
83}
84
89aff406
MD
85/*
86 * This is a really crude hack to provide clkdev support to platform
87 * devices until they get moved to DT.
88 */
f6f98b3e 89static const struct clk_name clk_names[] __initconst = {
89aff406
MD
90 { "du0", "du.0", "rcar-du-r8a7791" },
91 { "du1", "du.1", "rcar-du-r8a7791" },
92 { "lvds0", "lvds.0", "rcar-du-r8a7791" },
93};
f31239ef 94
a2baf191
MD
95static void __init koelsch_add_standard_devices(void)
96{
89aff406 97 shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
a2baf191 98 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
14c5ce17
LP
99
100 koelsch_add_du_device();
a2baf191
MD
101}
102
103static const char * const koelsch_boards_compat_dt[] __initconst = {
1d2bdbc3 104 "renesas,koelsch",
a2baf191
MD
105 "renesas,koelsch-reference",
106 NULL,
107};
108
109DT_MACHINE_START(KOELSCH_DT, "koelsch")
110 .smp = smp_ops(r8a7791_smp_ops),
7e99497c 111 .init_early = shmobile_init_delay,
a2baf191
MD
112 .init_time = rcar_gen2_timer_init,
113 .init_machine = koelsch_add_standard_devices,
6dc00ab9 114 .init_late = shmobile_init_late,
5f65c5bd 115 .reserve = rcar_gen2_reserve,
a2baf191
MD
116 .dt_compat = koelsch_boards_compat_dt,
117MACHINE_END