2 * armadillo 800 eva board support
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
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
22 #include <linux/clk.h>
23 #include <linux/delay.h>
24 #include <linux/err.h>
25 #include <linux/kernel.h>
26 #include <linux/input.h>
27 #include <linux/irq.h>
28 #include <linux/platform_device.h>
29 #include <linux/gpio.h>
30 #include <linux/gpio_keys.h>
31 #include <linux/sh_eth.h>
32 #include <linux/videodev2.h>
33 #include <linux/usb/renesas_usbhs.h>
34 #include <linux/mfd/tmio.h>
35 #include <linux/mmc/host.h>
36 #include <linux/mmc/sh_mmcif.h>
37 #include <linux/mmc/sh_mobile_sdhi.h>
38 #include <mach/common.h>
39 #include <mach/irqs.h>
40 #include <mach/r8a7740.h>
41 #include <media/mt9t112.h>
42 #include <media/sh_mobile_ceu.h>
43 #include <media/soc_camera.h>
45 #include <asm/mach-types.h>
46 #include <asm/mach/arch.h>
47 #include <asm/mach/map.h>
48 #include <asm/mach/time.h>
49 #include <asm/hardware/cache-l2x0.h>
50 #include <video/sh_mobile_lcdc.h>
51 #include <video/sh_mobile_hdmi.h>
57 * CON4 Composite Video Output
63 * CON10 Monaural Mic Input
64 * CON11 Stereo Headphone Output
65 * CON12 Audio Line Output(L)
66 * CON13 Audio Line Output(R)
77 * LED1 Camera LED(Yellow)
78 * LED2 Power LED (Green)
79 * ED3-LED6 User LED(Yellow)
80 * LED7 LAN link LED(Green)
81 * LED8 LAN activity LED(Yellow)
89 * -12345678-+---------------+----------------------------
91 * 0 | boot | OS auto boot
92 * -12345678-+---------------+----------------------------
93 * 00 | boot device | eMMC
94 * 10 | boot device | SDHI0 (CON7)
95 * 01 | boot device | -
96 * 11 | boot device | Extension Buss (CS0)
97 * -12345678-+---------------+----------------------------
98 * 0 | Extension Bus | D8-D15 disable, eMMC enable
99 * 1 | Extension Bus | D8-D15 enable, eMMC disable
100 * -12345678-+---------------+----------------------------
101 * 0 | SDHI1 | COM8 disable, COM14 enable
102 * 1 | SDHI1 | COM8 enable, COM14 disable
103 * -12345678-+---------------+----------------------------
104 * 0 | USB0 | COM20 enable, COM24 disable
105 * 1 | USB0 | COM20 disable, COM24 enable
106 * -12345678-+---------------+----------------------------
110 * 11 | JTAG | Boundary Scan
111 *-----------+---------------+----------------------------
117 * When you use USB Function,
118 * set SW1.6 ON, and connect cable to CN24.
120 * USBF needs workaround on R8A7740 chip.
121 * These are a little bit complex.
123 * usbhsf_power_ctrl()
127 * It uses autonomy mode for USB hotplug at this point
128 * (= usbhs_private.platform_callback.get_vbus is NULL),
129 * since we don't know what's happen on PM control
130 * on this workaround.
132 #define USBCR1 0xe605810a
133 #define USBH 0xC6700000
134 #define USBH_USBCTR 0x10834
136 struct usbhsf_private {
142 void __iomem *usbh_base;
143 struct renesas_usbhs_platform_info info;
146 #define usbhsf_get_priv(pdev) \
147 container_of(renesas_usbhs_get_info(pdev), \
148 struct usbhsf_private, info)
150 static int usbhsf_get_id(struct platform_device *pdev)
155 static void usbhsf_power_ctrl(struct platform_device *pdev,
156 void __iomem *base, int enable)
158 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
161 * Work around for USB Function.
162 * It needs USB host clock, and settings
166 * enable all the related usb clocks
169 clk_enable(priv->usb24);
170 clk_enable(priv->pci);
171 clk_enable(priv->host);
172 clk_enable(priv->func);
173 clk_enable(priv->phy);
178 * Port1 is driven by USB function,
179 * Port2 is driven by USB HOST
180 * One HOST (Port1 or Port2 is HOST)
181 * USB PLL input clock = 24MHz
183 __raw_writew(0xd750, USBCR1);
189 __raw_writel(0x0000000c, priv->usbh_base + USBH_USBCTR);
190 __raw_writel(0x00000008, priv->usbh_base + USBH_USBCTR);
196 __raw_writew(0xd770, USBCR1);
197 __raw_writew(0x4000, base + 0x102); /* USBF :: SUSPMODE */
200 __raw_writel(0x0000010f, priv->usbh_base + USBH_USBCTR);
201 __raw_writew(0xd7c0, USBCR1); /* GPIO */
203 clk_disable(priv->phy);
204 clk_disable(priv->func); /* usb work around */
205 clk_disable(priv->host); /* usb work around */
206 clk_disable(priv->pci); /* usb work around */
207 clk_disable(priv->usb24); /* usb work around */
211 static void usbhsf_hardware_exit(struct platform_device *pdev)
213 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
215 if (!IS_ERR(priv->phy))
217 if (!IS_ERR(priv->usb24))
218 clk_put(priv->usb24);
219 if (!IS_ERR(priv->pci))
221 if (!IS_ERR(priv->host))
223 if (!IS_ERR(priv->func))
226 iounmap(priv->usbh_base);
233 priv->usbh_base = NULL;
236 static int usbhsf_hardware_init(struct platform_device *pdev)
238 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
240 priv->phy = clk_get(&pdev->dev, "phy");
241 priv->usb24 = clk_get(&pdev->dev, "usb24");
242 priv->pci = clk_get(&pdev->dev, "pci");
243 priv->func = clk_get(&pdev->dev, "func");
244 priv->host = clk_get(&pdev->dev, "host");
245 priv->usbh_base = ioremap_nocache(USBH, 0x20000);
247 if (IS_ERR(priv->phy) ||
248 IS_ERR(priv->usb24) ||
250 IS_ERR(priv->host) ||
251 IS_ERR(priv->func) ||
253 dev_err(&pdev->dev, "USB clock setting failed\n");
254 usbhsf_hardware_exit(pdev);
258 /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
259 clk_set_rate(priv->usb24,
260 clk_get_rate(clk_get_parent(priv->usb24)));
265 static struct usbhsf_private usbhsf_private = {
267 .platform_callback = {
268 .get_id = usbhsf_get_id,
269 .hardware_init = usbhsf_hardware_init,
270 .hardware_exit = usbhsf_hardware_exit,
271 .power_ctrl = usbhsf_power_ctrl,
275 .detection_delay = 5,
280 static struct resource usbhsf_resources[] = {
284 .end = 0xe6890104 - 1,
285 .flags = IORESOURCE_MEM,
288 .start = evt2irq(0x0A20),
289 .flags = IORESOURCE_IRQ,
293 static struct platform_device usbhsf_device = {
294 .name = "renesas_usbhs",
296 .platform_data = &usbhsf_private.info,
299 .num_resources = ARRAY_SIZE(usbhsf_resources),
300 .resource = usbhsf_resources,
304 static struct sh_eth_plat_data sh_eth_platdata = {
305 .phy = 0x00, /* LAN8710A */
306 .edmac_endian = EDMAC_LITTLE_ENDIAN,
307 .register_type = SH_ETH_REG_GIGABIT,
308 .phy_interface = PHY_INTERFACE_MODE_MII,
311 static struct resource sh_eth_resources[] = {
314 .end = 0xe9a00800 - 1,
315 .flags = IORESOURCE_MEM,
318 .end = 0xe9a02000 - 1,
319 .flags = IORESOURCE_MEM,
321 .start = evt2irq(0x0500),
322 .flags = IORESOURCE_IRQ,
326 static struct platform_device sh_eth_device = {
330 .platform_data = &sh_eth_platdata,
332 .resource = sh_eth_resources,
333 .num_resources = ARRAY_SIZE(sh_eth_resources),
337 static struct fb_videomode lcdc0_mode = {
338 .name = "AMPIER/AM-800480",
350 static struct sh_mobile_lcdc_info lcdc0_info = {
351 .clock_source = LCDC_CLK_BUS,
353 .chan = LCDC_CHAN_MAINLCD,
354 .fourcc = V4L2_PIX_FMT_RGB565,
355 .interface_type = RGB24,
358 .lcd_modes = &lcdc0_mode,
367 static struct resource lcdc0_resources[] = {
372 .flags = IORESOURCE_MEM,
375 .start = intcs_evt2irq(0x580),
376 .flags = IORESOURCE_IRQ,
380 static struct platform_device lcdc0_device = {
381 .name = "sh_mobile_lcdc_fb",
382 .num_resources = ARRAY_SIZE(lcdc0_resources),
383 .resource = lcdc0_resources,
386 .platform_data = &lcdc0_info,
387 .coherent_dma_mask = ~0,
394 static struct sh_mobile_hdmi_info hdmi_info = {
395 .flags = HDMI_OUTPUT_PUSH_PULL |
396 HDMI_OUTPUT_POLARITY_HI |
402 static struct resource hdmi_resources[] = {
407 .flags = IORESOURCE_MEM,
410 .start = evt2irq(0x1700),
411 .flags = IORESOURCE_IRQ,
414 .name = "HDMI emma3pf",
417 .flags = IORESOURCE_MEM,
421 static struct platform_device hdmi_device = {
422 .name = "sh-mobile-hdmi",
423 .num_resources = ARRAY_SIZE(hdmi_resources),
424 .resource = hdmi_resources,
427 .platform_data = &hdmi_info,
431 static const struct fb_videomode lcdc1_mode = {
443 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
446 static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
447 .clock_source = LCDC_CLK_PERIPHERAL, /* HDMI clock */
449 .chan = LCDC_CHAN_MAINLCD,
450 .fourcc = V4L2_PIX_FMT_RGB565,
451 .interface_type = RGB24,
453 .flags = LCDC_FLAGS_DWPOL,
454 .lcd_modes = &lcdc1_mode,
456 .tx_dev = &hdmi_device,
464 static struct resource hdmi_lcdc_resources[] = {
468 .end = 0xfe948000 - 1,
469 .flags = IORESOURCE_MEM,
472 .start = intcs_evt2irq(0x1780),
473 .flags = IORESOURCE_IRQ,
477 static struct platform_device hdmi_lcdc_device = {
478 .name = "sh_mobile_lcdc_fb",
479 .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
480 .resource = hdmi_lcdc_resources,
483 .platform_data = &hdmi_lcdc_info,
484 .coherent_dma_mask = ~0,
489 #define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
491 static struct gpio_keys_button gpio_buttons[] = {
492 GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW1"),
493 GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW2"),
494 GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW3"),
495 GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW4"),
498 static struct gpio_keys_platform_data gpio_key_info = {
499 .buttons = gpio_buttons,
500 .nbuttons = ARRAY_SIZE(gpio_buttons),
503 static struct platform_device gpio_keys_device = {
507 .platform_data = &gpio_key_info,
515 * It use polling mode here, since
516 * CD (= Card Detect) pin is not connected to SDHI0_CD.
517 * We can use IRQ31 as card detect irq,
518 * but it needs chattering removal operation
520 #define IRQ31 evt2irq(0x33E0)
521 static struct sh_mobile_sdhi_info sdhi0_info = {
522 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\
524 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
525 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
528 static struct resource sdhi0_resources[] = {
532 .end = 0xe6850100 - 1,
533 .flags = IORESOURCE_MEM,
536 * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
539 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
540 .start = evt2irq(0x0E20),
541 .flags = IORESOURCE_IRQ,
544 .name = SH_MOBILE_SDHI_IRQ_SDIO,
545 .start = evt2irq(0x0E40),
546 .flags = IORESOURCE_IRQ,
550 static struct platform_device sdhi0_device = {
551 .name = "sh_mobile_sdhi",
554 .platform_data = &sdhi0_info,
556 .num_resources = ARRAY_SIZE(sdhi0_resources),
557 .resource = sdhi0_resources,
561 static struct sh_mobile_sdhi_info sdhi1_info = {
562 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
563 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
564 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
567 static struct resource sdhi1_resources[] = {
571 .end = 0xe6860100 - 1,
572 .flags = IORESOURCE_MEM,
575 .start = evt2irq(0x0E80),
576 .flags = IORESOURCE_IRQ,
579 .start = evt2irq(0x0EA0),
580 .flags = IORESOURCE_IRQ,
583 .start = evt2irq(0x0EC0),
584 .flags = IORESOURCE_IRQ,
588 static struct platform_device sdhi1_device = {
589 .name = "sh_mobile_sdhi",
592 .platform_data = &sdhi1_info,
594 .num_resources = ARRAY_SIZE(sdhi1_resources),
595 .resource = sdhi1_resources,
599 static struct sh_mmcif_plat_data sh_mmcif_plat = {
601 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
602 .caps = MMC_CAP_4_BIT_DATA |
604 MMC_CAP_NONREMOVABLE,
607 static struct resource sh_mmcif_resources[] = {
611 .end = 0xe6bd0100 - 1,
612 .flags = IORESOURCE_MEM,
616 .start = evt2irq(0x1AC0),
617 .flags = IORESOURCE_IRQ,
621 .start = evt2irq(0x1AE0),
622 .flags = IORESOURCE_IRQ,
626 static struct platform_device sh_mmcif_device = {
630 .platform_data = &sh_mmcif_plat,
632 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
633 .resource = sh_mmcif_resources,
637 static int mt9t111_power(struct device *dev, int mode)
639 struct clk *mclk = clk_get(NULL, "video1");
642 dev_err(dev, "can't get video1 clock\n");
647 /* video1 (= CON1 camera) expect 24MHz */
648 clk_set_rate(mclk, clk_round_rate(mclk, 24000000));
650 gpio_direction_output(GPIO_PORT158, 1);
652 gpio_direction_output(GPIO_PORT158, 0);
661 static struct i2c_board_info i2c_camera_mt9t111 = {
662 I2C_BOARD_INFO("mt9t112", 0x3d),
665 static struct mt9t112_camera_info mt9t111_info = {
666 .divider = { 16, 0, 0, 7, 0, 10, 14, 7, 7 },
669 static struct soc_camera_link mt9t111_link = {
672 .board_info = &i2c_camera_mt9t111,
673 .power = mt9t111_power,
674 .priv = &mt9t111_info,
677 static struct platform_device camera_device = {
678 .name = "soc-camera-pdrv",
681 .platform_data = &mt9t111_link,
686 static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
687 .flags = SH_CEU_FLAG_LOWER_8BIT,
690 static struct resource ceu0_resources[] = {
695 .flags = IORESOURCE_MEM,
698 .start = intcs_evt2irq(0x0500),
699 .flags = IORESOURCE_IRQ,
702 /* place holder for contiguous memory */
706 static struct platform_device ceu0_device = {
707 .name = "sh_mobile_ceu",
709 .num_resources = ARRAY_SIZE(ceu0_resources),
710 .resource = ceu0_resources,
712 .platform_data = &sh_mobile_ceu0_info,
713 .coherent_dma_mask = 0xffffffff,
718 static struct i2c_board_info i2c0_devices[] = {
720 I2C_BOARD_INFO("st1232-ts", 0x55),
721 .irq = evt2irq(0x0340),
728 static struct platform_device *eva_devices[] __initdata = {
740 static void __init eva_clock_init(void)
742 struct clk *system = clk_get(NULL, "system_clk");
743 struct clk *xtal1 = clk_get(NULL, "extal1");
744 struct clk *usb24s = clk_get(NULL, "usb24s");
746 if (IS_ERR(system) ||
749 pr_err("armadillo800eva board clock init failed\n");
753 /* armadillo 800 eva extal1 is 24MHz */
754 clk_set_rate(xtal1, 24000000);
756 /* usb24s use extal1 (= system) clock (= 24MHz) */
757 clk_set_parent(usb24s, system);
771 static void __init eva_init(void)
775 r8a7740_pinmux_init();
776 r8a7740_meram_workaround();
779 gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
780 gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
783 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
784 gpio_request(GPIO_FN_LCD0_D0, NULL);
785 gpio_request(GPIO_FN_LCD0_D1, NULL);
786 gpio_request(GPIO_FN_LCD0_D2, NULL);
787 gpio_request(GPIO_FN_LCD0_D3, NULL);
788 gpio_request(GPIO_FN_LCD0_D4, NULL);
789 gpio_request(GPIO_FN_LCD0_D5, NULL);
790 gpio_request(GPIO_FN_LCD0_D6, NULL);
791 gpio_request(GPIO_FN_LCD0_D7, NULL);
792 gpio_request(GPIO_FN_LCD0_D8, NULL);
793 gpio_request(GPIO_FN_LCD0_D9, NULL);
794 gpio_request(GPIO_FN_LCD0_D10, NULL);
795 gpio_request(GPIO_FN_LCD0_D11, NULL);
796 gpio_request(GPIO_FN_LCD0_D12, NULL);
797 gpio_request(GPIO_FN_LCD0_D13, NULL);
798 gpio_request(GPIO_FN_LCD0_D14, NULL);
799 gpio_request(GPIO_FN_LCD0_D15, NULL);
800 gpio_request(GPIO_FN_LCD0_D16, NULL);
801 gpio_request(GPIO_FN_LCD0_D17, NULL);
802 gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
803 gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
804 gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
805 gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
806 gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
807 gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
808 gpio_request(GPIO_FN_LCD0_DCK, NULL);
809 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
810 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
811 gpio_request(GPIO_FN_LCD0_DISP, NULL);
812 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
814 gpio_request(GPIO_PORT61, NULL); /* LCDDON */
815 gpio_direction_output(GPIO_PORT61, 1);
817 gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
818 gpio_direction_output(GPIO_PORT202, 0);
821 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
822 gpio_request(GPIO_PORT166, NULL); /* TP_RST_B */
823 gpio_direction_output(GPIO_PORT166, 1);
826 gpio_request(GPIO_FN_ET_CRS, NULL);
827 gpio_request(GPIO_FN_ET_MDC, NULL);
828 gpio_request(GPIO_FN_ET_MDIO, NULL);
829 gpio_request(GPIO_FN_ET_TX_ER, NULL);
830 gpio_request(GPIO_FN_ET_RX_ER, NULL);
831 gpio_request(GPIO_FN_ET_ERXD0, NULL);
832 gpio_request(GPIO_FN_ET_ERXD1, NULL);
833 gpio_request(GPIO_FN_ET_ERXD2, NULL);
834 gpio_request(GPIO_FN_ET_ERXD3, NULL);
835 gpio_request(GPIO_FN_ET_TX_CLK, NULL);
836 gpio_request(GPIO_FN_ET_TX_EN, NULL);
837 gpio_request(GPIO_FN_ET_ETXD0, NULL);
838 gpio_request(GPIO_FN_ET_ETXD1, NULL);
839 gpio_request(GPIO_FN_ET_ETXD2, NULL);
840 gpio_request(GPIO_FN_ET_ETXD3, NULL);
841 gpio_request(GPIO_FN_ET_PHY_INT, NULL);
842 gpio_request(GPIO_FN_ET_COL, NULL);
843 gpio_request(GPIO_FN_ET_RX_DV, NULL);
844 gpio_request(GPIO_FN_ET_RX_CLK, NULL);
846 gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
847 gpio_direction_output(GPIO_PORT18, 1);
850 gpio_request(GPIO_PORT159, NULL); /* USB_DEVICE_MODE */
851 gpio_direction_input(GPIO_PORT159);
853 if (gpio_get_value(GPIO_PORT159)) {
857 gpio_request(GPIO_FN_VBUS, NULL);
858 platform_device_register(&usbhsf_device);
862 gpio_request(GPIO_FN_SDHI0_CMD, NULL);
863 gpio_request(GPIO_FN_SDHI0_CLK, NULL);
864 gpio_request(GPIO_FN_SDHI0_D0, NULL);
865 gpio_request(GPIO_FN_SDHI0_D1, NULL);
866 gpio_request(GPIO_FN_SDHI0_D2, NULL);
867 gpio_request(GPIO_FN_SDHI0_D3, NULL);
868 gpio_request(GPIO_FN_SDHI0_WP, NULL);
870 gpio_request(GPIO_PORT17, NULL); /* SDHI0_18/33_B */
871 gpio_request(GPIO_PORT74, NULL); /* SDHI0_PON */
872 gpio_request(GPIO_PORT75, NULL); /* SDSLOT1_PON */
873 gpio_direction_output(GPIO_PORT17, 0);
874 gpio_direction_output(GPIO_PORT74, 1);
875 gpio_direction_output(GPIO_PORT75, 1);
877 /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
882 * Here doesn't care SW1.4 status,
883 * since CON2 is not mounted.
885 gpio_request(GPIO_FN_MMC1_CLK_PORT103, NULL);
886 gpio_request(GPIO_FN_MMC1_CMD_PORT104, NULL);
887 gpio_request(GPIO_FN_MMC1_D0_PORT149, NULL);
888 gpio_request(GPIO_FN_MMC1_D1_PORT148, NULL);
889 gpio_request(GPIO_FN_MMC1_D2_PORT147, NULL);
890 gpio_request(GPIO_FN_MMC1_D3_PORT146, NULL);
891 gpio_request(GPIO_FN_MMC1_D4_PORT145, NULL);
892 gpio_request(GPIO_FN_MMC1_D5_PORT144, NULL);
893 gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL);
894 gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL);
897 gpio_request(GPIO_FN_VIO0_D7, NULL);
898 gpio_request(GPIO_FN_VIO0_D6, NULL);
899 gpio_request(GPIO_FN_VIO0_D5, NULL);
900 gpio_request(GPIO_FN_VIO0_D4, NULL);
901 gpio_request(GPIO_FN_VIO0_D3, NULL);
902 gpio_request(GPIO_FN_VIO0_D2, NULL);
903 gpio_request(GPIO_FN_VIO0_D1, NULL);
904 gpio_request(GPIO_FN_VIO0_D0, NULL);
905 gpio_request(GPIO_FN_VIO0_CLK, NULL);
906 gpio_request(GPIO_FN_VIO0_HD, NULL);
907 gpio_request(GPIO_FN_VIO0_VD, NULL);
908 gpio_request(GPIO_FN_VIO0_FIELD, NULL);
909 gpio_request(GPIO_FN_VIO_CKO, NULL);
911 /* CON1/CON15 Camera */
912 gpio_request(GPIO_PORT173, NULL); /* STANDBY */
913 gpio_request(GPIO_PORT172, NULL); /* RST */
914 gpio_request(GPIO_PORT158, NULL); /* CAM_PON */
915 gpio_direction_output(GPIO_PORT173, 0);
916 gpio_direction_output(GPIO_PORT172, 1);
917 gpio_direction_output(GPIO_PORT158, 0); /* see mt9t111_power() */
922 * DBGMD/LCDC0/FSIA MUX
923 * DBGMD_SELECT_B should be set after setting PFC Function.
925 gpio_request(GPIO_PORT176, NULL);
926 gpio_direction_output(GPIO_PORT176, 1);
929 * We can switch CON8/CON14 by SW1.5,
930 * but it needs after DBGMD_SELECT_B
932 gpio_request(GPIO_PORT6, NULL);
933 gpio_direction_input(GPIO_PORT6);
934 if (gpio_get_value(GPIO_PORT6)) {
937 /* CON8 (SDHI1) enable */
938 gpio_request(GPIO_FN_SDHI1_CLK, NULL);
939 gpio_request(GPIO_FN_SDHI1_CMD, NULL);
940 gpio_request(GPIO_FN_SDHI1_D0, NULL);
941 gpio_request(GPIO_FN_SDHI1_D1, NULL);
942 gpio_request(GPIO_FN_SDHI1_D2, NULL);
943 gpio_request(GPIO_FN_SDHI1_D3, NULL);
944 gpio_request(GPIO_FN_SDHI1_CD, NULL);
945 gpio_request(GPIO_FN_SDHI1_WP, NULL);
947 gpio_request(GPIO_PORT16, NULL); /* SDSLOT2_PON */
948 gpio_direction_output(GPIO_PORT16, 1);
950 platform_device_register(&sdhi1_device);
954 #ifdef CONFIG_CACHE_L2X0
955 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
956 l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
959 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
961 r8a7740_add_standard_devices();
963 platform_add_devices(eva_devices,
964 ARRAY_SIZE(eva_devices));
967 static void __init eva_earlytimer_init(void)
969 r8a7740_clock_init(MD_CK0 | MD_CK2);
970 shmobile_earlytimer_init();
973 static void __init eva_add_early_devices(void)
975 r8a7740_add_early_devices();
977 /* override timer setup with board-specific code */
978 shmobile_timer.init = eva_earlytimer_init;
981 static const char *eva_boards_compat_dt[] __initdata = {
982 "renesas,armadillo800eva",
986 DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
987 .map_io = r8a7740_map_io,
988 .init_early = eva_add_early_devices,
989 .init_irq = r8a7740_init_irq,
990 .handle_irq = shmobile_handle_irq_intc,
991 .init_machine = eva_init,
992 .init_late = shmobile_init_late,
993 .timer = &shmobile_timer,
994 .dt_compat = eva_boards_compat_dt,