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 <asm/heartbeat.h>
33 #include <asm/sh_eth.h>
34 #include <asm/clock.h>
35 #include <asm/suspend.h>
36 #include <cpu/sh7724.h>
39 * Address Interface BusWidth
40 *-----------------------------------------
41 * 0x0000_0000 uboot 16bit
42 * 0x0004_0000 Linux romImage 16bit
43 * 0x0014_0000 MTD for Linux 16bit
44 * 0x0400_0000 Internal I/O 16/32bit
45 * 0x0800_0000 DRAM 32bit
46 * 0x1800_0000 MFI 16bit
50 *------------------------------
51 * DS2[1] = FlashROM write protect ON : write protect
52 * OFF : No write protect
53 * DS2[2] = RMII / TS, SCIF ON : RMII
55 * DS2[3] = Camera / Video ON : Camera
57 * DS2[5] = NTSC_OUT Clock ON : On board OSC
59 * DS2[6-7] = MMC / SD ON-OFF : SD
64 static unsigned char led_pos[] = { 0, 1, 2, 3 };
65 static struct heartbeat_data heartbeat_data = {
71 static struct resource heartbeat_resources[] = {
73 .start = 0xA405012C, /* PTG */
74 .end = 0xA405012E - 1,
75 .flags = IORESOURCE_MEM,
79 static struct platform_device heartbeat_device = {
83 .platform_data = &heartbeat_data,
85 .num_resources = ARRAY_SIZE(heartbeat_resources),
86 .resource = heartbeat_resources,
90 static struct mtd_partition nor_flash_partitions[] = {
92 .name = "boot loader",
94 .size = (5 * 1024 * 1024),
95 .mask_flags = MTD_WRITEABLE, /* force read-only */
98 .offset = MTDPART_OFS_APPEND,
99 .size = MTDPART_SIZ_FULL,
103 static struct physmap_flash_data nor_flash_data = {
105 .parts = nor_flash_partitions,
106 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
109 static struct resource nor_flash_resources[] = {
114 .flags = IORESOURCE_MEM,
118 static struct platform_device nor_flash_device = {
119 .name = "physmap-flash",
120 .resource = nor_flash_resources,
121 .num_resources = ARRAY_SIZE(nor_flash_resources),
123 .platform_data = &nor_flash_data,
128 #define SH_ETH_ADDR (0xA4600000)
129 #define SH_ETH_MAHR (SH_ETH_ADDR + 0x1C0)
130 #define SH_ETH_MALR (SH_ETH_ADDR + 0x1C8)
131 static struct resource sh_eth_resources[] = {
133 .start = SH_ETH_ADDR,
134 .end = SH_ETH_ADDR + 0x1FC,
135 .flags = IORESOURCE_MEM,
139 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
143 struct sh_eth_plat_data sh_eth_plat = {
144 .phy = 0x1f, /* SMSC LAN8700 */
145 .edmac_endian = EDMAC_LITTLE_ENDIAN,
146 .ether_link_active_low = 1
149 static struct platform_device sh_eth_device = {
153 .platform_data = &sh_eth_plat,
155 .num_resources = ARRAY_SIZE(sh_eth_resources),
156 .resource = sh_eth_resources,
158 .hwblk_id = HWBLK_ETHER,
163 void usb0_port_power(int port, int power)
165 gpio_set_value(GPIO_PTB4, power);
168 static struct r8a66597_platdata usb0_host_data = {
170 .port_power = usb0_port_power,
173 static struct resource usb0_host_resources[] = {
176 .end = 0xa4d80124 - 1,
177 .flags = IORESOURCE_MEM,
182 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
186 static struct platform_device usb0_host_device = {
187 .name = "r8a66597_hcd",
190 .dma_mask = NULL, /* not use dma */
191 .coherent_dma_mask = 0xffffffff,
192 .platform_data = &usb0_host_data,
194 .num_resources = ARRAY_SIZE(usb0_host_resources),
195 .resource = usb0_host_resources,
198 /* USB1 host/function */
199 void usb1_port_power(int port, int power)
201 gpio_set_value(GPIO_PTB5, power);
204 static struct r8a66597_platdata usb1_common_data = {
206 .port_power = usb1_port_power,
209 static struct resource usb1_common_resources[] = {
212 .end = 0xa4d90124 - 1,
213 .flags = IORESOURCE_MEM,
218 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
222 static struct platform_device usb1_common_device = {
223 /* .name will be added in arch_setup */
226 .dma_mask = NULL, /* not use dma */
227 .coherent_dma_mask = 0xffffffff,
228 .platform_data = &usb1_common_data,
230 .num_resources = ARRAY_SIZE(usb1_common_resources),
231 .resource = usb1_common_resources,
235 static struct sh_mobile_lcdc_info lcdc_info = {
237 .interface_type = RGB18,
238 .chan = LCDC_CHAN_MAINLCD,
241 .sync = 0, /* hsync and vsync are active low */
243 .lcd_size_cfg = { /* 7.0 inch */
252 static struct resource lcdc_resources[] = {
257 .flags = IORESOURCE_MEM,
261 .flags = IORESOURCE_IRQ,
265 static struct platform_device lcdc_device = {
266 .name = "sh_mobile_lcdc_fb",
267 .num_resources = ARRAY_SIZE(lcdc_resources),
268 .resource = lcdc_resources,
270 .platform_data = &lcdc_info,
273 .hwblk_id = HWBLK_LCDC,
278 static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
279 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
282 static struct resource ceu0_resources[] = {
287 .flags = IORESOURCE_MEM,
291 .flags = IORESOURCE_IRQ,
294 /* place holder for contiguous memory */
298 static struct platform_device ceu0_device = {
299 .name = "sh_mobile_ceu",
300 .id = 0, /* "ceu0" clock */
301 .num_resources = ARRAY_SIZE(ceu0_resources),
302 .resource = ceu0_resources,
304 .platform_data = &sh_mobile_ceu0_info,
307 .hwblk_id = HWBLK_CEU0,
312 static struct sh_mobile_ceu_info sh_mobile_ceu1_info = {
313 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
316 static struct resource ceu1_resources[] = {
321 .flags = IORESOURCE_MEM,
325 .flags = IORESOURCE_IRQ,
328 /* place holder for contiguous memory */
332 static struct platform_device ceu1_device = {
333 .name = "sh_mobile_ceu",
334 .id = 1, /* "ceu1" clock */
335 .num_resources = ARRAY_SIZE(ceu1_resources),
336 .resource = ceu1_resources,
338 .platform_data = &sh_mobile_ceu1_info,
341 .hwblk_id = HWBLK_CEU1,
346 static struct i2c_board_info i2c1_devices[] = {
348 I2C_BOARD_INFO("r2025sd", 0x32),
353 static struct sh_keysc_info keysc_info = {
354 .mode = SH_KEYSC_MODE_1,
358 .keycodes = { KEY_1, 0, 0, 0, 0,
363 KEY_6, 0, 0, 0, 0, },
366 static struct resource keysc_resources[] = {
371 .flags = IORESOURCE_MEM,
375 .flags = IORESOURCE_IRQ,
379 static struct platform_device keysc_device = {
381 .id = 0, /* keysc0 clock */
382 .num_resources = ARRAY_SIZE(keysc_resources),
383 .resource = keysc_resources,
385 .platform_data = &keysc_info,
388 .hwblk_id = HWBLK_KEYSC,
394 static int ts_get_pendown_state(void)
397 gpio_free(GPIO_FN_INTC_IRQ0);
398 gpio_request(GPIO_PTZ0, NULL);
399 gpio_direction_input(GPIO_PTZ0);
401 val = gpio_get_value(GPIO_PTZ0);
403 gpio_free(GPIO_PTZ0);
404 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
409 static int ts_init(void)
411 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
415 struct tsc2007_platform_data tsc2007_info = {
418 .get_pendown_state = ts_get_pendown_state,
419 .init_platform_hw = ts_init,
422 static struct i2c_board_info ts_i2c_clients = {
423 I2C_BOARD_INFO("tsc2007", 0x48),
425 .platform_data = &tsc2007_info,
429 #ifdef CONFIG_MFD_SH_MOBILE_SDHI
431 static void sdhi0_set_pwr(struct platform_device *pdev, int state)
433 gpio_set_value(GPIO_PTB6, state);
436 static struct sh_mobile_sdhi_info sdhi0_info = {
437 .set_pwr = sdhi0_set_pwr,
440 static struct resource sdhi0_resources[] = {
445 .flags = IORESOURCE_MEM,
449 .flags = IORESOURCE_IRQ,
453 static struct platform_device sdhi0_device = {
454 .name = "sh_mobile_sdhi",
455 .num_resources = ARRAY_SIZE(sdhi0_resources),
456 .resource = sdhi0_resources,
459 .platform_data = &sdhi0_info,
462 .hwblk_id = HWBLK_SDHI0,
467 static void sdhi1_set_pwr(struct platform_device *pdev, int state)
469 gpio_set_value(GPIO_PTB7, state);
472 static struct sh_mobile_sdhi_info sdhi1_info = {
473 .set_pwr = sdhi1_set_pwr,
476 static struct resource sdhi1_resources[] = {
481 .flags = IORESOURCE_MEM,
485 .flags = IORESOURCE_IRQ,
489 static struct platform_device sdhi1_device = {
490 .name = "sh_mobile_sdhi",
491 .num_resources = ARRAY_SIZE(sdhi1_resources),
492 .resource = sdhi1_resources,
495 .platform_data = &sdhi1_info,
498 .hwblk_id = HWBLK_SDHI1,
504 static int mmc_spi_get_ro(struct device *dev)
506 return gpio_get_value(GPIO_PTY6);
509 static int mmc_spi_get_cd(struct device *dev)
511 return !gpio_get_value(GPIO_PTY7);
514 static void mmc_spi_setpower(struct device *dev, unsigned int maskval)
516 gpio_set_value(GPIO_PTB6, maskval ? 1 : 0);
519 static struct mmc_spi_platform_data mmc_spi_info = {
520 .get_ro = mmc_spi_get_ro,
521 .get_cd = mmc_spi_get_cd,
522 .caps = MMC_CAP_NEEDS_POLL,
523 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */
524 .setpower = mmc_spi_setpower,
527 static struct spi_board_info spi_bus[] = {
529 .modalias = "mmc_spi",
530 .platform_data = &mmc_spi_info,
531 .max_speed_hz = 5000000,
533 .controller_data = (void *) GPIO_PTM4,
537 static struct sh_msiof_spi_info msiof0_data = {
541 static struct resource msiof0_resources[] = {
546 .flags = IORESOURCE_MEM,
550 .flags = IORESOURCE_IRQ,
554 static struct platform_device msiof0_device = {
555 .name = "spi_sh_msiof",
556 .id = 0, /* MSIOF0 */
558 .platform_data = &msiof0_data,
560 .num_resources = ARRAY_SIZE(msiof0_resources),
561 .resource = msiof0_resources,
563 .hwblk_id = HWBLK_MSIOF0,
570 static struct i2c_board_info i2c_camera[] = {
572 I2C_BOARD_INFO("tw9910", 0x45),
577 static int tw9910_power(struct device *dev, int mode)
579 int val = mode ? 0 : 1;
581 gpio_set_value(GPIO_PTU2, val);
588 static struct tw9910_video_info tw9910_info = {
589 .buswidth = SOCAM_DATAWIDTH_8,
590 .mpout = TW9910_MPO_FIELD,
593 static struct soc_camera_link tw9910_link = {
596 .power = tw9910_power,
597 .board_info = &i2c_camera[0],
598 .module_name = "tw9910",
599 .priv = &tw9910_info,
603 static struct platform_device camera_devices[] = {
605 .name = "soc-camera-pdrv",
608 .platform_data = &tw9910_link,
613 static struct platform_device *ecovec_devices[] __initdata = {
623 #ifdef CONFIG_MFD_SH_MOBILE_SDHI
632 #define EEPROM_ADDR 0x50
633 static u8 mac_read(struct i2c_adapter *a, u8 command)
635 struct i2c_msg msg[2];
639 msg[0].addr = EEPROM_ADDR;
642 msg[0].buf = &command;
644 msg[1].addr = EEPROM_ADDR;
645 msg[1].flags = I2C_M_RD;
649 ret = i2c_transfer(a, msg, 2);
651 printk(KERN_ERR "error %d\n", ret);
658 static void __init sh_eth_init(struct sh_eth_plat_data *pd)
660 struct i2c_adapter *a = i2c_get_adapter(1);
664 pr_err("can not get I2C 1\n");
668 /* read MAC address frome EEPROM */
669 for (i = 0; i < sizeof(pd->mac_addr); i++) {
670 pd->mac_addr[i] = mac_read(a, 0x10 + i);
675 #define PORT_HIZA 0xA4050158
676 #define IODRIVEA 0xA405018A
678 extern char ecovec24_sdram_enter_start;
679 extern char ecovec24_sdram_enter_end;
680 extern char ecovec24_sdram_leave_start;
681 extern char ecovec24_sdram_leave_end;
683 static int __init arch_setup(void)
685 /* register board specific self-refresh code */
686 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
687 &ecovec24_sdram_enter_start,
688 &ecovec24_sdram_enter_end,
689 &ecovec24_sdram_leave_start,
690 &ecovec24_sdram_leave_end);
692 /* enable STATUS0, STATUS2 and PDSTATUS */
693 gpio_request(GPIO_FN_STATUS0, NULL);
694 gpio_request(GPIO_FN_STATUS2, NULL);
695 gpio_request(GPIO_FN_PDSTATUS, NULL);
698 gpio_request(GPIO_FN_SCIF0_TXD, NULL);
699 gpio_request(GPIO_FN_SCIF0_RXD, NULL);
701 /* enable debug LED */
702 gpio_request(GPIO_PTG0, NULL);
703 gpio_request(GPIO_PTG1, NULL);
704 gpio_request(GPIO_PTG2, NULL);
705 gpio_request(GPIO_PTG3, NULL);
706 gpio_direction_output(GPIO_PTG0, 0);
707 gpio_direction_output(GPIO_PTG1, 0);
708 gpio_direction_output(GPIO_PTG2, 0);
709 gpio_direction_output(GPIO_PTG3, 0);
710 ctrl_outw((ctrl_inw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA);
713 gpio_request(GPIO_PTA1, NULL);
714 gpio_direction_output(GPIO_PTA1, 1);
717 gpio_request(GPIO_FN_RMII_RXD0, NULL);
718 gpio_request(GPIO_FN_RMII_RXD1, NULL);
719 gpio_request(GPIO_FN_RMII_TXD0, NULL);
720 gpio_request(GPIO_FN_RMII_TXD1, NULL);
721 gpio_request(GPIO_FN_RMII_REF_CLK, NULL);
722 gpio_request(GPIO_FN_RMII_TX_EN, NULL);
723 gpio_request(GPIO_FN_RMII_RX_ER, NULL);
724 gpio_request(GPIO_FN_RMII_CRS_DV, NULL);
725 gpio_request(GPIO_FN_MDIO, NULL);
726 gpio_request(GPIO_FN_MDC, NULL);
727 gpio_request(GPIO_FN_LNKSTA, NULL);
730 ctrl_outw(0x0000, 0xA4D80000);
731 ctrl_outw(0x0000, 0xA4D90000);
732 gpio_request(GPIO_PTB3, NULL);
733 gpio_request(GPIO_PTB4, NULL);
734 gpio_request(GPIO_PTB5, NULL);
735 gpio_direction_input(GPIO_PTB3);
736 gpio_direction_output(GPIO_PTB4, 0);
737 gpio_direction_output(GPIO_PTB5, 0);
738 ctrl_outw(0x0600, 0xa40501d4);
739 ctrl_outw(0x0600, 0xa4050192);
741 if (gpio_get_value(GPIO_PTB3)) {
742 printk(KERN_INFO "USB1 function is selected\n");
743 usb1_common_device.name = "r8a66597_udc";
745 printk(KERN_INFO "USB1 host is selected\n");
746 usb1_common_device.name = "r8a66597_hcd";
750 gpio_request(GPIO_FN_LCDD23, NULL);
751 gpio_request(GPIO_FN_LCDD22, NULL);
752 gpio_request(GPIO_FN_LCDD21, NULL);
753 gpio_request(GPIO_FN_LCDD20, NULL);
754 gpio_request(GPIO_FN_LCDD19, NULL);
755 gpio_request(GPIO_FN_LCDD18, NULL);
756 gpio_request(GPIO_FN_LCDD17, NULL);
757 gpio_request(GPIO_FN_LCDD16, NULL);
758 gpio_request(GPIO_FN_LCDD15, NULL);
759 gpio_request(GPIO_FN_LCDD14, NULL);
760 gpio_request(GPIO_FN_LCDD13, NULL);
761 gpio_request(GPIO_FN_LCDD12, NULL);
762 gpio_request(GPIO_FN_LCDD11, NULL);
763 gpio_request(GPIO_FN_LCDD10, NULL);
764 gpio_request(GPIO_FN_LCDD9, NULL);
765 gpio_request(GPIO_FN_LCDD8, NULL);
766 gpio_request(GPIO_FN_LCDD7, NULL);
767 gpio_request(GPIO_FN_LCDD6, NULL);
768 gpio_request(GPIO_FN_LCDD5, NULL);
769 gpio_request(GPIO_FN_LCDD4, NULL);
770 gpio_request(GPIO_FN_LCDD3, NULL);
771 gpio_request(GPIO_FN_LCDD2, NULL);
772 gpio_request(GPIO_FN_LCDD1, NULL);
773 gpio_request(GPIO_FN_LCDD0, NULL);
774 gpio_request(GPIO_FN_LCDDISP, NULL);
775 gpio_request(GPIO_FN_LCDHSYN, NULL);
776 gpio_request(GPIO_FN_LCDDCK, NULL);
777 gpio_request(GPIO_FN_LCDVSYN, NULL);
778 gpio_request(GPIO_FN_LCDDON, NULL);
779 gpio_request(GPIO_FN_LCDLCLK, NULL);
780 ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
782 gpio_request(GPIO_PTE6, NULL);
783 gpio_request(GPIO_PTU1, NULL);
784 gpio_request(GPIO_PTR1, NULL);
785 gpio_request(GPIO_PTA2, NULL);
786 gpio_direction_input(GPIO_PTE6);
787 gpio_direction_output(GPIO_PTU1, 0);
788 gpio_direction_output(GPIO_PTR1, 0);
789 gpio_direction_output(GPIO_PTA2, 0);
791 /* I/O buffer drive ability is high */
792 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x00c0) | 0x0080 , IODRIVEA);
794 if (gpio_get_value(GPIO_PTE6)) {
796 lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
797 lcdc_info.ch[0].clock_divider = 1,
798 lcdc_info.ch[0].lcd_cfg.name = "DVI";
799 lcdc_info.ch[0].lcd_cfg.xres = 1280;
800 lcdc_info.ch[0].lcd_cfg.yres = 720;
801 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
802 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
803 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
804 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
805 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
806 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
808 gpio_set_value(GPIO_PTA2, 1);
809 gpio_set_value(GPIO_PTU1, 1);
813 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
814 lcdc_info.ch[0].clock_divider = 2,
815 lcdc_info.ch[0].lcd_cfg.name = "Panel";
816 lcdc_info.ch[0].lcd_cfg.xres = 800;
817 lcdc_info.ch[0].lcd_cfg.yres = 480;
818 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
819 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
820 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
821 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
822 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
823 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
825 gpio_set_value(GPIO_PTR1, 1);
829 * LCDDON control is needed for Panel,
830 * but current sh_mobile_lcdc driver doesn't control it.
831 * It is temporary correspondence
833 gpio_request(GPIO_PTF4, NULL);
834 gpio_direction_output(GPIO_PTF4, 1);
836 /* enable TouchScreen */
837 i2c_register_board_info(0, &ts_i2c_clients, 1);
838 set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW);
842 gpio_request(GPIO_FN_VIO0_D15, NULL);
843 gpio_request(GPIO_FN_VIO0_D14, NULL);
844 gpio_request(GPIO_FN_VIO0_D13, NULL);
845 gpio_request(GPIO_FN_VIO0_D12, NULL);
846 gpio_request(GPIO_FN_VIO0_D11, NULL);
847 gpio_request(GPIO_FN_VIO0_D10, NULL);
848 gpio_request(GPIO_FN_VIO0_D9, NULL);
849 gpio_request(GPIO_FN_VIO0_D8, NULL);
850 gpio_request(GPIO_FN_VIO0_D7, NULL);
851 gpio_request(GPIO_FN_VIO0_D6, NULL);
852 gpio_request(GPIO_FN_VIO0_D5, NULL);
853 gpio_request(GPIO_FN_VIO0_D4, NULL);
854 gpio_request(GPIO_FN_VIO0_D3, NULL);
855 gpio_request(GPIO_FN_VIO0_D2, NULL);
856 gpio_request(GPIO_FN_VIO0_D1, NULL);
857 gpio_request(GPIO_FN_VIO0_D0, NULL);
858 gpio_request(GPIO_FN_VIO0_VD, NULL);
859 gpio_request(GPIO_FN_VIO0_CLK, NULL);
860 gpio_request(GPIO_FN_VIO0_FLD, NULL);
861 gpio_request(GPIO_FN_VIO0_HD, NULL);
862 platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20);
865 gpio_request(GPIO_FN_VIO1_D7, NULL);
866 gpio_request(GPIO_FN_VIO1_D6, NULL);
867 gpio_request(GPIO_FN_VIO1_D5, NULL);
868 gpio_request(GPIO_FN_VIO1_D4, NULL);
869 gpio_request(GPIO_FN_VIO1_D3, NULL);
870 gpio_request(GPIO_FN_VIO1_D2, NULL);
871 gpio_request(GPIO_FN_VIO1_D1, NULL);
872 gpio_request(GPIO_FN_VIO1_D0, NULL);
873 gpio_request(GPIO_FN_VIO1_FLD, NULL);
874 gpio_request(GPIO_FN_VIO1_HD, NULL);
875 gpio_request(GPIO_FN_VIO1_VD, NULL);
876 gpio_request(GPIO_FN_VIO1_CLK, NULL);
877 platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20);
880 gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
881 gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
882 gpio_request(GPIO_FN_KEYOUT3, NULL);
883 gpio_request(GPIO_FN_KEYOUT2, NULL);
884 gpio_request(GPIO_FN_KEYOUT1, NULL);
885 gpio_request(GPIO_FN_KEYOUT0, NULL);
886 gpio_request(GPIO_FN_KEYIN0, NULL);
888 /* enable user debug switch */
889 gpio_request(GPIO_PTR0, NULL);
890 gpio_request(GPIO_PTR4, NULL);
891 gpio_request(GPIO_PTR5, NULL);
892 gpio_request(GPIO_PTR6, NULL);
893 gpio_direction_input(GPIO_PTR0);
894 gpio_direction_input(GPIO_PTR4);
895 gpio_direction_input(GPIO_PTR5);
896 gpio_direction_input(GPIO_PTR6);
898 #ifdef CONFIG_MFD_SH_MOBILE_SDHI
899 /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
900 gpio_request(GPIO_FN_SDHI0CD, NULL);
901 gpio_request(GPIO_FN_SDHI0WP, NULL);
902 gpio_request(GPIO_FN_SDHI0CMD, NULL);
903 gpio_request(GPIO_FN_SDHI0CLK, NULL);
904 gpio_request(GPIO_FN_SDHI0D3, NULL);
905 gpio_request(GPIO_FN_SDHI0D2, NULL);
906 gpio_request(GPIO_FN_SDHI0D1, NULL);
907 gpio_request(GPIO_FN_SDHI0D0, NULL);
908 gpio_request(GPIO_PTB6, NULL);
909 gpio_direction_output(GPIO_PTB6, 0);
911 /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
912 gpio_request(GPIO_FN_SDHI1CD, NULL);
913 gpio_request(GPIO_FN_SDHI1WP, NULL);
914 gpio_request(GPIO_FN_SDHI1CMD, NULL);
915 gpio_request(GPIO_FN_SDHI1CLK, NULL);
916 gpio_request(GPIO_FN_SDHI1D3, NULL);
917 gpio_request(GPIO_FN_SDHI1D2, NULL);
918 gpio_request(GPIO_FN_SDHI1D1, NULL);
919 gpio_request(GPIO_FN_SDHI1D0, NULL);
920 gpio_request(GPIO_PTB7, NULL);
921 gpio_direction_output(GPIO_PTB7, 0);
923 /* I/O buffer drive ability is high for SDHI1 */
924 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
926 /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
927 gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
928 gpio_request(GPIO_FN_MSIOF0_RXD, NULL);
929 gpio_request(GPIO_FN_MSIOF0_TSCK, NULL);
930 gpio_request(GPIO_PTM4, NULL); /* software CS control of TSYNC pin */
931 gpio_direction_output(GPIO_PTM4, 1); /* active low CS */
932 gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */
933 gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */
934 gpio_request(GPIO_PTY6, NULL); /* write protect */
935 gpio_direction_input(GPIO_PTY6);
936 gpio_request(GPIO_PTY7, NULL); /* card detect */
937 gpio_direction_input(GPIO_PTY7);
939 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
943 gpio_request(GPIO_PTU2, NULL);
944 gpio_direction_output(GPIO_PTU2, 1);
946 /* enable I2C device */
947 i2c_register_board_info(1, i2c1_devices,
948 ARRAY_SIZE(i2c1_devices));
950 return platform_add_devices(ecovec_devices,
951 ARRAY_SIZE(ecovec_devices));
953 arch_initcall(arch_setup);
955 static int __init devices_setup(void)
957 sh_eth_init(&sh_eth_plat);
960 device_initcall(devices_setup);
962 static struct sh_machine_vector mv_ecovec __initmv = {
963 .mv_name = "R0P7724 (EcoVec)",