4 * Copyright (C) 2010 Magnus Damm
5 * Copyright (C) 2008 Yoshihiro Shimoda
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.
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.
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
20 #include <linux/clk.h>
21 #include <linux/kernel.h>
22 #include <linux/init.h>
23 #include <linux/interrupt.h>
24 #include <linux/irq.h>
25 #include <linux/platform_device.h>
26 #include <linux/delay.h>
27 #include <linux/mfd/sh_mobile_sdhi.h>
28 #include <linux/mmc/host.h>
29 #include <linux/mtd/mtd.h>
30 #include <linux/mtd/partitions.h>
31 #include <linux/mtd/physmap.h>
32 #include <linux/mmc/host.h>
33 #include <linux/mmc/sh_mmcif.h>
34 #include <linux/i2c.h>
35 #include <linux/i2c/tsc2007.h>
37 #include <linux/smsc911x.h>
38 #include <linux/sh_intc.h>
39 #include <linux/sh_clk.h>
40 #include <linux/gpio.h>
41 #include <linux/input.h>
42 #include <linux/input/sh_keysc.h>
43 #include <linux/usb/r8a66597.h>
45 #include <sound/sh_fsi.h>
47 #include <video/sh_mobile_lcdc.h>
48 #include <video/sh_mipi_dsi.h>
50 #include <mach/common.h>
51 #include <mach/irqs.h>
52 #include <mach/sh7372.h>
54 #include <asm/mach-types.h>
55 #include <asm/mach/arch.h>
56 #include <asm/mach/map.h>
57 #include <asm/mach/time.h>
60 * Address Interface BusWidth note
61 * ------------------------------------------------------------------
62 * 0x0000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = ON
63 * 0x0800_0000 user area -
64 * 0x1000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = OFF
65 * 0x1400_0000 Ether (LAN9220) 16bit
66 * 0x1600_0000 user area - cannot use with NAND
67 * 0x1800_0000 user area -
69 * 0x4000_0000 LPDDR2-SDRAM (POP) 32bit
75 * SW1 | SW2 | SW7 | NOR Flash ROM
76 * bit1 | bit1 bit2 | bit1 | Memory allocation
77 * ------+------------+------+------------------
78 * OFF | ON OFF | ON | Area 0
79 * OFF | ON OFF | OFF | Area 4
85 * SW1 | SW2 | SW7 | NAND Flash ROM
86 * bit1 | bit1 bit2 | bit2 | Memory allocation
87 * ------+------------+------+------------------
88 * OFF | ON OFF | ON | FCE 0
89 * OFF | ON OFF | OFF | FCE 1
96 * -----------------------
102 * LCD / IRQ / KEYSC / IrDA
104 * IRQ = IRQ26 (TS), IRQ27 (VIO), IRQ28 (QHD-TouchScreen)
105 * LCD = 2nd LCDC (WVGA)
109 * -------------+-----------------------+---------------+
110 * ON | KEY / IrDA | LCD |
111 * OFF | KEY / IrDA / IRQ | IRQ |
116 * You can choice display type on menuconfig.
117 * Then, check above dip-switch.
123 * J7 : 1-2 MAX3355E VBUS
132 * SW41 : ON : SH-Mobile AP4 Audio Mode
133 * : OFF : Bluetooth Audio Mode
139 * J22 : select card voltage
144 * | bit1 | bit2 | bit3 | bit4
145 * ------------+------+------+------+-------
146 * MMC0 OFF | OFF | ON | ON | X
147 * SDHI1 OFF | ON | X | OFF | ON
155 static struct mtd_partition nor_flash_partitions[] = {
158 .offset = 0x00000000,
163 .offset = MTDPART_OFS_APPEND,
168 .offset = MTDPART_OFS_APPEND,
169 .size = 8 * 1024 * 1024,
170 .mask_flags = MTD_WRITEABLE,
174 .offset = MTDPART_OFS_APPEND,
175 .size = 8 * 1024 * 1024,
179 .offset = MTDPART_OFS_APPEND,
180 .size = MTDPART_SIZ_FULL,
184 static struct physmap_flash_data nor_flash_data = {
186 .parts = nor_flash_partitions,
187 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
190 static struct resource nor_flash_resources[] = {
193 .end = 0x08000000 - 1,
194 .flags = IORESOURCE_MEM,
198 static struct platform_device nor_flash_device = {
199 .name = "physmap-flash",
201 .platform_data = &nor_flash_data,
203 .num_resources = ARRAY_SIZE(nor_flash_resources),
204 .resource = nor_flash_resources,
208 static struct resource smc911x_resources[] = {
211 .end = 0x16000000 - 1,
212 .flags = IORESOURCE_MEM,
214 .start = evt2irq(0x02c0) /* IRQ6A */,
215 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
219 static struct smsc911x_platform_config smsc911x_info = {
220 .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
221 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
222 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
225 static struct platform_device smc911x_device = {
228 .num_resources = ARRAY_SIZE(smc911x_resources),
229 .resource = smc911x_resources,
231 .platform_data = &smsc911x_info,
236 static struct resource sh_mmcif_resources[] = {
241 .flags = IORESOURCE_MEM,
245 .start = evt2irq(0x1ac0),
246 .flags = IORESOURCE_IRQ,
250 .start = evt2irq(0x1ae0),
251 .flags = IORESOURCE_IRQ,
255 static struct sh_mmcif_plat_data sh_mmcif_plat = {
257 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
258 .caps = MMC_CAP_4_BIT_DATA |
263 static struct platform_device sh_mmcif_device = {
268 .coherent_dma_mask = 0xffffffff,
269 .platform_data = &sh_mmcif_plat,
271 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
272 .resource = sh_mmcif_resources,
276 static struct sh_mobile_sdhi_info sdhi0_info = {
277 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
278 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
281 static struct resource sdhi0_resources[] = {
286 .flags = IORESOURCE_MEM,
289 .start = evt2irq(0x0e00) /* SDHI0 */,
290 .flags = IORESOURCE_IRQ,
294 static struct platform_device sdhi0_device = {
295 .name = "sh_mobile_sdhi",
296 .num_resources = ARRAY_SIZE(sdhi0_resources),
297 .resource = sdhi0_resources,
300 .platform_data = &sdhi0_info,
305 static struct sh_mobile_sdhi_info sdhi1_info = {
306 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
307 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
308 .tmio_ocr_mask = MMC_VDD_165_195,
311 static struct resource sdhi1_resources[] = {
316 .flags = IORESOURCE_MEM,
319 .start = evt2irq(0x0e80),
320 .flags = IORESOURCE_IRQ,
324 static struct platform_device sdhi1_device = {
325 .name = "sh_mobile_sdhi",
326 .num_resources = ARRAY_SIZE(sdhi1_resources),
327 .resource = sdhi1_resources,
330 .platform_data = &sdhi1_info,
335 static void usb1_host_port_power(int port, int power)
337 if (!power) /* only power-on supported for now */
340 /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
341 __raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008);
344 static struct r8a66597_platdata usb1_host_data = {
346 .port_power = usb1_host_port_power,
349 static struct resource usb1_host_resources[] = {
353 .end = 0xE68B00E6 - 1,
354 .flags = IORESOURCE_MEM,
357 .start = evt2irq(0x1ce0) /* USB1_USB1I0 */,
358 .flags = IORESOURCE_IRQ,
362 static struct platform_device usb1_host_device = {
363 .name = "r8a66597_hcd",
366 .dma_mask = NULL, /* not use dma */
367 .coherent_dma_mask = 0xffffffff,
368 .platform_data = &usb1_host_data,
370 .num_resources = ARRAY_SIZE(usb1_host_resources),
371 .resource = usb1_host_resources,
374 static struct sh_mobile_lcdc_info lcdc_info = {
376 .chan = LCDC_CHAN_MAINLCD,
381 static struct resource lcdc_resources[] = {
384 .start = 0xfe940000, /* P4-only space */
386 .flags = IORESOURCE_MEM,
389 .start = intcs_evt2irq(0x580),
390 .flags = IORESOURCE_IRQ,
394 static struct platform_device lcdc_device = {
395 .name = "sh_mobile_lcdc_fb",
396 .num_resources = ARRAY_SIZE(lcdc_resources),
397 .resource = lcdc_resources,
399 .platform_data = &lcdc_info,
400 .coherent_dma_mask = ~0,
407 #ifdef CONFIG_AP4EVB_QHD
409 /* KEYSC (Needs SW43 set to ON) */
410 static struct sh_keysc_info keysc_info = {
411 .mode = SH_KEYSC_MODE_1,
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,
423 static struct resource keysc_resources[] = {
428 .flags = IORESOURCE_MEM,
431 .start = evt2irq(0x0be0), /* KEYSC_KEY */
432 .flags = IORESOURCE_IRQ,
436 static struct platform_device keysc_device = {
438 .id = 0, /* "keysc0" clock */
439 .num_resources = ARRAY_SIZE(keysc_resources),
440 .resource = keysc_resources,
442 .platform_data = &keysc_info,
447 static struct resource mipidsi0_resources[] = {
451 .flags = IORESOURCE_MEM,
455 static struct sh_mipi_dsi_info mipidsi0_info = {
456 .data_format = MIPI_RGB888,
457 .lcd_chan = &lcdc_info.ch[0],
460 static struct platform_device mipidsi0_device = {
461 .name = "sh-mipi-dsi",
462 .num_resources = ARRAY_SIZE(mipidsi0_resources),
463 .resource = mipidsi0_resources,
466 .platform_data = &mipidsi0_info,
470 /* This function will disappear when we switch to (runtime) PM */
471 static int __init ap4evb_init_display_clk(void)
473 struct clk *lcdc_clk;
474 struct clk *dsitx_clk;
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);
481 dsitx_clk = clk_get(&mipidsi0_device.dev, "sh-mipi-dsi.0");
482 if (IS_ERR(dsitx_clk)) {
483 ret = PTR_ERR(dsitx_clk);
487 ret = clk_enable(lcdc_clk);
491 ret = clk_enable(dsitx_clk);
498 clk_disable(lcdc_clk);
506 device_initcall(ap4evb_init_display_clk);
508 static struct platform_device *qhd_devices[] __initdata = {
512 #endif /* CONFIG_AP4EVB_QHD */
515 #define IRQ_FSI evt2irq(0x1840)
516 #define FSIACKCR 0xE6150018
517 static void fsiackcr_init(struct clk *clk)
519 u32 status = __raw_readl(clk->enable_reg);
521 /* use external clock */
522 status &= ~0x000000ff;
523 status |= 0x00000080;
524 __raw_writel(status, clk->enable_reg);
527 static struct clk_ops fsiackcr_clk_ops = {
528 .init = fsiackcr_init,
531 static struct clk fsiackcr_clk = {
532 .ops = &fsiackcr_clk_ops,
533 .enable_reg = (void __iomem *)FSIACKCR,
534 .rate = 0, /* unknown */
537 static struct sh_fsi_platform_info fsi_info = {
538 .porta_flags = SH_FSI_BRS_INV |
539 SH_FSI_OUT_SLAVE_MODE |
540 SH_FSI_IN_SLAVE_MODE |
545 static struct resource fsi_resources[] = {
549 .end = 0xFE3C0400 - 1,
550 .flags = IORESOURCE_MEM,
554 .flags = IORESOURCE_IRQ,
558 static struct platform_device fsi_device = {
561 .num_resources = ARRAY_SIZE(fsi_resources),
562 .resource = fsi_resources,
564 .platform_data = &fsi_info,
568 static struct platform_device *ap4evb_devices[] __initdata = {
586 * current gpio frame work doesn't have
587 * the method to control only pull up/down/free.
588 * this function should be replaced by correct gpio function
590 static void __init gpio_no_direction(u32 addr)
592 __raw_writeb(0x00, addr);
595 static void __init gpio_pull_up(u32 addr)
597 u8 data = __raw_readb(addr);
601 __raw_writeb(data, addr);
605 #define IRQ28 evt2irq(0x3380) /* IRQ28A */
606 #define IRQ7 evt2irq(0x02e0) /* IRQ7A */
607 static int ts_get_pendown_state(void)
611 gpio_free(GPIO_FN_IRQ28_123);
612 gpio_free(GPIO_FN_IRQ7_40);
614 gpio_request(GPIO_PORT123, NULL);
615 gpio_request(GPIO_PORT40, NULL);
617 gpio_direction_input(GPIO_PORT123);
618 gpio_direction_input(GPIO_PORT40);
620 val1 = gpio_get_value(GPIO_PORT123);
621 val2 = gpio_get_value(GPIO_PORT40);
623 gpio_request(GPIO_FN_IRQ28_123, NULL); /* for QHD */
624 gpio_request(GPIO_FN_IRQ7_40, NULL); /* for WVGA */
629 #define PORT40CR 0xE6051028
630 #define PORT123CR 0xE605007B
631 static int ts_init(void)
633 gpio_request(GPIO_FN_IRQ28_123, NULL); /* for QHD */
634 gpio_request(GPIO_FN_IRQ7_40, NULL); /* for WVGA */
636 gpio_pull_up(PORT40CR);
637 gpio_pull_up(PORT123CR);
642 static struct tsc2007_platform_data tsc2007_info = {
645 .get_pendown_state = ts_get_pendown_state,
646 .init_platform_hw = ts_init,
649 static struct i2c_board_info tsc_device = {
650 I2C_BOARD_INFO("tsc2007", 0x48),
652 .platform_data = &tsc2007_info,
653 /*.irq is selected on ap4evb_init */
657 static struct i2c_board_info i2c0_devices[] = {
659 I2C_BOARD_INFO("ak4643", 0x13),
663 static struct i2c_board_info i2c1_devices[] = {
665 I2C_BOARD_INFO("r2025sd", 0x32),
669 static struct map_desc ap4evb_io_desc[] __initdata = {
670 /* create a 1:1 entity map for 0xe6xxxxxx
671 * used by CPGA, INTC and PFC.
674 .virtual = 0xe6000000,
675 .pfn = __phys_to_pfn(0xe6000000),
677 .type = MT_DEVICE_NONSHARED
681 static void __init ap4evb_map_io(void)
683 iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
685 /* setup early devices and console here as well */
686 sh7372_add_early_devices();
687 shmobile_setup_console();
690 #define GPIO_PORT9CR 0xE6051009
691 #define GPIO_PORT10CR 0xE605100A
693 static void __init ap4evb_init(void)
697 sh7372_pinmux_init();
700 gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
701 gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
703 /* enable SMSC911X */
704 gpio_request(GPIO_FN_CS5A, NULL);
705 gpio_request(GPIO_FN_IRQ6_39, NULL);
707 /* enable LED 1 - 4 */
708 gpio_request(GPIO_PORT185, NULL);
709 gpio_request(GPIO_PORT186, NULL);
710 gpio_request(GPIO_PORT187, NULL);
711 gpio_request(GPIO_PORT188, NULL);
712 gpio_direction_output(GPIO_PORT185, 1);
713 gpio_direction_output(GPIO_PORT186, 1);
714 gpio_direction_output(GPIO_PORT187, 1);
715 gpio_direction_output(GPIO_PORT188, 1);
716 gpio_export(GPIO_PORT185, 0);
717 gpio_export(GPIO_PORT186, 0);
718 gpio_export(GPIO_PORT187, 0);
719 gpio_export(GPIO_PORT188, 0);
721 /* enable Debug switch (S6) */
722 gpio_request(GPIO_PORT32, NULL);
723 gpio_request(GPIO_PORT33, NULL);
724 gpio_request(GPIO_PORT34, NULL);
725 gpio_request(GPIO_PORT35, NULL);
726 gpio_direction_input(GPIO_PORT32);
727 gpio_direction_input(GPIO_PORT33);
728 gpio_direction_input(GPIO_PORT34);
729 gpio_direction_input(GPIO_PORT35);
730 gpio_export(GPIO_PORT32, 0);
731 gpio_export(GPIO_PORT33, 0);
732 gpio_export(GPIO_PORT34, 0);
733 gpio_export(GPIO_PORT35, 0);
736 gpio_request(GPIO_FN_SDHICD0, NULL);
737 gpio_request(GPIO_FN_SDHIWP0, NULL);
738 gpio_request(GPIO_FN_SDHICMD0, NULL);
739 gpio_request(GPIO_FN_SDHICLK0, NULL);
740 gpio_request(GPIO_FN_SDHID0_3, NULL);
741 gpio_request(GPIO_FN_SDHID0_2, NULL);
742 gpio_request(GPIO_FN_SDHID0_1, NULL);
743 gpio_request(GPIO_FN_SDHID0_0, NULL);
746 gpio_request(GPIO_FN_SDHICMD1, NULL);
747 gpio_request(GPIO_FN_SDHICLK1, NULL);
748 gpio_request(GPIO_FN_SDHID1_3, NULL);
749 gpio_request(GPIO_FN_SDHID1_2, NULL);
750 gpio_request(GPIO_FN_SDHID1_1, NULL);
751 gpio_request(GPIO_FN_SDHID1_0, NULL);
754 gpio_request(GPIO_FN_MMCD0_0, NULL);
755 gpio_request(GPIO_FN_MMCD0_1, NULL);
756 gpio_request(GPIO_FN_MMCD0_2, NULL);
757 gpio_request(GPIO_FN_MMCD0_3, NULL);
758 gpio_request(GPIO_FN_MMCD0_4, NULL);
759 gpio_request(GPIO_FN_MMCD0_5, NULL);
760 gpio_request(GPIO_FN_MMCD0_6, NULL);
761 gpio_request(GPIO_FN_MMCD0_7, NULL);
762 gpio_request(GPIO_FN_MMCCMD0, NULL);
763 gpio_request(GPIO_FN_MMCCLK0, NULL);
766 gpio_request(GPIO_FN_VBUS0_1, NULL);
767 gpio_request(GPIO_FN_IDIN_1_18, NULL);
768 gpio_request(GPIO_FN_PWEN_1_115, NULL);
769 gpio_request(GPIO_FN_OVCN_1_114, NULL);
770 gpio_request(GPIO_FN_EXTLP_1, NULL);
771 gpio_request(GPIO_FN_OVCN2_1, NULL);
774 __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */
777 gpio_request(GPIO_FN_FSIAIBT, NULL);
778 gpio_request(GPIO_FN_FSIAILR, NULL);
779 gpio_request(GPIO_FN_FSIAISLD, NULL);
780 gpio_request(GPIO_FN_FSIAOSLD, NULL);
781 gpio_request(GPIO_PORT161, NULL);
782 gpio_direction_output(GPIO_PORT161, 0); /* slave */
784 gpio_request(GPIO_PORT9, NULL);
785 gpio_request(GPIO_PORT10, NULL);
786 gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */
787 gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
789 /* set SPU2 clock to 119.6 MHz */
790 clk = clk_get(NULL, "spu_clk");
792 clk_set_rate(clk, clk_round_rate(clk, 119600000));
796 /* change parent of FSI A */
797 clk = clk_get(NULL, "fsia_clk");
799 clk_register(&fsiackcr_clk);
800 clk_set_parent(clk, &fsiackcr_clk);
805 * set irq priority, to avoid sound chopping
806 * when NFS rootfs is used
807 * FSI(3) > SMSC911X(2)
809 intc_set_priority(IRQ_FSI, 3);
811 i2c_register_board_info(0, i2c0_devices,
812 ARRAY_SIZE(i2c0_devices));
814 i2c_register_board_info(1, i2c1_devices,
815 ARRAY_SIZE(i2c1_devices));
817 #ifdef CONFIG_AP4EVB_QHD
823 gpio_request(GPIO_FN_KEYOUT0, NULL);
824 gpio_request(GPIO_FN_KEYOUT1, NULL);
825 gpio_request(GPIO_FN_KEYOUT2, NULL);
826 gpio_request(GPIO_FN_KEYOUT3, NULL);
827 gpio_request(GPIO_FN_KEYOUT4, NULL);
828 gpio_request(GPIO_FN_KEYIN0_136, NULL);
829 gpio_request(GPIO_FN_KEYIN1_135, NULL);
830 gpio_request(GPIO_FN_KEYIN2_134, NULL);
831 gpio_request(GPIO_FN_KEYIN3_133, NULL);
832 gpio_request(GPIO_FN_KEYIN4, NULL);
834 /* enable TouchScreen */
835 set_irq_type(IRQ28, IRQ_TYPE_LEVEL_LOW);
837 tsc_device.irq = IRQ28;
838 i2c_register_board_info(1, &tsc_device, 1);
841 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
842 lcdc_info.ch[0].interface_type = RGB24;
843 lcdc_info.ch[0].clock_divider = 1;
844 lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
845 lcdc_info.ch[0].lcd_cfg.name = "R63302(QHD)";
846 lcdc_info.ch[0].lcd_cfg.xres = 544;
847 lcdc_info.ch[0].lcd_cfg.yres = 961;
848 lcdc_info.ch[0].lcd_cfg.left_margin = 72;
849 lcdc_info.ch[0].lcd_cfg.right_margin = 600;
850 lcdc_info.ch[0].lcd_cfg.hsync_len = 16;
851 lcdc_info.ch[0].lcd_cfg.upper_margin = 8;
852 lcdc_info.ch[0].lcd_cfg.lower_margin = 8;
853 lcdc_info.ch[0].lcd_cfg.vsync_len = 2;
854 lcdc_info.ch[0].lcd_cfg.sync = FB_SYNC_VERT_HIGH_ACT |
855 FB_SYNC_HOR_HIGH_ACT;
856 lcdc_info.ch[0].lcd_size_cfg.width = 44;
857 lcdc_info.ch[0].lcd_size_cfg.height = 79;
859 platform_add_devices(qhd_devices, ARRAY_SIZE(qhd_devices));
865 gpio_request(GPIO_FN_LCDD17, NULL);
866 gpio_request(GPIO_FN_LCDD16, NULL);
867 gpio_request(GPIO_FN_LCDD15, NULL);
868 gpio_request(GPIO_FN_LCDD14, NULL);
869 gpio_request(GPIO_FN_LCDD13, NULL);
870 gpio_request(GPIO_FN_LCDD12, NULL);
871 gpio_request(GPIO_FN_LCDD11, NULL);
872 gpio_request(GPIO_FN_LCDD10, NULL);
873 gpio_request(GPIO_FN_LCDD9, NULL);
874 gpio_request(GPIO_FN_LCDD8, NULL);
875 gpio_request(GPIO_FN_LCDD7, NULL);
876 gpio_request(GPIO_FN_LCDD6, NULL);
877 gpio_request(GPIO_FN_LCDD5, NULL);
878 gpio_request(GPIO_FN_LCDD4, NULL);
879 gpio_request(GPIO_FN_LCDD3, NULL);
880 gpio_request(GPIO_FN_LCDD2, NULL);
881 gpio_request(GPIO_FN_LCDD1, NULL);
882 gpio_request(GPIO_FN_LCDD0, NULL);
883 gpio_request(GPIO_FN_LCDDISP, NULL);
884 gpio_request(GPIO_FN_LCDDCK, NULL);
886 gpio_request(GPIO_PORT189, NULL); /* backlight */
887 gpio_direction_output(GPIO_PORT189, 1);
889 gpio_request(GPIO_PORT151, NULL); /* LCDDON */
890 gpio_direction_output(GPIO_PORT151, 1);
892 lcdc_info.clock_source = LCDC_CLK_BUS;
893 lcdc_info.ch[0].interface_type = RGB18;
894 lcdc_info.ch[0].clock_divider = 2;
895 lcdc_info.ch[0].flags = 0;
896 lcdc_info.ch[0].lcd_cfg.name = "WVGA Panel";
897 lcdc_info.ch[0].lcd_cfg.xres = 800;
898 lcdc_info.ch[0].lcd_cfg.yres = 480;
899 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
900 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
901 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
902 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
903 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
904 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
905 lcdc_info.ch[0].lcd_cfg.sync = 0;
906 lcdc_info.ch[0].lcd_size_cfg.width = 152;
907 lcdc_info.ch[0].lcd_size_cfg.height = 91;
909 /* enable TouchScreen */
910 set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
912 tsc_device.irq = IRQ7;
913 i2c_register_board_info(0, &tsc_device, 1);
914 #endif /* CONFIG_AP4EVB_QHD */
916 sh7372_add_standard_devices();
918 platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
921 static void __init ap4evb_timer_init(void)
924 shmobile_timer.init();
927 static struct sys_timer ap4evb_timer = {
928 .init = ap4evb_timer_init,
931 MACHINE_START(AP4EVB, "ap4evb")
932 .phys_io = 0xe6000000,
933 .io_pg_offst = ((0xe6000000) >> 18) & 0xfffc,
934 .map_io = ap4evb_map_io,
935 .init_irq = sh7372_init_irq,
936 .init_machine = ap4evb_init,
937 .timer = &ap4evb_timer,