2 * Copyright (C) 2009 Renesas Solutions Corp.
4 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
11 #include <linux/init.h>
12 #include <linux/device.h>
13 #include <linux/platform_device.h>
14 #include <linux/mtd/physmap.h>
15 #include <linux/gpio.h>
16 #include <linux/interrupt.h>
18 #include <linux/delay.h>
19 #include <linux/usb/r8a66597.h>
20 #include <linux/i2c.h>
21 #include <linux/i2c/tsc2007.h>
22 #include <linux/spi/spi.h>
23 #include <linux/spi/sh_msiof.h>
24 #include <linux/spi/mmc_spi.h>
25 #include <linux/mmc/host.h>
26 #include <linux/input.h>
27 #include <linux/input/sh_keysc.h>
28 #include <linux/mfd/sh_mobile_sdhi.h>
29 #include <video/sh_mobile_lcdc.h>
30 #include <media/sh_mobile_ceu.h>
31 #include <media/tw9910.h>
32 #include <media/mt9t112.h>
33 #include <asm/heartbeat.h>
34 #include <asm/sh_eth.h>
35 #include <asm/clock.h>
36 #include <asm/suspend.h>
37 #include <cpu/sh7724.h>
40 * Address Interface BusWidth
41 *-----------------------------------------
42 * 0x0000_0000 uboot 16bit
43 * 0x0004_0000 Linux romImage 16bit
44 * 0x0014_0000 MTD for Linux 16bit
45 * 0x0400_0000 Internal I/O 16/32bit
46 * 0x0800_0000 DRAM 32bit
47 * 0x1800_0000 MFI 16bit
51 *------------------------------
52 * DS2[1] = FlashROM write protect ON : write protect
53 * OFF : No write protect
54 * DS2[2] = RMII / TS, SCIF ON : RMII
56 * DS2[3] = Camera / Video ON : Camera
58 * DS2[5] = NTSC_OUT Clock ON : On board OSC
60 * DS2[6-7] = MMC / SD ON-OFF : SD
65 static unsigned char led_pos[] = { 0, 1, 2, 3 };
66 static struct heartbeat_data heartbeat_data = {
72 static struct resource heartbeat_resources[] = {
74 .start = 0xA405012C, /* PTG */
75 .end = 0xA405012E - 1,
76 .flags = IORESOURCE_MEM,
80 static struct platform_device heartbeat_device = {
84 .platform_data = &heartbeat_data,
86 .num_resources = ARRAY_SIZE(heartbeat_resources),
87 .resource = heartbeat_resources,
91 static struct mtd_partition nor_flash_partitions[] = {
93 .name = "boot loader",
95 .size = (5 * 1024 * 1024),
96 .mask_flags = MTD_WRITEABLE, /* force read-only */
99 .offset = MTDPART_OFS_APPEND,
100 .size = MTDPART_SIZ_FULL,
104 static struct physmap_flash_data nor_flash_data = {
106 .parts = nor_flash_partitions,
107 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
110 static struct resource nor_flash_resources[] = {
115 .flags = IORESOURCE_MEM,
119 static struct platform_device nor_flash_device = {
120 .name = "physmap-flash",
121 .resource = nor_flash_resources,
122 .num_resources = ARRAY_SIZE(nor_flash_resources),
124 .platform_data = &nor_flash_data,
129 #define SH_ETH_ADDR (0xA4600000)
130 #define SH_ETH_MAHR (SH_ETH_ADDR + 0x1C0)
131 #define SH_ETH_MALR (SH_ETH_ADDR + 0x1C8)
132 static struct resource sh_eth_resources[] = {
134 .start = SH_ETH_ADDR,
135 .end = SH_ETH_ADDR + 0x1FC,
136 .flags = IORESOURCE_MEM,
140 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
144 struct sh_eth_plat_data sh_eth_plat = {
145 .phy = 0x1f, /* SMSC LAN8700 */
146 .edmac_endian = EDMAC_LITTLE_ENDIAN,
147 .ether_link_active_low = 1
150 static struct platform_device sh_eth_device = {
154 .platform_data = &sh_eth_plat,
156 .num_resources = ARRAY_SIZE(sh_eth_resources),
157 .resource = sh_eth_resources,
159 .hwblk_id = HWBLK_ETHER,
164 void usb0_port_power(int port, int power)
166 gpio_set_value(GPIO_PTB4, power);
169 static struct r8a66597_platdata usb0_host_data = {
171 .port_power = usb0_port_power,
174 static struct resource usb0_host_resources[] = {
177 .end = 0xa4d80124 - 1,
178 .flags = IORESOURCE_MEM,
183 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
187 static struct platform_device usb0_host_device = {
188 .name = "r8a66597_hcd",
191 .dma_mask = NULL, /* not use dma */
192 .coherent_dma_mask = 0xffffffff,
193 .platform_data = &usb0_host_data,
195 .num_resources = ARRAY_SIZE(usb0_host_resources),
196 .resource = usb0_host_resources,
199 /* USB1 host/function */
200 void usb1_port_power(int port, int power)
202 gpio_set_value(GPIO_PTB5, power);
205 static struct r8a66597_platdata usb1_common_data = {
207 .port_power = usb1_port_power,
210 static struct resource usb1_common_resources[] = {
213 .end = 0xa4d90124 - 1,
214 .flags = IORESOURCE_MEM,
219 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
223 static struct platform_device usb1_common_device = {
224 /* .name will be added in arch_setup */
227 .dma_mask = NULL, /* not use dma */
228 .coherent_dma_mask = 0xffffffff,
229 .platform_data = &usb1_common_data,
231 .num_resources = ARRAY_SIZE(usb1_common_resources),
232 .resource = usb1_common_resources,
236 static struct sh_mobile_lcdc_info lcdc_info = {
238 .interface_type = RGB18,
239 .chan = LCDC_CHAN_MAINLCD,
242 .sync = 0, /* hsync and vsync are active low */
244 .lcd_size_cfg = { /* 7.0 inch */
253 static struct resource lcdc_resources[] = {
258 .flags = IORESOURCE_MEM,
262 .flags = IORESOURCE_IRQ,
266 static struct platform_device lcdc_device = {
267 .name = "sh_mobile_lcdc_fb",
268 .num_resources = ARRAY_SIZE(lcdc_resources),
269 .resource = lcdc_resources,
271 .platform_data = &lcdc_info,
274 .hwblk_id = HWBLK_LCDC,
279 static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
280 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
283 static struct resource ceu0_resources[] = {
288 .flags = IORESOURCE_MEM,
292 .flags = IORESOURCE_IRQ,
295 /* place holder for contiguous memory */
299 static struct platform_device ceu0_device = {
300 .name = "sh_mobile_ceu",
301 .id = 0, /* "ceu0" clock */
302 .num_resources = ARRAY_SIZE(ceu0_resources),
303 .resource = ceu0_resources,
305 .platform_data = &sh_mobile_ceu0_info,
308 .hwblk_id = HWBLK_CEU0,
313 static struct sh_mobile_ceu_info sh_mobile_ceu1_info = {
314 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
317 static struct resource ceu1_resources[] = {
322 .flags = IORESOURCE_MEM,
326 .flags = IORESOURCE_IRQ,
329 /* place holder for contiguous memory */
333 static struct platform_device ceu1_device = {
334 .name = "sh_mobile_ceu",
335 .id = 1, /* "ceu1" clock */
336 .num_resources = ARRAY_SIZE(ceu1_resources),
337 .resource = ceu1_resources,
339 .platform_data = &sh_mobile_ceu1_info,
342 .hwblk_id = HWBLK_CEU1,
347 static struct i2c_board_info i2c1_devices[] = {
349 I2C_BOARD_INFO("r2025sd", 0x32),
354 static struct sh_keysc_info keysc_info = {
355 .mode = SH_KEYSC_MODE_1,
359 .keycodes = { KEY_1, 0, 0, 0, 0,
364 KEY_6, 0, 0, 0, 0, },
367 static struct resource keysc_resources[] = {
372 .flags = IORESOURCE_MEM,
376 .flags = IORESOURCE_IRQ,
380 static struct platform_device keysc_device = {
382 .id = 0, /* keysc0 clock */
383 .num_resources = ARRAY_SIZE(keysc_resources),
384 .resource = keysc_resources,
386 .platform_data = &keysc_info,
389 .hwblk_id = HWBLK_KEYSC,
395 static int ts_get_pendown_state(void)
398 gpio_free(GPIO_FN_INTC_IRQ0);
399 gpio_request(GPIO_PTZ0, NULL);
400 gpio_direction_input(GPIO_PTZ0);
402 val = gpio_get_value(GPIO_PTZ0);
404 gpio_free(GPIO_PTZ0);
405 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
410 static int ts_init(void)
412 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
416 struct tsc2007_platform_data tsc2007_info = {
419 .get_pendown_state = ts_get_pendown_state,
420 .init_platform_hw = ts_init,
423 static struct i2c_board_info ts_i2c_clients = {
424 I2C_BOARD_INFO("tsc2007", 0x48),
426 .platform_data = &tsc2007_info,
430 #ifdef CONFIG_MFD_SH_MOBILE_SDHI
432 static void sdhi0_set_pwr(struct platform_device *pdev, int state)
434 gpio_set_value(GPIO_PTB6, state);
437 static struct sh_mobile_sdhi_info sdhi0_info = {
438 .set_pwr = sdhi0_set_pwr,
441 static struct resource sdhi0_resources[] = {
446 .flags = IORESOURCE_MEM,
450 .flags = IORESOURCE_IRQ,
454 static struct platform_device sdhi0_device = {
455 .name = "sh_mobile_sdhi",
456 .num_resources = ARRAY_SIZE(sdhi0_resources),
457 .resource = sdhi0_resources,
460 .platform_data = &sdhi0_info,
463 .hwblk_id = HWBLK_SDHI0,
468 static void sdhi1_set_pwr(struct platform_device *pdev, int state)
470 gpio_set_value(GPIO_PTB7, state);
473 static struct sh_mobile_sdhi_info sdhi1_info = {
474 .set_pwr = sdhi1_set_pwr,
477 static struct resource sdhi1_resources[] = {
482 .flags = IORESOURCE_MEM,
486 .flags = IORESOURCE_IRQ,
490 static struct platform_device sdhi1_device = {
491 .name = "sh_mobile_sdhi",
492 .num_resources = ARRAY_SIZE(sdhi1_resources),
493 .resource = sdhi1_resources,
496 .platform_data = &sdhi1_info,
499 .hwblk_id = HWBLK_SDHI1,
505 static int mmc_spi_get_ro(struct device *dev)
507 return gpio_get_value(GPIO_PTY6);
510 static int mmc_spi_get_cd(struct device *dev)
512 return !gpio_get_value(GPIO_PTY7);
515 static void mmc_spi_setpower(struct device *dev, unsigned int maskval)
517 gpio_set_value(GPIO_PTB6, maskval ? 1 : 0);
520 static struct mmc_spi_platform_data mmc_spi_info = {
521 .get_ro = mmc_spi_get_ro,
522 .get_cd = mmc_spi_get_cd,
523 .caps = MMC_CAP_NEEDS_POLL,
524 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */
525 .setpower = mmc_spi_setpower,
528 static struct spi_board_info spi_bus[] = {
530 .modalias = "mmc_spi",
531 .platform_data = &mmc_spi_info,
532 .max_speed_hz = 5000000,
534 .controller_data = (void *) GPIO_PTM4,
538 static struct sh_msiof_spi_info msiof0_data = {
542 static struct resource msiof0_resources[] = {
547 .flags = IORESOURCE_MEM,
551 .flags = IORESOURCE_IRQ,
555 static struct platform_device msiof0_device = {
556 .name = "spi_sh_msiof",
557 .id = 0, /* MSIOF0 */
559 .platform_data = &msiof0_data,
561 .num_resources = ARRAY_SIZE(msiof0_resources),
562 .resource = msiof0_resources,
564 .hwblk_id = HWBLK_MSIOF0,
570 /* I2C Video/Camera */
571 static struct i2c_board_info i2c_camera[] = {
573 I2C_BOARD_INFO("tw9910", 0x45),
577 I2C_BOARD_INFO("mt9t112", 0x3c),
581 I2C_BOARD_INFO("mt9t112", 0x3c),
586 static int tw9910_power(struct device *dev, int mode)
588 int val = mode ? 0 : 1;
590 gpio_set_value(GPIO_PTU2, val);
597 static struct tw9910_video_info tw9910_info = {
598 .buswidth = SOCAM_DATAWIDTH_8,
599 .mpout = TW9910_MPO_FIELD,
602 static struct soc_camera_link tw9910_link = {
605 .power = tw9910_power,
606 .board_info = &i2c_camera[0],
607 .module_name = "tw9910",
608 .priv = &tw9910_info,
612 static int mt9t112_power1(struct device *dev, int mode)
614 gpio_set_value(GPIO_PTA3, mode);
621 static struct mt9t112_camera_info mt9t112_info1 = {
622 .flags = MT9T112_FLAG_PCLK_RISING_EDGE | MT9T112_FLAG_DATAWIDTH_8,
623 .divider = { 0x49, 0x6, 0, 6, 0, 9, 9, 6, 0 }, /* for 24MHz */
626 static struct soc_camera_link mt9t112_link1 = {
628 .power = mt9t112_power1,
630 .board_info = &i2c_camera[1],
631 .module_name = "mt9t112",
632 .priv = &mt9t112_info1,
635 static int mt9t112_power2(struct device *dev, int mode)
637 gpio_set_value(GPIO_PTA4, mode);
644 static struct mt9t112_camera_info mt9t112_info2 = {
645 .flags = MT9T112_FLAG_PCLK_RISING_EDGE | MT9T112_FLAG_DATAWIDTH_8,
646 .divider = { 0x49, 0x6, 0, 6, 0, 9, 9, 6, 0 }, /* for 24MHz */
649 static struct soc_camera_link mt9t112_link2 = {
651 .power = mt9t112_power2,
653 .board_info = &i2c_camera[2],
654 .module_name = "mt9t112",
655 .priv = &mt9t112_info2,
658 static struct platform_device camera_devices[] = {
660 .name = "soc-camera-pdrv",
663 .platform_data = &tw9910_link,
667 .name = "soc-camera-pdrv",
670 .platform_data = &mt9t112_link1,
674 .name = "soc-camera-pdrv",
677 .platform_data = &mt9t112_link2,
682 static struct platform_device *ecovec_devices[] __initdata = {
692 #ifdef CONFIG_MFD_SH_MOBILE_SDHI
703 #define EEPROM_ADDR 0x50
704 static u8 mac_read(struct i2c_adapter *a, u8 command)
706 struct i2c_msg msg[2];
710 msg[0].addr = EEPROM_ADDR;
713 msg[0].buf = &command;
715 msg[1].addr = EEPROM_ADDR;
716 msg[1].flags = I2C_M_RD;
720 ret = i2c_transfer(a, msg, 2);
722 printk(KERN_ERR "error %d\n", ret);
729 static void __init sh_eth_init(struct sh_eth_plat_data *pd)
731 struct i2c_adapter *a = i2c_get_adapter(1);
735 pr_err("can not get I2C 1\n");
739 /* read MAC address frome EEPROM */
740 for (i = 0; i < sizeof(pd->mac_addr); i++) {
741 pd->mac_addr[i] = mac_read(a, 0x10 + i);
746 #define PORT_HIZA 0xA4050158
747 #define IODRIVEA 0xA405018A
749 extern char ecovec24_sdram_enter_start;
750 extern char ecovec24_sdram_enter_end;
751 extern char ecovec24_sdram_leave_start;
752 extern char ecovec24_sdram_leave_end;
754 static int __init arch_setup(void)
756 /* register board specific self-refresh code */
757 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
758 &ecovec24_sdram_enter_start,
759 &ecovec24_sdram_enter_end,
760 &ecovec24_sdram_leave_start,
761 &ecovec24_sdram_leave_end);
763 /* enable STATUS0, STATUS2 and PDSTATUS */
764 gpio_request(GPIO_FN_STATUS0, NULL);
765 gpio_request(GPIO_FN_STATUS2, NULL);
766 gpio_request(GPIO_FN_PDSTATUS, NULL);
769 gpio_request(GPIO_FN_SCIF0_TXD, NULL);
770 gpio_request(GPIO_FN_SCIF0_RXD, NULL);
772 /* enable debug LED */
773 gpio_request(GPIO_PTG0, NULL);
774 gpio_request(GPIO_PTG1, NULL);
775 gpio_request(GPIO_PTG2, NULL);
776 gpio_request(GPIO_PTG3, NULL);
777 gpio_direction_output(GPIO_PTG0, 0);
778 gpio_direction_output(GPIO_PTG1, 0);
779 gpio_direction_output(GPIO_PTG2, 0);
780 gpio_direction_output(GPIO_PTG3, 0);
781 ctrl_outw((ctrl_inw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA);
784 gpio_request(GPIO_PTA1, NULL);
785 gpio_direction_output(GPIO_PTA1, 1);
788 gpio_request(GPIO_FN_RMII_RXD0, NULL);
789 gpio_request(GPIO_FN_RMII_RXD1, NULL);
790 gpio_request(GPIO_FN_RMII_TXD0, NULL);
791 gpio_request(GPIO_FN_RMII_TXD1, NULL);
792 gpio_request(GPIO_FN_RMII_REF_CLK, NULL);
793 gpio_request(GPIO_FN_RMII_TX_EN, NULL);
794 gpio_request(GPIO_FN_RMII_RX_ER, NULL);
795 gpio_request(GPIO_FN_RMII_CRS_DV, NULL);
796 gpio_request(GPIO_FN_MDIO, NULL);
797 gpio_request(GPIO_FN_MDC, NULL);
798 gpio_request(GPIO_FN_LNKSTA, NULL);
801 ctrl_outw(0x0000, 0xA4D80000);
802 ctrl_outw(0x0000, 0xA4D90000);
803 gpio_request(GPIO_PTB3, NULL);
804 gpio_request(GPIO_PTB4, NULL);
805 gpio_request(GPIO_PTB5, NULL);
806 gpio_direction_input(GPIO_PTB3);
807 gpio_direction_output(GPIO_PTB4, 0);
808 gpio_direction_output(GPIO_PTB5, 0);
809 ctrl_outw(0x0600, 0xa40501d4);
810 ctrl_outw(0x0600, 0xa4050192);
812 if (gpio_get_value(GPIO_PTB3)) {
813 printk(KERN_INFO "USB1 function is selected\n");
814 usb1_common_device.name = "r8a66597_udc";
816 printk(KERN_INFO "USB1 host is selected\n");
817 usb1_common_device.name = "r8a66597_hcd";
821 gpio_request(GPIO_FN_LCDD23, NULL);
822 gpio_request(GPIO_FN_LCDD22, NULL);
823 gpio_request(GPIO_FN_LCDD21, NULL);
824 gpio_request(GPIO_FN_LCDD20, NULL);
825 gpio_request(GPIO_FN_LCDD19, NULL);
826 gpio_request(GPIO_FN_LCDD18, NULL);
827 gpio_request(GPIO_FN_LCDD17, NULL);
828 gpio_request(GPIO_FN_LCDD16, NULL);
829 gpio_request(GPIO_FN_LCDD15, NULL);
830 gpio_request(GPIO_FN_LCDD14, NULL);
831 gpio_request(GPIO_FN_LCDD13, NULL);
832 gpio_request(GPIO_FN_LCDD12, NULL);
833 gpio_request(GPIO_FN_LCDD11, NULL);
834 gpio_request(GPIO_FN_LCDD10, NULL);
835 gpio_request(GPIO_FN_LCDD9, NULL);
836 gpio_request(GPIO_FN_LCDD8, NULL);
837 gpio_request(GPIO_FN_LCDD7, NULL);
838 gpio_request(GPIO_FN_LCDD6, NULL);
839 gpio_request(GPIO_FN_LCDD5, NULL);
840 gpio_request(GPIO_FN_LCDD4, NULL);
841 gpio_request(GPIO_FN_LCDD3, NULL);
842 gpio_request(GPIO_FN_LCDD2, NULL);
843 gpio_request(GPIO_FN_LCDD1, NULL);
844 gpio_request(GPIO_FN_LCDD0, NULL);
845 gpio_request(GPIO_FN_LCDDISP, NULL);
846 gpio_request(GPIO_FN_LCDHSYN, NULL);
847 gpio_request(GPIO_FN_LCDDCK, NULL);
848 gpio_request(GPIO_FN_LCDVSYN, NULL);
849 gpio_request(GPIO_FN_LCDDON, NULL);
850 gpio_request(GPIO_FN_LCDLCLK, NULL);
851 ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
853 gpio_request(GPIO_PTE6, NULL);
854 gpio_request(GPIO_PTU1, NULL);
855 gpio_request(GPIO_PTR1, NULL);
856 gpio_request(GPIO_PTA2, NULL);
857 gpio_direction_input(GPIO_PTE6);
858 gpio_direction_output(GPIO_PTU1, 0);
859 gpio_direction_output(GPIO_PTR1, 0);
860 gpio_direction_output(GPIO_PTA2, 0);
862 /* I/O buffer drive ability is high */
863 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x00c0) | 0x0080 , IODRIVEA);
865 if (gpio_get_value(GPIO_PTE6)) {
867 lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
868 lcdc_info.ch[0].clock_divider = 1,
869 lcdc_info.ch[0].lcd_cfg.name = "DVI";
870 lcdc_info.ch[0].lcd_cfg.xres = 1280;
871 lcdc_info.ch[0].lcd_cfg.yres = 720;
872 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
873 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
874 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
875 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
876 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
877 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
879 gpio_set_value(GPIO_PTA2, 1);
880 gpio_set_value(GPIO_PTU1, 1);
884 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
885 lcdc_info.ch[0].clock_divider = 2,
886 lcdc_info.ch[0].lcd_cfg.name = "Panel";
887 lcdc_info.ch[0].lcd_cfg.xres = 800;
888 lcdc_info.ch[0].lcd_cfg.yres = 480;
889 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
890 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
891 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
892 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
893 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
894 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
896 gpio_set_value(GPIO_PTR1, 1);
900 * LCDDON control is needed for Panel,
901 * but current sh_mobile_lcdc driver doesn't control it.
902 * It is temporary correspondence
904 gpio_request(GPIO_PTF4, NULL);
905 gpio_direction_output(GPIO_PTF4, 1);
907 /* enable TouchScreen */
908 i2c_register_board_info(0, &ts_i2c_clients, 1);
909 set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW);
913 gpio_request(GPIO_FN_VIO0_D15, NULL);
914 gpio_request(GPIO_FN_VIO0_D14, NULL);
915 gpio_request(GPIO_FN_VIO0_D13, NULL);
916 gpio_request(GPIO_FN_VIO0_D12, NULL);
917 gpio_request(GPIO_FN_VIO0_D11, NULL);
918 gpio_request(GPIO_FN_VIO0_D10, NULL);
919 gpio_request(GPIO_FN_VIO0_D9, NULL);
920 gpio_request(GPIO_FN_VIO0_D8, NULL);
921 gpio_request(GPIO_FN_VIO0_D7, NULL);
922 gpio_request(GPIO_FN_VIO0_D6, NULL);
923 gpio_request(GPIO_FN_VIO0_D5, NULL);
924 gpio_request(GPIO_FN_VIO0_D4, NULL);
925 gpio_request(GPIO_FN_VIO0_D3, NULL);
926 gpio_request(GPIO_FN_VIO0_D2, NULL);
927 gpio_request(GPIO_FN_VIO0_D1, NULL);
928 gpio_request(GPIO_FN_VIO0_D0, NULL);
929 gpio_request(GPIO_FN_VIO0_VD, NULL);
930 gpio_request(GPIO_FN_VIO0_CLK, NULL);
931 gpio_request(GPIO_FN_VIO0_FLD, NULL);
932 gpio_request(GPIO_FN_VIO0_HD, NULL);
933 platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20);
936 gpio_request(GPIO_FN_VIO1_D7, NULL);
937 gpio_request(GPIO_FN_VIO1_D6, NULL);
938 gpio_request(GPIO_FN_VIO1_D5, NULL);
939 gpio_request(GPIO_FN_VIO1_D4, NULL);
940 gpio_request(GPIO_FN_VIO1_D3, NULL);
941 gpio_request(GPIO_FN_VIO1_D2, NULL);
942 gpio_request(GPIO_FN_VIO1_D1, NULL);
943 gpio_request(GPIO_FN_VIO1_D0, NULL);
944 gpio_request(GPIO_FN_VIO1_FLD, NULL);
945 gpio_request(GPIO_FN_VIO1_HD, NULL);
946 gpio_request(GPIO_FN_VIO1_VD, NULL);
947 gpio_request(GPIO_FN_VIO1_CLK, NULL);
948 platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20);
951 gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
952 gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
953 gpio_request(GPIO_FN_KEYOUT3, NULL);
954 gpio_request(GPIO_FN_KEYOUT2, NULL);
955 gpio_request(GPIO_FN_KEYOUT1, NULL);
956 gpio_request(GPIO_FN_KEYOUT0, NULL);
957 gpio_request(GPIO_FN_KEYIN0, NULL);
959 /* enable user debug switch */
960 gpio_request(GPIO_PTR0, NULL);
961 gpio_request(GPIO_PTR4, NULL);
962 gpio_request(GPIO_PTR5, NULL);
963 gpio_request(GPIO_PTR6, NULL);
964 gpio_direction_input(GPIO_PTR0);
965 gpio_direction_input(GPIO_PTR4);
966 gpio_direction_input(GPIO_PTR5);
967 gpio_direction_input(GPIO_PTR6);
969 #ifdef CONFIG_MFD_SH_MOBILE_SDHI
970 /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
971 gpio_request(GPIO_FN_SDHI0CD, NULL);
972 gpio_request(GPIO_FN_SDHI0WP, NULL);
973 gpio_request(GPIO_FN_SDHI0CMD, NULL);
974 gpio_request(GPIO_FN_SDHI0CLK, NULL);
975 gpio_request(GPIO_FN_SDHI0D3, NULL);
976 gpio_request(GPIO_FN_SDHI0D2, NULL);
977 gpio_request(GPIO_FN_SDHI0D1, NULL);
978 gpio_request(GPIO_FN_SDHI0D0, NULL);
979 gpio_request(GPIO_PTB6, NULL);
980 gpio_direction_output(GPIO_PTB6, 0);
982 /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
983 gpio_request(GPIO_FN_SDHI1CD, NULL);
984 gpio_request(GPIO_FN_SDHI1WP, NULL);
985 gpio_request(GPIO_FN_SDHI1CMD, NULL);
986 gpio_request(GPIO_FN_SDHI1CLK, NULL);
987 gpio_request(GPIO_FN_SDHI1D3, NULL);
988 gpio_request(GPIO_FN_SDHI1D2, NULL);
989 gpio_request(GPIO_FN_SDHI1D1, NULL);
990 gpio_request(GPIO_FN_SDHI1D0, NULL);
991 gpio_request(GPIO_PTB7, NULL);
992 gpio_direction_output(GPIO_PTB7, 0);
994 /* I/O buffer drive ability is high for SDHI1 */
995 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
997 /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
998 gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
999 gpio_request(GPIO_FN_MSIOF0_RXD, NULL);
1000 gpio_request(GPIO_FN_MSIOF0_TSCK, NULL);
1001 gpio_request(GPIO_PTM4, NULL); /* software CS control of TSYNC pin */
1002 gpio_direction_output(GPIO_PTM4, 1); /* active low CS */
1003 gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */
1004 gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */
1005 gpio_request(GPIO_PTY6, NULL); /* write protect */
1006 gpio_direction_input(GPIO_PTY6);
1007 gpio_request(GPIO_PTY7, NULL); /* card detect */
1008 gpio_direction_input(GPIO_PTY7);
1010 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
1014 gpio_request(GPIO_PTU2, NULL);
1015 gpio_direction_output(GPIO_PTU2, 1);
1018 gpio_request(GPIO_PTA3, NULL);
1019 gpio_request(GPIO_PTA4, NULL);
1020 gpio_direction_output(GPIO_PTA3, 0);
1021 gpio_direction_output(GPIO_PTA4, 0);
1023 /* enable I2C device */
1024 i2c_register_board_info(1, i2c1_devices,
1025 ARRAY_SIZE(i2c1_devices));
1027 return platform_add_devices(ecovec_devices,
1028 ARRAY_SIZE(ecovec_devices));
1030 arch_initcall(arch_setup);
1032 static int __init devices_setup(void)
1034 sh_eth_init(&sh_eth_plat);
1037 device_initcall(devices_setup);
1039 static struct sh_machine_vector mv_ecovec __initmv = {
1040 .mv_name = "R0P7724 (EcoVec)",