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