aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2010-06-03 23:15:09 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-08-04 02:32:46 -0400
commit9fa1b7fe716d0a0fb1629e0b95efd4ee47e380e1 (patch)
tree42498b0e24939424c98971e0024f9325b2c88377 /arch
parent701ec7a7b04a62c74ab1b83b59a3fd35c0ba5fdb (diff)
ARM: mach-shmobile: ap4evb: Add LCD panel selection
On AP4EVB board, it is possible to select LCD panel type which are parallel or MIPI by SW3, SW43 dip-switch. This patch add parallel LCD settings and select menu to Kconfig. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/Kconfig13
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c346
2 files changed, 227 insertions, 132 deletions
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index a87f26121dba..54b479c35ee0 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -44,6 +44,19 @@ config MACH_AP4EVB
44 select ARCH_REQUIRE_GPIOLIB 44 select ARCH_REQUIRE_GPIOLIB
45 select SH_LCD_MIPI_DSI 45 select SH_LCD_MIPI_DSI
46 46
47choice
48 prompt "AP4EVB LCD panel selection"
49 default AP4EVB_QHD
50 depends on MACH_AP4EVB
51
52config AP4EVB_QHD
53 bool "MIPI-DSI QHD (960x540)"
54
55config AP4EVB_WVGA
56 bool "Parallel WVGA (800x480)"
57
58endchoice
59
47comment "SH-Mobile System Configuration" 60comment "SH-Mobile System Configuration"
48 61
49menu "Memory configuration" 62menu "Memory configuration"
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 5d24d4ec93a7..e8a9d7990d34 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -101,14 +101,20 @@
101/* 101/*
102 * LCD / IRQ / KEYSC / IrDA 102 * LCD / IRQ / KEYSC / IrDA
103 * 103 *
104 * IRQ = IRQ26 (TS), IRQ27 (VIO), IRQ28 (TouchScreen) 104 * IRQ = IRQ26 (TS), IRQ27 (VIO), IRQ28 (QHD-TouchScreen)
105 * LCD = 2nd LCDC 105 * LCD = 2nd LCDC (WVGA)
106 * 106 *
107 * | SW43 | 107 * | SW43 |
108 * SW3 | ON | OFF | 108 * SW3 | ON | OFF |
109 * -------------+-----------------------+---------------+ 109 * -------------+-----------------------+---------------+
110 * ON | KEY / IrDA | LCD | 110 * ON | KEY / IrDA | LCD |
111 * OFF | KEY / IrDA / IRQ | IRQ | 111 * OFF | KEY / IrDA / IRQ | IRQ |
112 *
113 *
114 * QHD / WVGA display
115 *
116 * You can choice display type on menuconfig.
117 * Then, check above dip-switch.
112 */ 118 */
113 119
114/* 120/*
@@ -226,43 +232,6 @@ static struct platform_device smc911x_device = {
226 }, 232 },
227}; 233};
228 234
229/* KEYSC (Needs SW43 set to ON) */
230static struct sh_keysc_info keysc_info = {
231 .mode = SH_KEYSC_MODE_1,
232 .scan_timing = 3,
233 .delay = 2500,
234 .keycodes = {
235 KEY_0, KEY_1, KEY_2, KEY_3, KEY_4,
236 KEY_5, KEY_6, KEY_7, KEY_8, KEY_9,
237 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
238 KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
239 KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
240 },
241};
242
243static struct resource keysc_resources[] = {
244 [0] = {
245 .name = "KEYSC",
246 .start = 0xe61b0000,
247 .end = 0xe61b0063,
248 .flags = IORESOURCE_MEM,
249 },
250 [1] = {
251 .start = evt2irq(0x0be0), /* KEYSC_KEY */
252 .flags = IORESOURCE_IRQ,
253 },
254};
255
256static struct platform_device keysc_device = {
257 .name = "sh_keysc",
258 .id = 0, /* "keysc0" clock */
259 .num_resources = ARRAY_SIZE(keysc_resources),
260 .resource = keysc_resources,
261 .dev = {
262 .platform_data = &keysc_info,
263 },
264};
265
266/* SH_MMCIF */ 235/* SH_MMCIF */
267static struct resource sh_mmcif_resources[] = { 236static struct resource sh_mmcif_resources[] = {
268 [0] = { 237 [0] = {
@@ -402,30 +371,10 @@ static struct platform_device usb1_host_device = {
402 .resource = usb1_host_resources, 371 .resource = usb1_host_resources,
403}; 372};
404 373
405static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { 374static struct sh_mobile_lcdc_info lcdc_info = {
406 .clock_source = LCDC_CLK_PERIPHERAL, /* One of interface clocks */
407 .ch[0] = { 375 .ch[0] = {
408 .chan = LCDC_CHAN_MAINLCD, 376 .chan = LCDC_CHAN_MAINLCD,
409 .bpp = 16, 377 .bpp = 16,
410 .interface_type = RGB24,
411 .clock_divider = 1,
412 .flags = LCDC_FLAGS_DWPOL,
413 .lcd_cfg = {
414 .name = "R63302(QHD)",
415 .xres = 544,
416 .yres = 961,
417 .left_margin = 72,
418 .right_margin = 600,
419 .hsync_len = 16,
420 .upper_margin = 8,
421 .lower_margin = 8,
422 .vsync_len = 2,
423 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
424 },
425 .lcd_size_cfg = {
426 .width = 44,
427 .height = 79,
428 },
429 } 378 }
430}; 379};
431 380
@@ -447,11 +396,54 @@ static struct platform_device lcdc_device = {
447 .num_resources = ARRAY_SIZE(lcdc_resources), 396 .num_resources = ARRAY_SIZE(lcdc_resources),
448 .resource = lcdc_resources, 397 .resource = lcdc_resources,
449 .dev = { 398 .dev = {
450 .platform_data = &sh_mobile_lcdc_info, 399 .platform_data = &lcdc_info,
451 .coherent_dma_mask = ~0, 400 .coherent_dma_mask = ~0,
452 }, 401 },
453}; 402};
454 403
404/*
405 * QHD display
406 */
407#ifdef CONFIG_AP4EVB_QHD
408
409/* KEYSC (Needs SW43 set to ON) */
410static struct sh_keysc_info keysc_info = {
411 .mode = SH_KEYSC_MODE_1,
412 .scan_timing = 3,
413 .delay = 2500,
414 .keycodes = {
415 KEY_0, KEY_1, KEY_2, KEY_3, KEY_4,
416 KEY_5, KEY_6, KEY_7, KEY_8, KEY_9,
417 KEY_A, KEY_B, KEY_C, KEY_D, KEY_E,
418 KEY_F, KEY_G, KEY_H, KEY_I, KEY_J,
419 KEY_K, KEY_L, KEY_M, KEY_N, KEY_O,
420 },
421};
422
423static struct resource keysc_resources[] = {
424 [0] = {
425 .name = "KEYSC",
426 .start = 0xe61b0000,
427 .end = 0xe61b0063,
428 .flags = IORESOURCE_MEM,
429 },
430 [1] = {
431 .start = evt2irq(0x0be0), /* KEYSC_KEY */
432 .flags = IORESOURCE_IRQ,
433 },
434};
435
436static struct platform_device keysc_device = {
437 .name = "sh_keysc",
438 .id = 0, /* "keysc0" clock */
439 .num_resources = ARRAY_SIZE(keysc_resources),
440 .resource = keysc_resources,
441 .dev = {
442 .platform_data = &keysc_info,
443 },
444};
445
446/* MIPI-DSI */
455static struct resource mipidsi0_resources[] = { 447static struct resource mipidsi0_resources[] = {
456 [0] = { 448 [0] = {
457 .start = 0xffc60000, 449 .start = 0xffc60000,
@@ -462,7 +454,7 @@ static struct resource mipidsi0_resources[] = {
462 454
463static struct sh_mipi_dsi_info mipidsi0_info = { 455static struct sh_mipi_dsi_info mipidsi0_info = {
464 .data_format = MIPI_RGB888, 456 .data_format = MIPI_RGB888,
465 .lcd_chan = &sh_mobile_lcdc_info.ch[0], 457 .lcd_chan = &lcdc_info.ch[0],
466}; 458};
467 459
468static struct platform_device mipidsi0_device = { 460static struct platform_device mipidsi0_device = {
@@ -475,6 +467,50 @@ static struct platform_device mipidsi0_device = {
475 }, 467 },
476}; 468};
477 469
470/* This function will disappear when we switch to (runtime) PM */
471static int __init ap4evb_init_display_clk(void)
472{
473 struct clk *lcdc_clk;
474 struct clk *dsitx_clk;
475 int ret;
476
477 lcdc_clk = clk_get(&lcdc_device.dev, "sh_mobile_lcdc_fb.0");
478 if (IS_ERR(lcdc_clk))
479 return PTR_ERR(lcdc_clk);
480
481 dsitx_clk = clk_get(&mipidsi0_device.dev, "sh-mipi-dsi.0");
482 if (IS_ERR(dsitx_clk)) {
483 ret = PTR_ERR(dsitx_clk);
484 goto eclkdsitxget;
485 }
486
487 ret = clk_enable(lcdc_clk);
488 if (ret < 0)
489 goto eclklcdcon;
490
491 ret = clk_enable(dsitx_clk);
492 if (ret < 0)
493 goto eclkdsitxon;
494
495 return 0;
496
497eclkdsitxon:
498 clk_disable(lcdc_clk);
499eclklcdcon:
500 clk_put(dsitx_clk);
501eclkdsitxget:
502 clk_put(lcdc_clk);
503
504 return ret;
505}
506device_initcall(ap4evb_init_display_clk);
507
508static struct platform_device *qhd_devices[] __initdata = {
509 &mipidsi0_device,
510 &keysc_device,
511};
512#endif /* CONFIG_AP4EVB_QHD */
513
478/* FSI */ 514/* FSI */
479#define IRQ_FSI evt2irq(0x1840) 515#define IRQ_FSI evt2irq(0x1840)
480#define FSIACKCR 0xE6150018 516#define FSIACKCR 0xE6150018
@@ -532,23 +568,29 @@ static struct platform_device fsi_device = {
532static struct platform_device *ap4evb_devices[] __initdata = { 568static struct platform_device *ap4evb_devices[] __initdata = {
533 &nor_flash_device, 569 &nor_flash_device,
534 &smc911x_device, 570 &smc911x_device,
535 &keysc_device,
536 &sdhi0_device, 571 &sdhi0_device,
537 &sdhi1_device, 572 &sdhi1_device,
538 &usb1_host_device, 573 &usb1_host_device,
539 &lcdc_device, 574 &lcdc_device,
540 &mipidsi0_device,
541 &fsi_device, 575 &fsi_device,
542 &sh_mmcif_device 576 &sh_mmcif_device
543}; 577};
544 578
545/* TouchScreen (Needs SW3 set to OFF) */ 579/* TouchScreen */
546#define IRQ28 evt2irq(0x3380) /* IRQ28A */ 580#define IRQ28 evt2irq(0x3380) /* IRQ28A */
581#define IRQ7 evt2irq(0x02e0) /* IRQ7A */
547static struct tsc2007_platform_data tsc2007_info = { 582static struct tsc2007_platform_data tsc2007_info = {
548 .model = 2007, 583 .model = 2007,
549 .x_plate_ohms = 180, 584 .x_plate_ohms = 180,
550}; 585};
551 586
587static struct i2c_board_info tsc_device = {
588 I2C_BOARD_INFO("tsc2007", 0x48),
589 .type = "tsc2007",
590 .platform_data = &tsc2007_info,
591 /*.irq is selected on ap4evb_init */
592};
593
552/* I2C */ 594/* I2C */
553static struct i2c_board_info i2c0_devices[] = { 595static struct i2c_board_info i2c0_devices[] = {
554 { 596 {
@@ -560,12 +602,6 @@ static struct i2c_board_info i2c1_devices[] = {
560 { 602 {
561 I2C_BOARD_INFO("r2025sd", 0x32), 603 I2C_BOARD_INFO("r2025sd", 0x32),
562 }, 604 },
563 {
564 I2C_BOARD_INFO("tsc2007", 0x48),
565 .type = "tsc2007",
566 .platform_data = &tsc2007_info,
567 .irq = IRQ28,
568 },
569}; 605};
570 606
571static struct map_desc ap4evb_io_desc[] __initdata = { 607static struct map_desc ap4evb_io_desc[] __initdata = {
@@ -589,45 +625,6 @@ static void __init ap4evb_map_io(void)
589 shmobile_setup_console(); 625 shmobile_setup_console();
590} 626}
591 627
592/* This function will disappear when we switch to (runtime) PM */
593static int __init ap4evb_init_display_clk(void)
594{
595 struct clk *lcdc_clk;
596 struct clk *dsitx_clk;
597 int ret;
598
599 lcdc_clk = clk_get(&lcdc_device.dev, "sh_mobile_lcdc_fb.0");
600 if (IS_ERR(lcdc_clk))
601 return PTR_ERR(lcdc_clk);
602
603 dsitx_clk = clk_get(&mipidsi0_device.dev, "sh-mipi-dsi.0");
604 if (IS_ERR(dsitx_clk)) {
605 ret = PTR_ERR(dsitx_clk);
606 goto eclkdsitxget;
607 }
608
609 ret = clk_enable(lcdc_clk);
610 if (ret < 0)
611 goto eclklcdcon;
612
613 ret = clk_enable(dsitx_clk);
614 if (ret < 0)
615 goto eclkdsitxon;
616
617 return 0;
618
619eclkdsitxon:
620 clk_disable(lcdc_clk);
621eclklcdcon:
622 clk_put(dsitx_clk);
623eclkdsitxget:
624 clk_put(lcdc_clk);
625
626 return ret;
627}
628
629device_initcall(ap4evb_init_display_clk);
630
631/* 628/*
632 * FIXME !! 629 * FIXME !!
633 * 630 *
@@ -687,18 +684,6 @@ static void __init ap4evb_init(void)
687 gpio_export(GPIO_PORT34, 0); 684 gpio_export(GPIO_PORT34, 0);
688 gpio_export(GPIO_PORT35, 0); 685 gpio_export(GPIO_PORT35, 0);
689 686
690 /* enable KEYSC */
691 gpio_request(GPIO_FN_KEYOUT0, NULL);
692 gpio_request(GPIO_FN_KEYOUT1, NULL);
693 gpio_request(GPIO_FN_KEYOUT2, NULL);
694 gpio_request(GPIO_FN_KEYOUT3, NULL);
695 gpio_request(GPIO_FN_KEYOUT4, NULL);
696 gpio_request(GPIO_FN_KEYIN0_136, NULL);
697 gpio_request(GPIO_FN_KEYIN1_135, NULL);
698 gpio_request(GPIO_FN_KEYIN2_134, NULL);
699 gpio_request(GPIO_FN_KEYIN3_133, NULL);
700 gpio_request(GPIO_FN_KEYIN4, NULL);
701
702 /* SDHI0 */ 687 /* SDHI0 */
703 gpio_request(GPIO_FN_SDHICD0, NULL); 688 gpio_request(GPIO_FN_SDHICD0, NULL);
704 gpio_request(GPIO_FN_SDHIWP0, NULL); 689 gpio_request(GPIO_FN_SDHIWP0, NULL);
@@ -709,9 +694,13 @@ static void __init ap4evb_init(void)
709 gpio_request(GPIO_FN_SDHID0_1, NULL); 694 gpio_request(GPIO_FN_SDHID0_1, NULL);
710 gpio_request(GPIO_FN_SDHID0_0, NULL); 695 gpio_request(GPIO_FN_SDHID0_0, NULL);
711 696
712 /* enable TouchScreen */ 697 /* SDHI1 */
713 gpio_request(GPIO_FN_IRQ28_123, NULL); 698 gpio_request(GPIO_FN_SDHICMD1, NULL);
714 set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW); 699 gpio_request(GPIO_FN_SDHICLK1, NULL);
700 gpio_request(GPIO_FN_SDHID1_3, NULL);
701 gpio_request(GPIO_FN_SDHID1_2, NULL);
702 gpio_request(GPIO_FN_SDHID1_1, NULL);
703 gpio_request(GPIO_FN_SDHID1_0, NULL);
715 704
716 /* MMCIF */ 705 /* MMCIF */
717 gpio_request(GPIO_FN_MMCD0_0, NULL); 706 gpio_request(GPIO_FN_MMCD0_0, NULL);
@@ -777,13 +766,106 @@ static void __init ap4evb_init(void)
777 i2c_register_board_info(1, i2c1_devices, 766 i2c_register_board_info(1, i2c1_devices,
778 ARRAY_SIZE(i2c1_devices)); 767 ARRAY_SIZE(i2c1_devices));
779 768
780 /* SDHI1 */ 769#ifdef CONFIG_AP4EVB_QHD
781 gpio_request(GPIO_FN_SDHICMD1, NULL); 770 /*
782 gpio_request(GPIO_FN_SDHICLK1, NULL); 771 * QHD
783 gpio_request(GPIO_FN_SDHID1_3, NULL); 772 */
784 gpio_request(GPIO_FN_SDHID1_2, NULL); 773
785 gpio_request(GPIO_FN_SDHID1_1, NULL); 774 /* enable KEYSC */
786 gpio_request(GPIO_FN_SDHID1_0, NULL); 775 gpio_request(GPIO_FN_KEYOUT0, NULL);
776 gpio_request(GPIO_FN_KEYOUT1, NULL);
777 gpio_request(GPIO_FN_KEYOUT2, NULL);
778 gpio_request(GPIO_FN_KEYOUT3, NULL);
779 gpio_request(GPIO_FN_KEYOUT4, NULL);
780 gpio_request(GPIO_FN_KEYIN0_136, NULL);
781 gpio_request(GPIO_FN_KEYIN1_135, NULL);
782 gpio_request(GPIO_FN_KEYIN2_134, NULL);
783 gpio_request(GPIO_FN_KEYIN3_133, NULL);
784 gpio_request(GPIO_FN_KEYIN4, NULL);
785
786 /* enable TouchScreen */
787 gpio_request(GPIO_FN_IRQ28_123, NULL);
788 set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW);
789
790 tsc_device.irq = IRQ28;
791 i2c_register_board_info(1, &tsc_device, 1);
792
793 /* LCDC0 */
794 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
795 lcdc_info.ch[0].interface_type = RGB24;
796 lcdc_info.ch[0].clock_divider = 1;
797 lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
798 lcdc_info.ch[0].lcd_cfg.name = "R63302(QHD)";
799 lcdc_info.ch[0].lcd_cfg.xres = 544;
800 lcdc_info.ch[0].lcd_cfg.yres = 961;
801 lcdc_info.ch[0].lcd_cfg.left_margin = 72;
802 lcdc_info.ch[0].lcd_cfg.right_margin = 600;
803 lcdc_info.ch[0].lcd_cfg.hsync_len = 16;
804 lcdc_info.ch[0].lcd_cfg.upper_margin = 8;
805 lcdc_info.ch[0].lcd_cfg.lower_margin = 8;
806 lcdc_info.ch[0].lcd_cfg.vsync_len = 2;
807 lcdc_info.ch[0].lcd_cfg.sync = FB_SYNC_VERT_HIGH_ACT |
808 FB_SYNC_HOR_HIGH_ACT;
809 lcdc_info.ch[0].lcd_size_cfg.width = 44;
810 lcdc_info.ch[0].lcd_size_cfg.height = 79;
811
812 platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices));
813
814#else
815 /*
816 * WVGA
817 */
818 gpio_request(GPIO_FN_LCDD17, NULL);
819 gpio_request(GPIO_FN_LCDD16, NULL);
820 gpio_request(GPIO_FN_LCDD15, NULL);
821 gpio_request(GPIO_FN_LCDD14, NULL);
822 gpio_request(GPIO_FN_LCDD13, NULL);
823 gpio_request(GPIO_FN_LCDD12, NULL);
824 gpio_request(GPIO_FN_LCDD11, NULL);
825 gpio_request(GPIO_FN_LCDD10, NULL);
826 gpio_request(GPIO_FN_LCDD9, NULL);
827 gpio_request(GPIO_FN_LCDD8, NULL);
828 gpio_request(GPIO_FN_LCDD7, NULL);
829 gpio_request(GPIO_FN_LCDD6, NULL);
830 gpio_request(GPIO_FN_LCDD5, NULL);
831 gpio_request(GPIO_FN_LCDD4, NULL);
832 gpio_request(GPIO_FN_LCDD3, NULL);
833 gpio_request(GPIO_FN_LCDD2, NULL);
834 gpio_request(GPIO_FN_LCDD1, NULL);
835 gpio_request(GPIO_FN_LCDD0, NULL);
836 gpio_request(GPIO_FN_LCDDISP, NULL);
837 gpio_request(GPIO_FN_LCDDCK, NULL);
838
839 gpio_request(GPIO_PORT189, NULL); /* backlight */
840 gpio_direction_output(GPIO_PORT189, 1);
841
842 gpio_request(GPIO_PORT151, NULL); /* LCDDON */
843 gpio_direction_output(GPIO_PORT151, 1);
844
845 lcdc_info.clock_source = LCDC_CLK_BUS;
846 lcdc_info.ch[0].interface_type = RGB18;
847 lcdc_info.ch[0].clock_divider = 2;
848 lcdc_info.ch[0].flags = 0;
849 lcdc_info.ch[0].lcd_cfg.name = "WVGA Panel";
850 lcdc_info.ch[0].lcd_cfg.xres = 800;
851 lcdc_info.ch[0].lcd_cfg.yres = 480;
852 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
853 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
854 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
855 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
856 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
857 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
858 lcdc_info.ch[0].lcd_cfg.sync = 0;
859 lcdc_info.ch[0].lcd_size_cfg.width = 152;
860 lcdc_info.ch[0].lcd_size_cfg.height = 91;
861
862 /* enable TouchScreen */
863 gpio_request(GPIO_FN_IRQ7_40, NULL);
864 set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
865
866 tsc_device.irq = IRQ7;
867 i2c_register_board_info(0, &tsc_device, 1);
868#endif /* CONFIG_AP4EVB_QHD */
787 869
788 sh7372_add_standard_devices(); 870 sh7372_add_standard_devices();
789 871