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 <asm/heartbeat.h>
32 #include <asm/sh_eth.h>
33 #include <asm/clock.h>
34 #include <asm/suspend.h>
35 #include <cpu/sh7724.h>
38 * Address Interface BusWidth
39 *-----------------------------------------
40 * 0x0000_0000 uboot 16bit
41 * 0x0004_0000 Linux romImage 16bit
42 * 0x0014_0000 MTD for Linux 16bit
43 * 0x0400_0000 Internal I/O 16/32bit
44 * 0x0800_0000 DRAM 32bit
45 * 0x1800_0000 MFI 16bit
49 *------------------------------
50 * DS2[1] = FlashROM write protect ON : write protect
51 * OFF : No write protect
52 * DS2[2] = RMII / TS, SCIF ON : RMII
54 * DS2[3] = Camera / Video ON : Camera
56 * DS2[5] = NTSC_OUT Clock ON : On board OSC
58 * DS2[6-7] = MMC / SD ON-OFF : SD
63 static unsigned char led_pos[] = { 0, 1, 2, 3 };
64 static struct heartbeat_data heartbeat_data = {
70 static struct resource heartbeat_resources[] = {
72 .start = 0xA405012C, /* PTG */
73 .end = 0xA405012E - 1,
74 .flags = IORESOURCE_MEM,
78 static struct platform_device heartbeat_device = {
82 .platform_data = &heartbeat_data,
84 .num_resources = ARRAY_SIZE(heartbeat_resources),
85 .resource = heartbeat_resources,
89 static struct mtd_partition nor_flash_partitions[] = {
91 .name = "boot loader",
93 .size = (5 * 1024 * 1024),
94 .mask_flags = MTD_WRITEABLE, /* force read-only */
97 .offset = MTDPART_OFS_APPEND,
98 .size = MTDPART_SIZ_FULL,
102 static struct physmap_flash_data nor_flash_data = {
104 .parts = nor_flash_partitions,
105 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
108 static struct resource nor_flash_resources[] = {
113 .flags = IORESOURCE_MEM,
117 static struct platform_device nor_flash_device = {
118 .name = "physmap-flash",
119 .resource = nor_flash_resources,
120 .num_resources = ARRAY_SIZE(nor_flash_resources),
122 .platform_data = &nor_flash_data,
127 #define SH_ETH_ADDR (0xA4600000)
128 #define SH_ETH_MAHR (SH_ETH_ADDR + 0x1C0)
129 #define SH_ETH_MALR (SH_ETH_ADDR + 0x1C8)
130 static struct resource sh_eth_resources[] = {
132 .start = SH_ETH_ADDR,
133 .end = SH_ETH_ADDR + 0x1FC,
134 .flags = IORESOURCE_MEM,
138 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
142 struct sh_eth_plat_data sh_eth_plat = {
143 .phy = 0x1f, /* SMSC LAN8700 */
144 .edmac_endian = EDMAC_LITTLE_ENDIAN,
145 .ether_link_active_low = 1
148 static struct platform_device sh_eth_device = {
152 .platform_data = &sh_eth_plat,
154 .num_resources = ARRAY_SIZE(sh_eth_resources),
155 .resource = sh_eth_resources,
157 .hwblk_id = HWBLK_ETHER,
162 void usb0_port_power(int port, int power)
164 gpio_set_value(GPIO_PTB4, power);
167 static struct r8a66597_platdata usb0_host_data = {
169 .port_power = usb0_port_power,
172 static struct resource usb0_host_resources[] = {
175 .end = 0xa4d80124 - 1,
176 .flags = IORESOURCE_MEM,
181 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
185 static struct platform_device usb0_host_device = {
186 .name = "r8a66597_hcd",
189 .dma_mask = NULL, /* not use dma */
190 .coherent_dma_mask = 0xffffffff,
191 .platform_data = &usb0_host_data,
193 .num_resources = ARRAY_SIZE(usb0_host_resources),
194 .resource = usb0_host_resources,
197 /* USB1 host/function */
198 void usb1_port_power(int port, int power)
200 gpio_set_value(GPIO_PTB5, power);
203 static struct r8a66597_platdata usb1_common_data = {
205 .port_power = usb1_port_power,
208 static struct resource usb1_common_resources[] = {
211 .end = 0xa4d90124 - 1,
212 .flags = IORESOURCE_MEM,
217 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
221 static struct platform_device usb1_common_device = {
222 /* .name will be added in arch_setup */
225 .dma_mask = NULL, /* not use dma */
226 .coherent_dma_mask = 0xffffffff,
227 .platform_data = &usb1_common_data,
229 .num_resources = ARRAY_SIZE(usb1_common_resources),
230 .resource = usb1_common_resources,
234 static struct sh_mobile_lcdc_info lcdc_info = {
236 .interface_type = RGB18,
237 .chan = LCDC_CHAN_MAINLCD,
240 .sync = 0, /* hsync and vsync are active low */
242 .lcd_size_cfg = { /* 7.0 inch */
251 static struct resource lcdc_resources[] = {
256 .flags = IORESOURCE_MEM,
260 .flags = IORESOURCE_IRQ,
264 static struct platform_device lcdc_device = {
265 .name = "sh_mobile_lcdc_fb",
266 .num_resources = ARRAY_SIZE(lcdc_resources),
267 .resource = lcdc_resources,
269 .platform_data = &lcdc_info,
272 .hwblk_id = HWBLK_LCDC,
277 static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
278 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
281 static struct resource ceu0_resources[] = {
286 .flags = IORESOURCE_MEM,
290 .flags = IORESOURCE_IRQ,
293 /* place holder for contiguous memory */
297 static struct platform_device ceu0_device = {
298 .name = "sh_mobile_ceu",
299 .id = 0, /* "ceu0" clock */
300 .num_resources = ARRAY_SIZE(ceu0_resources),
301 .resource = ceu0_resources,
303 .platform_data = &sh_mobile_ceu0_info,
306 .hwblk_id = HWBLK_CEU0,
311 static struct sh_mobile_ceu_info sh_mobile_ceu1_info = {
312 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
315 static struct resource ceu1_resources[] = {
320 .flags = IORESOURCE_MEM,
324 .flags = IORESOURCE_IRQ,
327 /* place holder for contiguous memory */
331 static struct platform_device ceu1_device = {
332 .name = "sh_mobile_ceu",
333 .id = 1, /* "ceu1" clock */
334 .num_resources = ARRAY_SIZE(ceu1_resources),
335 .resource = ceu1_resources,
337 .platform_data = &sh_mobile_ceu1_info,
340 .hwblk_id = HWBLK_CEU1,
345 static struct i2c_board_info i2c1_devices[] = {
347 I2C_BOARD_INFO("r2025sd", 0x32),
352 static struct sh_keysc_info keysc_info = {
353 .mode = SH_KEYSC_MODE_1,
357 .keycodes = { KEY_1, 0, 0, 0, 0,
362 KEY_6, 0, 0, 0, 0, },
365 static struct resource keysc_resources[] = {
370 .flags = IORESOURCE_MEM,
374 .flags = IORESOURCE_IRQ,
378 static struct platform_device keysc_device = {
380 .id = 0, /* keysc0 clock */
381 .num_resources = ARRAY_SIZE(keysc_resources),
382 .resource = keysc_resources,
384 .platform_data = &keysc_info,
387 .hwblk_id = HWBLK_KEYSC,
393 static int ts_get_pendown_state(void)
396 gpio_free(GPIO_FN_INTC_IRQ0);
397 gpio_request(GPIO_PTZ0, NULL);
398 gpio_direction_input(GPIO_PTZ0);
400 val = gpio_get_value(GPIO_PTZ0);
402 gpio_free(GPIO_PTZ0);
403 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
408 static int ts_init(void)
410 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
414 struct tsc2007_platform_data tsc2007_info = {
417 .get_pendown_state = ts_get_pendown_state,
418 .init_platform_hw = ts_init,
421 static struct i2c_board_info ts_i2c_clients = {
422 I2C_BOARD_INFO("tsc2007", 0x48),
424 .platform_data = &tsc2007_info,
428 #ifdef CONFIG_MFD_SH_MOBILE_SDHI
430 static void sdhi0_set_pwr(struct platform_device *pdev, int state)
432 gpio_set_value(GPIO_PTB6, state);
435 static struct sh_mobile_sdhi_info sdhi0_info = {
436 .set_pwr = sdhi0_set_pwr,
439 static struct resource sdhi0_resources[] = {
444 .flags = IORESOURCE_MEM,
448 .flags = IORESOURCE_IRQ,
452 static struct platform_device sdhi0_device = {
453 .name = "sh_mobile_sdhi",
454 .num_resources = ARRAY_SIZE(sdhi0_resources),
455 .resource = sdhi0_resources,
458 .platform_data = &sdhi0_info,
461 .hwblk_id = HWBLK_SDHI0,
466 static void sdhi1_set_pwr(struct platform_device *pdev, int state)
468 gpio_set_value(GPIO_PTB7, state);
471 static struct sh_mobile_sdhi_info sdhi1_info = {
472 .set_pwr = sdhi1_set_pwr,
475 static struct resource sdhi1_resources[] = {
480 .flags = IORESOURCE_MEM,
484 .flags = IORESOURCE_IRQ,
488 static struct platform_device sdhi1_device = {
489 .name = "sh_mobile_sdhi",
490 .num_resources = ARRAY_SIZE(sdhi1_resources),
491 .resource = sdhi1_resources,
494 .platform_data = &sdhi1_info,
497 .hwblk_id = HWBLK_SDHI1,
503 static int mmc_spi_get_ro(struct device *dev)
505 return gpio_get_value(GPIO_PTY6);
508 static int mmc_spi_get_cd(struct device *dev)
510 return !gpio_get_value(GPIO_PTY7);
513 static void mmc_spi_setpower(struct device *dev, unsigned int maskval)
515 gpio_set_value(GPIO_PTB6, maskval ? 1 : 0);
518 static struct mmc_spi_platform_data mmc_spi_info = {
519 .get_ro = mmc_spi_get_ro,
520 .get_cd = mmc_spi_get_cd,
521 .caps = MMC_CAP_NEEDS_POLL,
522 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */
523 .setpower = mmc_spi_setpower,
526 static struct spi_board_info spi_bus[] = {
528 .modalias = "mmc_spi",
529 .platform_data = &mmc_spi_info,
530 .max_speed_hz = 5000000,
532 .controller_data = (void *) GPIO_PTM4,
536 static struct sh_msiof_spi_info msiof0_data = {
540 static struct resource msiof0_resources[] = {
545 .flags = IORESOURCE_MEM,
549 .flags = IORESOURCE_IRQ,
553 static struct platform_device msiof0_device = {
554 .name = "spi_sh_msiof",
555 .id = 0, /* MSIOF0 */
557 .platform_data = &msiof0_data,
559 .num_resources = ARRAY_SIZE(msiof0_resources),
560 .resource = msiof0_resources,
562 .hwblk_id = HWBLK_MSIOF0,
568 static struct platform_device *ecovec_devices[] __initdata = {
578 #ifdef CONFIG_MFD_SH_MOBILE_SDHI
586 #define EEPROM_ADDR 0x50
587 static u8 mac_read(struct i2c_adapter *a, u8 command)
589 struct i2c_msg msg[2];
593 msg[0].addr = EEPROM_ADDR;
596 msg[0].buf = &command;
598 msg[1].addr = EEPROM_ADDR;
599 msg[1].flags = I2C_M_RD;
603 ret = i2c_transfer(a, msg, 2);
605 printk(KERN_ERR "error %d\n", ret);
612 static void __init sh_eth_init(struct sh_eth_plat_data *pd)
614 struct i2c_adapter *a = i2c_get_adapter(1);
618 pr_err("can not get I2C 1\n");
622 /* read MAC address frome EEPROM */
623 for (i = 0; i < sizeof(pd->mac_addr); i++) {
624 pd->mac_addr[i] = mac_read(a, 0x10 + i);
629 #define PORT_HIZA 0xA4050158
630 #define IODRIVEA 0xA405018A
632 extern char ecovec24_sdram_enter_start;
633 extern char ecovec24_sdram_enter_end;
634 extern char ecovec24_sdram_leave_start;
635 extern char ecovec24_sdram_leave_end;
637 static int __init arch_setup(void)
639 /* register board specific self-refresh code */
640 sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
641 &ecovec24_sdram_enter_start,
642 &ecovec24_sdram_enter_end,
643 &ecovec24_sdram_leave_start,
644 &ecovec24_sdram_leave_end);
646 /* enable STATUS0, STATUS2 and PDSTATUS */
647 gpio_request(GPIO_FN_STATUS0, NULL);
648 gpio_request(GPIO_FN_STATUS2, NULL);
649 gpio_request(GPIO_FN_PDSTATUS, NULL);
652 gpio_request(GPIO_FN_SCIF0_TXD, NULL);
653 gpio_request(GPIO_FN_SCIF0_RXD, NULL);
655 /* enable debug LED */
656 gpio_request(GPIO_PTG0, NULL);
657 gpio_request(GPIO_PTG1, NULL);
658 gpio_request(GPIO_PTG2, NULL);
659 gpio_request(GPIO_PTG3, NULL);
660 gpio_direction_output(GPIO_PTG0, 0);
661 gpio_direction_output(GPIO_PTG1, 0);
662 gpio_direction_output(GPIO_PTG2, 0);
663 gpio_direction_output(GPIO_PTG3, 0);
664 ctrl_outw((ctrl_inw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA);
667 gpio_request(GPIO_PTA1, NULL);
668 gpio_direction_output(GPIO_PTA1, 1);
671 gpio_request(GPIO_FN_RMII_RXD0, NULL);
672 gpio_request(GPIO_FN_RMII_RXD1, NULL);
673 gpio_request(GPIO_FN_RMII_TXD0, NULL);
674 gpio_request(GPIO_FN_RMII_TXD1, NULL);
675 gpio_request(GPIO_FN_RMII_REF_CLK, NULL);
676 gpio_request(GPIO_FN_RMII_TX_EN, NULL);
677 gpio_request(GPIO_FN_RMII_RX_ER, NULL);
678 gpio_request(GPIO_FN_RMII_CRS_DV, NULL);
679 gpio_request(GPIO_FN_MDIO, NULL);
680 gpio_request(GPIO_FN_MDC, NULL);
681 gpio_request(GPIO_FN_LNKSTA, NULL);
684 ctrl_outw(0x0000, 0xA4D80000);
685 ctrl_outw(0x0000, 0xA4D90000);
686 gpio_request(GPIO_PTB3, NULL);
687 gpio_request(GPIO_PTB4, NULL);
688 gpio_request(GPIO_PTB5, NULL);
689 gpio_direction_input(GPIO_PTB3);
690 gpio_direction_output(GPIO_PTB4, 0);
691 gpio_direction_output(GPIO_PTB5, 0);
692 ctrl_outw(0x0600, 0xa40501d4);
693 ctrl_outw(0x0600, 0xa4050192);
695 if (gpio_get_value(GPIO_PTB3)) {
696 printk(KERN_INFO "USB1 function is selected\n");
697 usb1_common_device.name = "r8a66597_udc";
699 printk(KERN_INFO "USB1 host is selected\n");
700 usb1_common_device.name = "r8a66597_hcd";
704 gpio_request(GPIO_FN_LCDD23, NULL);
705 gpio_request(GPIO_FN_LCDD22, NULL);
706 gpio_request(GPIO_FN_LCDD21, NULL);
707 gpio_request(GPIO_FN_LCDD20, NULL);
708 gpio_request(GPIO_FN_LCDD19, NULL);
709 gpio_request(GPIO_FN_LCDD18, NULL);
710 gpio_request(GPIO_FN_LCDD17, NULL);
711 gpio_request(GPIO_FN_LCDD16, NULL);
712 gpio_request(GPIO_FN_LCDD15, NULL);
713 gpio_request(GPIO_FN_LCDD14, NULL);
714 gpio_request(GPIO_FN_LCDD13, NULL);
715 gpio_request(GPIO_FN_LCDD12, NULL);
716 gpio_request(GPIO_FN_LCDD11, NULL);
717 gpio_request(GPIO_FN_LCDD10, NULL);
718 gpio_request(GPIO_FN_LCDD9, NULL);
719 gpio_request(GPIO_FN_LCDD8, NULL);
720 gpio_request(GPIO_FN_LCDD7, NULL);
721 gpio_request(GPIO_FN_LCDD6, NULL);
722 gpio_request(GPIO_FN_LCDD5, NULL);
723 gpio_request(GPIO_FN_LCDD4, NULL);
724 gpio_request(GPIO_FN_LCDD3, NULL);
725 gpio_request(GPIO_FN_LCDD2, NULL);
726 gpio_request(GPIO_FN_LCDD1, NULL);
727 gpio_request(GPIO_FN_LCDD0, NULL);
728 gpio_request(GPIO_FN_LCDDISP, NULL);
729 gpio_request(GPIO_FN_LCDHSYN, NULL);
730 gpio_request(GPIO_FN_LCDDCK, NULL);
731 gpio_request(GPIO_FN_LCDVSYN, NULL);
732 gpio_request(GPIO_FN_LCDDON, NULL);
733 gpio_request(GPIO_FN_LCDLCLK, NULL);
734 ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
736 gpio_request(GPIO_PTE6, NULL);
737 gpio_request(GPIO_PTU1, NULL);
738 gpio_request(GPIO_PTR1, NULL);
739 gpio_request(GPIO_PTA2, NULL);
740 gpio_direction_input(GPIO_PTE6);
741 gpio_direction_output(GPIO_PTU1, 0);
742 gpio_direction_output(GPIO_PTR1, 0);
743 gpio_direction_output(GPIO_PTA2, 0);
745 /* I/O buffer drive ability is high */
746 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x00c0) | 0x0080 , IODRIVEA);
748 if (gpio_get_value(GPIO_PTE6)) {
750 lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
751 lcdc_info.ch[0].clock_divider = 1,
752 lcdc_info.ch[0].lcd_cfg.name = "DVI";
753 lcdc_info.ch[0].lcd_cfg.xres = 1280;
754 lcdc_info.ch[0].lcd_cfg.yres = 720;
755 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
756 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
757 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
758 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
759 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
760 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
762 gpio_set_value(GPIO_PTA2, 1);
763 gpio_set_value(GPIO_PTU1, 1);
767 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
768 lcdc_info.ch[0].clock_divider = 2,
769 lcdc_info.ch[0].lcd_cfg.name = "Panel";
770 lcdc_info.ch[0].lcd_cfg.xres = 800;
771 lcdc_info.ch[0].lcd_cfg.yres = 480;
772 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
773 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
774 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
775 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
776 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
777 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
779 gpio_set_value(GPIO_PTR1, 1);
783 * LCDDON control is needed for Panel,
784 * but current sh_mobile_lcdc driver doesn't control it.
785 * It is temporary correspondence
787 gpio_request(GPIO_PTF4, NULL);
788 gpio_direction_output(GPIO_PTF4, 1);
790 /* enable TouchScreen */
791 i2c_register_board_info(0, &ts_i2c_clients, 1);
792 set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW);
796 gpio_request(GPIO_FN_VIO0_D15, NULL);
797 gpio_request(GPIO_FN_VIO0_D14, NULL);
798 gpio_request(GPIO_FN_VIO0_D13, NULL);
799 gpio_request(GPIO_FN_VIO0_D12, NULL);
800 gpio_request(GPIO_FN_VIO0_D11, NULL);
801 gpio_request(GPIO_FN_VIO0_D10, NULL);
802 gpio_request(GPIO_FN_VIO0_D9, NULL);
803 gpio_request(GPIO_FN_VIO0_D8, NULL);
804 gpio_request(GPIO_FN_VIO0_D7, NULL);
805 gpio_request(GPIO_FN_VIO0_D6, NULL);
806 gpio_request(GPIO_FN_VIO0_D5, NULL);
807 gpio_request(GPIO_FN_VIO0_D4, NULL);
808 gpio_request(GPIO_FN_VIO0_D3, NULL);
809 gpio_request(GPIO_FN_VIO0_D2, NULL);
810 gpio_request(GPIO_FN_VIO0_D1, NULL);
811 gpio_request(GPIO_FN_VIO0_D0, NULL);
812 gpio_request(GPIO_FN_VIO0_VD, NULL);
813 gpio_request(GPIO_FN_VIO0_CLK, NULL);
814 gpio_request(GPIO_FN_VIO0_FLD, NULL);
815 gpio_request(GPIO_FN_VIO0_HD, NULL);
816 platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20);
819 gpio_request(GPIO_FN_VIO1_D7, NULL);
820 gpio_request(GPIO_FN_VIO1_D6, NULL);
821 gpio_request(GPIO_FN_VIO1_D5, NULL);
822 gpio_request(GPIO_FN_VIO1_D4, NULL);
823 gpio_request(GPIO_FN_VIO1_D3, NULL);
824 gpio_request(GPIO_FN_VIO1_D2, NULL);
825 gpio_request(GPIO_FN_VIO1_D1, NULL);
826 gpio_request(GPIO_FN_VIO1_D0, NULL);
827 gpio_request(GPIO_FN_VIO1_FLD, NULL);
828 gpio_request(GPIO_FN_VIO1_HD, NULL);
829 gpio_request(GPIO_FN_VIO1_VD, NULL);
830 gpio_request(GPIO_FN_VIO1_CLK, NULL);
831 platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20);
834 gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
835 gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
836 gpio_request(GPIO_FN_KEYOUT3, NULL);
837 gpio_request(GPIO_FN_KEYOUT2, NULL);
838 gpio_request(GPIO_FN_KEYOUT1, NULL);
839 gpio_request(GPIO_FN_KEYOUT0, NULL);
840 gpio_request(GPIO_FN_KEYIN0, NULL);
842 /* enable user debug switch */
843 gpio_request(GPIO_PTR0, NULL);
844 gpio_request(GPIO_PTR4, NULL);
845 gpio_request(GPIO_PTR5, NULL);
846 gpio_request(GPIO_PTR6, NULL);
847 gpio_direction_input(GPIO_PTR0);
848 gpio_direction_input(GPIO_PTR4);
849 gpio_direction_input(GPIO_PTR5);
850 gpio_direction_input(GPIO_PTR6);
852 #ifdef CONFIG_MFD_SH_MOBILE_SDHI
853 /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */
854 gpio_request(GPIO_FN_SDHI0CD, NULL);
855 gpio_request(GPIO_FN_SDHI0WP, NULL);
856 gpio_request(GPIO_FN_SDHI0CMD, NULL);
857 gpio_request(GPIO_FN_SDHI0CLK, NULL);
858 gpio_request(GPIO_FN_SDHI0D3, NULL);
859 gpio_request(GPIO_FN_SDHI0D2, NULL);
860 gpio_request(GPIO_FN_SDHI0D1, NULL);
861 gpio_request(GPIO_FN_SDHI0D0, NULL);
862 gpio_request(GPIO_PTB6, NULL);
863 gpio_direction_output(GPIO_PTB6, 0);
865 /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */
866 gpio_request(GPIO_FN_SDHI1CD, NULL);
867 gpio_request(GPIO_FN_SDHI1WP, NULL);
868 gpio_request(GPIO_FN_SDHI1CMD, NULL);
869 gpio_request(GPIO_FN_SDHI1CLK, NULL);
870 gpio_request(GPIO_FN_SDHI1D3, NULL);
871 gpio_request(GPIO_FN_SDHI1D2, NULL);
872 gpio_request(GPIO_FN_SDHI1D1, NULL);
873 gpio_request(GPIO_FN_SDHI1D0, NULL);
874 gpio_request(GPIO_PTB7, NULL);
875 gpio_direction_output(GPIO_PTB7, 0);
877 /* I/O buffer drive ability is high for SDHI1 */
878 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA);
880 /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */
881 gpio_request(GPIO_FN_MSIOF0_TXD, NULL);
882 gpio_request(GPIO_FN_MSIOF0_RXD, NULL);
883 gpio_request(GPIO_FN_MSIOF0_TSCK, NULL);
884 gpio_request(GPIO_PTM4, NULL); /* software CS control of TSYNC pin */
885 gpio_direction_output(GPIO_PTM4, 1); /* active low CS */
886 gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */
887 gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */
888 gpio_request(GPIO_PTY6, NULL); /* write protect */
889 gpio_direction_input(GPIO_PTY6);
890 gpio_request(GPIO_PTY7, NULL); /* card detect */
891 gpio_direction_input(GPIO_PTY7);
893 spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus));
896 /* enable I2C device */
897 i2c_register_board_info(1, i2c1_devices,
898 ARRAY_SIZE(i2c1_devices));
900 return platform_add_devices(ecovec_devices,
901 ARRAY_SIZE(ecovec_devices));
903 arch_initcall(arch_setup);
905 static int __init devices_setup(void)
907 sh_eth_init(&sh_eth_plat);
910 device_initcall(devices_setup);
912 static struct sh_machine_vector mv_ecovec __initmv = {
913 .mv_name = "R0P7724 (EcoVec)",