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 */ 104138b740SKuninori Morimoto 114138b740SKuninori Morimoto #include <linux/init.h> 124138b740SKuninori Morimoto #include <linux/device.h> 134138b740SKuninori Morimoto #include <linux/platform_device.h> 144138b740SKuninori Morimoto #include <linux/mtd/physmap.h> 154138b740SKuninori Morimoto #include <linux/gpio.h> 164138b740SKuninori Morimoto #include <linux/interrupt.h> 1735a35408SKuninori Morimoto #include <linux/io.h> 1835a35408SKuninori Morimoto #include <linux/delay.h> 19907050a3SKuninori Morimoto #include <linux/usb/r8a66597.h> 20fa3ba51bSKuninori Morimoto #include <video/sh_mobile_lcdc.h> 21*2153ad32SKuninori Morimoto #include <media/sh_mobile_ceu.h> 224138b740SKuninori Morimoto #include <asm/heartbeat.h> 2335a35408SKuninori Morimoto #include <asm/sh_eth.h> 244138b740SKuninori Morimoto #include <cpu/sh7724.h> 254138b740SKuninori Morimoto 264138b740SKuninori Morimoto /* 27b7056bc1SKuninori Morimoto * Address Interface BusWidth 28b7056bc1SKuninori Morimoto *----------------------------------------- 29b7056bc1SKuninori Morimoto * 0x0000_0000 uboot 16bit 30b7056bc1SKuninori Morimoto * 0x0004_0000 Linux romImage 16bit 31b7056bc1SKuninori Morimoto * 0x0014_0000 MTD for Linux 16bit 32b7056bc1SKuninori Morimoto * 0x0400_0000 Internal I/O 16/32bit 33b7056bc1SKuninori Morimoto * 0x0800_0000 DRAM 32bit 34b7056bc1SKuninori Morimoto * 0x1800_0000 MFI 16bit 354138b740SKuninori Morimoto */ 364138b740SKuninori Morimoto 374138b740SKuninori Morimoto /* Heartbeat */ 384138b740SKuninori Morimoto static unsigned char led_pos[] = { 0, 1, 2, 3 }; 394138b740SKuninori Morimoto static struct heartbeat_data heartbeat_data = { 404138b740SKuninori Morimoto .regsize = 8, 414138b740SKuninori Morimoto .nr_bits = 4, 424138b740SKuninori Morimoto .bit_pos = led_pos, 434138b740SKuninori Morimoto }; 444138b740SKuninori Morimoto 454138b740SKuninori Morimoto static struct resource heartbeat_resources[] = { 464138b740SKuninori Morimoto [0] = { 474138b740SKuninori Morimoto .start = 0xA405012C, /* PTG */ 484138b740SKuninori Morimoto .end = 0xA405012E - 1, 494138b740SKuninori Morimoto .flags = IORESOURCE_MEM, 504138b740SKuninori Morimoto }, 514138b740SKuninori Morimoto }; 524138b740SKuninori Morimoto 534138b740SKuninori Morimoto static struct platform_device heartbeat_device = { 544138b740SKuninori Morimoto .name = "heartbeat", 554138b740SKuninori Morimoto .id = -1, 564138b740SKuninori Morimoto .dev = { 574138b740SKuninori Morimoto .platform_data = &heartbeat_data, 584138b740SKuninori Morimoto }, 594138b740SKuninori Morimoto .num_resources = ARRAY_SIZE(heartbeat_resources), 604138b740SKuninori Morimoto .resource = heartbeat_resources, 614138b740SKuninori Morimoto }; 624138b740SKuninori Morimoto 634138b740SKuninori Morimoto /* MTD */ 644138b740SKuninori Morimoto static struct mtd_partition nor_flash_partitions[] = { 654138b740SKuninori Morimoto { 66b7056bc1SKuninori Morimoto .name = "boot loader", 674138b740SKuninori Morimoto .offset = 0, 68b7056bc1SKuninori Morimoto .size = (5 * 1024 * 1024), 694138b740SKuninori Morimoto .mask_flags = MTD_CAP_ROM, 704138b740SKuninori Morimoto }, { 714138b740SKuninori Morimoto .name = "free-area", 724138b740SKuninori Morimoto .offset = MTDPART_OFS_APPEND, 734138b740SKuninori Morimoto .size = MTDPART_SIZ_FULL, 744138b740SKuninori Morimoto }, 754138b740SKuninori Morimoto }; 764138b740SKuninori Morimoto 774138b740SKuninori Morimoto static struct physmap_flash_data nor_flash_data = { 784138b740SKuninori Morimoto .width = 2, 794138b740SKuninori Morimoto .parts = nor_flash_partitions, 804138b740SKuninori Morimoto .nr_parts = ARRAY_SIZE(nor_flash_partitions), 814138b740SKuninori Morimoto }; 824138b740SKuninori Morimoto 834138b740SKuninori Morimoto static struct resource nor_flash_resources[] = { 844138b740SKuninori Morimoto [0] = { 854138b740SKuninori Morimoto .name = "NOR Flash", 864138b740SKuninori Morimoto .start = 0x00000000, 874138b740SKuninori Morimoto .end = 0x03ffffff, 884138b740SKuninori Morimoto .flags = IORESOURCE_MEM, 894138b740SKuninori Morimoto } 904138b740SKuninori Morimoto }; 914138b740SKuninori Morimoto 924138b740SKuninori Morimoto static struct platform_device nor_flash_device = { 934138b740SKuninori Morimoto .name = "physmap-flash", 944138b740SKuninori Morimoto .resource = nor_flash_resources, 954138b740SKuninori Morimoto .num_resources = ARRAY_SIZE(nor_flash_resources), 964138b740SKuninori Morimoto .dev = { 974138b740SKuninori Morimoto .platform_data = &nor_flash_data, 984138b740SKuninori Morimoto }, 994138b740SKuninori Morimoto }; 1004138b740SKuninori Morimoto 10135a35408SKuninori Morimoto /* SH Eth */ 10235a35408SKuninori Morimoto #define SH_ETH_ADDR (0xA4600000) 10335a35408SKuninori Morimoto #define SH_ETH_MAHR (SH_ETH_ADDR + 0x1C0) 10435a35408SKuninori Morimoto #define SH_ETH_MALR (SH_ETH_ADDR + 0x1C8) 10535a35408SKuninori Morimoto static struct resource sh_eth_resources[] = { 10635a35408SKuninori Morimoto [0] = { 10735a35408SKuninori Morimoto .start = SH_ETH_ADDR, 10835a35408SKuninori Morimoto .end = SH_ETH_ADDR + 0x1FC, 10935a35408SKuninori Morimoto .flags = IORESOURCE_MEM, 11035a35408SKuninori Morimoto }, 11135a35408SKuninori Morimoto [1] = { 11235a35408SKuninori Morimoto .start = 91, 11335a35408SKuninori Morimoto .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, 11435a35408SKuninori Morimoto }, 11535a35408SKuninori Morimoto }; 11635a35408SKuninori Morimoto 11735a35408SKuninori Morimoto struct sh_eth_plat_data sh_eth_plat = { 11835a35408SKuninori Morimoto .phy = 0x1f, /* SMSC LAN8700 */ 11935a35408SKuninori Morimoto .edmac_endian = EDMAC_LITTLE_ENDIAN, 12035a35408SKuninori Morimoto }; 12135a35408SKuninori Morimoto 12235a35408SKuninori Morimoto static struct platform_device sh_eth_device = { 12335a35408SKuninori Morimoto .name = "sh-eth", 12435a35408SKuninori Morimoto .id = 0, 12535a35408SKuninori Morimoto .dev = { 12635a35408SKuninori Morimoto .platform_data = &sh_eth_plat, 12735a35408SKuninori Morimoto }, 12835a35408SKuninori Morimoto .num_resources = ARRAY_SIZE(sh_eth_resources), 12935a35408SKuninori Morimoto .resource = sh_eth_resources, 13035a35408SKuninori Morimoto }; 13135a35408SKuninori Morimoto 132907050a3SKuninori Morimoto /* USB0 host */ 133907050a3SKuninori Morimoto void usb0_port_power(int port, int power) 134907050a3SKuninori Morimoto { 135907050a3SKuninori Morimoto gpio_set_value(GPIO_PTB4, power); 136907050a3SKuninori Morimoto } 137907050a3SKuninori Morimoto 138907050a3SKuninori Morimoto static struct r8a66597_platdata usb0_host_data = { 139907050a3SKuninori Morimoto .on_chip = 1, 140907050a3SKuninori Morimoto .port_power = usb0_port_power, 141907050a3SKuninori Morimoto }; 142907050a3SKuninori Morimoto 143907050a3SKuninori Morimoto static struct resource usb0_host_resources[] = { 144907050a3SKuninori Morimoto [0] = { 145907050a3SKuninori Morimoto .start = 0xa4d80000, 146907050a3SKuninori Morimoto .end = 0xa4d80124 - 1, 147907050a3SKuninori Morimoto .flags = IORESOURCE_MEM, 148907050a3SKuninori Morimoto }, 149907050a3SKuninori Morimoto [1] = { 150907050a3SKuninori Morimoto .start = 65, 151907050a3SKuninori Morimoto .end = 65, 152907050a3SKuninori Morimoto .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, 153907050a3SKuninori Morimoto }, 154907050a3SKuninori Morimoto }; 155907050a3SKuninori Morimoto 156907050a3SKuninori Morimoto static struct platform_device usb0_host_device = { 157907050a3SKuninori Morimoto .name = "r8a66597_hcd", 158907050a3SKuninori Morimoto .id = 0, 159907050a3SKuninori Morimoto .dev = { 160907050a3SKuninori Morimoto .dma_mask = NULL, /* not use dma */ 161907050a3SKuninori Morimoto .coherent_dma_mask = 0xffffffff, 162907050a3SKuninori Morimoto .platform_data = &usb0_host_data, 163907050a3SKuninori Morimoto }, 164907050a3SKuninori Morimoto .num_resources = ARRAY_SIZE(usb0_host_resources), 165907050a3SKuninori Morimoto .resource = usb0_host_resources, 166907050a3SKuninori Morimoto }; 167907050a3SKuninori Morimoto 168907050a3SKuninori Morimoto /* 169907050a3SKuninori Morimoto * USB1 170907050a3SKuninori Morimoto * 171907050a3SKuninori Morimoto * CN5 can use both host/function, 172907050a3SKuninori Morimoto * and we can determine it by checking PTB[3] 173907050a3SKuninori Morimoto * 174907050a3SKuninori Morimoto * This time only USB1 host is supported. 175907050a3SKuninori Morimoto */ 176907050a3SKuninori Morimoto void usb1_port_power(int port, int power) 177907050a3SKuninori Morimoto { 178907050a3SKuninori Morimoto if (!gpio_get_value(GPIO_PTB3)) { 179907050a3SKuninori Morimoto printk(KERN_ERR "USB1 function is not supported\n"); 180907050a3SKuninori Morimoto return; 181907050a3SKuninori Morimoto } 182907050a3SKuninori Morimoto 183907050a3SKuninori Morimoto gpio_set_value(GPIO_PTB5, power); 184907050a3SKuninori Morimoto } 185907050a3SKuninori Morimoto 186907050a3SKuninori Morimoto static struct r8a66597_platdata usb1_host_data = { 187907050a3SKuninori Morimoto .on_chip = 1, 188907050a3SKuninori Morimoto .port_power = usb1_port_power, 189907050a3SKuninori Morimoto }; 190907050a3SKuninori Morimoto 191907050a3SKuninori Morimoto static struct resource usb1_host_resources[] = { 192907050a3SKuninori Morimoto [0] = { 193907050a3SKuninori Morimoto .start = 0xa4d90000, 194907050a3SKuninori Morimoto .end = 0xa4d90124 - 1, 195907050a3SKuninori Morimoto .flags = IORESOURCE_MEM, 196907050a3SKuninori Morimoto }, 197907050a3SKuninori Morimoto [1] = { 198907050a3SKuninori Morimoto .start = 66, 199907050a3SKuninori Morimoto .end = 66, 200907050a3SKuninori Morimoto .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, 201907050a3SKuninori Morimoto }, 202907050a3SKuninori Morimoto }; 203907050a3SKuninori Morimoto 204907050a3SKuninori Morimoto static struct platform_device usb1_host_device = { 205907050a3SKuninori Morimoto .name = "r8a66597_hcd", 206907050a3SKuninori Morimoto .id = 1, 207907050a3SKuninori Morimoto .dev = { 208907050a3SKuninori Morimoto .dma_mask = NULL, /* not use dma */ 209907050a3SKuninori Morimoto .coherent_dma_mask = 0xffffffff, 210907050a3SKuninori Morimoto .platform_data = &usb1_host_data, 211907050a3SKuninori Morimoto }, 212907050a3SKuninori Morimoto .num_resources = ARRAY_SIZE(usb1_host_resources), 213907050a3SKuninori Morimoto .resource = usb1_host_resources, 214907050a3SKuninori Morimoto }; 215907050a3SKuninori Morimoto 216fa3ba51bSKuninori Morimoto /* LCDC */ 217fa3ba51bSKuninori Morimoto static struct sh_mobile_lcdc_info lcdc_info = { 218fa3ba51bSKuninori Morimoto .ch[0] = { 219fa3ba51bSKuninori Morimoto .interface_type = RGB18, 220fa3ba51bSKuninori Morimoto .chan = LCDC_CHAN_MAINLCD, 221fa3ba51bSKuninori Morimoto .bpp = 16, 222fa3ba51bSKuninori Morimoto .clock_divider = 1, 223fa3ba51bSKuninori Morimoto .lcd_cfg = { 224fa3ba51bSKuninori Morimoto .sync = 0, /* hsync and vsync are active low */ 225fa3ba51bSKuninori Morimoto }, 226fa3ba51bSKuninori Morimoto .lcd_size_cfg = { /* 7.0 inch */ 227fa3ba51bSKuninori Morimoto .width = 152, 228fa3ba51bSKuninori Morimoto .height = 91, 229fa3ba51bSKuninori Morimoto }, 230fa3ba51bSKuninori Morimoto .board_cfg = { 231fa3ba51bSKuninori Morimoto }, 232fa3ba51bSKuninori Morimoto } 233fa3ba51bSKuninori Morimoto }; 234fa3ba51bSKuninori Morimoto 235fa3ba51bSKuninori Morimoto static struct resource lcdc_resources[] = { 236fa3ba51bSKuninori Morimoto [0] = { 237fa3ba51bSKuninori Morimoto .name = "LCDC", 238fa3ba51bSKuninori Morimoto .start = 0xfe940000, 239fa3ba51bSKuninori Morimoto .end = 0xfe941fff, 240fa3ba51bSKuninori Morimoto .flags = IORESOURCE_MEM, 241fa3ba51bSKuninori Morimoto }, 242fa3ba51bSKuninori Morimoto [1] = { 243fa3ba51bSKuninori Morimoto .start = 106, 244fa3ba51bSKuninori Morimoto .flags = IORESOURCE_IRQ, 245fa3ba51bSKuninori Morimoto }, 246fa3ba51bSKuninori Morimoto }; 247fa3ba51bSKuninori Morimoto 248fa3ba51bSKuninori Morimoto static struct platform_device lcdc_device = { 249fa3ba51bSKuninori Morimoto .name = "sh_mobile_lcdc_fb", 250fa3ba51bSKuninori Morimoto .num_resources = ARRAY_SIZE(lcdc_resources), 251fa3ba51bSKuninori Morimoto .resource = lcdc_resources, 252fa3ba51bSKuninori Morimoto .dev = { 253fa3ba51bSKuninori Morimoto .platform_data = &lcdc_info, 254fa3ba51bSKuninori Morimoto }, 255fa3ba51bSKuninori Morimoto .archdata = { 256fa3ba51bSKuninori Morimoto .hwblk_id = HWBLK_LCDC, 257fa3ba51bSKuninori Morimoto }, 258fa3ba51bSKuninori Morimoto }; 259fa3ba51bSKuninori Morimoto 260*2153ad32SKuninori Morimoto /* CEU0 */ 261*2153ad32SKuninori Morimoto static struct sh_mobile_ceu_info sh_mobile_ceu0_info = { 262*2153ad32SKuninori Morimoto .flags = SH_CEU_FLAG_USE_8BIT_BUS, 263*2153ad32SKuninori Morimoto }; 264*2153ad32SKuninori Morimoto 265*2153ad32SKuninori Morimoto static struct resource ceu0_resources[] = { 266*2153ad32SKuninori Morimoto [0] = { 267*2153ad32SKuninori Morimoto .name = "CEU0", 268*2153ad32SKuninori Morimoto .start = 0xfe910000, 269*2153ad32SKuninori Morimoto .end = 0xfe91009f, 270*2153ad32SKuninori Morimoto .flags = IORESOURCE_MEM, 271*2153ad32SKuninori Morimoto }, 272*2153ad32SKuninori Morimoto [1] = { 273*2153ad32SKuninori Morimoto .start = 52, 274*2153ad32SKuninori Morimoto .flags = IORESOURCE_IRQ, 275*2153ad32SKuninori Morimoto }, 276*2153ad32SKuninori Morimoto [2] = { 277*2153ad32SKuninori Morimoto /* place holder for contiguous memory */ 278*2153ad32SKuninori Morimoto }, 279*2153ad32SKuninori Morimoto }; 280*2153ad32SKuninori Morimoto 281*2153ad32SKuninori Morimoto static struct platform_device ceu0_device = { 282*2153ad32SKuninori Morimoto .name = "sh_mobile_ceu", 283*2153ad32SKuninori Morimoto .id = 0, /* "ceu0" clock */ 284*2153ad32SKuninori Morimoto .num_resources = ARRAY_SIZE(ceu0_resources), 285*2153ad32SKuninori Morimoto .resource = ceu0_resources, 286*2153ad32SKuninori Morimoto .dev = { 287*2153ad32SKuninori Morimoto .platform_data = &sh_mobile_ceu0_info, 288*2153ad32SKuninori Morimoto }, 289*2153ad32SKuninori Morimoto .archdata = { 290*2153ad32SKuninori Morimoto .hwblk_id = HWBLK_CEU0, 291*2153ad32SKuninori Morimoto }, 292*2153ad32SKuninori Morimoto }; 293*2153ad32SKuninori Morimoto 294*2153ad32SKuninori Morimoto /* CEU1 */ 295*2153ad32SKuninori Morimoto static struct sh_mobile_ceu_info sh_mobile_ceu1_info = { 296*2153ad32SKuninori Morimoto .flags = SH_CEU_FLAG_USE_8BIT_BUS, 297*2153ad32SKuninori Morimoto }; 298*2153ad32SKuninori Morimoto 299*2153ad32SKuninori Morimoto static struct resource ceu1_resources[] = { 300*2153ad32SKuninori Morimoto [0] = { 301*2153ad32SKuninori Morimoto .name = "CEU1", 302*2153ad32SKuninori Morimoto .start = 0xfe914000, 303*2153ad32SKuninori Morimoto .end = 0xfe91409f, 304*2153ad32SKuninori Morimoto .flags = IORESOURCE_MEM, 305*2153ad32SKuninori Morimoto }, 306*2153ad32SKuninori Morimoto [1] = { 307*2153ad32SKuninori Morimoto .start = 63, 308*2153ad32SKuninori Morimoto .flags = IORESOURCE_IRQ, 309*2153ad32SKuninori Morimoto }, 310*2153ad32SKuninori Morimoto [2] = { 311*2153ad32SKuninori Morimoto /* place holder for contiguous memory */ 312*2153ad32SKuninori Morimoto }, 313*2153ad32SKuninori Morimoto }; 314*2153ad32SKuninori Morimoto 315*2153ad32SKuninori Morimoto static struct platform_device ceu1_device = { 316*2153ad32SKuninori Morimoto .name = "sh_mobile_ceu", 317*2153ad32SKuninori Morimoto .id = 1, /* "ceu1" clock */ 318*2153ad32SKuninori Morimoto .num_resources = ARRAY_SIZE(ceu1_resources), 319*2153ad32SKuninori Morimoto .resource = ceu1_resources, 320*2153ad32SKuninori Morimoto .dev = { 321*2153ad32SKuninori Morimoto .platform_data = &sh_mobile_ceu1_info, 322*2153ad32SKuninori Morimoto }, 323*2153ad32SKuninori Morimoto .archdata = { 324*2153ad32SKuninori Morimoto .hwblk_id = HWBLK_CEU1, 325*2153ad32SKuninori Morimoto }, 326*2153ad32SKuninori Morimoto }; 327*2153ad32SKuninori Morimoto 3284138b740SKuninori Morimoto static struct platform_device *ecovec_devices[] __initdata = { 3294138b740SKuninori Morimoto &heartbeat_device, 3304138b740SKuninori Morimoto &nor_flash_device, 33135a35408SKuninori Morimoto &sh_eth_device, 332907050a3SKuninori Morimoto &usb0_host_device, 333907050a3SKuninori Morimoto &usb1_host_device, /* USB1 host support */ 334fa3ba51bSKuninori Morimoto &lcdc_device, 335*2153ad32SKuninori Morimoto &ceu0_device, 336*2153ad32SKuninori Morimoto &ceu1_device, 3374138b740SKuninori Morimoto }; 3384138b740SKuninori Morimoto 339fa3ba51bSKuninori Morimoto #define PORT_HIZA 0xA4050158 3404138b740SKuninori Morimoto static int __init devices_setup(void) 3414138b740SKuninori Morimoto { 3424138b740SKuninori Morimoto /* enable SCIFA0 */ 3434138b740SKuninori Morimoto gpio_request(GPIO_FN_SCIF0_TXD, NULL); 3444138b740SKuninori Morimoto gpio_request(GPIO_FN_SCIF0_RXD, NULL); 3454138b740SKuninori Morimoto 3464138b740SKuninori Morimoto /* enable debug LED */ 3474138b740SKuninori Morimoto gpio_request(GPIO_PTG0, NULL); 3484138b740SKuninori Morimoto gpio_request(GPIO_PTG1, NULL); 3494138b740SKuninori Morimoto gpio_request(GPIO_PTG2, NULL); 3504138b740SKuninori Morimoto gpio_request(GPIO_PTG3, NULL); 351b7056bc1SKuninori Morimoto gpio_direction_output(GPIO_PTG0, 0); 352b7056bc1SKuninori Morimoto gpio_direction_output(GPIO_PTG1, 0); 353b7056bc1SKuninori Morimoto gpio_direction_output(GPIO_PTG2, 0); 354b7056bc1SKuninori Morimoto gpio_direction_output(GPIO_PTG3, 0); 3554138b740SKuninori Morimoto 35635a35408SKuninori Morimoto /* enable SH-Eth */ 35735a35408SKuninori Morimoto gpio_request(GPIO_PTA1, NULL); 35835a35408SKuninori Morimoto gpio_direction_output(GPIO_PTA1, 1); 35935a35408SKuninori Morimoto mdelay(20); 36035a35408SKuninori Morimoto 36135a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_RXD0, NULL); 36235a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_RXD1, NULL); 36335a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_TXD0, NULL); 36435a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_TXD1, NULL); 36535a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_REF_CLK, NULL); 36635a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_TX_EN, NULL); 36735a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_RX_ER, NULL); 36835a35408SKuninori Morimoto gpio_request(GPIO_FN_RMII_CRS_DV, NULL); 36935a35408SKuninori Morimoto gpio_request(GPIO_FN_MDIO, NULL); 37035a35408SKuninori Morimoto gpio_request(GPIO_FN_MDC, NULL); 37135a35408SKuninori Morimoto gpio_request(GPIO_FN_LNKSTA, NULL); 37235a35408SKuninori Morimoto 373907050a3SKuninori Morimoto /* enable USB */ 374907050a3SKuninori Morimoto gpio_request(GPIO_PTB3, NULL); 375907050a3SKuninori Morimoto gpio_request(GPIO_PTB4, NULL); 376907050a3SKuninori Morimoto gpio_request(GPIO_PTB5, NULL); 377907050a3SKuninori Morimoto gpio_direction_input(GPIO_PTB3); 378907050a3SKuninori Morimoto gpio_direction_output(GPIO_PTB4, 0); 379907050a3SKuninori Morimoto gpio_direction_output(GPIO_PTB5, 0); 380907050a3SKuninori Morimoto ctrl_outw(0x0600, 0xa40501d4); 381907050a3SKuninori Morimoto ctrl_outw(0x0600, 0xa4050192); 382907050a3SKuninori Morimoto 383fa3ba51bSKuninori Morimoto /* enable LCDC */ 384fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD23, NULL); 385fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD22, NULL); 386fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD21, NULL); 387fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD20, NULL); 388fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD19, NULL); 389fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD18, NULL); 390fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD17, NULL); 391fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD16, NULL); 392fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD15, NULL); 393fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD14, NULL); 394fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD13, NULL); 395fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD12, NULL); 396fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD11, NULL); 397fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD10, NULL); 398fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD9, NULL); 399fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD8, NULL); 400fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD7, NULL); 401fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD6, NULL); 402fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD5, NULL); 403fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD4, NULL); 404fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD3, NULL); 405fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD2, NULL); 406fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD1, NULL); 407fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDD0, NULL); 408fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDDISP, NULL); 409fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDHSYN, NULL); 410fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDDCK, NULL); 411fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDVSYN, NULL); 412fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDDON, NULL); 413fa3ba51bSKuninori Morimoto gpio_request(GPIO_FN_LCDLCLK, NULL); 414fa3ba51bSKuninori Morimoto ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA); 415fa3ba51bSKuninori Morimoto 416fa3ba51bSKuninori Morimoto gpio_request(GPIO_PTE6, NULL); 417fa3ba51bSKuninori Morimoto gpio_request(GPIO_PTU1, NULL); 418fa3ba51bSKuninori Morimoto gpio_request(GPIO_PTR1, NULL); 419fa3ba51bSKuninori Morimoto gpio_request(GPIO_PTA2, NULL); 420fa3ba51bSKuninori Morimoto gpio_direction_input(GPIO_PTE6); 421fa3ba51bSKuninori Morimoto gpio_direction_output(GPIO_PTU1, 0); 422fa3ba51bSKuninori Morimoto gpio_direction_output(GPIO_PTR1, 0); 423fa3ba51bSKuninori Morimoto gpio_direction_output(GPIO_PTA2, 0); 424fa3ba51bSKuninori Morimoto 425fa3ba51bSKuninori Morimoto if (gpio_get_value(GPIO_PTE6)) { 426fa3ba51bSKuninori Morimoto /* DVI */ 427fa3ba51bSKuninori Morimoto lcdc_info.clock_source = LCDC_CLK_EXTERNAL; 428fa3ba51bSKuninori Morimoto lcdc_info.ch[0].lcd_cfg.name = "DVI"; 429fa3ba51bSKuninori Morimoto lcdc_info.ch[0].lcd_cfg.xres = 1280; 430fa3ba51bSKuninori Morimoto lcdc_info.ch[0].lcd_cfg.yres = 720; 431fa3ba51bSKuninori Morimoto lcdc_info.ch[0].lcd_cfg.left_margin = 220; 432fa3ba51bSKuninori Morimoto lcdc_info.ch[0].lcd_cfg.right_margin = 110; 433fa3ba51bSKuninori Morimoto lcdc_info.ch[0].lcd_cfg.hsync_len = 40; 434fa3ba51bSKuninori Morimoto lcdc_info.ch[0].lcd_cfg.upper_margin = 20; 435fa3ba51bSKuninori Morimoto lcdc_info.ch[0].lcd_cfg.lower_margin = 5; 436fa3ba51bSKuninori Morimoto lcdc_info.ch[0].lcd_cfg.vsync_len = 5; 437fa3ba51bSKuninori Morimoto 438fa3ba51bSKuninori Morimoto gpio_set_value(GPIO_PTA2, 1); 439fa3ba51bSKuninori Morimoto gpio_set_value(GPIO_PTU1, 1); 440fa3ba51bSKuninori Morimoto } else { 441fa3ba51bSKuninori Morimoto /* Panel */ 442fa3ba51bSKuninori Morimoto /* not supported */ 443fa3ba51bSKuninori Morimoto } 444fa3ba51bSKuninori Morimoto 445*2153ad32SKuninori Morimoto /* enable CEU0 */ 446*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D15, NULL); 447*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D14, NULL); 448*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D13, NULL); 449*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D12, NULL); 450*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D11, NULL); 451*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D10, NULL); 452*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D9, NULL); 453*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D8, NULL); 454*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D7, NULL); 455*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D6, NULL); 456*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D5, NULL); 457*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D4, NULL); 458*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D3, NULL); 459*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D2, NULL); 460*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D1, NULL); 461*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_D0, NULL); 462*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_VD, NULL); 463*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_CLK, NULL); 464*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_FLD, NULL); 465*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO0_HD, NULL); 466*2153ad32SKuninori Morimoto platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20); 467*2153ad32SKuninori Morimoto 468*2153ad32SKuninori Morimoto /* enable CEU1 */ 469*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D7, NULL); 470*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D6, NULL); 471*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D5, NULL); 472*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D4, NULL); 473*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D3, NULL); 474*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D2, NULL); 475*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D1, NULL); 476*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_D0, NULL); 477*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_FLD, NULL); 478*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_HD, NULL); 479*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_VD, NULL); 480*2153ad32SKuninori Morimoto gpio_request(GPIO_FN_VIO1_CLK, NULL); 481*2153ad32SKuninori Morimoto platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20); 482*2153ad32SKuninori Morimoto 4834138b740SKuninori Morimoto return platform_add_devices(ecovec_devices, 4844138b740SKuninori Morimoto ARRAY_SIZE(ecovec_devices)); 4854138b740SKuninori Morimoto } 4864138b740SKuninori Morimoto device_initcall(devices_setup); 4874138b740SKuninori Morimoto 4884138b740SKuninori Morimoto static struct sh_machine_vector mv_ecovec __initmv = { 4894138b740SKuninori Morimoto .mv_name = "R0P7724 (EcoVec)", 4904138b740SKuninori Morimoto }; 491