14138b740SKuninori Morimoto /* 24138b740SKuninori Morimoto * Copyright (C) 2009 Renesas Solutions Corp. 34138b740SKuninori Morimoto * 44138b740SKuninori Morimoto * Kuninori Morimoto <morimoto.kuninori@renesas.com> 54138b740SKuninori Morimoto * 64138b740SKuninori Morimoto * This file is subject to the terms and conditions of the GNU General Public 74138b740SKuninori Morimoto * License. See the file "COPYING" in the main directory of this archive 84138b740SKuninori Morimoto * for more details. 94138b740SKuninori Morimoto */ 10*c2f9b05fSJacopo Mondi #include <asm/clock.h> 11*c2f9b05fSJacopo Mondi #include <asm/heartbeat.h> 12*c2f9b05fSJacopo Mondi #include <asm/suspend.h> 13*c2f9b05fSJacopo Mondi #include <cpu/sh7724.h> 14*c2f9b05fSJacopo Mondi #include <linux/delay.h> 154138b740SKuninori Morimoto #include <linux/device.h> 16*c2f9b05fSJacopo Mondi #include <linux/i2c.h> 17*c2f9b05fSJacopo Mondi #include <linux/io.h> 18*c2f9b05fSJacopo Mondi #include <linux/init.h> 19*c2f9b05fSJacopo Mondi #include <linux/input.h> 20*c2f9b05fSJacopo Mondi #include <linux/input/sh_keysc.h> 21*c2f9b05fSJacopo Mondi #include <linux/interrupt.h> 22*c2f9b05fSJacopo Mondi #include <linux/memblock.h> 23*c2f9b05fSJacopo Mondi #include <linux/mfd/tmio.h> 241238c684SYusuke Goda #include <linux/mmc/host.h> 251238c684SYusuke Goda #include <linux/mmc/sh_mmcif.h> 264138b740SKuninori Morimoto #include <linux/mtd/physmap.h> 274138b740SKuninori Morimoto #include <linux/gpio.h> 28*c2f9b05fSJacopo Mondi #include <linux/gpio/machine.h> 29*c2f9b05fSJacopo Mondi #include <linux/platform_data/gpio_backlight.h> 30*c2f9b05fSJacopo Mondi #include <linux/platform_data/tsc2007.h> 31*c2f9b05fSJacopo Mondi #include <linux/platform_device.h> 32d4c191dfSGuennadi Liakhovetski #include <linux/regulator/fixed.h> 33d4c191dfSGuennadi Liakhovetski #include <linux/regulator/machine.h> 34cf8e56bfSYoshihiro Shimoda #include <linux/sh_eth.h> 359307d115SPaul Mundt #include <linux/sh_intc.h> 36*c2f9b05fSJacopo Mondi #include <linux/spi/mmc_spi.h> 37*c2f9b05fSJacopo Mondi #include <linux/spi/sh_msiof.h> 38*c2f9b05fSJacopo Mondi #include <linux/spi/spi.h> 39*c2f9b05fSJacopo Mondi #include <linux/usb/r8a66597.h> 40*c2f9b05fSJacopo Mondi #include <linux/usb/renesas_usbhs.h> 41a1ad8033SGuennadi Liakhovetski #include <linux/videodev2.h> 42*c2f9b05fSJacopo Mondi 43*c2f9b05fSJacopo Mondi #include <media/drv-intf/renesas-ceu.h> 44*c2f9b05fSJacopo Mondi #include <media/i2c/mt9t112.h> 45*c2f9b05fSJacopo Mondi #include <media/i2c/tw9910.h> 46*c2f9b05fSJacopo Mondi 471980fdc4SKuninori Morimoto #include <sound/sh_fsi.h> 48064bfadaSKuninori Morimoto #include <sound/simple_card.h> 49*c2f9b05fSJacopo Mondi 50*c2f9b05fSJacopo Mondi #include <video/sh_mobile_lcdc.h> 514138b740SKuninori Morimoto 524138b740SKuninori Morimoto /* 53b7056bc1SKuninori Morimoto * Address Interface BusWidth 54b7056bc1SKuninori Morimoto *----------------------------------------- 55b7056bc1SKuninori Morimoto * 0x0000_0000 uboot 16bit 56b7056bc1SKuninori Morimoto * 0x0004_0000 Linux romImage 16bit 57b7056bc1SKuninori Morimoto * 0x0014_0000 MTD for Linux 16bit 58b7056bc1SKuninori Morimoto * 0x0400_0000 Internal I/O 16/32bit 59b7056bc1SKuninori Morimoto * 0x0800_0000 DRAM 32bit 60b7056bc1SKuninori Morimoto * 0x1800_0000 MFI 16bit 614138b740SKuninori Morimoto */ 624138b740SKuninori Morimoto 639c472c4dSKuninori Morimoto /* SWITCH 649c472c4dSKuninori Morimoto *------------------------------ 659c472c4dSKuninori Morimoto * DS2[1] = FlashROM write protect ON : write protect 669c472c4dSKuninori Morimoto * OFF : No write protect 679c472c4dSKuninori Morimoto * DS2[2] = RMII / TS, SCIF ON : RMII 689c472c4dSKuninori Morimoto * OFF : TS, SCIF3 699c472c4dSKuninori Morimoto * DS2[3] = Camera / Video ON : Camera 709c472c4dSKuninori Morimoto * OFF : NTSC/PAL (IN) 719c472c4dSKuninori Morimoto * DS2[5] = NTSC_OUT Clock ON : On board OSC 729c472c4dSKuninori Morimoto * OFF : SH7724 DV_CLK 739c472c4dSKuninori Morimoto * DS2[6-7] = MMC / SD ON-OFF : SD 749c472c4dSKuninori Morimoto * OFF-ON : MMC 759c472c4dSKuninori Morimoto */ 769c472c4dSKuninori Morimoto 77035688d9SKuninori Morimoto /* 78035688d9SKuninori Morimoto * FSI - DA7210 79035688d9SKuninori Morimoto * 80035688d9SKuninori Morimoto * it needs amixer settings for playing 81035688d9SKuninori Morimoto * 82035688d9SKuninori Morimoto * amixer set 'HeadPhone' 80 83035688d9SKuninori Morimoto * amixer set 'Out Mixer Left DAC Left' on 84035688d9SKuninori Morimoto * amixer set 'Out Mixer Right DAC Right' on 85035688d9SKuninori Morimoto */ 86035688d9SKuninori Morimoto 87*c2f9b05fSJacopo Mondi #define CEU_BUFFER_MEMORY_SIZE (4 << 20) 88*c2f9b05fSJacopo Mondi static phys_addr_t ceu0_dma_membase; 89*c2f9b05fSJacopo Mondi static phys_addr_t ceu1_dma_membase; 90*c2f9b05fSJacopo Mondi 914138b740SKuninori Morimoto /* Heartbeat */ 924138b740SKuninori Morimoto static unsigned char led_pos[] = { 0, 1, 2, 3 }; 93a09d2831SPaul Mundt 944138b740SKuninori Morimoto static struct heartbeat_data heartbeat_data = { 954138b740SKuninori Morimoto .nr_bits = 4, 964138b740SKuninori Morimoto .bit_pos = led_pos, 974138b740SKuninori Morimoto }; 984138b740SKuninori Morimoto 99a09d2831SPaul Mundt static struct resource heartbeat_resource = { 1004138b740SKuninori Morimoto .start = 0xA405012C, /* PTG */ 1014138b740SKuninori Morimoto .end = 0xA405012E - 1, 102a09d2831SPaul Mundt .flags = IORESOURCE_MEM | IORESOURCE_MEM_8BIT, 1034138b740SKuninori Morimoto }; 1044138b740SKuninori Morimoto 1054138b740SKuninori Morimoto static struct platform_device heartbeat_device = { 1064138b740SKuninori Morimoto .name = "heartbeat", 1074138b740SKuninori Morimoto .id = -1, 1084138b740SKuninori Morimoto .dev = { 1094138b740SKuninori Morimoto .platform_data = &heartbeat_data, 1104138b740SKuninori Morimoto }, 111a09d2831SPaul Mundt .num_resources = 1, 112a09d2831SPaul Mundt .resource = &heartbeat_resource, 1134138b740SKuninori Morimoto }; 1144138b740SKuninori Morimoto 1154138b740SKuninori Morimoto /* MTD */ 1164138b740SKuninori Morimoto static struct mtd_partition nor_flash_partitions[] = { 1174138b740SKuninori Morimoto { 118b7056bc1SKuninori Morimoto .name = "boot loader", 1194138b740SKuninori Morimoto .offset = 0, 120b7056bc1SKuninori Morimoto .size = (5 * 1024 * 1024), 121d5ce010cSKuninori Morimoto .mask_flags = MTD_WRITEABLE, /* force read-only */ 1224138b740SKuninori Morimoto }, { 1234138b740SKuninori Morimoto .name = "free-area", 1244138b740SKuninori Morimoto .offset = MTDPART_OFS_APPEND, 1254138b740SKuninori Morimoto .size = MTDPART_SIZ_FULL, 1264138b740SKuninori Morimoto }, 1274138b740SKuninori Morimoto }; 1284138b740SKuninori Morimoto 1294138b740SKuninori Morimoto static struct physmap_flash_data nor_flash_data = { 1304138b740SKuninori Morimoto .width = 2, 1314138b740SKuninori Morimoto .parts = nor_flash_partitions, 1324138b740SKuninori Morimoto .nr_parts = ARRAY_SIZE(nor_flash_partitions), 1334138b740SKuninori Morimoto }; 1344138b740SKuninori Morimoto 1354138b740SKuninori Morimoto static struct resource nor_flash_resources[] = { 1364138b740SKuninori Morimoto [0] = { 1374138b740SKuninori Morimoto .name = "NOR Flash", 1384138b740SKuninori Morimoto .start = 0x00000000, 1394138b740SKuninori Morimoto .end = 0x03ffffff, 1404138b740SKuninori Morimoto .flags = IORESOURCE_MEM, 1414138b740SKuninori Morimoto } 1424138b740SKuninori Morimoto }; 1434138b740SKuninori Morimoto 1444138b740SKuninori Morimoto static struct platform_device nor_flash_device = { 1454138b740SKuninori Morimoto .name = "physmap-flash", 1464138b740SKuninori Morimoto .resource = nor_flash_resources, 1474138b740SKuninori Morimoto .num_resources = ARRAY_SIZE(nor_flash_resources), 1484138b740SKuninori Morimoto .dev = { 1494138b740SKuninori Morimoto .platform_data = &nor_flash_data, 1504138b740SKuninori Morimoto }, 1514138b740SKuninori Morimoto }; 1524138b740SKuninori Morimoto 15335a35408SKuninori Morimoto /* SH Eth */ 15435a35408SKuninori Morimoto #define SH_ETH_ADDR (0xA4600000) 15535a35408SKuninori Morimoto static struct resource sh_eth_resources[] = { 15635a35408SKuninori Morimoto [0] = { 15735a35408SKuninori Morimoto .start = SH_ETH_ADDR, 15835a35408SKuninori Morimoto .end = SH_ETH_ADDR + 0x1FC, 15935a35408SKuninori Morimoto .flags = IORESOURCE_MEM, 16035a35408SKuninori Morimoto }, 16135a35408SKuninori Morimoto [1] = { 1629307d115SPaul Mundt .start = evt2irq(0xd60), 16335a35408SKuninori Morimoto .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 16435a35408SKuninori Morimoto }, 16535a35408SKuninori Morimoto }; 16635a35408SKuninori Morimoto 1673ce09334SKuninori Morimoto static struct sh_eth_plat_data sh_eth_plat = { 16835a35408SKuninori Morimoto .phy = 0x1f, /* SMSC LAN8700 */ 1699055f895SYoshihiro Shimoda .phy_interface = PHY_INTERFACE_MODE_MII, 170acf3cc28SKuninori Morimoto .ether_link_active_low = 1 17135a35408SKuninori Morimoto }; 17235a35408SKuninori Morimoto 17335a35408SKuninori Morimoto static struct platform_device sh_eth_device = { 1749c3beaabSSergei Shtylyov .name = "sh7724-ether", 17535a35408SKuninori Morimoto .id = 0, 17635a35408SKuninori Morimoto .dev = { 17735a35408SKuninori Morimoto .platform_data = &sh_eth_plat, 17835a35408SKuninori Morimoto }, 17935a35408SKuninori Morimoto .num_resources = ARRAY_SIZE(sh_eth_resources), 18035a35408SKuninori Morimoto .resource = sh_eth_resources, 18135a35408SKuninori Morimoto }; 18235a35408SKuninori Morimoto 183907050a3SKuninori Morimoto /* USB0 host */ 1843ce09334SKuninori Morimoto static void usb0_port_power(int port, int power) 185907050a3SKuninori Morimoto { 186907050a3SKuninori Morimoto gpio_set_value(GPIO_PTB4, power); 187907050a3SKuninori Morimoto } 188907050a3SKuninori Morimoto 189907050a3SKuninori Morimoto static struct r8a66597_platdata usb0_host_data = { 190907050a3SKuninori Morimoto .on_chip = 1, 191907050a3SKuninori Morimoto .port_power = usb0_port_power, 192907050a3SKuninori Morimoto }; 193907050a3SKuninori Morimoto 194907050a3SKuninori Morimoto static struct resource usb0_host_resources[] = { 195907050a3SKuninori Morimoto [0] = { 196907050a3SKuninori Morimoto .start = 0xa4d80000, 197907050a3SKuninori Morimoto .end = 0xa4d80124 - 1, 198907050a3SKuninori Morimoto .flags = IORESOURCE_MEM, 199907050a3SKuninori Morimoto }, 200907050a3SKuninori Morimoto [1] = { 2019307d115SPaul Mundt .start = evt2irq(0xa20), 2029307d115SPaul Mundt .end = evt2irq(0xa20), 203907050a3SKuninori Morimoto .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, 204907050a3SKuninori Morimoto }, 205907050a3SKuninori Morimoto }; 206907050a3SKuninori Morimoto 207907050a3SKuninori Morimoto static struct platform_device usb0_host_device = { 208907050a3SKuninori Morimoto .name = "r8a66597_hcd", 209907050a3SKuninori Morimoto .id = 0, 210907050a3SKuninori Morimoto .dev = { 211907050a3SKuninori Morimoto .dma_mask = NULL, /* not use dma */ 212907050a3SKuninori Morimoto .coherent_dma_mask = 0xffffffff, 213907050a3SKuninori Morimoto .platform_data = &usb0_host_data, 214907050a3SKuninori Morimoto }, 215907050a3SKuninori Morimoto .num_resources = ARRAY_SIZE(usb0_host_resources), 216907050a3SKuninori Morimoto .resource = usb0_host_resources, 217907050a3SKuninori Morimoto }; 218907050a3SKuninori Morimoto 2193714a9a0SKuninori Morimoto /* USB1 host/function */ 2203ce09334SKuninori Morimoto static void usb1_port_power(int port, int power) 221907050a3SKuninori Morimoto { 222907050a3SKuninori Morimoto gpio_set_value(GPIO_PTB5, power); 223907050a3SKuninori Morimoto } 224907050a3SKuninori Morimoto 2253714a9a0SKuninori Morimoto static struct r8a66597_platdata usb1_common_data = { 226907050a3SKuninori Morimoto .on_chip = 1, 227907050a3SKuninori Morimoto .port_power = usb1_port_power, 228907050a3SKuninori Morimoto }; 229907050a3SKuninori Morimoto 2303714a9a0SKuninori Morimoto static struct resource usb1_common_resources[] = { 231907050a3SKuninori Morimoto [0] = { 232907050a3SKuninori Morimoto .start = 0xa4d90000, 233907050a3SKuninori Morimoto .end = 0xa4d90124 - 1, 234907050a3SKuninori Morimoto .flags = IORESOURCE_MEM, 235907050a3SKuninori Morimoto }, 236907050a3SKuninori Morimoto [1] = { 2379307d115SPaul Mundt .start = evt2irq(0xa40), 2389307d115SPaul Mundt .end = evt2irq(0xa40), 239907050a3SKuninori Morimoto .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, 240907050a3SKuninori Morimoto }, 241907050a3SKuninori Morimoto }; 242907050a3SKuninori Morimoto 2433714a9a0SKuninori Morimoto static struct platform_device usb1_common_device = { 2443714a9a0SKuninori Morimoto /* .name will be added in arch_setup */ 245907050a3SKuninori Morimoto .id = 1, 246907050a3SKuninori Morimoto .dev = { 247907050a3SKuninori Morimoto .dma_mask = NULL, /* not use dma */ 248907050a3SKuninori Morimoto .coherent_dma_mask = 0xffffffff, 2493714a9a0SKuninori Morimoto .platform_data = &usb1_common_data, 250907050a3SKuninori Morimoto }, 2513714a9a0SKuninori Morimoto .num_resources = ARRAY_SIZE(usb1_common_resources), 2523714a9a0SKuninori Morimoto .resource = usb1_common_resources, 253907050a3SKuninori Morimoto }; 254907050a3SKuninori Morimoto 255fb2e7394SKuninori Morimoto /* 256fb2e7394SKuninori Morimoto * USBHS 257fb2e7394SKuninori Morimoto */ 258fb2e7394SKuninori Morimoto static int usbhs_get_id(struct platform_device *pdev) 259fb2e7394SKuninori Morimoto { 260fb2e7394SKuninori Morimoto return gpio_get_value(GPIO_PTB3); 261fb2e7394SKuninori Morimoto } 262fb2e7394SKuninori Morimoto 263225da3e3SKuninori Morimoto static int usbhs_phy_reset(struct platform_device *pdev) 2641ca8fe38SKuninori Morimoto { 2651ca8fe38SKuninori Morimoto /* enable vbus if HOST */ 2661ca8fe38SKuninori Morimoto if (!gpio_get_value(GPIO_PTB3)) 2671ca8fe38SKuninori Morimoto gpio_set_value(GPIO_PTB5, 1); 268225da3e3SKuninori Morimoto 269225da3e3SKuninori Morimoto return 0; 2701ca8fe38SKuninori Morimoto } 2711ca8fe38SKuninori Morimoto 272fb2e7394SKuninori Morimoto static struct renesas_usbhs_platform_info usbhs_info = { 273fb2e7394SKuninori Morimoto .platform_callback = { 274fb2e7394SKuninori Morimoto .get_id = usbhs_get_id, 2751ca8fe38SKuninori Morimoto .phy_reset = usbhs_phy_reset, 276fb2e7394SKuninori Morimoto }, 277fb2e7394SKuninori Morimoto .driver_param = { 278fb2e7394SKuninori Morimoto .buswait_bwait = 4, 279fb2e7394SKuninori Morimoto .detection_delay = 5, 2809f0fa799SKuninori Morimoto .d0_tx_id = SHDMA_SLAVE_USB1D0_TX, 2819f0fa799SKuninori Morimoto .d0_rx_id = SHDMA_SLAVE_USB1D0_RX, 2829f0fa799SKuninori Morimoto .d1_tx_id = SHDMA_SLAVE_USB1D1_TX, 2839f0fa799SKuninori Morimoto .d1_rx_id = SHDMA_SLAVE_USB1D1_RX, 284fb2e7394SKuninori Morimoto }, 285fb2e7394SKuninori Morimoto }; 286fb2e7394SKuninori Morimoto 287fb2e7394SKuninori Morimoto static struct resource usbhs_resources[] = { 288fb2e7394SKuninori Morimoto [0] = { 289fb2e7394SKuninori Morimoto .start = 0xa4d90000, 290fb2e7394SKuninori Morimoto .end = 0xa4d90124 - 1, 291fb2e7394SKuninori Morimoto .flags = IORESOURCE_MEM, 292fb2e7394SKuninori Morimoto }, 293fb2e7394SKuninori Morimoto [1] = { 2949307d115SPaul Mundt .start = evt2irq(0xa40), 2959307d115SPaul Mundt .end = evt2irq(0xa40), 296fb2e7394SKuninori Morimoto .flags = IORESOURCE_IRQ, 297fb2e7394SKuninori Morimoto }, 298fb2e7394SKuninori Morimoto }; 299fb2e7394SKuninori Morimoto 300fb2e7394SKuninori Morimoto static struct platform_device usbhs_device = { 301fb2e7394SKuninori Morimoto .name = "renesas_usbhs", 302fb2e7394SKuninori Morimoto .id = 1, 303fb2e7394SKuninori Morimoto .dev = { 304fb2e7394SKuninori Morimoto .dma_mask = NULL, /* not use dma */ 305fb2e7394SKuninori Morimoto .coherent_dma_mask = 0xffffffff, 306fb2e7394SKuninori Morimoto .platform_data = &usbhs_info, 307fb2e7394SKuninori Morimoto }, 308fb2e7394SKuninori Morimoto .num_resources = ARRAY_SIZE(usbhs_resources), 309fb2e7394SKuninori Morimoto .resource = usbhs_resources, 310fb2e7394SKuninori Morimoto }; 311fb2e7394SKuninori Morimoto 312fe79f919SLaurent Pinchart /* LCDC and backlight */ 313e04008ebSJesper Juhl static const struct fb_videomode ecovec_lcd_modes[] = { 31444432407SGuennadi Liakhovetski { 31544432407SGuennadi Liakhovetski .name = "Panel", 31644432407SGuennadi Liakhovetski .xres = 800, 31744432407SGuennadi Liakhovetski .yres = 480, 31844432407SGuennadi Liakhovetski .left_margin = 220, 31944432407SGuennadi Liakhovetski .right_margin = 110, 32044432407SGuennadi Liakhovetski .hsync_len = 70, 32144432407SGuennadi Liakhovetski .upper_margin = 20, 32244432407SGuennadi Liakhovetski .lower_margin = 5, 32344432407SGuennadi Liakhovetski .vsync_len = 5, 32444432407SGuennadi Liakhovetski .sync = 0, /* hsync and vsync are active low */ 32544432407SGuennadi Liakhovetski }, 32644432407SGuennadi Liakhovetski }; 32744432407SGuennadi Liakhovetski 328e04008ebSJesper Juhl static const struct fb_videomode ecovec_dvi_modes[] = { 32944432407SGuennadi Liakhovetski { 33044432407SGuennadi Liakhovetski .name = "DVI", 33144432407SGuennadi Liakhovetski .xres = 1280, 33244432407SGuennadi Liakhovetski .yres = 720, 33344432407SGuennadi Liakhovetski .left_margin = 220, 33444432407SGuennadi Liakhovetski .right_margin = 110, 33544432407SGuennadi Liakhovetski .hsync_len = 40, 33644432407SGuennadi Liakhovetski .upper_margin = 20, 33744432407SGuennadi Liakhovetski .lower_margin = 5, 33844432407SGuennadi Liakhovetski .vsync_len = 5, 33944432407SGuennadi Liakhovetski .sync = 0, /* hsync and vsync are active low */ 34044432407SGuennadi Liakhovetski }, 34144432407SGuennadi Liakhovetski }; 34244432407SGuennadi Liakhovetski 343fa3ba51bSKuninori Morimoto static struct sh_mobile_lcdc_info lcdc_info = { 344fa3ba51bSKuninori Morimoto .ch[0] = { 345fa3ba51bSKuninori Morimoto .interface_type = RGB18, 346fa3ba51bSKuninori Morimoto .chan = LCDC_CHAN_MAINLCD, 347edd153a3SLaurent Pinchart .fourcc = V4L2_PIX_FMT_RGB565, 348afaad83bSLaurent Pinchart .panel_cfg = { /* 7.0 inch */ 349fa3ba51bSKuninori Morimoto .width = 152, 350fa3ba51bSKuninori Morimoto .height = 91, 351fa3ba51bSKuninori Morimoto }, 352fa3ba51bSKuninori Morimoto } 353fa3ba51bSKuninori Morimoto }; 354fa3ba51bSKuninori Morimoto 355fa3ba51bSKuninori Morimoto static struct resource lcdc_resources[] = { 356fa3ba51bSKuninori Morimoto [0] = { 357fa3ba51bSKuninori Morimoto .name = "LCDC", 358fa3ba51bSKuninori Morimoto .start = 0xfe940000, 359a6f15adeSPhil Edworthy .end = 0xfe942fff, 360fa3ba51bSKuninori Morimoto .flags = IORESOURCE_MEM, 361fa3ba51bSKuninori Morimoto }, 362fa3ba51bSKuninori Morimoto [1] = { 3639307d115SPaul Mundt .start = evt2irq(0xf40), 364fa3ba51bSKuninori Morimoto .flags = IORESOURCE_IRQ, 365fa3ba51bSKuninori Morimoto }, 366fa3ba51bSKuninori Morimoto }; 367fa3ba51bSKuninori Morimoto 368fa3ba51bSKuninori Morimoto static struct platform_device lcdc_device = { 369fa3ba51bSKuninori Morimoto .name = "sh_mobile_lcdc_fb", 370fa3ba51bSKuninori Morimoto .num_resources = ARRAY_SIZE(lcdc_resources), 371fa3ba51bSKuninori Morimoto .resource = lcdc_resources, 372fa3ba51bSKuninori Morimoto .dev = { 373fa3ba51bSKuninori Morimoto .platform_data = &lcdc_info, 374fa3ba51bSKuninori Morimoto }, 375fa3ba51bSKuninori Morimoto }; 376fa3ba51bSKuninori Morimoto 377fe79f919SLaurent Pinchart static struct gpio_backlight_platform_data gpio_backlight_data = { 378fe79f919SLaurent Pinchart .fbdev = &lcdc_device.dev, 379fe79f919SLaurent Pinchart .gpio = GPIO_PTR1, 380fe79f919SLaurent Pinchart .def_value = 1, 381fe79f919SLaurent Pinchart .name = "backlight", 382fe79f919SLaurent Pinchart }; 383fe79f919SLaurent Pinchart 384fe79f919SLaurent Pinchart static struct platform_device gpio_backlight_device = { 385fe79f919SLaurent Pinchart .name = "gpio-backlight", 386fe79f919SLaurent Pinchart .dev = { 387fe79f919SLaurent Pinchart .platform_data = &gpio_backlight_data, 388fe79f919SLaurent Pinchart }, 389fe79f919SLaurent Pinchart }; 390fe79f919SLaurent Pinchart 3912153ad32SKuninori Morimoto /* CEU0 */ 392*c2f9b05fSJacopo Mondi static struct ceu_platform_data ceu0_pdata = { 393*c2f9b05fSJacopo Mondi .num_subdevs = 2, 394*c2f9b05fSJacopo Mondi .subdevs = { 395*c2f9b05fSJacopo Mondi { /* [0] = mt9t112 */ 396*c2f9b05fSJacopo Mondi .flags = 0, 397*c2f9b05fSJacopo Mondi .bus_width = 8, 398*c2f9b05fSJacopo Mondi .bus_shift = 0, 399*c2f9b05fSJacopo Mondi .i2c_adapter_id = 0, 400*c2f9b05fSJacopo Mondi .i2c_address = 0x3c, 401*c2f9b05fSJacopo Mondi }, 402*c2f9b05fSJacopo Mondi { /* [1] = tw9910 */ 403*c2f9b05fSJacopo Mondi .flags = 0, 404*c2f9b05fSJacopo Mondi .bus_width = 8, 405*c2f9b05fSJacopo Mondi .bus_shift = 0, 406*c2f9b05fSJacopo Mondi .i2c_adapter_id = 0, 407*c2f9b05fSJacopo Mondi .i2c_address = 0x45, 408*c2f9b05fSJacopo Mondi }, 409*c2f9b05fSJacopo Mondi }, 4102153ad32SKuninori Morimoto }; 4112153ad32SKuninori Morimoto 4122153ad32SKuninori Morimoto static struct resource ceu0_resources[] = { 4132153ad32SKuninori Morimoto [0] = { 4142153ad32SKuninori Morimoto .name = "CEU0", 4152153ad32SKuninori Morimoto .start = 0xfe910000, 4162153ad32SKuninori Morimoto .end = 0xfe91009f, 4172153ad32SKuninori Morimoto .flags = IORESOURCE_MEM, 4182153ad32SKuninori Morimoto }, 4192153ad32SKuninori Morimoto [1] = { 4209307d115SPaul Mundt .start = evt2irq(0x880), 4212153ad32SKuninori Morimoto .flags = IORESOURCE_IRQ, 4222153ad32SKuninori Morimoto }, 4232153ad32SKuninori Morimoto }; 4242153ad32SKuninori Morimoto 4252153ad32SKuninori Morimoto static struct platform_device ceu0_device = { 426*c2f9b05fSJacopo Mondi .name = "renesas-ceu", 427*c2f9b05fSJacopo Mondi .id = 0, /* ceu.0 */ 4282153ad32SKuninori Morimoto .num_resources = ARRAY_SIZE(ceu0_resources), 4292153ad32SKuninori Morimoto .resource = ceu0_resources, 4302153ad32SKuninori Morimoto .dev = { 431*c2f9b05fSJacopo Mondi .platform_data = &ceu0_pdata, 4322153ad32SKuninori Morimoto }, 4332153ad32SKuninori Morimoto }; 4342153ad32SKuninori Morimoto 4352153ad32SKuninori Morimoto /* CEU1 */ 436*c2f9b05fSJacopo Mondi static struct ceu_platform_data ceu1_pdata = { 437*c2f9b05fSJacopo Mondi .num_subdevs = 1, 438*c2f9b05fSJacopo Mondi .subdevs = { 439*c2f9b05fSJacopo Mondi { /* [0] = mt9t112 */ 440*c2f9b05fSJacopo Mondi .flags = 0, 441*c2f9b05fSJacopo Mondi .bus_width = 8, 442*c2f9b05fSJacopo Mondi .bus_shift = 0, 443*c2f9b05fSJacopo Mondi .i2c_adapter_id = 1, 444*c2f9b05fSJacopo Mondi .i2c_address = 0x3c, 445*c2f9b05fSJacopo Mondi }, 446*c2f9b05fSJacopo Mondi }, 4472153ad32SKuninori Morimoto }; 4482153ad32SKuninori Morimoto 4492153ad32SKuninori Morimoto static struct resource ceu1_resources[] = { 4502153ad32SKuninori Morimoto [0] = { 4512153ad32SKuninori Morimoto .name = "CEU1", 4522153ad32SKuninori Morimoto .start = 0xfe914000, 4532153ad32SKuninori Morimoto .end = 0xfe91409f, 4542153ad32SKuninori Morimoto .flags = IORESOURCE_MEM, 4552153ad32SKuninori Morimoto }, 4562153ad32SKuninori Morimoto [1] = { 4579307d115SPaul Mundt .start = evt2irq(0x9e0), 4582153ad32SKuninori Morimoto .flags = IORESOURCE_IRQ, 4592153ad32SKuninori Morimoto }, 4602153ad32SKuninori Morimoto }; 4612153ad32SKuninori Morimoto 4622153ad32SKuninori Morimoto static struct platform_device ceu1_device = { 463*c2f9b05fSJacopo Mondi .name = "renesas-ceu", 464*c2f9b05fSJacopo Mondi .id = 1, /* ceu.1 */ 4652153ad32SKuninori Morimoto .num_resources = ARRAY_SIZE(ceu1_resources), 4662153ad32SKuninori Morimoto .resource = ceu1_resources, 4672153ad32SKuninori Morimoto .dev = { 468*c2f9b05fSJacopo Mondi .platform_data = &ceu1_pdata, 469*c2f9b05fSJacopo Mondi }, 470*c2f9b05fSJacopo Mondi }; 471*c2f9b05fSJacopo Mondi 472*c2f9b05fSJacopo Mondi /* Power up/down GPIOs for camera devices and video decoder */ 473*c2f9b05fSJacopo Mondi static struct gpiod_lookup_table tw9910_gpios = { 474*c2f9b05fSJacopo Mondi .dev_id = "0-0045", 475*c2f9b05fSJacopo Mondi .table = { 476*c2f9b05fSJacopo Mondi GPIO_LOOKUP("sh7724_pfc", GPIO_PTU2, "pdn", GPIO_ACTIVE_HIGH), 477*c2f9b05fSJacopo Mondi }, 478*c2f9b05fSJacopo Mondi }; 479*c2f9b05fSJacopo Mondi 480*c2f9b05fSJacopo Mondi static struct gpiod_lookup_table mt9t112_0_gpios = { 481*c2f9b05fSJacopo Mondi .dev_id = "0-003c", 482*c2f9b05fSJacopo Mondi .table = { 483*c2f9b05fSJacopo Mondi GPIO_LOOKUP("sh7724_pfc", GPIO_PTA3, "standby", 484*c2f9b05fSJacopo Mondi GPIO_ACTIVE_HIGH), 485*c2f9b05fSJacopo Mondi }, 486*c2f9b05fSJacopo Mondi }; 487*c2f9b05fSJacopo Mondi 488*c2f9b05fSJacopo Mondi static struct gpiod_lookup_table mt9t112_1_gpios = { 489*c2f9b05fSJacopo Mondi .dev_id = "1-003c", 490*c2f9b05fSJacopo Mondi .table = { 491*c2f9b05fSJacopo Mondi GPIO_LOOKUP("sh7724_pfc", GPIO_PTA4, "standby", 492*c2f9b05fSJacopo Mondi GPIO_ACTIVE_HIGH), 4932153ad32SKuninori Morimoto }, 4942153ad32SKuninori Morimoto }; 4952153ad32SKuninori Morimoto 496125ecce6SKuninori Morimoto /* I2C device */ 497*c2f9b05fSJacopo Mondi static struct tw9910_video_info tw9910_info = { 498*c2f9b05fSJacopo Mondi .buswidth = 8, 499*c2f9b05fSJacopo Mondi .mpout = TW9910_MPO_FIELD, 500*c2f9b05fSJacopo Mondi }; 501*c2f9b05fSJacopo Mondi 502*c2f9b05fSJacopo Mondi static struct mt9t112_platform_data mt9t112_0_pdata = { 503*c2f9b05fSJacopo Mondi .flags = MT9T112_FLAG_PCLK_RISING_EDGE, 504*c2f9b05fSJacopo Mondi .divider = { 0x49, 0x6, 0, 6, 0, 9, 9, 6, 0 }, /* for 24MHz */ 505*c2f9b05fSJacopo Mondi }; 506*c2f9b05fSJacopo Mondi 507*c2f9b05fSJacopo Mondi static struct mt9t112_platform_data mt9t112_1_pdata = { 508*c2f9b05fSJacopo Mondi .flags = MT9T112_FLAG_PCLK_RISING_EDGE, 509*c2f9b05fSJacopo Mondi .divider = { 0x49, 0x6, 0, 6, 0, 9, 9, 6, 0 }, /* for 24MHz */ 510*c2f9b05fSJacopo Mondi }; 511*c2f9b05fSJacopo Mondi 5121980fdc4SKuninori Morimoto static struct i2c_board_info i2c0_devices[] = { 5131980fdc4SKuninori Morimoto { 5141980fdc4SKuninori Morimoto I2C_BOARD_INFO("da7210", 0x1a), 5151980fdc4SKuninori Morimoto }, 516*c2f9b05fSJacopo Mondi { 517*c2f9b05fSJacopo Mondi I2C_BOARD_INFO("tw9910", 0x45), 518*c2f9b05fSJacopo Mondi .platform_data = &tw9910_info, 519*c2f9b05fSJacopo Mondi }, 520*c2f9b05fSJacopo Mondi { 521*c2f9b05fSJacopo Mondi /* 1st camera */ 522*c2f9b05fSJacopo Mondi I2C_BOARD_INFO("mt9t112", 0x3c), 523*c2f9b05fSJacopo Mondi .platform_data = &mt9t112_0_pdata, 524*c2f9b05fSJacopo Mondi }, 5251980fdc4SKuninori Morimoto }; 5261980fdc4SKuninori Morimoto 527125ecce6SKuninori Morimoto static struct i2c_board_info i2c1_devices[] = { 528125ecce6SKuninori Morimoto { 529125ecce6SKuninori Morimoto I2C_BOARD_INFO("r2025sd", 0x32), 530125ecce6SKuninori Morimoto }, 531ea440783SNISHIMOTO Hiroki { 532ea440783SNISHIMOTO Hiroki I2C_BOARD_INFO("lis3lv02d", 0x1c), 5339307d115SPaul Mundt .irq = evt2irq(0x620), 534*c2f9b05fSJacopo Mondi }, 535*c2f9b05fSJacopo Mondi { 536*c2f9b05fSJacopo Mondi /* 2nd camera */ 537*c2f9b05fSJacopo Mondi I2C_BOARD_INFO("mt9t112", 0x3c), 538*c2f9b05fSJacopo Mondi .platform_data = &mt9t112_1_pdata, 539*c2f9b05fSJacopo Mondi }, 540125ecce6SKuninori Morimoto }; 541125ecce6SKuninori Morimoto 542e9103e74SKuninori Morimoto /* KEYSC */ 543e9103e74SKuninori Morimoto static struct sh_keysc_info keysc_info = { 544e9103e74SKuninori Morimoto .mode = SH_KEYSC_MODE_1, 545e9103e74SKuninori Morimoto .scan_timing = 3, 546e9103e74SKuninori Morimoto .delay = 50, 547e9103e74SKuninori Morimoto .kycr2_delay = 100, 548e9103e74SKuninori Morimoto .keycodes = { KEY_1, 0, 0, 0, 0, 549e9103e74SKuninori Morimoto KEY_2, 0, 0, 0, 0, 550e9103e74SKuninori Morimoto KEY_3, 0, 0, 0, 0, 551e9103e74SKuninori Morimoto KEY_4, 0, 0, 0, 0, 552e9103e74SKuninori Morimoto KEY_5, 0, 0, 0, 0, 553e9103e74SKuninori Morimoto KEY_6, 0, 0, 0, 0, }, 554e9103e74SKuninori Morimoto }; 555e9103e74SKuninori Morimoto 556e9103e74SKuninori Morimoto static struct resource keysc_resources[] = { 557e9103e74SKuninori Morimoto [0] = { 558e9103e74SKuninori Morimoto .name = "KEYSC", 559e9103e74SKuninori Morimoto .start = 0x044b0000, 560e9103e74SKuninori Morimoto .end = 0x044b000f, 561e9103e74SKuninori Morimoto .flags = IORESOURCE_MEM, 562e9103e74SKuninori Morimoto }, 563e9103e74SKuninori Morimoto [1] = { 5649307d115SPaul Mundt .start = evt2irq(0xbe0), 565e9103e74SKuninori Morimoto .flags = IORESOURCE_IRQ, 566e9103e74SKuninori Morimoto }, 567e9103e74SKuninori Morimoto }; 568e9103e74SKuninori Morimoto 569e9103e74SKuninori Morimoto static struct platform_device keysc_device = { 570e9103e74SKuninori Morimoto .name = "sh_keysc", 571e9103e74SKuninori Morimoto .id = 0, /* keysc0 clock */ 572e9103e74SKuninori Morimoto .num_resources = ARRAY_SIZE(keysc_resources), 573e9103e74SKuninori Morimoto .resource = keysc_resources, 574e9103e74SKuninori Morimoto .dev = { 575e9103e74SKuninori Morimoto .platform_data = &keysc_info, 576e9103e74SKuninori Morimoto }, 577e9103e74SKuninori Morimoto }; 578e9103e74SKuninori Morimoto 5798810e055SKuninori Morimoto /* TouchScreen */ 5809307d115SPaul Mundt #define IRQ0 evt2irq(0x600) 5819307d115SPaul Mundt 58207f9e5cfSDenis Carikli static int ts_get_pendown_state(struct device *dev) 5835d75b3a2SPaul Mundt { 5845d75b3a2SPaul Mundt int val = 0; 5855d75b3a2SPaul Mundt gpio_free(GPIO_FN_INTC_IRQ0); 5865d75b3a2SPaul Mundt gpio_request(GPIO_PTZ0, NULL); 5875d75b3a2SPaul Mundt gpio_direction_input(GPIO_PTZ0); 5885d75b3a2SPaul Mundt 5895d75b3a2SPaul Mundt val = gpio_get_value(GPIO_PTZ0); 5905d75b3a2SPaul Mundt 5915d75b3a2SPaul Mundt gpio_free(GPIO_PTZ0); 5925d75b3a2SPaul Mundt gpio_request(GPIO_FN_INTC_IRQ0, NULL); 5935d75b3a2SPaul Mundt 5945d75b3a2SPaul Mundt return val ? 0 : 1; 5955d75b3a2SPaul Mundt } 5965d75b3a2SPaul Mundt 5975d75b3a2SPaul Mundt static int ts_init(void) 5985d75b3a2SPaul Mundt { 5995d75b3a2SPaul Mundt gpio_request(GPIO_FN_INTC_IRQ0, NULL); 6005d75b3a2SPaul Mundt return 0; 6015d75b3a2SPaul Mundt } 6025d75b3a2SPaul Mundt 6033ce09334SKuninori Morimoto static struct tsc2007_platform_data tsc2007_info = { 6048810e055SKuninori Morimoto .model = 2007, 6055d75b3a2SPaul Mundt .x_plate_ohms = 180, 6065d75b3a2SPaul Mundt .get_pendown_state = ts_get_pendown_state, 6075d75b3a2SPaul Mundt .init_platform_hw = ts_init, 6088810e055SKuninori Morimoto }; 6098810e055SKuninori Morimoto 6108810e055SKuninori Morimoto static struct i2c_board_info ts_i2c_clients = { 6118810e055SKuninori Morimoto I2C_BOARD_INFO("tsc2007", 0x48), 6128810e055SKuninori Morimoto .type = "tsc2007", 6138810e055SKuninori Morimoto .platform_data = &tsc2007_info, 6148810e055SKuninori Morimoto .irq = IRQ0, 6158810e055SKuninori Morimoto }; 6168810e055SKuninori Morimoto 617d4c191dfSGuennadi Liakhovetski static struct regulator_consumer_supply cn12_power_consumers[] = 618d4c191dfSGuennadi Liakhovetski { 619d4c191dfSGuennadi Liakhovetski REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"), 620d4c191dfSGuennadi Liakhovetski REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"), 621d4c191dfSGuennadi Liakhovetski REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), 622d4c191dfSGuennadi Liakhovetski REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"), 623d4c191dfSGuennadi Liakhovetski }; 624d4c191dfSGuennadi Liakhovetski 625d4c191dfSGuennadi Liakhovetski static struct regulator_init_data cn12_power_init_data = { 626d4c191dfSGuennadi Liakhovetski .constraints = { 627d4c191dfSGuennadi Liakhovetski .valid_ops_mask = REGULATOR_CHANGE_STATUS, 628d4c191dfSGuennadi Liakhovetski }, 629d4c191dfSGuennadi Liakhovetski .num_consumer_supplies = ARRAY_SIZE(cn12_power_consumers), 630d4c191dfSGuennadi Liakhovetski .consumer_supplies = cn12_power_consumers, 631d4c191dfSGuennadi Liakhovetski }; 632d4c191dfSGuennadi Liakhovetski 633d4c191dfSGuennadi Liakhovetski static struct fixed_voltage_config cn12_power_info = { 634d4c191dfSGuennadi Liakhovetski .supply_name = "CN12 SD/MMC Vdd", 635d4c191dfSGuennadi Liakhovetski .microvolts = 3300000, 636d4c191dfSGuennadi Liakhovetski .gpio = GPIO_PTB7, 637d4c191dfSGuennadi Liakhovetski .enable_high = 1, 638d4c191dfSGuennadi Liakhovetski .init_data = &cn12_power_init_data, 639d4c191dfSGuennadi Liakhovetski }; 640d4c191dfSGuennadi Liakhovetski 641d4c191dfSGuennadi Liakhovetski static struct platform_device cn12_power = { 642d4c191dfSGuennadi Liakhovetski .name = "reg-fixed-voltage", 643d4c191dfSGuennadi Liakhovetski .id = 0, 644d4c191dfSGuennadi Liakhovetski .dev = { 645d4c191dfSGuennadi Liakhovetski .platform_data = &cn12_power_info, 646d4c191dfSGuennadi Liakhovetski }, 647d4c191dfSGuennadi Liakhovetski }; 648d4c191dfSGuennadi Liakhovetski 6495744c881SGuennadi Liakhovetski #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) 6501238c684SYusuke Goda /* SDHI0 */ 651d4c191dfSGuennadi Liakhovetski static struct regulator_consumer_supply sdhi0_power_consumers[] = 652d4c191dfSGuennadi Liakhovetski { 653d4c191dfSGuennadi Liakhovetski REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"), 654d4c191dfSGuennadi Liakhovetski REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"), 655d4c191dfSGuennadi Liakhovetski }; 656d4c191dfSGuennadi Liakhovetski 657d4c191dfSGuennadi Liakhovetski static struct regulator_init_data sdhi0_power_init_data = { 658d4c191dfSGuennadi Liakhovetski .constraints = { 659d4c191dfSGuennadi Liakhovetski .valid_ops_mask = REGULATOR_CHANGE_STATUS, 660d4c191dfSGuennadi Liakhovetski }, 661d4c191dfSGuennadi Liakhovetski .num_consumer_supplies = ARRAY_SIZE(sdhi0_power_consumers), 662d4c191dfSGuennadi Liakhovetski .consumer_supplies = sdhi0_power_consumers, 663d4c191dfSGuennadi Liakhovetski }; 664d4c191dfSGuennadi Liakhovetski 665d4c191dfSGuennadi Liakhovetski static struct fixed_voltage_config sdhi0_power_info = { 666d4c191dfSGuennadi Liakhovetski .supply_name = "CN11 SD/MMC Vdd", 667d4c191dfSGuennadi Liakhovetski .microvolts = 3300000, 668d4c191dfSGuennadi Liakhovetski .gpio = GPIO_PTB6, 669d4c191dfSGuennadi Liakhovetski .enable_high = 1, 670d4c191dfSGuennadi Liakhovetski .init_data = &sdhi0_power_init_data, 671d4c191dfSGuennadi Liakhovetski }; 672d4c191dfSGuennadi Liakhovetski 673d4c191dfSGuennadi Liakhovetski static struct platform_device sdhi0_power = { 674d4c191dfSGuennadi Liakhovetski .name = "reg-fixed-voltage", 675d4c191dfSGuennadi Liakhovetski .id = 1, 676d4c191dfSGuennadi Liakhovetski .dev = { 677d4c191dfSGuennadi Liakhovetski .platform_data = &sdhi0_power_info, 678d4c191dfSGuennadi Liakhovetski }, 679d4c191dfSGuennadi Liakhovetski }; 680d4c191dfSGuennadi Liakhovetski 68184f11d5bSKuninori Morimoto static struct tmio_mmc_data sdhi0_info = { 68284f11d5bSKuninori Morimoto .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI0_TX, 68384f11d5bSKuninori Morimoto .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI0_RX, 68484f11d5bSKuninori Morimoto .capabilities = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD | 6854eb80146SGuennadi Liakhovetski MMC_CAP_NEEDS_POLL, 68684f11d5bSKuninori Morimoto .flags = TMIO_MMC_USE_GPIO_CD, 687afa2c940SLaurent Pinchart .cd_gpio = GPIO_PTY7, 68898779ad8SMagnus Damm }; 68998779ad8SMagnus Damm 69096987d96SKuninori Morimoto static struct resource sdhi0_resources[] = { 69196987d96SKuninori Morimoto [0] = { 69296987d96SKuninori Morimoto .name = "SDHI0", 69396987d96SKuninori Morimoto .start = 0x04ce0000, 694d80e9221SGuennadi Liakhovetski .end = 0x04ce00ff, 69596987d96SKuninori Morimoto .flags = IORESOURCE_MEM, 69696987d96SKuninori Morimoto }, 69796987d96SKuninori Morimoto [1] = { 6989307d115SPaul Mundt .start = evt2irq(0xe80), 69996987d96SKuninori Morimoto .flags = IORESOURCE_IRQ, 70096987d96SKuninori Morimoto }, 70196987d96SKuninori Morimoto }; 70296987d96SKuninori Morimoto 70396987d96SKuninori Morimoto static struct platform_device sdhi0_device = { 70496987d96SKuninori Morimoto .name = "sh_mobile_sdhi", 70596987d96SKuninori Morimoto .num_resources = ARRAY_SIZE(sdhi0_resources), 70696987d96SKuninori Morimoto .resource = sdhi0_resources, 70796987d96SKuninori Morimoto .id = 0, 70898779ad8SMagnus Damm .dev = { 70998779ad8SMagnus Damm .platform_data = &sdhi0_info, 71098779ad8SMagnus Damm }, 71196987d96SKuninori Morimoto }; 71296987d96SKuninori Morimoto 713d4c191dfSGuennadi Liakhovetski #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 714d4c191dfSGuennadi Liakhovetski /* SDHI1 */ 71584f11d5bSKuninori Morimoto static struct tmio_mmc_data sdhi1_info = { 71684f11d5bSKuninori Morimoto .chan_priv_tx = (void *)SHDMA_SLAVE_SDHI1_TX, 71784f11d5bSKuninori Morimoto .chan_priv_rx = (void *)SHDMA_SLAVE_SDHI1_RX, 71884f11d5bSKuninori Morimoto .capabilities = MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD | 7194eb80146SGuennadi Liakhovetski MMC_CAP_NEEDS_POLL, 72084f11d5bSKuninori Morimoto .flags = TMIO_MMC_USE_GPIO_CD, 721afa2c940SLaurent Pinchart .cd_gpio = GPIO_PTW7, 72298779ad8SMagnus Damm }; 72398779ad8SMagnus Damm 72496987d96SKuninori Morimoto static struct resource sdhi1_resources[] = { 72596987d96SKuninori Morimoto [0] = { 72696987d96SKuninori Morimoto .name = "SDHI1", 72796987d96SKuninori Morimoto .start = 0x04cf0000, 728d80e9221SGuennadi Liakhovetski .end = 0x04cf00ff, 72996987d96SKuninori Morimoto .flags = IORESOURCE_MEM, 73096987d96SKuninori Morimoto }, 73196987d96SKuninori Morimoto [1] = { 7329307d115SPaul Mundt .start = evt2irq(0x4e0), 73396987d96SKuninori Morimoto .flags = IORESOURCE_IRQ, 73496987d96SKuninori Morimoto }, 73596987d96SKuninori Morimoto }; 73696987d96SKuninori Morimoto 73796987d96SKuninori Morimoto static struct platform_device sdhi1_device = { 73896987d96SKuninori Morimoto .name = "sh_mobile_sdhi", 73996987d96SKuninori Morimoto .num_resources = ARRAY_SIZE(sdhi1_resources), 74096987d96SKuninori Morimoto .resource = sdhi1_resources, 74196987d96SKuninori Morimoto .id = 1, 74298779ad8SMagnus Damm .dev = { 74398779ad8SMagnus Damm .platform_data = &sdhi1_info, 74498779ad8SMagnus Damm }, 74596987d96SKuninori Morimoto }; 7461238c684SYusuke Goda #endif /* CONFIG_MMC_SH_MMCIF */ 74796987d96SKuninori Morimoto 7481ce4da7aSMagnus Damm #else 7491ce4da7aSMagnus Damm 7509503e891SKuninori Morimoto /* MMC SPI */ 7511ce4da7aSMagnus Damm static void mmc_spi_setpower(struct device *dev, unsigned int maskval) 7521ce4da7aSMagnus Damm { 7531ce4da7aSMagnus Damm gpio_set_value(GPIO_PTB6, maskval ? 1 : 0); 7541ce4da7aSMagnus Damm } 7551ce4da7aSMagnus Damm 7561ce4da7aSMagnus Damm static struct mmc_spi_platform_data mmc_spi_info = { 7571ce4da7aSMagnus Damm .caps = MMC_CAP_NEEDS_POLL, 758afa2c940SLaurent Pinchart .caps2 = MMC_CAP2_RO_ACTIVE_HIGH, 7591ce4da7aSMagnus Damm .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */ 7601ce4da7aSMagnus Damm .setpower = mmc_spi_setpower, 761afa2c940SLaurent Pinchart .flags = MMC_SPI_USE_CD_GPIO | MMC_SPI_USE_RO_GPIO, 762afa2c940SLaurent Pinchart .cd_gpio = GPIO_PTY7, 763afa2c940SLaurent Pinchart .ro_gpio = GPIO_PTY6, 7641ce4da7aSMagnus Damm }; 7651ce4da7aSMagnus Damm 7661ce4da7aSMagnus Damm static struct spi_board_info spi_bus[] = { 7671ce4da7aSMagnus Damm { 7681ce4da7aSMagnus Damm .modalias = "mmc_spi", 7691ce4da7aSMagnus Damm .platform_data = &mmc_spi_info, 7701ce4da7aSMagnus Damm .max_speed_hz = 5000000, 7711ce4da7aSMagnus Damm .mode = SPI_MODE_0, 7721ce4da7aSMagnus Damm .controller_data = (void *) GPIO_PTM4, 7731ce4da7aSMagnus Damm }, 7741ce4da7aSMagnus Damm }; 7751ce4da7aSMagnus Damm 7769503e891SKuninori Morimoto /* MSIOF0 */ 7771ce4da7aSMagnus Damm static struct sh_msiof_spi_info msiof0_data = { 7781ce4da7aSMagnus Damm .num_chipselect = 1, 7791ce4da7aSMagnus Damm }; 7801ce4da7aSMagnus Damm 7811ce4da7aSMagnus Damm static struct resource msiof0_resources[] = { 7821ce4da7aSMagnus Damm [0] = { 7831ce4da7aSMagnus Damm .name = "MSIOF0", 7841ce4da7aSMagnus Damm .start = 0xa4c40000, 7851ce4da7aSMagnus Damm .end = 0xa4c40063, 7861ce4da7aSMagnus Damm .flags = IORESOURCE_MEM, 7871ce4da7aSMagnus Damm }, 7881ce4da7aSMagnus Damm [1] = { 7899307d115SPaul Mundt .start = evt2irq(0xc80), 7901ce4da7aSMagnus Damm .flags = IORESOURCE_IRQ, 7911ce4da7aSMagnus Damm }, 7921ce4da7aSMagnus Damm }; 7931ce4da7aSMagnus Damm 7941ce4da7aSMagnus Damm static struct platform_device msiof0_device = { 7951ce4da7aSMagnus Damm .name = "spi_sh_msiof", 7961ce4da7aSMagnus Damm .id = 0, /* MSIOF0 */ 7971ce4da7aSMagnus Damm .dev = { 7981ce4da7aSMagnus Damm .platform_data = &msiof0_data, 7991ce4da7aSMagnus Damm }, 8001ce4da7aSMagnus Damm .num_resources = ARRAY_SIZE(msiof0_resources), 8011ce4da7aSMagnus Damm .resource = msiof0_resources, 8021ce4da7aSMagnus Damm }; 8031ce4da7aSMagnus Damm 8041ce4da7aSMagnus Damm #endif 8051ce4da7aSMagnus Damm 8061980fdc4SKuninori Morimoto /* FSI */ 8071980fdc4SKuninori Morimoto static struct resource fsi_resources[] = { 8081980fdc4SKuninori Morimoto [0] = { 8091980fdc4SKuninori Morimoto .name = "FSI", 8101980fdc4SKuninori Morimoto .start = 0xFE3C0000, 8111980fdc4SKuninori Morimoto .end = 0xFE3C021d, 8121980fdc4SKuninori Morimoto .flags = IORESOURCE_MEM, 8131980fdc4SKuninori Morimoto }, 8141980fdc4SKuninori Morimoto [1] = { 8159307d115SPaul Mundt .start = evt2irq(0xf80), 8161980fdc4SKuninori Morimoto .flags = IORESOURCE_IRQ, 8171980fdc4SKuninori Morimoto }, 8181980fdc4SKuninori Morimoto }; 8191980fdc4SKuninori Morimoto 8201980fdc4SKuninori Morimoto static struct platform_device fsi_device = { 8211980fdc4SKuninori Morimoto .name = "sh_fsi", 8221980fdc4SKuninori Morimoto .id = 0, 8231980fdc4SKuninori Morimoto .num_resources = ARRAY_SIZE(fsi_resources), 8241980fdc4SKuninori Morimoto .resource = fsi_resources, 8251980fdc4SKuninori Morimoto }; 8261980fdc4SKuninori Morimoto 827064bfadaSKuninori Morimoto static struct asoc_simple_card_info fsi_da7210_info = { 828064bfadaSKuninori Morimoto .name = "DA7210", 829064bfadaSKuninori Morimoto .card = "FSIB-DA7210", 830064bfadaSKuninori Morimoto .codec = "da7210.0-001a", 831064bfadaSKuninori Morimoto .platform = "sh_fsi.0", 832c7a507eeSKuninori Morimoto .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM, 833a4a2992cSKuninori Morimoto .cpu_dai = { 834a4a2992cSKuninori Morimoto .name = "fsib-dai", 835a4a2992cSKuninori Morimoto }, 836a4a2992cSKuninori Morimoto .codec_dai = { 837a4a2992cSKuninori Morimoto .name = "da7210-hifi", 838a4a2992cSKuninori Morimoto }, 839064bfadaSKuninori Morimoto }; 840064bfadaSKuninori Morimoto 841064bfadaSKuninori Morimoto static struct platform_device fsi_da7210_device = { 842064bfadaSKuninori Morimoto .name = "asoc-simple-card", 843064bfadaSKuninori Morimoto .dev = { 844064bfadaSKuninori Morimoto .platform_data = &fsi_da7210_info, 845ffb83e8cSKuninori Morimoto .coherent_dma_mask = DMA_BIT_MASK(32), 846ffb83e8cSKuninori Morimoto .dma_mask = &fsi_da7210_device.dev.coherent_dma_mask, 847064bfadaSKuninori Morimoto }, 848064bfadaSKuninori Morimoto }; 849064bfadaSKuninori Morimoto 850064bfadaSKuninori Morimoto 85126365716SKuninori Morimoto /* IrDA */ 85226365716SKuninori Morimoto static struct resource irda_resources[] = { 85326365716SKuninori Morimoto [0] = { 85426365716SKuninori Morimoto .name = "IrDA", 85526365716SKuninori Morimoto .start = 0xA45D0000, 85626365716SKuninori Morimoto .end = 0xA45D0049, 85726365716SKuninori Morimoto .flags = IORESOURCE_MEM, 85826365716SKuninori Morimoto }, 85926365716SKuninori Morimoto [1] = { 8609307d115SPaul Mundt .start = evt2irq(0x480), 86126365716SKuninori Morimoto .flags = IORESOURCE_IRQ, 86226365716SKuninori Morimoto }, 86326365716SKuninori Morimoto }; 86426365716SKuninori Morimoto 86526365716SKuninori Morimoto static struct platform_device irda_device = { 86626365716SKuninori Morimoto .name = "sh_sir", 86726365716SKuninori Morimoto .num_resources = ARRAY_SIZE(irda_resources), 86826365716SKuninori Morimoto .resource = irda_resources, 86926365716SKuninori Morimoto }; 87026365716SKuninori Morimoto 871b5dcee22SMauro Carvalho Chehab #include <media/i2c/ak881x.h> 872d647f0b7SMauro Carvalho Chehab #include <media/drv-intf/sh_vou.h> 873aee5ab0bSGuennadi Liakhovetski 8743ce09334SKuninori Morimoto static struct ak881x_pdata ak881x_pdata = { 875aee5ab0bSGuennadi Liakhovetski .flags = AK881X_IF_MODE_SLAVE, 876aee5ab0bSGuennadi Liakhovetski }; 877aee5ab0bSGuennadi Liakhovetski 878aee5ab0bSGuennadi Liakhovetski static struct i2c_board_info ak8813 = { 879aee5ab0bSGuennadi Liakhovetski I2C_BOARD_INFO("ak8813", 0x20), 880aee5ab0bSGuennadi Liakhovetski .platform_data = &ak881x_pdata, 881aee5ab0bSGuennadi Liakhovetski }; 882aee5ab0bSGuennadi Liakhovetski 8833ce09334SKuninori Morimoto static struct sh_vou_pdata sh_vou_pdata = { 884aee5ab0bSGuennadi Liakhovetski .bus_fmt = SH_VOU_BUS_8BIT, 885aee5ab0bSGuennadi Liakhovetski .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW, 886aee5ab0bSGuennadi Liakhovetski .board_info = &ak8813, 887aee5ab0bSGuennadi Liakhovetski .i2c_adap = 0, 888aee5ab0bSGuennadi Liakhovetski }; 889aee5ab0bSGuennadi Liakhovetski 890aee5ab0bSGuennadi Liakhovetski static struct resource sh_vou_resources[] = { 891aee5ab0bSGuennadi Liakhovetski [0] = { 892aee5ab0bSGuennadi Liakhovetski .start = 0xfe960000, 893aee5ab0bSGuennadi Liakhovetski .end = 0xfe962043, 894aee5ab0bSGuennadi Liakhovetski .flags = IORESOURCE_MEM, 895aee5ab0bSGuennadi Liakhovetski }, 896aee5ab0bSGuennadi Liakhovetski [1] = { 8979307d115SPaul Mundt .start = evt2irq(0x8e0), 898aee5ab0bSGuennadi Liakhovetski .flags = IORESOURCE_IRQ, 899aee5ab0bSGuennadi Liakhovetski }, 900aee5ab0bSGuennadi Liakhovetski }; 901aee5ab0bSGuennadi Liakhovetski 902aee5ab0bSGuennadi Liakhovetski static struct platform_device vou_device = { 903aee5ab0bSGuennadi Liakhovetski .name = "sh-vou", 904aee5ab0bSGuennadi Liakhovetski .id = -1, 905aee5ab0bSGuennadi Liakhovetski .num_resources = ARRAY_SIZE(sh_vou_resources), 906aee5ab0bSGuennadi Liakhovetski .resource = sh_vou_resources, 907aee5ab0bSGuennadi Liakhovetski .dev = { 908aee5ab0bSGuennadi Liakhovetski .platform_data = &sh_vou_pdata, 909aee5ab0bSGuennadi Liakhovetski }, 910aee5ab0bSGuennadi Liakhovetski }; 911aee5ab0bSGuennadi Liakhovetski 9125744c881SGuennadi Liakhovetski #if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE) 9131238c684SYusuke Goda /* SH_MMCIF */ 9141238c684SYusuke Goda static struct resource sh_mmcif_resources[] = { 9151238c684SYusuke Goda [0] = { 9161238c684SYusuke Goda .name = "SH_MMCIF", 9171238c684SYusuke Goda .start = 0xA4CA0000, 9181238c684SYusuke Goda .end = 0xA4CA00FF, 9191238c684SYusuke Goda .flags = IORESOURCE_MEM, 9201238c684SYusuke Goda }, 9211238c684SYusuke Goda [1] = { 9221238c684SYusuke Goda /* MMC2I */ 9239307d115SPaul Mundt .start = evt2irq(0x5a0), 9241238c684SYusuke Goda .flags = IORESOURCE_IRQ, 9251238c684SYusuke Goda }, 9261238c684SYusuke Goda [2] = { 9271238c684SYusuke Goda /* MMC3I */ 9289307d115SPaul Mundt .start = evt2irq(0x5c0), 9291238c684SYusuke Goda .flags = IORESOURCE_IRQ, 9301238c684SYusuke Goda }, 9311238c684SYusuke Goda }; 9321238c684SYusuke Goda 9333ce09334SKuninori Morimoto static struct sh_mmcif_plat_data sh_mmcif_plat = { 9341238c684SYusuke Goda .sup_pclk = 0, /* SH7724: Max Pclk/2 */ 9351238c684SYusuke Goda .caps = MMC_CAP_4_BIT_DATA | 9361238c684SYusuke Goda MMC_CAP_8_BIT_DATA | 9371238c684SYusuke Goda MMC_CAP_NEEDS_POLL, 9381238c684SYusuke Goda .ocr = MMC_VDD_32_33 | MMC_VDD_33_34, 9391238c684SYusuke Goda }; 9401238c684SYusuke Goda 9411238c684SYusuke Goda static struct platform_device sh_mmcif_device = { 9421238c684SYusuke Goda .name = "sh_mmcif", 9431238c684SYusuke Goda .id = 0, 9441238c684SYusuke Goda .dev = { 9451238c684SYusuke Goda .platform_data = &sh_mmcif_plat, 9461238c684SYusuke Goda }, 9471238c684SYusuke Goda .num_resources = ARRAY_SIZE(sh_mmcif_resources), 9481238c684SYusuke Goda .resource = sh_mmcif_resources, 9491238c684SYusuke Goda }; 9501238c684SYusuke Goda #endif 9511238c684SYusuke Goda 952*c2f9b05fSJacopo Mondi static struct platform_device *ecovec_ceu_devices[] __initdata = { 953*c2f9b05fSJacopo Mondi &ceu0_device, 954*c2f9b05fSJacopo Mondi &ceu1_device, 955*c2f9b05fSJacopo Mondi }; 956*c2f9b05fSJacopo Mondi 9574138b740SKuninori Morimoto static struct platform_device *ecovec_devices[] __initdata = { 9584138b740SKuninori Morimoto &heartbeat_device, 9594138b740SKuninori Morimoto &nor_flash_device, 96035a35408SKuninori Morimoto &sh_eth_device, 961907050a3SKuninori Morimoto &usb0_host_device, 9623714a9a0SKuninori Morimoto &usb1_common_device, 963fb2e7394SKuninori Morimoto &usbhs_device, 964fa3ba51bSKuninori Morimoto &lcdc_device, 965fe79f919SLaurent Pinchart &gpio_backlight_device, 966e9103e74SKuninori Morimoto &keysc_device, 967d4c191dfSGuennadi Liakhovetski &cn12_power, 9685744c881SGuennadi Liakhovetski #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) 969d4c191dfSGuennadi Liakhovetski &sdhi0_power, 97096987d96SKuninori Morimoto &sdhi0_device, 9715744c881SGuennadi Liakhovetski #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) 97296987d96SKuninori Morimoto &sdhi1_device, 9731238c684SYusuke Goda #endif 9741ce4da7aSMagnus Damm #else 9751ce4da7aSMagnus Damm &msiof0_device, 9761ce4da7aSMagnus Damm #endif 9771980fdc4SKuninori Morimoto &fsi_device, 978064bfadaSKuninori Morimoto &fsi_da7210_device, 97926365716SKuninori Morimoto &irda_device, 980aee5ab0bSGuennadi Liakhovetski &vou_device, 9815744c881SGuennadi Liakhovetski #if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE) 9821238c684SYusuke Goda &sh_mmcif_device, 9831238c684SYusuke Goda #endif 9844138b740SKuninori Morimoto }; 9854138b740SKuninori Morimoto 9866b3b5575SMagnus Damm #ifdef CONFIG_I2C 9874907d57fSKuninori Morimoto #define EEPROM_ADDR 0x50 9884907d57fSKuninori Morimoto static u8 mac_read(struct i2c_adapter *a, u8 command) 9894907d57fSKuninori Morimoto { 9904907d57fSKuninori Morimoto struct i2c_msg msg[2]; 9914907d57fSKuninori Morimoto u8 buf; 9924907d57fSKuninori Morimoto int ret; 9934907d57fSKuninori Morimoto 9944907d57fSKuninori Morimoto msg[0].addr = EEPROM_ADDR; 9954907d57fSKuninori Morimoto msg[0].flags = 0; 9964907d57fSKuninori Morimoto msg[0].len = 1; 9974907d57fSKuninori Morimoto msg[0].buf = &command; 9984907d57fSKuninori Morimoto 9994907d57fSKuninori Morimoto msg[1].addr = EEPROM_ADDR; 10004907d57fSKuninori Morimoto msg[1].flags = I2C_M_RD; 10014907d57fSKuninori Morimoto msg[1].len = 1; 10024907d57fSKuninori Morimoto msg[1].buf = &buf; 10034907d57fSKuninori Morimoto 10044907d57fSKuninori Morimoto ret = i2c_transfer(a, msg, 2); 10054907d57fSKuninori Morimoto if (ret < 0) { 10064907d57fSKuninori Morimoto printk(KERN_ERR "error %d\n", ret); 10074907d57fSKuninori Morimoto buf = 0xff; 10084907d57fSKuninori Morimoto } 10094907d57fSKuninori Morimoto 10104907d57fSKuninori Morimoto return buf; 10114907d57fSKuninori Morimoto } 10124907d57fSKuninori Morimoto 1013376abbb4SMagnus Damm static void __init sh_eth_init(struct sh_eth_plat_data *pd) 10144907d57fSKuninori Morimoto { 10154907d57fSKuninori Morimoto struct i2c_adapter *a = i2c_get_adapter(1); 10164907d57fSKuninori Morimoto int i; 10174907d57fSKuninori Morimoto 10184907d57fSKuninori Morimoto if (!a) { 10194907d57fSKuninori Morimoto pr_err("can not get I2C 1\n"); 10204907d57fSKuninori Morimoto return; 10214907d57fSKuninori Morimoto } 10224907d57fSKuninori Morimoto 102325985edcSLucas De Marchi /* read MAC address from EEPROM */ 1024376abbb4SMagnus Damm for (i = 0; i < sizeof(pd->mac_addr); i++) { 1025376abbb4SMagnus Damm pd->mac_addr[i] = mac_read(a, 0x10 + i); 10264907d57fSKuninori Morimoto msleep(10); 10274907d57fSKuninori Morimoto } 1028b230eb32SKuninori Morimoto 1029b230eb32SKuninori Morimoto i2c_put_adapter(a); 10304907d57fSKuninori Morimoto } 10316b3b5575SMagnus Damm #else 10326b3b5575SMagnus Damm static void __init sh_eth_init(struct sh_eth_plat_data *pd) 10336b3b5575SMagnus Damm { 10346b3b5575SMagnus Damm pr_err("unable to read sh_eth MAC address\n"); 10356b3b5575SMagnus Damm } 10366b3b5575SMagnus Damm #endif 10374907d57fSKuninori Morimoto 1038fa3ba51bSKuninori Morimoto #define PORT_HIZA 0xA4050158 1039ea15edb2SKuninori Morimoto #define IODRIVEA 0xA405018A 1040eb0cd9e8SMagnus Damm 1041eb0cd9e8SMagnus Damm extern char ecovec24_sdram_enter_start; 1042eb0cd9e8SMagnus Damm extern char ecovec24_sdram_enter_end; 1043eb0cd9e8SMagnus Damm extern char ecovec24_sdram_leave_start; 1044eb0cd9e8SMagnus Damm extern char ecovec24_sdram_leave_end; 1045eb0cd9e8SMagnus Damm 10464907d57fSKuninori Morimoto static int __init arch_setup(void) 10474138b740SKuninori Morimoto { 10481980fdc4SKuninori Morimoto struct clk *clk; 10494eb80146SGuennadi Liakhovetski bool cn12_enabled = false; 10501980fdc4SKuninori Morimoto 1051eb0cd9e8SMagnus Damm /* register board specific self-refresh code */ 10522839bd61SMagnus Damm sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF | 10532839bd61SMagnus Damm SUSP_SH_RSTANDBY, 1054eb0cd9e8SMagnus Damm &ecovec24_sdram_enter_start, 1055eb0cd9e8SMagnus Damm &ecovec24_sdram_enter_end, 1056eb0cd9e8SMagnus Damm &ecovec24_sdram_leave_start, 1057eb0cd9e8SMagnus Damm &ecovec24_sdram_leave_end); 1058eb0cd9e8SMagnus Damm 1059f78bab30SMagnus Damm /* enable STATUS0, STATUS2 and PDSTATUS */ 1060f78bab30SMagnus Damm gpio_request(GPIO_FN_STATUS0, NULL); 1061f78bab30SMagnus Damm gpio_request(GPIO_FN_STATUS2, NULL); 1062f78bab30SMagnus Damm gpio_request(GPIO_FN_PDSTATUS, NULL); 1063f78bab30SMagnus Damm 10644138b740SKuninori Morimoto /* enable SCIFA0 */ 10654138b740SKuninori Morimoto gpio_request(GPIO_FN_SCIF0_TXD, NULL); 10664138b740SKuninori Morimoto gpio_request(GPIO_FN_SCIF0_RXD, NULL); 10674138b740SKuninori Morimoto 10684138b740SKuninori Morimoto /* enable debug LED */ 10694138b740SKuninori Morimoto gpio_request(GPIO_PTG0, NULL); 10704138b740SKuninori Morimoto gpio_request(GPIO_PTG1, NULL); 10714138b740SKuninori Morimoto gpio_request(GPIO_PTG2, NULL); 10724138b740SKuninori Morimoto gpio_request(GPIO_PTG3, NULL); 1073b7056bc1SKuninori Morimoto gpio_direction_output(GPIO_PTG0, 0); 1074b7056bc1SKuninori Morimoto gpio_direction_output(GPIO_PTG1, 0); 1075b7056bc1SKuninori Morimoto gpio_direction_output(GPIO_PTG2, 0); 1076b7056bc1SKuninori Morimoto gpio_direction_output(GPIO_PTG3, 0); 10779d56dd3bSPaul Mundt __raw_writew((__raw_readw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA); 10784138b740SKuninori Morimoto 107935a35408SKuninori Morimoto /* enable SH-Eth */ 108035a35408SKuninori Morimoto gpio_request(GPIO_PTA1, NULL); 108135a35408SKuninori Morimoto gpio_direction_output(GPIO_PTA1, 1); 108235a35408SKuninori Morimoto mdelay(20); 108335a35408SKuninori Morimoto 108435a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_RXD0, NULL); 108535a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_RXD1, NULL); 108635a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_TXD0, NULL); 108735a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_TXD1, NULL); 108835a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_REF_CLK, NULL); 108935a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_TX_EN, NULL); 109035a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_RX_ER, NULL); 109135a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_CRS_DV, NULL); 109235a35408SKuninori Morimoto gpio_request(GPIO_FN_MDIO, NULL); 109335a35408SKuninori Morimoto gpio_request(GPIO_FN_MDC, NULL); 109435a35408SKuninori Morimoto gpio_request(GPIO_FN_LNKSTA, NULL); 109535a35408SKuninori Morimoto 1096907050a3SKuninori Morimoto /* enable USB */ 10979d56dd3bSPaul Mundt __raw_writew(0x0000, 0xA4D80000); 10989d56dd3bSPaul Mundt __raw_writew(0x0000, 0xA4D90000); 1099907050a3SKuninori Morimoto gpio_request(GPIO_PTB3, NULL); 1100907050a3SKuninori Morimoto gpio_request(GPIO_PTB4, NULL); 1101907050a3SKuninori Morimoto gpio_request(GPIO_PTB5, NULL); 1102907050a3SKuninori Morimoto gpio_direction_input(GPIO_PTB3); 1103907050a3SKuninori Morimoto gpio_direction_output(GPIO_PTB4, 0); 1104907050a3SKuninori Morimoto gpio_direction_output(GPIO_PTB5, 0); 11059d56dd3bSPaul Mundt __raw_writew(0x0600, 0xa40501d4); 11069d56dd3bSPaul Mundt __raw_writew(0x0600, 0xa4050192); 1107907050a3SKuninori Morimoto 11083714a9a0SKuninori Morimoto if (gpio_get_value(GPIO_PTB3)) { 11093714a9a0SKuninori Morimoto printk(KERN_INFO "USB1 function is selected\n"); 11103714a9a0SKuninori Morimoto usb1_common_device.name = "r8a66597_udc"; 11113714a9a0SKuninori Morimoto } else { 11123714a9a0SKuninori Morimoto printk(KERN_INFO "USB1 host is selected\n"); 11133714a9a0SKuninori Morimoto usb1_common_device.name = "r8a66597_hcd"; 11143714a9a0SKuninori Morimoto } 11153714a9a0SKuninori Morimoto 1116fa3ba51bSKuninori Morimoto /* enable LCDC */ 1117fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD23, NULL); 1118fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD22, NULL); 1119fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD21, NULL); 1120fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD20, NULL); 1121fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD19, NULL); 1122fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD18, NULL); 1123fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD17, NULL); 1124fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD16, NULL); 1125fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD15, NULL); 1126fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD14, NULL); 1127fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD13, NULL); 1128fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD12, NULL); 1129fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD11, NULL); 1130fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD10, NULL); 1131fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD9, NULL); 1132fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD8, NULL); 1133fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD7, NULL); 1134fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD6, NULL); 1135fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD5, NULL); 1136fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD4, NULL); 1137fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD3, NULL); 1138fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD2, NULL); 1139fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD1, NULL); 1140fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD0, NULL); 1141fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDDISP, NULL); 1142fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDHSYN, NULL); 1143fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDDCK, NULL); 1144fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDVSYN, NULL); 1145fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDDON, NULL); 1146fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDLCLK, NULL); 11479d56dd3bSPaul Mundt __raw_writew((__raw_readw(PORT_HIZA) & ~0x0001), PORT_HIZA); 1148fa3ba51bSKuninori Morimoto 1149fa3ba51bSKuninori Morimoto gpio_request(GPIO_PTE6, NULL); 1150fa3ba51bSKuninori Morimoto gpio_request(GPIO_PTU1, NULL); 1151fa3ba51bSKuninori Morimoto gpio_request(GPIO_PTA2, NULL); 1152fa3ba51bSKuninori Morimoto gpio_direction_input(GPIO_PTE6); 1153fa3ba51bSKuninori Morimoto gpio_direction_output(GPIO_PTU1, 0); 1154fa3ba51bSKuninori Morimoto gpio_direction_output(GPIO_PTA2, 0); 1155fa3ba51bSKuninori Morimoto 115682b33221SKuninori Morimoto /* I/O buffer drive ability is high */ 11579d56dd3bSPaul Mundt __raw_writew((__raw_readw(IODRIVEA) & ~0x00c0) | 0x0080 , IODRIVEA); 1158ea15edb2SKuninori Morimoto 1159fa3ba51bSKuninori Morimoto if (gpio_get_value(GPIO_PTE6)) { 1160fa3ba51bSKuninori Morimoto /* DVI */ 1161fa3ba51bSKuninori Morimoto lcdc_info.clock_source = LCDC_CLK_EXTERNAL; 116244432407SGuennadi Liakhovetski lcdc_info.ch[0].clock_divider = 1; 116393ff2598SLaurent Pinchart lcdc_info.ch[0].lcd_modes = ecovec_dvi_modes; 116493ff2598SLaurent Pinchart lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_dvi_modes); 1165fa3ba51bSKuninori Morimoto 1166fe79f919SLaurent Pinchart /* No backlight */ 1167fe79f919SLaurent Pinchart gpio_backlight_data.fbdev = NULL; 1168fe79f919SLaurent Pinchart 1169fa3ba51bSKuninori Morimoto gpio_set_value(GPIO_PTA2, 1); 1170fa3ba51bSKuninori Morimoto gpio_set_value(GPIO_PTU1, 1); 1171fa3ba51bSKuninori Morimoto } else { 1172fa3ba51bSKuninori Morimoto /* Panel */ 1173ea15edb2SKuninori Morimoto lcdc_info.clock_source = LCDC_CLK_PERIPHERAL; 117444432407SGuennadi Liakhovetski lcdc_info.ch[0].clock_divider = 2; 117593ff2598SLaurent Pinchart lcdc_info.ch[0].lcd_modes = ecovec_lcd_modes; 117693ff2598SLaurent Pinchart lcdc_info.ch[0].num_modes = ARRAY_SIZE(ecovec_lcd_modes); 1177ea15edb2SKuninori Morimoto 1178ea15edb2SKuninori Morimoto /* FIXME 1179ea15edb2SKuninori Morimoto * 1180ea15edb2SKuninori Morimoto * LCDDON control is needed for Panel, 1181ea15edb2SKuninori Morimoto * but current sh_mobile_lcdc driver doesn't control it. 1182ea15edb2SKuninori Morimoto * It is temporary correspondence 1183ea15edb2SKuninori Morimoto */ 1184ea15edb2SKuninori Morimoto gpio_request(GPIO_PTF4, NULL); 1185ea15edb2SKuninori Morimoto gpio_direction_output(GPIO_PTF4, 1); 11868810e055SKuninori Morimoto 11878810e055SKuninori Morimoto /* enable TouchScreen */ 11888810e055SKuninori Morimoto i2c_register_board_info(0, &ts_i2c_clients, 1); 1189fcb8918fSThomas Gleixner irq_set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW); 1190fa3ba51bSKuninori Morimoto } 1191fa3ba51bSKuninori Morimoto 11922153ad32SKuninori Morimoto /* enable CEU0 */ 11932153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D15, NULL); 11942153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D14, NULL); 11952153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D13, NULL); 11962153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D12, NULL); 11972153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D11, NULL); 11982153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D10, NULL); 11992153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D9, NULL); 12002153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D8, NULL); 12012153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D7, NULL); 12022153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D6, NULL); 12032153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D5, NULL); 12042153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D4, NULL); 12052153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D3, NULL); 12062153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D2, NULL); 12072153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D1, NULL); 12082153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D0, NULL); 12092153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_VD, NULL); 12102153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_CLK, NULL); 12112153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_FLD, NULL); 12122153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_HD, NULL); 12132153ad32SKuninori Morimoto 12142153ad32SKuninori Morimoto /* enable CEU1 */ 12152153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D7, NULL); 12162153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D6, NULL); 12172153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D5, NULL); 12182153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D4, NULL); 12192153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D3, NULL); 12202153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D2, NULL); 12212153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D1, NULL); 12222153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D0, NULL); 12232153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_FLD, NULL); 12242153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_HD, NULL); 12252153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_VD, NULL); 12262153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_CLK, NULL); 12272153ad32SKuninori Morimoto 1228e9103e74SKuninori Morimoto /* enable KEYSC */ 1229e9103e74SKuninori Morimoto gpio_request(GPIO_FN_KEYOUT5_IN5, NULL); 1230e9103e74SKuninori Morimoto gpio_request(GPIO_FN_KEYOUT4_IN6, NULL); 1231e9103e74SKuninori Morimoto gpio_request(GPIO_FN_KEYOUT3, NULL); 1232e9103e74SKuninori Morimoto gpio_request(GPIO_FN_KEYOUT2, NULL); 1233e9103e74SKuninori Morimoto gpio_request(GPIO_FN_KEYOUT1, NULL); 1234e9103e74SKuninori Morimoto gpio_request(GPIO_FN_KEYOUT0, NULL); 1235e9103e74SKuninori Morimoto gpio_request(GPIO_FN_KEYIN0, NULL); 1236e9103e74SKuninori Morimoto 1237064a16dcSKuninori Morimoto /* enable user debug switch */ 1238064a16dcSKuninori Morimoto gpio_request(GPIO_PTR0, NULL); 1239064a16dcSKuninori Morimoto gpio_request(GPIO_PTR4, NULL); 1240064a16dcSKuninori Morimoto gpio_request(GPIO_PTR5, NULL); 1241064a16dcSKuninori Morimoto gpio_request(GPIO_PTR6, NULL); 1242064a16dcSKuninori Morimoto gpio_direction_input(GPIO_PTR0); 1243064a16dcSKuninori Morimoto gpio_direction_input(GPIO_PTR4); 1244064a16dcSKuninori Morimoto gpio_direction_input(GPIO_PTR5); 1245064a16dcSKuninori Morimoto gpio_direction_input(GPIO_PTR6); 1246064a16dcSKuninori Morimoto 12474eb80146SGuennadi Liakhovetski /* SD-card slot CN11 */ 12485744c881SGuennadi Liakhovetski #if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) 12491ce4da7aSMagnus Damm /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */ 125096987d96SKuninori Morimoto gpio_request(GPIO_FN_SDHI0WP, NULL); 125196987d96SKuninori Morimoto gpio_request(GPIO_FN_SDHI0CMD, NULL); 125296987d96SKuninori Morimoto gpio_request(GPIO_FN_SDHI0CLK, NULL); 125396987d96SKuninori Morimoto gpio_request(GPIO_FN_SDHI0D3, NULL); 125496987d96SKuninori Morimoto gpio_request(GPIO_FN_SDHI0D2, NULL); 125596987d96SKuninori Morimoto gpio_request(GPIO_FN_SDHI0D1, NULL); 125696987d96SKuninori Morimoto gpio_request(GPIO_FN_SDHI0D0, NULL); 12571ce4da7aSMagnus Damm #else 12581ce4da7aSMagnus Damm /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */ 12591ce4da7aSMagnus Damm gpio_request(GPIO_FN_MSIOF0_TXD, NULL); 12601ce4da7aSMagnus Damm gpio_request(GPIO_FN_MSIOF0_RXD, NULL); 12611ce4da7aSMagnus Damm gpio_request(GPIO_FN_MSIOF0_TSCK, NULL); 12621ce4da7aSMagnus Damm gpio_request(GPIO_PTM4, NULL); /* software CS control of TSYNC pin */ 12631ce4da7aSMagnus Damm gpio_direction_output(GPIO_PTM4, 1); /* active low CS */ 12641ce4da7aSMagnus Damm gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */ 12651ce4da7aSMagnus Damm gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */ 12661ce4da7aSMagnus Damm 12671ce4da7aSMagnus Damm spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); 12681ce4da7aSMagnus Damm #endif 126996987d96SKuninori Morimoto 12704eb80146SGuennadi Liakhovetski /* MMC/SD-card slot CN12 */ 12714eb80146SGuennadi Liakhovetski #if defined(CONFIG_MMC_SH_MMCIF) || defined(CONFIG_MMC_SH_MMCIF_MODULE) 12724eb80146SGuennadi Liakhovetski /* enable MMCIF (needs DS2.6,7 set to OFF,ON) */ 12734eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_MMC_D7, NULL); 12744eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_MMC_D6, NULL); 12754eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_MMC_D5, NULL); 12764eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_MMC_D4, NULL); 12774eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_MMC_D3, NULL); 12784eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_MMC_D2, NULL); 12794eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_MMC_D1, NULL); 12804eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_MMC_D0, NULL); 12814eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_MMC_CLK, NULL); 12824eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_MMC_CMD, NULL); 12834eb80146SGuennadi Liakhovetski 12844eb80146SGuennadi Liakhovetski cn12_enabled = true; 12854eb80146SGuennadi Liakhovetski #elif defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) 12864eb80146SGuennadi Liakhovetski /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */ 12874eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_SDHI1WP, NULL); 12884eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_SDHI1CMD, NULL); 12894eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_SDHI1CLK, NULL); 12904eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_SDHI1D3, NULL); 12914eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_SDHI1D2, NULL); 12924eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_SDHI1D1, NULL); 12934eb80146SGuennadi Liakhovetski gpio_request(GPIO_FN_SDHI1D0, NULL); 12944eb80146SGuennadi Liakhovetski 12954eb80146SGuennadi Liakhovetski cn12_enabled = true; 12964eb80146SGuennadi Liakhovetski #endif 12974eb80146SGuennadi Liakhovetski 12984eb80146SGuennadi Liakhovetski if (cn12_enabled) 12994eb80146SGuennadi Liakhovetski /* I/O buffer drive ability is high for CN12 */ 13004eb80146SGuennadi Liakhovetski __raw_writew((__raw_readw(IODRIVEA) & ~0x3000) | 0x2000, 13014eb80146SGuennadi Liakhovetski IODRIVEA); 13024eb80146SGuennadi Liakhovetski 13031980fdc4SKuninori Morimoto /* enable FSI */ 13041980fdc4SKuninori Morimoto gpio_request(GPIO_FN_FSIMCKB, NULL); 13051980fdc4SKuninori Morimoto gpio_request(GPIO_FN_FSIIBSD, NULL); 13061980fdc4SKuninori Morimoto gpio_request(GPIO_FN_FSIOBSD, NULL); 13071980fdc4SKuninori Morimoto gpio_request(GPIO_FN_FSIIBBCK, NULL); 13081980fdc4SKuninori Morimoto gpio_request(GPIO_FN_FSIIBLRCK, NULL); 13091980fdc4SKuninori Morimoto gpio_request(GPIO_FN_FSIOBBCK, NULL); 13101980fdc4SKuninori Morimoto gpio_request(GPIO_FN_FSIOBLRCK, NULL); 13111980fdc4SKuninori Morimoto gpio_request(GPIO_FN_CLKAUDIOBO, NULL); 13121980fdc4SKuninori Morimoto 131316afc9fbSKuninori Morimoto /* set SPU2 clock to 83.4 MHz */ 131416afc9fbSKuninori Morimoto clk = clk_get(NULL, "spu_clk"); 131556ea5109SGuennadi Liakhovetski if (!IS_ERR(clk)) { 131616afc9fbSKuninori Morimoto clk_set_rate(clk, clk_round_rate(clk, 83333333)); 131716afc9fbSKuninori Morimoto clk_put(clk); 131810305853SKuninori Morimoto } 131916afc9fbSKuninori Morimoto 13201980fdc4SKuninori Morimoto /* change parent of FSI B */ 13211980fdc4SKuninori Morimoto clk = clk_get(NULL, "fsib_clk"); 132256ea5109SGuennadi Liakhovetski if (!IS_ERR(clk)) { 13234bd5d259SKuninori Morimoto /* 48kHz dummy clock was used to make sure 1/1 divide */ 13244bd5d259SKuninori Morimoto clk_set_rate(&sh7724_fsimckb_clk, 48000); 13254bd5d259SKuninori Morimoto clk_set_parent(clk, &sh7724_fsimckb_clk); 13264bd5d259SKuninori Morimoto clk_set_rate(clk, 48000); 13271980fdc4SKuninori Morimoto clk_put(clk); 132810305853SKuninori Morimoto } 13291980fdc4SKuninori Morimoto 13301980fdc4SKuninori Morimoto gpio_request(GPIO_PTU0, NULL); 13311980fdc4SKuninori Morimoto gpio_direction_output(GPIO_PTU0, 0); 13321980fdc4SKuninori Morimoto mdelay(20); 13331980fdc4SKuninori Morimoto 1334ea440783SNISHIMOTO Hiroki /* enable motion sensor */ 1335ea440783SNISHIMOTO Hiroki gpio_request(GPIO_FN_INTC_IRQ1, NULL); 1336ea440783SNISHIMOTO Hiroki gpio_direction_input(GPIO_FN_INTC_IRQ1); 1337ea440783SNISHIMOTO Hiroki 13386f26d19fSMagnus Damm /* set VPU clock to 166 MHz */ 13396f26d19fSMagnus Damm clk = clk_get(NULL, "vpu_clk"); 134056ea5109SGuennadi Liakhovetski if (!IS_ERR(clk)) { 13416f26d19fSMagnus Damm clk_set_rate(clk, clk_round_rate(clk, 166000000)); 13426f26d19fSMagnus Damm clk_put(clk); 134310305853SKuninori Morimoto } 13446f26d19fSMagnus Damm 134526365716SKuninori Morimoto /* enable IrDA */ 134626365716SKuninori Morimoto gpio_request(GPIO_FN_IRDA_OUT, NULL); 134726365716SKuninori Morimoto gpio_request(GPIO_FN_IRDA_IN, NULL); 134826365716SKuninori Morimoto gpio_request(GPIO_PTU5, NULL); 134926365716SKuninori Morimoto gpio_direction_output(GPIO_PTU5, 0); 135026365716SKuninori Morimoto 1351*c2f9b05fSJacopo Mondi /* Register gpio lookup tables for cameras and video decoder */ 1352*c2f9b05fSJacopo Mondi gpiod_add_lookup_table(&tw9910_gpios); 1353*c2f9b05fSJacopo Mondi gpiod_add_lookup_table(&mt9t112_0_gpios); 1354*c2f9b05fSJacopo Mondi gpiod_add_lookup_table(&mt9t112_1_gpios); 1355*c2f9b05fSJacopo Mondi 1356125ecce6SKuninori Morimoto /* enable I2C device */ 13571980fdc4SKuninori Morimoto i2c_register_board_info(0, i2c0_devices, 13581980fdc4SKuninori Morimoto ARRAY_SIZE(i2c0_devices)); 13591980fdc4SKuninori Morimoto 1360125ecce6SKuninori Morimoto i2c_register_board_info(1, i2c1_devices, 1361125ecce6SKuninori Morimoto ARRAY_SIZE(i2c1_devices)); 1362125ecce6SKuninori Morimoto 136392359a70SGuennadi Liakhovetski #if defined(CONFIG_VIDEO_SH_VOU) || defined(CONFIG_VIDEO_SH_VOU_MODULE) 1364aee5ab0bSGuennadi Liakhovetski /* VOU */ 1365aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_D15, NULL); 1366aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_D14, NULL); 1367aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_D13, NULL); 1368aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_D12, NULL); 1369aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_D11, NULL); 1370aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_D10, NULL); 1371aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_D9, NULL); 1372aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_D8, NULL); 1373aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_CLKI, NULL); 1374aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_CLK, NULL); 1375aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_VSYNC, NULL); 1376aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_FN_DV_HSYNC, NULL); 1377aee5ab0bSGuennadi Liakhovetski 1378aee5ab0bSGuennadi Liakhovetski /* AK8813 power / reset sequence */ 1379aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_PTG4, NULL); 1380aee5ab0bSGuennadi Liakhovetski gpio_request(GPIO_PTU3, NULL); 1381aee5ab0bSGuennadi Liakhovetski /* Reset */ 1382aee5ab0bSGuennadi Liakhovetski gpio_direction_output(GPIO_PTG4, 0); 1383aee5ab0bSGuennadi Liakhovetski /* Power down */ 1384aee5ab0bSGuennadi Liakhovetski gpio_direction_output(GPIO_PTU3, 1); 1385aee5ab0bSGuennadi Liakhovetski 1386aee5ab0bSGuennadi Liakhovetski udelay(10); 1387aee5ab0bSGuennadi Liakhovetski 1388aee5ab0bSGuennadi Liakhovetski /* Power up, reset */ 1389aee5ab0bSGuennadi Liakhovetski gpio_set_value(GPIO_PTU3, 0); 1390aee5ab0bSGuennadi Liakhovetski 1391aee5ab0bSGuennadi Liakhovetski udelay(10); 1392aee5ab0bSGuennadi Liakhovetski 1393aee5ab0bSGuennadi Liakhovetski /* Remove reset */ 1394aee5ab0bSGuennadi Liakhovetski gpio_set_value(GPIO_PTG4, 1); 139592359a70SGuennadi Liakhovetski #endif 1396aee5ab0bSGuennadi Liakhovetski 1397*c2f9b05fSJacopo Mondi /* Initialize CEU platform devices separately to map memory first */ 1398*c2f9b05fSJacopo Mondi device_initialize(&ecovec_ceu_devices[0]->dev); 1399*c2f9b05fSJacopo Mondi arch_setup_pdev_archdata(ecovec_ceu_devices[0]); 1400*c2f9b05fSJacopo Mondi dma_declare_coherent_memory(&ecovec_ceu_devices[0]->dev, 1401*c2f9b05fSJacopo Mondi ceu0_dma_membase, ceu0_dma_membase, 1402*c2f9b05fSJacopo Mondi ceu0_dma_membase + 1403*c2f9b05fSJacopo Mondi CEU_BUFFER_MEMORY_SIZE - 1, 1404*c2f9b05fSJacopo Mondi DMA_MEMORY_EXCLUSIVE); 1405*c2f9b05fSJacopo Mondi platform_device_add(ecovec_ceu_devices[0]); 1406*c2f9b05fSJacopo Mondi 1407*c2f9b05fSJacopo Mondi device_initialize(&ecovec_ceu_devices[1]->dev); 1408*c2f9b05fSJacopo Mondi arch_setup_pdev_archdata(ecovec_ceu_devices[1]); 1409*c2f9b05fSJacopo Mondi dma_declare_coherent_memory(&ecovec_ceu_devices[1]->dev, 1410*c2f9b05fSJacopo Mondi ceu1_dma_membase, ceu1_dma_membase, 1411*c2f9b05fSJacopo Mondi ceu1_dma_membase + 1412*c2f9b05fSJacopo Mondi CEU_BUFFER_MEMORY_SIZE - 1, 1413*c2f9b05fSJacopo Mondi DMA_MEMORY_EXCLUSIVE); 1414*c2f9b05fSJacopo Mondi platform_device_add(ecovec_ceu_devices[1]); 1415*c2f9b05fSJacopo Mondi 14164138b740SKuninori Morimoto return platform_add_devices(ecovec_devices, 14174138b740SKuninori Morimoto ARRAY_SIZE(ecovec_devices)); 14184138b740SKuninori Morimoto } 14194907d57fSKuninori Morimoto arch_initcall(arch_setup); 14204907d57fSKuninori Morimoto 14214907d57fSKuninori Morimoto static int __init devices_setup(void) 14224907d57fSKuninori Morimoto { 1423376abbb4SMagnus Damm sh_eth_init(&sh_eth_plat); 14244907d57fSKuninori Morimoto return 0; 14254907d57fSKuninori Morimoto } 14264907d57fSKuninori Morimoto device_initcall(devices_setup); 14274907d57fSKuninori Morimoto 1428*c2f9b05fSJacopo Mondi /* Reserve a portion of memory for CEU 0 and CEU 1 buffers */ 1429*c2f9b05fSJacopo Mondi static void __init ecovec_mv_mem_reserve(void) 1430*c2f9b05fSJacopo Mondi { 1431*c2f9b05fSJacopo Mondi phys_addr_t phys; 1432*c2f9b05fSJacopo Mondi phys_addr_t size = CEU_BUFFER_MEMORY_SIZE; 1433*c2f9b05fSJacopo Mondi 1434*c2f9b05fSJacopo Mondi phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE); 1435*c2f9b05fSJacopo Mondi memblock_free(phys, size); 1436*c2f9b05fSJacopo Mondi memblock_remove(phys, size); 1437*c2f9b05fSJacopo Mondi ceu0_dma_membase = phys; 1438*c2f9b05fSJacopo Mondi 1439*c2f9b05fSJacopo Mondi phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE); 1440*c2f9b05fSJacopo Mondi memblock_free(phys, size); 1441*c2f9b05fSJacopo Mondi memblock_remove(phys, size); 1442*c2f9b05fSJacopo Mondi ceu1_dma_membase = phys; 1443*c2f9b05fSJacopo Mondi } 1444*c2f9b05fSJacopo Mondi 14454138b740SKuninori Morimoto static struct sh_machine_vector mv_ecovec __initmv = { 14464138b740SKuninori Morimoto .mv_name = "R0P7724 (EcoVec)", 1447*c2f9b05fSJacopo Mondi .mv_mem_reserve = ecovec_mv_mem_reserve, 14484138b740SKuninori Morimoto }; 1449