aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-ag5evm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-shmobile/board-ag5evm.c')
-rw-r--r--arch/arm/mach-shmobile/board-ag5evm.c180
1 files changed, 178 insertions, 2 deletions
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index c18a740a4159..2123b96b5638 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -34,9 +34,10 @@
34#include <linux/input/sh_keysc.h> 34#include <linux/input/sh_keysc.h>
35#include <linux/mmc/host.h> 35#include <linux/mmc/host.h>
36#include <linux/mmc/sh_mmcif.h> 36#include <linux/mmc/sh_mmcif.h>
37 37#include <linux/sh_clk.h>
38#include <video/sh_mobile_lcdc.h>
39#include <video/sh_mipi_dsi.h>
38#include <sound/sh_fsi.h> 40#include <sound/sh_fsi.h>
39
40#include <mach/hardware.h> 41#include <mach/hardware.h>
41#include <mach/sh73a0.h> 42#include <mach/sh73a0.h>
42#include <mach/common.h> 43#include <mach/common.h>
@@ -183,11 +184,165 @@ static struct platform_device mmc_device = {
183 .resource = sh_mmcif_resources, 184 .resource = sh_mmcif_resources,
184}; 185};
185 186
187/* IrDA */
188static struct resource irda_resources[] = {
189 [0] = {
190 .start = 0xE6D00000,
191 .end = 0xE6D01FD4 - 1,
192 .flags = IORESOURCE_MEM,
193 },
194 [1] = {
195 .start = gic_spi(95),
196 .flags = IORESOURCE_IRQ,
197 },
198};
199
200static struct platform_device irda_device = {
201 .name = "sh_irda",
202 .id = 0,
203 .resource = irda_resources,
204 .num_resources = ARRAY_SIZE(irda_resources),
205};
206
207static unsigned char lcd_backlight_seq[3][2] = {
208 { 0x04, 0x07 },
209 { 0x23, 0x80 },
210 { 0x03, 0x01 },
211};
212
213static void lcd_backlight_on(void)
214{
215 struct i2c_adapter *a;
216 struct i2c_msg msg;
217 int k;
218
219 a = i2c_get_adapter(1);
220 for (k = 0; a && k < 3; k++) {
221 msg.addr = 0x6d;
222 msg.buf = &lcd_backlight_seq[k][0];
223 msg.len = 2;
224 msg.flags = 0;
225 if (i2c_transfer(a, &msg, 1) != 1)
226 break;
227 }
228}
229
230static void lcd_backlight_reset(void)
231{
232 gpio_set_value(GPIO_PORT235, 0);
233 mdelay(24);
234 gpio_set_value(GPIO_PORT235, 1);
235}
236
237static void lcd_on(void *board_data, struct fb_info *info)
238{
239 lcd_backlight_on();
240}
241
242static void lcd_off(void *board_data)
243{
244 lcd_backlight_reset();
245}
246
247/* LCDC0 */
248static const struct fb_videomode lcdc0_modes[] = {
249 {
250 .name = "R63302(QHD)",
251 .xres = 544,
252 .yres = 961,
253 .left_margin = 72,
254 .right_margin = 600,
255 .hsync_len = 16,
256 .upper_margin = 8,
257 .lower_margin = 8,
258 .vsync_len = 2,
259 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
260 },
261};
262
263static struct sh_mobile_lcdc_info lcdc0_info = {
264 .clock_source = LCDC_CLK_PERIPHERAL,
265 .ch[0] = {
266 .chan = LCDC_CHAN_MAINLCD,
267 .interface_type = RGB24,
268 .clock_divider = 1,
269 .flags = LCDC_FLAGS_DWPOL,
270 .lcd_size_cfg.width = 44,
271 .lcd_size_cfg.height = 79,
272 .bpp = 16,
273 .lcd_cfg = lcdc0_modes,
274 .num_cfg = ARRAY_SIZE(lcdc0_modes),
275 .board_cfg = {
276 .display_on = lcd_on,
277 .display_off = lcd_off,
278 },
279 }
280};
281
282static struct resource lcdc0_resources[] = {
283 [0] = {
284 .name = "LCDC0",
285 .start = 0xfe940000, /* P4-only space */
286 .end = 0xfe943fff,
287 .flags = IORESOURCE_MEM,
288 },
289 [1] = {
290 .start = intcs_evt2irq(0x580),
291 .flags = IORESOURCE_IRQ,
292 },
293};
294
295static struct platform_device lcdc0_device = {
296 .name = "sh_mobile_lcdc_fb",
297 .num_resources = ARRAY_SIZE(lcdc0_resources),
298 .resource = lcdc0_resources,
299 .id = 0,
300 .dev = {
301 .platform_data = &lcdc0_info,
302 .coherent_dma_mask = ~0,
303 },
304};
305
306/* MIPI-DSI */
307static struct resource mipidsi0_resources[] = {
308 [0] = {
309 .start = 0xfeab0000,
310 .end = 0xfeab3fff,
311 .flags = IORESOURCE_MEM,
312 },
313 [1] = {
314 .start = 0xfeab4000,
315 .end = 0xfeab7fff,
316 .flags = IORESOURCE_MEM,
317 },
318};
319
320static struct sh_mipi_dsi_info mipidsi0_info = {
321 .data_format = MIPI_RGB888,
322 .lcd_chan = &lcdc0_info.ch[0],
323 .vsynw_offset = 20,
324 .clksrc = 1,
325 .flags = SH_MIPI_DSI_HSABM,
326};
327
328static struct platform_device mipidsi0_device = {
329 .name = "sh-mipi-dsi",
330 .num_resources = ARRAY_SIZE(mipidsi0_resources),
331 .resource = mipidsi0_resources,
332 .id = 0,
333 .dev = {
334 .platform_data = &mipidsi0_info,
335 },
336};
337
186static struct platform_device *ag5evm_devices[] __initdata = { 338static struct platform_device *ag5evm_devices[] __initdata = {
187 &eth_device, 339 &eth_device,
188 &keysc_device, 340 &keysc_device,
189 &fsi_device, 341 &fsi_device,
190 &mmc_device, 342 &mmc_device,
343 &irda_device,
344 &lcdc0_device,
345 &mipidsi0_device,
191}; 346};
192 347
193static struct map_desc ag5evm_io_desc[] __initdata = { 348static struct map_desc ag5evm_io_desc[] __initdata = {
@@ -224,6 +379,8 @@ void __init ag5evm_init_irq(void)
224 __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A); 379 __raw_writew(__raw_readw(PINTCR0A) | (2<<10), PINTCR0A);
225} 380}
226 381
382#define DSI0PHYCR 0xe615006c
383
227static void __init ag5evm_init(void) 384static void __init ag5evm_init(void)
228{ 385{
229 sh73a0_pinmux_init(); 386 sh73a0_pinmux_init();
@@ -287,6 +444,25 @@ static void __init ag5evm_init(void)
287 gpio_request(GPIO_FN_FSIAISLD, NULL); 444 gpio_request(GPIO_FN_FSIAISLD, NULL);
288 gpio_request(GPIO_FN_FSIAOSLD, NULL); 445 gpio_request(GPIO_FN_FSIAOSLD, NULL);
289 446
447 /* IrDA */
448 gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL);
449 gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL);
450 gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL);
451
452 /* LCD panel */
453 gpio_request(GPIO_PORT217, NULL); /* RESET */
454 gpio_direction_output(GPIO_PORT217, 0);
455 mdelay(1);
456 gpio_set_value(GPIO_PORT217, 1);
457
458 /* LCD backlight controller */
459 gpio_request(GPIO_PORT235, NULL); /* RESET */
460 gpio_direction_output(GPIO_PORT235, 0);
461 lcd_backlight_reset();
462
463 /* MIPI-DSI clock setup */
464 __raw_writel(0x2a809010, DSI0PHYCR);
465
290#ifdef CONFIG_CACHE_L2X0 466#ifdef CONFIG_CACHE_L2X0
291 /* Shared attribute override enable, 64K*8way */ 467 /* Shared attribute override enable, 64K*8way */
292 l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff); 468 l2x0_init(__io(0xf0100000), 0x00460000, 0xc2000fff);