ARM: mach-shmobile: armadillo800eva: add support LCDC0
[deliverable/linux.git] / arch / arm / mach-shmobile / board-armadillo800eva.c
CommitLineData
4d22e564
KM
1/*
2 * armadillo 800 eva board support
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
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 */
21
22#include <linux/clk.h>
23#include <linux/err.h>
24#include <linux/kernel.h>
25#include <linux/platform_device.h>
26#include <linux/gpio.h>
dad29d1c 27#include <linux/videodev2.h>
4d22e564
KM
28#include <mach/common.h>
29#include <mach/irqs.h>
30#include <asm/page.h>
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33#include <asm/mach/map.h>
34#include <asm/mach/time.h>
35#include <asm/hardware/cache-l2x0.h>
36#include <mach/r8a7740.h>
dad29d1c 37#include <video/sh_mobile_lcdc.h>
4d22e564
KM
38
39/*
40 * CON1 Camera Module
41 * CON2 Extension Bus
42 * CON3 HDMI Output
43 * CON4 Composite Video Output
44 * CON5 H-UDI JTAG
45 * CON6 ARM JTAG
46 * CON7 SD1
47 * CON8 SD2
48 * CON9 RTC BackUp
49 * CON10 Monaural Mic Input
50 * CON11 Stereo Headphone Output
51 * CON12 Audio Line Output(L)
52 * CON13 Audio Line Output(R)
53 * CON14 AWL13 Module
54 * CON15 Extension
55 * CON16 LCD1
56 * CON17 LCD2
57 * CON19 Power Input
58 * CON20 USB1
59 * CON21 USB2
60 * CON22 Serial
61 * CON23 LAN
62 * CON24 USB3
63 * LED1 Camera LED(Yellow)
64 * LED2 Power LED (Green)
65 * ED3-LED6 User LED(Yellow)
66 * LED7 LAN link LED(Green)
67 * LED8 LAN activity LED(Yellow)
68 */
69
70/*
71 * DipSwitch
72 *
73 * SW1
74 *
75 * -12345678-+---------------+----------------------------
76 * 1 | boot | hermit
77 * 0 | boot | OS auto boot
78 * -12345678-+---------------+----------------------------
79 * 00 | boot device | eMMC
80 * 10 | boot device | SDHI0 (CON7)
81 * 01 | boot device | -
82 * 11 | boot device | Extension Buss (CS0)
83 * -12345678-+---------------+----------------------------
84 * 0 | Extension Bus | D8-D15 disable, eMMC enable
85 * 1 | Extension Bus | D8-D15 enable, eMMC disable
86 * -12345678-+---------------+----------------------------
87 * 0 | SDHI1 | COM8 enable, COM14 disable
88 * 1 | SDHI1 | COM8 enable, COM14 disable
89 * -12345678-+---------------+----------------------------
90 * 00 | JTAG | SH-X2
91 * 10 | JTAG | ARM
92 * 01 | JTAG | -
93 * 11 | JTAG | Boundary Scan
94 *-----------+---------------+----------------------------
95 */
96
dad29d1c
KM
97/* LCDC */
98static struct fb_videomode lcdc0_mode = {
99 .name = "AMPIER/AM-800480",
100 .xres = 800,
101 .yres = 480,
102 .left_margin = 88,
103 .right_margin = 40,
104 .hsync_len = 128,
105 .upper_margin = 20,
106 .lower_margin = 5,
107 .vsync_len = 5,
108 .sync = 0,
109};
110
111static struct sh_mobile_lcdc_info lcdc0_info = {
112 .clock_source = LCDC_CLK_BUS,
113 .ch[0] = {
114 .chan = LCDC_CHAN_MAINLCD,
115 .fourcc = V4L2_PIX_FMT_RGB565,
116 .interface_type = RGB24,
117 .clock_divider = 5,
118 .flags = 0,
119 .lcd_modes = &lcdc0_mode,
120 .num_modes = 1,
121 .panel_cfg = {
122 .width = 111,
123 .height = 68,
124 },
125 },
126};
127
128static struct resource lcdc0_resources[] = {
129 [0] = {
130 .name = "LCD0",
131 .start = 0xfe940000,
132 .end = 0xfe943fff,
133 .flags = IORESOURCE_MEM,
134 },
135 [1] = {
136 .start = intcs_evt2irq(0x580),
137 .flags = IORESOURCE_IRQ,
138 },
139};
140
141static struct platform_device lcdc0_device = {
142 .name = "sh_mobile_lcdc_fb",
143 .num_resources = ARRAY_SIZE(lcdc0_resources),
144 .resource = lcdc0_resources,
145 .id = 0,
146 .dev = {
147 .platform_data = &lcdc0_info,
148 .coherent_dma_mask = ~0,
149 },
150};
151
4d22e564
KM
152/*
153 * board devices
154 */
155static struct platform_device *eva_devices[] __initdata = {
dad29d1c 156 &lcdc0_device,
4d22e564
KM
157};
158
159/*
160 * board init
161 */
162static void __init eva_init(void)
163{
164 r8a7740_pinmux_init();
165
166 /* SCIFA1 */
167 gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
168 gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
169
dad29d1c
KM
170 /* LCDC0 */
171 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
172 gpio_request(GPIO_FN_LCD0_D0, NULL);
173 gpio_request(GPIO_FN_LCD0_D1, NULL);
174 gpio_request(GPIO_FN_LCD0_D2, NULL);
175 gpio_request(GPIO_FN_LCD0_D3, NULL);
176 gpio_request(GPIO_FN_LCD0_D4, NULL);
177 gpio_request(GPIO_FN_LCD0_D5, NULL);
178 gpio_request(GPIO_FN_LCD0_D6, NULL);
179 gpio_request(GPIO_FN_LCD0_D7, NULL);
180 gpio_request(GPIO_FN_LCD0_D8, NULL);
181 gpio_request(GPIO_FN_LCD0_D9, NULL);
182 gpio_request(GPIO_FN_LCD0_D10, NULL);
183 gpio_request(GPIO_FN_LCD0_D11, NULL);
184 gpio_request(GPIO_FN_LCD0_D12, NULL);
185 gpio_request(GPIO_FN_LCD0_D13, NULL);
186 gpio_request(GPIO_FN_LCD0_D14, NULL);
187 gpio_request(GPIO_FN_LCD0_D15, NULL);
188 gpio_request(GPIO_FN_LCD0_D16, NULL);
189 gpio_request(GPIO_FN_LCD0_D17, NULL);
190 gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
191 gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
192 gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
193 gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
194 gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
195 gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
196 gpio_request(GPIO_FN_LCD0_DCK, NULL);
197 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
198 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
199 gpio_request(GPIO_FN_LCD0_DISP, NULL);
200 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
201
202 gpio_request(GPIO_PORT61, NULL); /* LCDDON */
203 gpio_direction_output(GPIO_PORT61, 1);
204
205 gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
206 gpio_direction_output(GPIO_PORT202, 0);
207
208 /*
209 * CAUTION
210 *
211 * DBGMD/LCDC0/FSIA MUX
212 * DBGMD_SELECT_B should be set after setting PFC Function.
213 */
214 gpio_request(GPIO_PORT176, NULL);
215 gpio_direction_output(GPIO_PORT176, 1);
216
4d22e564
KM
217#ifdef CONFIG_CACHE_L2X0
218 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
219 l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
220#endif
221
222 r8a7740_add_standard_devices();
223
224 platform_add_devices(eva_devices,
225 ARRAY_SIZE(eva_devices));
226}
227
228static void __init eva_earlytimer_init(void)
229{
230 struct clk *xtal1;
231
232 r8a7740_clock_init(MD_CK0 | MD_CK2);
233
234 xtal1 = clk_get(NULL, "extal1");
235 if (!IS_ERR(xtal1)) {
236 /* armadillo 800 eva extal1 is 24MHz */
237 clk_set_rate(xtal1, 24000000);
238 clk_put(xtal1);
239 }
240
241 shmobile_earlytimer_init();
242}
243
244static void __init eva_add_early_devices(void)
245{
246 r8a7740_add_early_devices();
247
248 /* override timer setup with board-specific code */
249 shmobile_timer.init = eva_earlytimer_init;
250}
251
252MACHINE_START(ARMADILLO800EVA, "armadillo800eva")
253 .map_io = r8a7740_map_io,
254 .init_early = eva_add_early_devices,
255 .init_irq = r8a7740_init_irq,
256 .handle_irq = shmobile_handle_irq_intc,
257 .init_machine = eva_init,
258 .timer = &shmobile_timer,
259MACHINE_END
This page took 0.039766 seconds and 5 git commands to generate.