ARM: shmobile: Remove FSF address from copyright headers
[cascardo/linux.git] / arch / arm / mach-shmobile / board-lager-reference.c
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
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>
21
22 #include <asm/mach/arch.h>
23
24 #include "clock.h"
25 #include "common.h"
26 #include "irqs.h"
27 #include "r8a7790.h"
28 #include "rcar-gen2.h"
29
30 /* DU */
31 static struct rcar_du_encoder_data lager_du_encoders[] = {
32         {
33                 .type = RCAR_DU_ENCODER_VGA,
34                 .output = RCAR_DU_OUTPUT_DPAD0,
35         }, {
36                 .type = RCAR_DU_ENCODER_NONE,
37                 .output = RCAR_DU_OUTPUT_LVDS1,
38                 .connector.lvds.panel = {
39                         .width_mm = 210,
40                         .height_mm = 158,
41                         .mode = {
42                                 .pixelclock = 65000000,
43                                 .hactive = 1024,
44                                 .hfront_porch = 20,
45                                 .hback_porch = 160,
46                                 .hsync_len = 136,
47                                 .vactive = 768,
48                                 .vfront_porch = 3,
49                                 .vback_porch = 29,
50                                 .vsync_len = 6,
51                         },
52                 },
53         },
54 };
55
56 static struct rcar_du_platform_data lager_du_pdata = {
57         .encoders = lager_du_encoders,
58         .num_encoders = ARRAY_SIZE(lager_du_encoders),
59 };
60
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)),
68 };
69
70 static void __init lager_add_du_device(void)
71 {
72         struct platform_device_info info = {
73                 .name = "rcar-du-r8a7790",
74                 .id = -1,
75                 .res = du_resources,
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),
80         };
81
82         platform_device_register_full(&info);
83 }
84
85 /*
86  * This is a really crude hack to provide clkdev support to platform
87  * devices until they get moved to DT.
88  */
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" },
95 };
96
97 static void __init lager_add_standard_devices(void)
98 {
99         shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
100         of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
101
102         lager_add_du_device();
103 }
104
105 static const char *lager_boards_compat_dt[] __initdata = {
106         "renesas,lager",
107         "renesas,lager-reference",
108         NULL,
109 };
110
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,
119 MACHINE_END