Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 Renesas Solutions Corp. |
| 3 | * |
| 4 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> |
| 5 | * |
| 6 | * This file is subject to the terms and conditions of the GNU General Public |
| 7 | * License. See the file "COPYING" in the main directory of this archive |
| 8 | * for more details. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/init.h> |
| 12 | #include <linux/device.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/mtd/physmap.h> |
| 15 | #include <linux/gpio.h> |
| 16 | #include <linux/interrupt.h> |
Kuninori Morimoto | 35a3540 | 2009-08-26 11:04:26 +0000 | [diff] [blame] | 17 | #include <linux/io.h> |
| 18 | #include <linux/delay.h> |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 19 | #include <linux/usb/r8a66597.h> |
Kuninori Morimoto | 4907d57 | 2009-09-10 01:39:58 +0000 | [diff] [blame] | 20 | #include <linux/i2c.h> |
Kuninori Morimoto | 8810e05 | 2009-09-28 08:21:41 +0000 | [diff] [blame] | 21 | #include <linux/i2c/tsc2007.h> |
Magnus Damm | 1ce4da7 | 2009-12-07 14:05:45 +0000 | [diff] [blame] | 22 | #include <linux/spi/spi.h> |
| 23 | #include <linux/spi/sh_msiof.h> |
| 24 | #include <linux/spi/mmc_spi.h> |
| 25 | #include <linux/mmc/host.h> |
Kuninori Morimoto | e9103e7 | 2009-09-14 11:23:00 +0000 | [diff] [blame] | 26 | #include <linux/input.h> |
Magnus Damm | fc1d003 | 2009-11-27 07:32:24 +0000 | [diff] [blame] | 27 | #include <linux/input/sh_keysc.h> |
Magnus Damm | 98779ad | 2009-11-27 04:36:58 +0000 | [diff] [blame] | 28 | #include <linux/mfd/sh_mobile_sdhi.h> |
Kuninori Morimoto | fa3ba51 | 2009-08-26 11:04:34 +0000 | [diff] [blame] | 29 | #include <video/sh_mobile_lcdc.h> |
Kuninori Morimoto | 2153ad3 | 2009-08-26 11:04:36 +0000 | [diff] [blame] | 30 | #include <media/sh_mobile_ceu.h> |
Kuninori Morimoto | 207efd0 | 2009-12-15 05:37:16 +0000 | [diff] [blame^] | 31 | #include <media/tw9910.h> |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 32 | #include <asm/heartbeat.h> |
Kuninori Morimoto | 35a3540 | 2009-08-26 11:04:26 +0000 | [diff] [blame] | 33 | #include <asm/sh_eth.h> |
Kuninori Morimoto | a991801 | 2009-09-14 11:23:16 +0000 | [diff] [blame] | 34 | #include <asm/clock.h> |
Magnus Damm | eb0cd9e | 2009-10-30 04:23:59 +0000 | [diff] [blame] | 35 | #include <asm/suspend.h> |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 36 | #include <cpu/sh7724.h> |
| 37 | |
| 38 | /* |
Kuninori Morimoto | b7056bc | 2009-08-26 11:04:22 +0000 | [diff] [blame] | 39 | * Address Interface BusWidth |
| 40 | *----------------------------------------- |
| 41 | * 0x0000_0000 uboot 16bit |
| 42 | * 0x0004_0000 Linux romImage 16bit |
| 43 | * 0x0014_0000 MTD for Linux 16bit |
| 44 | * 0x0400_0000 Internal I/O 16/32bit |
| 45 | * 0x0800_0000 DRAM 32bit |
| 46 | * 0x1800_0000 MFI 16bit |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 47 | */ |
| 48 | |
Kuninori Morimoto | 9c472c4 | 2009-10-02 07:52:20 +0000 | [diff] [blame] | 49 | /* SWITCH |
| 50 | *------------------------------ |
| 51 | * DS2[1] = FlashROM write protect ON : write protect |
| 52 | * OFF : No write protect |
| 53 | * DS2[2] = RMII / TS, SCIF ON : RMII |
| 54 | * OFF : TS, SCIF3 |
| 55 | * DS2[3] = Camera / Video ON : Camera |
| 56 | * OFF : NTSC/PAL (IN) |
| 57 | * DS2[5] = NTSC_OUT Clock ON : On board OSC |
| 58 | * OFF : SH7724 DV_CLK |
| 59 | * DS2[6-7] = MMC / SD ON-OFF : SD |
| 60 | * OFF-ON : MMC |
| 61 | */ |
| 62 | |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 63 | /* Heartbeat */ |
| 64 | static unsigned char led_pos[] = { 0, 1, 2, 3 }; |
| 65 | static struct heartbeat_data heartbeat_data = { |
| 66 | .regsize = 8, |
| 67 | .nr_bits = 4, |
| 68 | .bit_pos = led_pos, |
| 69 | }; |
| 70 | |
| 71 | static struct resource heartbeat_resources[] = { |
| 72 | [0] = { |
| 73 | .start = 0xA405012C, /* PTG */ |
| 74 | .end = 0xA405012E - 1, |
| 75 | .flags = IORESOURCE_MEM, |
| 76 | }, |
| 77 | }; |
| 78 | |
| 79 | static struct platform_device heartbeat_device = { |
| 80 | .name = "heartbeat", |
| 81 | .id = -1, |
| 82 | .dev = { |
| 83 | .platform_data = &heartbeat_data, |
| 84 | }, |
| 85 | .num_resources = ARRAY_SIZE(heartbeat_resources), |
| 86 | .resource = heartbeat_resources, |
| 87 | }; |
| 88 | |
| 89 | /* MTD */ |
| 90 | static struct mtd_partition nor_flash_partitions[] = { |
| 91 | { |
Kuninori Morimoto | b7056bc | 2009-08-26 11:04:22 +0000 | [diff] [blame] | 92 | .name = "boot loader", |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 93 | .offset = 0, |
Kuninori Morimoto | b7056bc | 2009-08-26 11:04:22 +0000 | [diff] [blame] | 94 | .size = (5 * 1024 * 1024), |
Kuninori Morimoto | d5ce010 | 2009-09-30 00:50:30 +0000 | [diff] [blame] | 95 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 96 | }, { |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 97 | .name = "free-area", |
| 98 | .offset = MTDPART_OFS_APPEND, |
| 99 | .size = MTDPART_SIZ_FULL, |
| 100 | }, |
| 101 | }; |
| 102 | |
| 103 | static struct physmap_flash_data nor_flash_data = { |
| 104 | .width = 2, |
| 105 | .parts = nor_flash_partitions, |
| 106 | .nr_parts = ARRAY_SIZE(nor_flash_partitions), |
| 107 | }; |
| 108 | |
| 109 | static struct resource nor_flash_resources[] = { |
| 110 | [0] = { |
| 111 | .name = "NOR Flash", |
| 112 | .start = 0x00000000, |
| 113 | .end = 0x03ffffff, |
| 114 | .flags = IORESOURCE_MEM, |
| 115 | } |
| 116 | }; |
| 117 | |
| 118 | static struct platform_device nor_flash_device = { |
| 119 | .name = "physmap-flash", |
| 120 | .resource = nor_flash_resources, |
| 121 | .num_resources = ARRAY_SIZE(nor_flash_resources), |
| 122 | .dev = { |
| 123 | .platform_data = &nor_flash_data, |
| 124 | }, |
| 125 | }; |
| 126 | |
Kuninori Morimoto | 35a3540 | 2009-08-26 11:04:26 +0000 | [diff] [blame] | 127 | /* SH Eth */ |
| 128 | #define SH_ETH_ADDR (0xA4600000) |
| 129 | #define SH_ETH_MAHR (SH_ETH_ADDR + 0x1C0) |
| 130 | #define SH_ETH_MALR (SH_ETH_ADDR + 0x1C8) |
| 131 | static struct resource sh_eth_resources[] = { |
| 132 | [0] = { |
| 133 | .start = SH_ETH_ADDR, |
| 134 | .end = SH_ETH_ADDR + 0x1FC, |
| 135 | .flags = IORESOURCE_MEM, |
| 136 | }, |
| 137 | [1] = { |
| 138 | .start = 91, |
| 139 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL, |
| 140 | }, |
| 141 | }; |
| 142 | |
| 143 | struct sh_eth_plat_data sh_eth_plat = { |
| 144 | .phy = 0x1f, /* SMSC LAN8700 */ |
| 145 | .edmac_endian = EDMAC_LITTLE_ENDIAN, |
Kuninori Morimoto | acf3cc2 | 2009-09-24 06:28:27 +0000 | [diff] [blame] | 146 | .ether_link_active_low = 1 |
Kuninori Morimoto | 35a3540 | 2009-08-26 11:04:26 +0000 | [diff] [blame] | 147 | }; |
| 148 | |
| 149 | static struct platform_device sh_eth_device = { |
| 150 | .name = "sh-eth", |
| 151 | .id = 0, |
| 152 | .dev = { |
| 153 | .platform_data = &sh_eth_plat, |
| 154 | }, |
| 155 | .num_resources = ARRAY_SIZE(sh_eth_resources), |
| 156 | .resource = sh_eth_resources, |
Magnus Damm | 40e4231 | 2009-10-26 10:41:58 +0000 | [diff] [blame] | 157 | .archdata = { |
| 158 | .hwblk_id = HWBLK_ETHER, |
| 159 | }, |
Kuninori Morimoto | 35a3540 | 2009-08-26 11:04:26 +0000 | [diff] [blame] | 160 | }; |
| 161 | |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 162 | /* USB0 host */ |
| 163 | void usb0_port_power(int port, int power) |
| 164 | { |
| 165 | gpio_set_value(GPIO_PTB4, power); |
| 166 | } |
| 167 | |
| 168 | static struct r8a66597_platdata usb0_host_data = { |
| 169 | .on_chip = 1, |
| 170 | .port_power = usb0_port_power, |
| 171 | }; |
| 172 | |
| 173 | static struct resource usb0_host_resources[] = { |
| 174 | [0] = { |
| 175 | .start = 0xa4d80000, |
| 176 | .end = 0xa4d80124 - 1, |
| 177 | .flags = IORESOURCE_MEM, |
| 178 | }, |
| 179 | [1] = { |
| 180 | .start = 65, |
| 181 | .end = 65, |
| 182 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, |
| 183 | }, |
| 184 | }; |
| 185 | |
| 186 | static struct platform_device usb0_host_device = { |
| 187 | .name = "r8a66597_hcd", |
| 188 | .id = 0, |
| 189 | .dev = { |
| 190 | .dma_mask = NULL, /* not use dma */ |
| 191 | .coherent_dma_mask = 0xffffffff, |
| 192 | .platform_data = &usb0_host_data, |
| 193 | }, |
| 194 | .num_resources = ARRAY_SIZE(usb0_host_resources), |
| 195 | .resource = usb0_host_resources, |
| 196 | }; |
| 197 | |
Kuninori Morimoto | 3714a9a | 2009-10-28 06:31:57 +0000 | [diff] [blame] | 198 | /* USB1 host/function */ |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 199 | void usb1_port_power(int port, int power) |
| 200 | { |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 201 | gpio_set_value(GPIO_PTB5, power); |
| 202 | } |
| 203 | |
Kuninori Morimoto | 3714a9a | 2009-10-28 06:31:57 +0000 | [diff] [blame] | 204 | static struct r8a66597_platdata usb1_common_data = { |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 205 | .on_chip = 1, |
| 206 | .port_power = usb1_port_power, |
| 207 | }; |
| 208 | |
Kuninori Morimoto | 3714a9a | 2009-10-28 06:31:57 +0000 | [diff] [blame] | 209 | static struct resource usb1_common_resources[] = { |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 210 | [0] = { |
| 211 | .start = 0xa4d90000, |
| 212 | .end = 0xa4d90124 - 1, |
| 213 | .flags = IORESOURCE_MEM, |
| 214 | }, |
| 215 | [1] = { |
| 216 | .start = 66, |
| 217 | .end = 66, |
| 218 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, |
| 219 | }, |
| 220 | }; |
| 221 | |
Kuninori Morimoto | 3714a9a | 2009-10-28 06:31:57 +0000 | [diff] [blame] | 222 | static struct platform_device usb1_common_device = { |
| 223 | /* .name will be added in arch_setup */ |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 224 | .id = 1, |
| 225 | .dev = { |
| 226 | .dma_mask = NULL, /* not use dma */ |
| 227 | .coherent_dma_mask = 0xffffffff, |
Kuninori Morimoto | 3714a9a | 2009-10-28 06:31:57 +0000 | [diff] [blame] | 228 | .platform_data = &usb1_common_data, |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 229 | }, |
Kuninori Morimoto | 3714a9a | 2009-10-28 06:31:57 +0000 | [diff] [blame] | 230 | .num_resources = ARRAY_SIZE(usb1_common_resources), |
| 231 | .resource = usb1_common_resources, |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 232 | }; |
| 233 | |
Kuninori Morimoto | fa3ba51 | 2009-08-26 11:04:34 +0000 | [diff] [blame] | 234 | /* LCDC */ |
| 235 | static struct sh_mobile_lcdc_info lcdc_info = { |
| 236 | .ch[0] = { |
| 237 | .interface_type = RGB18, |
| 238 | .chan = LCDC_CHAN_MAINLCD, |
| 239 | .bpp = 16, |
Kuninori Morimoto | fa3ba51 | 2009-08-26 11:04:34 +0000 | [diff] [blame] | 240 | .lcd_cfg = { |
| 241 | .sync = 0, /* hsync and vsync are active low */ |
| 242 | }, |
| 243 | .lcd_size_cfg = { /* 7.0 inch */ |
| 244 | .width = 152, |
| 245 | .height = 91, |
| 246 | }, |
| 247 | .board_cfg = { |
| 248 | }, |
| 249 | } |
| 250 | }; |
| 251 | |
| 252 | static struct resource lcdc_resources[] = { |
| 253 | [0] = { |
| 254 | .name = "LCDC", |
| 255 | .start = 0xfe940000, |
Phil Edworthy | a6f15ad | 2009-09-15 12:00:30 +0000 | [diff] [blame] | 256 | .end = 0xfe942fff, |
Kuninori Morimoto | fa3ba51 | 2009-08-26 11:04:34 +0000 | [diff] [blame] | 257 | .flags = IORESOURCE_MEM, |
| 258 | }, |
| 259 | [1] = { |
| 260 | .start = 106, |
| 261 | .flags = IORESOURCE_IRQ, |
| 262 | }, |
| 263 | }; |
| 264 | |
| 265 | static struct platform_device lcdc_device = { |
| 266 | .name = "sh_mobile_lcdc_fb", |
| 267 | .num_resources = ARRAY_SIZE(lcdc_resources), |
| 268 | .resource = lcdc_resources, |
| 269 | .dev = { |
| 270 | .platform_data = &lcdc_info, |
| 271 | }, |
| 272 | .archdata = { |
| 273 | .hwblk_id = HWBLK_LCDC, |
| 274 | }, |
| 275 | }; |
| 276 | |
Kuninori Morimoto | 2153ad3 | 2009-08-26 11:04:36 +0000 | [diff] [blame] | 277 | /* CEU0 */ |
| 278 | static struct sh_mobile_ceu_info sh_mobile_ceu0_info = { |
| 279 | .flags = SH_CEU_FLAG_USE_8BIT_BUS, |
| 280 | }; |
| 281 | |
| 282 | static struct resource ceu0_resources[] = { |
| 283 | [0] = { |
| 284 | .name = "CEU0", |
| 285 | .start = 0xfe910000, |
| 286 | .end = 0xfe91009f, |
| 287 | .flags = IORESOURCE_MEM, |
| 288 | }, |
| 289 | [1] = { |
| 290 | .start = 52, |
| 291 | .flags = IORESOURCE_IRQ, |
| 292 | }, |
| 293 | [2] = { |
| 294 | /* place holder for contiguous memory */ |
| 295 | }, |
| 296 | }; |
| 297 | |
| 298 | static struct platform_device ceu0_device = { |
| 299 | .name = "sh_mobile_ceu", |
| 300 | .id = 0, /* "ceu0" clock */ |
| 301 | .num_resources = ARRAY_SIZE(ceu0_resources), |
| 302 | .resource = ceu0_resources, |
| 303 | .dev = { |
| 304 | .platform_data = &sh_mobile_ceu0_info, |
| 305 | }, |
| 306 | .archdata = { |
| 307 | .hwblk_id = HWBLK_CEU0, |
| 308 | }, |
| 309 | }; |
| 310 | |
| 311 | /* CEU1 */ |
| 312 | static struct sh_mobile_ceu_info sh_mobile_ceu1_info = { |
| 313 | .flags = SH_CEU_FLAG_USE_8BIT_BUS, |
| 314 | }; |
| 315 | |
| 316 | static struct resource ceu1_resources[] = { |
| 317 | [0] = { |
| 318 | .name = "CEU1", |
| 319 | .start = 0xfe914000, |
| 320 | .end = 0xfe91409f, |
| 321 | .flags = IORESOURCE_MEM, |
| 322 | }, |
| 323 | [1] = { |
| 324 | .start = 63, |
| 325 | .flags = IORESOURCE_IRQ, |
| 326 | }, |
| 327 | [2] = { |
| 328 | /* place holder for contiguous memory */ |
| 329 | }, |
| 330 | }; |
| 331 | |
| 332 | static struct platform_device ceu1_device = { |
| 333 | .name = "sh_mobile_ceu", |
| 334 | .id = 1, /* "ceu1" clock */ |
| 335 | .num_resources = ARRAY_SIZE(ceu1_resources), |
| 336 | .resource = ceu1_resources, |
| 337 | .dev = { |
| 338 | .platform_data = &sh_mobile_ceu1_info, |
| 339 | }, |
| 340 | .archdata = { |
| 341 | .hwblk_id = HWBLK_CEU1, |
| 342 | }, |
| 343 | }; |
| 344 | |
Kuninori Morimoto | 125ecce | 2009-09-10 01:39:37 +0000 | [diff] [blame] | 345 | /* I2C device */ |
| 346 | static struct i2c_board_info i2c1_devices[] = { |
| 347 | { |
| 348 | I2C_BOARD_INFO("r2025sd", 0x32), |
| 349 | }, |
| 350 | }; |
| 351 | |
Kuninori Morimoto | e9103e7 | 2009-09-14 11:23:00 +0000 | [diff] [blame] | 352 | /* KEYSC */ |
| 353 | static struct sh_keysc_info keysc_info = { |
| 354 | .mode = SH_KEYSC_MODE_1, |
| 355 | .scan_timing = 3, |
| 356 | .delay = 50, |
| 357 | .kycr2_delay = 100, |
| 358 | .keycodes = { KEY_1, 0, 0, 0, 0, |
| 359 | KEY_2, 0, 0, 0, 0, |
| 360 | KEY_3, 0, 0, 0, 0, |
| 361 | KEY_4, 0, 0, 0, 0, |
| 362 | KEY_5, 0, 0, 0, 0, |
| 363 | KEY_6, 0, 0, 0, 0, }, |
| 364 | }; |
| 365 | |
| 366 | static struct resource keysc_resources[] = { |
| 367 | [0] = { |
| 368 | .name = "KEYSC", |
| 369 | .start = 0x044b0000, |
| 370 | .end = 0x044b000f, |
| 371 | .flags = IORESOURCE_MEM, |
| 372 | }, |
| 373 | [1] = { |
| 374 | .start = 79, |
| 375 | .flags = IORESOURCE_IRQ, |
| 376 | }, |
| 377 | }; |
| 378 | |
| 379 | static struct platform_device keysc_device = { |
| 380 | .name = "sh_keysc", |
| 381 | .id = 0, /* keysc0 clock */ |
| 382 | .num_resources = ARRAY_SIZE(keysc_resources), |
| 383 | .resource = keysc_resources, |
| 384 | .dev = { |
| 385 | .platform_data = &keysc_info, |
| 386 | }, |
| 387 | .archdata = { |
| 388 | .hwblk_id = HWBLK_KEYSC, |
| 389 | }, |
| 390 | }; |
| 391 | |
Kuninori Morimoto | 8810e05 | 2009-09-28 08:21:41 +0000 | [diff] [blame] | 392 | /* TouchScreen */ |
| 393 | #define IRQ0 32 |
| 394 | static int ts_get_pendown_state(void) |
| 395 | { |
| 396 | int val = 0; |
| 397 | gpio_free(GPIO_FN_INTC_IRQ0); |
| 398 | gpio_request(GPIO_PTZ0, NULL); |
| 399 | gpio_direction_input(GPIO_PTZ0); |
| 400 | |
| 401 | val = gpio_get_value(GPIO_PTZ0); |
| 402 | |
| 403 | gpio_free(GPIO_PTZ0); |
| 404 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); |
| 405 | |
| 406 | return val ? 0 : 1; |
| 407 | } |
| 408 | |
| 409 | static int ts_init(void) |
| 410 | { |
| 411 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); |
| 412 | return 0; |
| 413 | } |
| 414 | |
| 415 | struct tsc2007_platform_data tsc2007_info = { |
| 416 | .model = 2007, |
| 417 | .x_plate_ohms = 180, |
| 418 | .get_pendown_state = ts_get_pendown_state, |
| 419 | .init_platform_hw = ts_init, |
| 420 | }; |
| 421 | |
| 422 | static struct i2c_board_info ts_i2c_clients = { |
| 423 | I2C_BOARD_INFO("tsc2007", 0x48), |
| 424 | .type = "tsc2007", |
| 425 | .platform_data = &tsc2007_info, |
| 426 | .irq = IRQ0, |
| 427 | }; |
| 428 | |
Magnus Damm | 1ce4da7 | 2009-12-07 14:05:45 +0000 | [diff] [blame] | 429 | #ifdef CONFIG_MFD_SH_MOBILE_SDHI |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 430 | /* SHDI0 */ |
Magnus Damm | 98779ad | 2009-11-27 04:36:58 +0000 | [diff] [blame] | 431 | static void sdhi0_set_pwr(struct platform_device *pdev, int state) |
| 432 | { |
| 433 | gpio_set_value(GPIO_PTB6, state); |
| 434 | } |
| 435 | |
| 436 | static struct sh_mobile_sdhi_info sdhi0_info = { |
| 437 | .set_pwr = sdhi0_set_pwr, |
| 438 | }; |
| 439 | |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 440 | static struct resource sdhi0_resources[] = { |
| 441 | [0] = { |
| 442 | .name = "SDHI0", |
| 443 | .start = 0x04ce0000, |
| 444 | .end = 0x04ce01ff, |
| 445 | .flags = IORESOURCE_MEM, |
| 446 | }, |
| 447 | [1] = { |
| 448 | .start = 101, |
| 449 | .flags = IORESOURCE_IRQ, |
| 450 | }, |
| 451 | }; |
| 452 | |
| 453 | static struct platform_device sdhi0_device = { |
| 454 | .name = "sh_mobile_sdhi", |
| 455 | .num_resources = ARRAY_SIZE(sdhi0_resources), |
| 456 | .resource = sdhi0_resources, |
| 457 | .id = 0, |
Magnus Damm | 98779ad | 2009-11-27 04:36:58 +0000 | [diff] [blame] | 458 | .dev = { |
| 459 | .platform_data = &sdhi0_info, |
| 460 | }, |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 461 | .archdata = { |
| 462 | .hwblk_id = HWBLK_SDHI0, |
| 463 | }, |
| 464 | }; |
| 465 | |
| 466 | /* SHDI1 */ |
Magnus Damm | 98779ad | 2009-11-27 04:36:58 +0000 | [diff] [blame] | 467 | static void sdhi1_set_pwr(struct platform_device *pdev, int state) |
| 468 | { |
| 469 | gpio_set_value(GPIO_PTB7, state); |
| 470 | } |
| 471 | |
| 472 | static struct sh_mobile_sdhi_info sdhi1_info = { |
| 473 | .set_pwr = sdhi1_set_pwr, |
| 474 | }; |
| 475 | |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 476 | static struct resource sdhi1_resources[] = { |
| 477 | [0] = { |
| 478 | .name = "SDHI1", |
| 479 | .start = 0x04cf0000, |
| 480 | .end = 0x04cf01ff, |
| 481 | .flags = IORESOURCE_MEM, |
| 482 | }, |
| 483 | [1] = { |
| 484 | .start = 24, |
| 485 | .flags = IORESOURCE_IRQ, |
| 486 | }, |
| 487 | }; |
| 488 | |
| 489 | static struct platform_device sdhi1_device = { |
| 490 | .name = "sh_mobile_sdhi", |
| 491 | .num_resources = ARRAY_SIZE(sdhi1_resources), |
| 492 | .resource = sdhi1_resources, |
| 493 | .id = 1, |
Magnus Damm | 98779ad | 2009-11-27 04:36:58 +0000 | [diff] [blame] | 494 | .dev = { |
| 495 | .platform_data = &sdhi1_info, |
| 496 | }, |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 497 | .archdata = { |
| 498 | .hwblk_id = HWBLK_SDHI1, |
| 499 | }, |
| 500 | }; |
| 501 | |
Magnus Damm | 1ce4da7 | 2009-12-07 14:05:45 +0000 | [diff] [blame] | 502 | #else |
| 503 | |
| 504 | static int mmc_spi_get_ro(struct device *dev) |
| 505 | { |
| 506 | return gpio_get_value(GPIO_PTY6); |
| 507 | } |
| 508 | |
| 509 | static int mmc_spi_get_cd(struct device *dev) |
| 510 | { |
| 511 | return !gpio_get_value(GPIO_PTY7); |
| 512 | } |
| 513 | |
| 514 | static void mmc_spi_setpower(struct device *dev, unsigned int maskval) |
| 515 | { |
| 516 | gpio_set_value(GPIO_PTB6, maskval ? 1 : 0); |
| 517 | } |
| 518 | |
| 519 | static struct mmc_spi_platform_data mmc_spi_info = { |
| 520 | .get_ro = mmc_spi_get_ro, |
| 521 | .get_cd = mmc_spi_get_cd, |
| 522 | .caps = MMC_CAP_NEEDS_POLL, |
| 523 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, /* 3.3V only */ |
| 524 | .setpower = mmc_spi_setpower, |
| 525 | }; |
| 526 | |
| 527 | static struct spi_board_info spi_bus[] = { |
| 528 | { |
| 529 | .modalias = "mmc_spi", |
| 530 | .platform_data = &mmc_spi_info, |
| 531 | .max_speed_hz = 5000000, |
| 532 | .mode = SPI_MODE_0, |
| 533 | .controller_data = (void *) GPIO_PTM4, |
| 534 | }, |
| 535 | }; |
| 536 | |
| 537 | static struct sh_msiof_spi_info msiof0_data = { |
| 538 | .num_chipselect = 1, |
| 539 | }; |
| 540 | |
| 541 | static struct resource msiof0_resources[] = { |
| 542 | [0] = { |
| 543 | .name = "MSIOF0", |
| 544 | .start = 0xa4c40000, |
| 545 | .end = 0xa4c40063, |
| 546 | .flags = IORESOURCE_MEM, |
| 547 | }, |
| 548 | [1] = { |
| 549 | .start = 84, |
| 550 | .flags = IORESOURCE_IRQ, |
| 551 | }, |
| 552 | }; |
| 553 | |
| 554 | static struct platform_device msiof0_device = { |
| 555 | .name = "spi_sh_msiof", |
| 556 | .id = 0, /* MSIOF0 */ |
| 557 | .dev = { |
| 558 | .platform_data = &msiof0_data, |
| 559 | }, |
| 560 | .num_resources = ARRAY_SIZE(msiof0_resources), |
| 561 | .resource = msiof0_resources, |
| 562 | .archdata = { |
| 563 | .hwblk_id = HWBLK_MSIOF0, |
| 564 | }, |
| 565 | }; |
| 566 | |
| 567 | #endif |
| 568 | |
Kuninori Morimoto | 207efd0 | 2009-12-15 05:37:16 +0000 | [diff] [blame^] | 569 | /* I2C Video */ |
| 570 | static struct i2c_board_info i2c_camera[] = { |
| 571 | { |
| 572 | I2C_BOARD_INFO("tw9910", 0x45), |
| 573 | }, |
| 574 | }; |
| 575 | |
| 576 | /* tw9910 */ |
| 577 | static int tw9910_power(struct device *dev, int mode) |
| 578 | { |
| 579 | int val = mode ? 0 : 1; |
| 580 | |
| 581 | gpio_set_value(GPIO_PTU2, val); |
| 582 | if (mode) |
| 583 | mdelay(100); |
| 584 | |
| 585 | return 0; |
| 586 | } |
| 587 | |
| 588 | static struct tw9910_video_info tw9910_info = { |
| 589 | .buswidth = SOCAM_DATAWIDTH_8, |
| 590 | .mpout = TW9910_MPO_FIELD, |
| 591 | }; |
| 592 | |
| 593 | static struct soc_camera_link tw9910_link = { |
| 594 | .i2c_adapter_id = 0, |
| 595 | .bus_id = 1, |
| 596 | .power = tw9910_power, |
| 597 | .board_info = &i2c_camera[0], |
| 598 | .module_name = "tw9910", |
| 599 | .priv = &tw9910_info, |
| 600 | }; |
| 601 | |
| 602 | |
| 603 | static struct platform_device camera_devices[] = { |
| 604 | { |
| 605 | .name = "soc-camera-pdrv", |
| 606 | .id = 0, |
| 607 | .dev = { |
| 608 | .platform_data = &tw9910_link, |
| 609 | }, |
| 610 | }, |
| 611 | }; |
| 612 | |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 613 | static struct platform_device *ecovec_devices[] __initdata = { |
| 614 | &heartbeat_device, |
| 615 | &nor_flash_device, |
Kuninori Morimoto | 35a3540 | 2009-08-26 11:04:26 +0000 | [diff] [blame] | 616 | &sh_eth_device, |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 617 | &usb0_host_device, |
Kuninori Morimoto | 3714a9a | 2009-10-28 06:31:57 +0000 | [diff] [blame] | 618 | &usb1_common_device, |
Kuninori Morimoto | fa3ba51 | 2009-08-26 11:04:34 +0000 | [diff] [blame] | 619 | &lcdc_device, |
Kuninori Morimoto | 2153ad3 | 2009-08-26 11:04:36 +0000 | [diff] [blame] | 620 | &ceu0_device, |
| 621 | &ceu1_device, |
Kuninori Morimoto | e9103e7 | 2009-09-14 11:23:00 +0000 | [diff] [blame] | 622 | &keysc_device, |
Magnus Damm | 1ce4da7 | 2009-12-07 14:05:45 +0000 | [diff] [blame] | 623 | #ifdef CONFIG_MFD_SH_MOBILE_SDHI |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 624 | &sdhi0_device, |
| 625 | &sdhi1_device, |
Magnus Damm | 1ce4da7 | 2009-12-07 14:05:45 +0000 | [diff] [blame] | 626 | #else |
| 627 | &msiof0_device, |
| 628 | #endif |
Kuninori Morimoto | 207efd0 | 2009-12-15 05:37:16 +0000 | [diff] [blame^] | 629 | &camera_devices[0], |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 630 | }; |
| 631 | |
Kuninori Morimoto | 4907d57 | 2009-09-10 01:39:58 +0000 | [diff] [blame] | 632 | #define EEPROM_ADDR 0x50 |
| 633 | static u8 mac_read(struct i2c_adapter *a, u8 command) |
| 634 | { |
| 635 | struct i2c_msg msg[2]; |
| 636 | u8 buf; |
| 637 | int ret; |
| 638 | |
| 639 | msg[0].addr = EEPROM_ADDR; |
| 640 | msg[0].flags = 0; |
| 641 | msg[0].len = 1; |
| 642 | msg[0].buf = &command; |
| 643 | |
| 644 | msg[1].addr = EEPROM_ADDR; |
| 645 | msg[1].flags = I2C_M_RD; |
| 646 | msg[1].len = 1; |
| 647 | msg[1].buf = &buf; |
| 648 | |
| 649 | ret = i2c_transfer(a, msg, 2); |
| 650 | if (ret < 0) { |
| 651 | printk(KERN_ERR "error %d\n", ret); |
| 652 | buf = 0xff; |
| 653 | } |
| 654 | |
| 655 | return buf; |
| 656 | } |
| 657 | |
Magnus Damm | 376abbb | 2009-10-26 10:44:37 +0000 | [diff] [blame] | 658 | static void __init sh_eth_init(struct sh_eth_plat_data *pd) |
Kuninori Morimoto | 4907d57 | 2009-09-10 01:39:58 +0000 | [diff] [blame] | 659 | { |
| 660 | struct i2c_adapter *a = i2c_get_adapter(1); |
Kuninori Morimoto | 4907d57 | 2009-09-10 01:39:58 +0000 | [diff] [blame] | 661 | int i; |
| 662 | |
| 663 | if (!a) { |
| 664 | pr_err("can not get I2C 1\n"); |
| 665 | return; |
| 666 | } |
| 667 | |
Kuninori Morimoto | 4907d57 | 2009-09-10 01:39:58 +0000 | [diff] [blame] | 668 | /* read MAC address frome EEPROM */ |
Magnus Damm | 376abbb | 2009-10-26 10:44:37 +0000 | [diff] [blame] | 669 | for (i = 0; i < sizeof(pd->mac_addr); i++) { |
| 670 | pd->mac_addr[i] = mac_read(a, 0x10 + i); |
Kuninori Morimoto | 4907d57 | 2009-09-10 01:39:58 +0000 | [diff] [blame] | 671 | msleep(10); |
| 672 | } |
Kuninori Morimoto | 4907d57 | 2009-09-10 01:39:58 +0000 | [diff] [blame] | 673 | } |
| 674 | |
Kuninori Morimoto | fa3ba51 | 2009-08-26 11:04:34 +0000 | [diff] [blame] | 675 | #define PORT_HIZA 0xA4050158 |
Kuninori Morimoto | ea15edb | 2009-08-26 11:04:39 +0000 | [diff] [blame] | 676 | #define IODRIVEA 0xA405018A |
Magnus Damm | eb0cd9e | 2009-10-30 04:23:59 +0000 | [diff] [blame] | 677 | |
| 678 | extern char ecovec24_sdram_enter_start; |
| 679 | extern char ecovec24_sdram_enter_end; |
| 680 | extern char ecovec24_sdram_leave_start; |
| 681 | extern char ecovec24_sdram_leave_end; |
| 682 | |
Kuninori Morimoto | 4907d57 | 2009-09-10 01:39:58 +0000 | [diff] [blame] | 683 | static int __init arch_setup(void) |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 684 | { |
Magnus Damm | eb0cd9e | 2009-10-30 04:23:59 +0000 | [diff] [blame] | 685 | /* register board specific self-refresh code */ |
| 686 | sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF, |
| 687 | &ecovec24_sdram_enter_start, |
| 688 | &ecovec24_sdram_enter_end, |
| 689 | &ecovec24_sdram_leave_start, |
| 690 | &ecovec24_sdram_leave_end); |
| 691 | |
Magnus Damm | f78bab3 | 2009-10-07 09:00:06 +0000 | [diff] [blame] | 692 | /* enable STATUS0, STATUS2 and PDSTATUS */ |
| 693 | gpio_request(GPIO_FN_STATUS0, NULL); |
| 694 | gpio_request(GPIO_FN_STATUS2, NULL); |
| 695 | gpio_request(GPIO_FN_PDSTATUS, NULL); |
| 696 | |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 697 | /* enable SCIFA0 */ |
| 698 | gpio_request(GPIO_FN_SCIF0_TXD, NULL); |
| 699 | gpio_request(GPIO_FN_SCIF0_RXD, NULL); |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 700 | |
| 701 | /* enable debug LED */ |
| 702 | gpio_request(GPIO_PTG0, NULL); |
| 703 | gpio_request(GPIO_PTG1, NULL); |
| 704 | gpio_request(GPIO_PTG2, NULL); |
| 705 | gpio_request(GPIO_PTG3, NULL); |
Kuninori Morimoto | b7056bc | 2009-08-26 11:04:22 +0000 | [diff] [blame] | 706 | gpio_direction_output(GPIO_PTG0, 0); |
| 707 | gpio_direction_output(GPIO_PTG1, 0); |
| 708 | gpio_direction_output(GPIO_PTG2, 0); |
| 709 | gpio_direction_output(GPIO_PTG3, 0); |
Kuninori Morimoto | 643e9d1 | 2009-09-10 01:40:00 +0000 | [diff] [blame] | 710 | ctrl_outw((ctrl_inw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA); |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 711 | |
Kuninori Morimoto | 35a3540 | 2009-08-26 11:04:26 +0000 | [diff] [blame] | 712 | /* enable SH-Eth */ |
| 713 | gpio_request(GPIO_PTA1, NULL); |
| 714 | gpio_direction_output(GPIO_PTA1, 1); |
| 715 | mdelay(20); |
| 716 | |
| 717 | gpio_request(GPIO_FN_RMII_RXD0, NULL); |
| 718 | gpio_request(GPIO_FN_RMII_RXD1, NULL); |
| 719 | gpio_request(GPIO_FN_RMII_TXD0, NULL); |
| 720 | gpio_request(GPIO_FN_RMII_TXD1, NULL); |
| 721 | gpio_request(GPIO_FN_RMII_REF_CLK, NULL); |
| 722 | gpio_request(GPIO_FN_RMII_TX_EN, NULL); |
| 723 | gpio_request(GPIO_FN_RMII_RX_ER, NULL); |
| 724 | gpio_request(GPIO_FN_RMII_CRS_DV, NULL); |
| 725 | gpio_request(GPIO_FN_MDIO, NULL); |
| 726 | gpio_request(GPIO_FN_MDC, NULL); |
| 727 | gpio_request(GPIO_FN_LNKSTA, NULL); |
| 728 | |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 729 | /* enable USB */ |
Kuninori Morimoto | be4ebf9 | 2009-09-10 01:39:55 +0000 | [diff] [blame] | 730 | ctrl_outw(0x0000, 0xA4D80000); |
Kuninori Morimoto | 147df2d | 2009-09-14 11:22:31 +0000 | [diff] [blame] | 731 | ctrl_outw(0x0000, 0xA4D90000); |
Kuninori Morimoto | 907050a | 2009-08-26 11:04:31 +0000 | [diff] [blame] | 732 | gpio_request(GPIO_PTB3, NULL); |
| 733 | gpio_request(GPIO_PTB4, NULL); |
| 734 | gpio_request(GPIO_PTB5, NULL); |
| 735 | gpio_direction_input(GPIO_PTB3); |
| 736 | gpio_direction_output(GPIO_PTB4, 0); |
| 737 | gpio_direction_output(GPIO_PTB5, 0); |
| 738 | ctrl_outw(0x0600, 0xa40501d4); |
| 739 | ctrl_outw(0x0600, 0xa4050192); |
| 740 | |
Kuninori Morimoto | 3714a9a | 2009-10-28 06:31:57 +0000 | [diff] [blame] | 741 | if (gpio_get_value(GPIO_PTB3)) { |
| 742 | printk(KERN_INFO "USB1 function is selected\n"); |
| 743 | usb1_common_device.name = "r8a66597_udc"; |
| 744 | } else { |
| 745 | printk(KERN_INFO "USB1 host is selected\n"); |
| 746 | usb1_common_device.name = "r8a66597_hcd"; |
| 747 | } |
| 748 | |
Kuninori Morimoto | fa3ba51 | 2009-08-26 11:04:34 +0000 | [diff] [blame] | 749 | /* enable LCDC */ |
| 750 | gpio_request(GPIO_FN_LCDD23, NULL); |
| 751 | gpio_request(GPIO_FN_LCDD22, NULL); |
| 752 | gpio_request(GPIO_FN_LCDD21, NULL); |
| 753 | gpio_request(GPIO_FN_LCDD20, NULL); |
| 754 | gpio_request(GPIO_FN_LCDD19, NULL); |
| 755 | gpio_request(GPIO_FN_LCDD18, NULL); |
| 756 | gpio_request(GPIO_FN_LCDD17, NULL); |
| 757 | gpio_request(GPIO_FN_LCDD16, NULL); |
| 758 | gpio_request(GPIO_FN_LCDD15, NULL); |
| 759 | gpio_request(GPIO_FN_LCDD14, NULL); |
| 760 | gpio_request(GPIO_FN_LCDD13, NULL); |
| 761 | gpio_request(GPIO_FN_LCDD12, NULL); |
| 762 | gpio_request(GPIO_FN_LCDD11, NULL); |
| 763 | gpio_request(GPIO_FN_LCDD10, NULL); |
| 764 | gpio_request(GPIO_FN_LCDD9, NULL); |
| 765 | gpio_request(GPIO_FN_LCDD8, NULL); |
| 766 | gpio_request(GPIO_FN_LCDD7, NULL); |
| 767 | gpio_request(GPIO_FN_LCDD6, NULL); |
| 768 | gpio_request(GPIO_FN_LCDD5, NULL); |
| 769 | gpio_request(GPIO_FN_LCDD4, NULL); |
| 770 | gpio_request(GPIO_FN_LCDD3, NULL); |
| 771 | gpio_request(GPIO_FN_LCDD2, NULL); |
| 772 | gpio_request(GPIO_FN_LCDD1, NULL); |
| 773 | gpio_request(GPIO_FN_LCDD0, NULL); |
| 774 | gpio_request(GPIO_FN_LCDDISP, NULL); |
| 775 | gpio_request(GPIO_FN_LCDHSYN, NULL); |
| 776 | gpio_request(GPIO_FN_LCDDCK, NULL); |
| 777 | gpio_request(GPIO_FN_LCDVSYN, NULL); |
| 778 | gpio_request(GPIO_FN_LCDDON, NULL); |
| 779 | gpio_request(GPIO_FN_LCDLCLK, NULL); |
| 780 | ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA); |
| 781 | |
| 782 | gpio_request(GPIO_PTE6, NULL); |
| 783 | gpio_request(GPIO_PTU1, NULL); |
| 784 | gpio_request(GPIO_PTR1, NULL); |
| 785 | gpio_request(GPIO_PTA2, NULL); |
| 786 | gpio_direction_input(GPIO_PTE6); |
| 787 | gpio_direction_output(GPIO_PTU1, 0); |
| 788 | gpio_direction_output(GPIO_PTR1, 0); |
| 789 | gpio_direction_output(GPIO_PTA2, 0); |
| 790 | |
Kuninori Morimoto | 82b3322 | 2009-12-02 09:35:42 +0000 | [diff] [blame] | 791 | /* I/O buffer drive ability is high */ |
| 792 | ctrl_outw((ctrl_inw(IODRIVEA) & ~0x00c0) | 0x0080 , IODRIVEA); |
Kuninori Morimoto | ea15edb | 2009-08-26 11:04:39 +0000 | [diff] [blame] | 793 | |
Kuninori Morimoto | fa3ba51 | 2009-08-26 11:04:34 +0000 | [diff] [blame] | 794 | if (gpio_get_value(GPIO_PTE6)) { |
| 795 | /* DVI */ |
| 796 | lcdc_info.clock_source = LCDC_CLK_EXTERNAL; |
Kuninori Morimoto | ea15edb | 2009-08-26 11:04:39 +0000 | [diff] [blame] | 797 | lcdc_info.ch[0].clock_divider = 1, |
Kuninori Morimoto | fa3ba51 | 2009-08-26 11:04:34 +0000 | [diff] [blame] | 798 | lcdc_info.ch[0].lcd_cfg.name = "DVI"; |
| 799 | lcdc_info.ch[0].lcd_cfg.xres = 1280; |
| 800 | lcdc_info.ch[0].lcd_cfg.yres = 720; |
| 801 | lcdc_info.ch[0].lcd_cfg.left_margin = 220; |
| 802 | lcdc_info.ch[0].lcd_cfg.right_margin = 110; |
| 803 | lcdc_info.ch[0].lcd_cfg.hsync_len = 40; |
| 804 | lcdc_info.ch[0].lcd_cfg.upper_margin = 20; |
| 805 | lcdc_info.ch[0].lcd_cfg.lower_margin = 5; |
| 806 | lcdc_info.ch[0].lcd_cfg.vsync_len = 5; |
| 807 | |
| 808 | gpio_set_value(GPIO_PTA2, 1); |
| 809 | gpio_set_value(GPIO_PTU1, 1); |
| 810 | } else { |
| 811 | /* Panel */ |
Kuninori Morimoto | ea15edb | 2009-08-26 11:04:39 +0000 | [diff] [blame] | 812 | |
| 813 | lcdc_info.clock_source = LCDC_CLK_PERIPHERAL; |
| 814 | lcdc_info.ch[0].clock_divider = 2, |
| 815 | lcdc_info.ch[0].lcd_cfg.name = "Panel"; |
| 816 | lcdc_info.ch[0].lcd_cfg.xres = 800; |
| 817 | lcdc_info.ch[0].lcd_cfg.yres = 480; |
| 818 | lcdc_info.ch[0].lcd_cfg.left_margin = 220; |
| 819 | lcdc_info.ch[0].lcd_cfg.right_margin = 110; |
| 820 | lcdc_info.ch[0].lcd_cfg.hsync_len = 70; |
| 821 | lcdc_info.ch[0].lcd_cfg.upper_margin = 20; |
| 822 | lcdc_info.ch[0].lcd_cfg.lower_margin = 5; |
| 823 | lcdc_info.ch[0].lcd_cfg.vsync_len = 5; |
| 824 | |
| 825 | gpio_set_value(GPIO_PTR1, 1); |
| 826 | |
| 827 | /* FIXME |
| 828 | * |
| 829 | * LCDDON control is needed for Panel, |
| 830 | * but current sh_mobile_lcdc driver doesn't control it. |
| 831 | * It is temporary correspondence |
| 832 | */ |
| 833 | gpio_request(GPIO_PTF4, NULL); |
| 834 | gpio_direction_output(GPIO_PTF4, 1); |
Kuninori Morimoto | 8810e05 | 2009-09-28 08:21:41 +0000 | [diff] [blame] | 835 | |
| 836 | /* enable TouchScreen */ |
| 837 | i2c_register_board_info(0, &ts_i2c_clients, 1); |
| 838 | set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW); |
Kuninori Morimoto | fa3ba51 | 2009-08-26 11:04:34 +0000 | [diff] [blame] | 839 | } |
| 840 | |
Kuninori Morimoto | 2153ad3 | 2009-08-26 11:04:36 +0000 | [diff] [blame] | 841 | /* enable CEU0 */ |
| 842 | gpio_request(GPIO_FN_VIO0_D15, NULL); |
| 843 | gpio_request(GPIO_FN_VIO0_D14, NULL); |
| 844 | gpio_request(GPIO_FN_VIO0_D13, NULL); |
| 845 | gpio_request(GPIO_FN_VIO0_D12, NULL); |
| 846 | gpio_request(GPIO_FN_VIO0_D11, NULL); |
| 847 | gpio_request(GPIO_FN_VIO0_D10, NULL); |
| 848 | gpio_request(GPIO_FN_VIO0_D9, NULL); |
| 849 | gpio_request(GPIO_FN_VIO0_D8, NULL); |
| 850 | gpio_request(GPIO_FN_VIO0_D7, NULL); |
| 851 | gpio_request(GPIO_FN_VIO0_D6, NULL); |
| 852 | gpio_request(GPIO_FN_VIO0_D5, NULL); |
| 853 | gpio_request(GPIO_FN_VIO0_D4, NULL); |
| 854 | gpio_request(GPIO_FN_VIO0_D3, NULL); |
| 855 | gpio_request(GPIO_FN_VIO0_D2, NULL); |
| 856 | gpio_request(GPIO_FN_VIO0_D1, NULL); |
| 857 | gpio_request(GPIO_FN_VIO0_D0, NULL); |
| 858 | gpio_request(GPIO_FN_VIO0_VD, NULL); |
| 859 | gpio_request(GPIO_FN_VIO0_CLK, NULL); |
| 860 | gpio_request(GPIO_FN_VIO0_FLD, NULL); |
| 861 | gpio_request(GPIO_FN_VIO0_HD, NULL); |
| 862 | platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20); |
| 863 | |
| 864 | /* enable CEU1 */ |
| 865 | gpio_request(GPIO_FN_VIO1_D7, NULL); |
| 866 | gpio_request(GPIO_FN_VIO1_D6, NULL); |
| 867 | gpio_request(GPIO_FN_VIO1_D5, NULL); |
| 868 | gpio_request(GPIO_FN_VIO1_D4, NULL); |
| 869 | gpio_request(GPIO_FN_VIO1_D3, NULL); |
| 870 | gpio_request(GPIO_FN_VIO1_D2, NULL); |
| 871 | gpio_request(GPIO_FN_VIO1_D1, NULL); |
| 872 | gpio_request(GPIO_FN_VIO1_D0, NULL); |
| 873 | gpio_request(GPIO_FN_VIO1_FLD, NULL); |
| 874 | gpio_request(GPIO_FN_VIO1_HD, NULL); |
| 875 | gpio_request(GPIO_FN_VIO1_VD, NULL); |
| 876 | gpio_request(GPIO_FN_VIO1_CLK, NULL); |
| 877 | platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20); |
| 878 | |
Kuninori Morimoto | e9103e7 | 2009-09-14 11:23:00 +0000 | [diff] [blame] | 879 | /* enable KEYSC */ |
| 880 | gpio_request(GPIO_FN_KEYOUT5_IN5, NULL); |
| 881 | gpio_request(GPIO_FN_KEYOUT4_IN6, NULL); |
| 882 | gpio_request(GPIO_FN_KEYOUT3, NULL); |
| 883 | gpio_request(GPIO_FN_KEYOUT2, NULL); |
| 884 | gpio_request(GPIO_FN_KEYOUT1, NULL); |
| 885 | gpio_request(GPIO_FN_KEYOUT0, NULL); |
| 886 | gpio_request(GPIO_FN_KEYIN0, NULL); |
| 887 | |
Kuninori Morimoto | 064a16d | 2009-09-16 11:34:34 +0000 | [diff] [blame] | 888 | /* enable user debug switch */ |
| 889 | gpio_request(GPIO_PTR0, NULL); |
| 890 | gpio_request(GPIO_PTR4, NULL); |
| 891 | gpio_request(GPIO_PTR5, NULL); |
| 892 | gpio_request(GPIO_PTR6, NULL); |
| 893 | gpio_direction_input(GPIO_PTR0); |
| 894 | gpio_direction_input(GPIO_PTR4); |
| 895 | gpio_direction_input(GPIO_PTR5); |
| 896 | gpio_direction_input(GPIO_PTR6); |
| 897 | |
Magnus Damm | 1ce4da7 | 2009-12-07 14:05:45 +0000 | [diff] [blame] | 898 | #ifdef CONFIG_MFD_SH_MOBILE_SDHI |
| 899 | /* enable SDHI0 on CN11 (needs DS2.4 set to ON) */ |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 900 | gpio_request(GPIO_FN_SDHI0CD, NULL); |
| 901 | gpio_request(GPIO_FN_SDHI0WP, NULL); |
| 902 | gpio_request(GPIO_FN_SDHI0CMD, NULL); |
| 903 | gpio_request(GPIO_FN_SDHI0CLK, NULL); |
| 904 | gpio_request(GPIO_FN_SDHI0D3, NULL); |
| 905 | gpio_request(GPIO_FN_SDHI0D2, NULL); |
| 906 | gpio_request(GPIO_FN_SDHI0D1, NULL); |
| 907 | gpio_request(GPIO_FN_SDHI0D0, NULL); |
Magnus Damm | 98779ad | 2009-11-27 04:36:58 +0000 | [diff] [blame] | 908 | gpio_request(GPIO_PTB6, NULL); |
| 909 | gpio_direction_output(GPIO_PTB6, 0); |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 910 | |
Magnus Damm | 1ce4da7 | 2009-12-07 14:05:45 +0000 | [diff] [blame] | 911 | /* enable SDHI1 on CN12 (needs DS2.6,7 set to ON,OFF) */ |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 912 | gpio_request(GPIO_FN_SDHI1CD, NULL); |
| 913 | gpio_request(GPIO_FN_SDHI1WP, NULL); |
| 914 | gpio_request(GPIO_FN_SDHI1CMD, NULL); |
| 915 | gpio_request(GPIO_FN_SDHI1CLK, NULL); |
| 916 | gpio_request(GPIO_FN_SDHI1D3, NULL); |
| 917 | gpio_request(GPIO_FN_SDHI1D2, NULL); |
| 918 | gpio_request(GPIO_FN_SDHI1D1, NULL); |
| 919 | gpio_request(GPIO_FN_SDHI1D0, NULL); |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 920 | gpio_request(GPIO_PTB7, NULL); |
Magnus Damm | 98779ad | 2009-11-27 04:36:58 +0000 | [diff] [blame] | 921 | gpio_direction_output(GPIO_PTB7, 0); |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 922 | |
| 923 | /* I/O buffer drive ability is high for SDHI1 */ |
| 924 | ctrl_outw((ctrl_inw(IODRIVEA) & ~0x3000) | 0x2000 , IODRIVEA); |
Magnus Damm | 1ce4da7 | 2009-12-07 14:05:45 +0000 | [diff] [blame] | 925 | #else |
| 926 | /* enable MSIOF0 on CN11 (needs DS2.4 set to OFF) */ |
| 927 | gpio_request(GPIO_FN_MSIOF0_TXD, NULL); |
| 928 | gpio_request(GPIO_FN_MSIOF0_RXD, NULL); |
| 929 | gpio_request(GPIO_FN_MSIOF0_TSCK, NULL); |
| 930 | gpio_request(GPIO_PTM4, NULL); /* software CS control of TSYNC pin */ |
| 931 | gpio_direction_output(GPIO_PTM4, 1); /* active low CS */ |
| 932 | gpio_request(GPIO_PTB6, NULL); /* 3.3V power control */ |
| 933 | gpio_direction_output(GPIO_PTB6, 0); /* disable power by default */ |
| 934 | gpio_request(GPIO_PTY6, NULL); /* write protect */ |
| 935 | gpio_direction_input(GPIO_PTY6); |
| 936 | gpio_request(GPIO_PTY7, NULL); /* card detect */ |
| 937 | gpio_direction_input(GPIO_PTY7); |
| 938 | |
| 939 | spi_register_board_info(spi_bus, ARRAY_SIZE(spi_bus)); |
| 940 | #endif |
Kuninori Morimoto | 96987d9 | 2009-10-02 07:54:42 +0000 | [diff] [blame] | 941 | |
Kuninori Morimoto | 207efd0 | 2009-12-15 05:37:16 +0000 | [diff] [blame^] | 942 | /* enable Video */ |
| 943 | gpio_request(GPIO_PTU2, NULL); |
| 944 | gpio_direction_output(GPIO_PTU2, 1); |
| 945 | |
Kuninori Morimoto | 125ecce | 2009-09-10 01:39:37 +0000 | [diff] [blame] | 946 | /* enable I2C device */ |
| 947 | i2c_register_board_info(1, i2c1_devices, |
| 948 | ARRAY_SIZE(i2c1_devices)); |
| 949 | |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 950 | return platform_add_devices(ecovec_devices, |
| 951 | ARRAY_SIZE(ecovec_devices)); |
| 952 | } |
Kuninori Morimoto | 4907d57 | 2009-09-10 01:39:58 +0000 | [diff] [blame] | 953 | arch_initcall(arch_setup); |
| 954 | |
| 955 | static int __init devices_setup(void) |
| 956 | { |
Magnus Damm | 376abbb | 2009-10-26 10:44:37 +0000 | [diff] [blame] | 957 | sh_eth_init(&sh_eth_plat); |
Kuninori Morimoto | 4907d57 | 2009-09-10 01:39:58 +0000 | [diff] [blame] | 958 | return 0; |
| 959 | } |
| 960 | device_initcall(devices_setup); |
| 961 | |
Kuninori Morimoto | 4138b74 | 2009-08-19 12:08:33 +0000 | [diff] [blame] | 962 | static struct sh_machine_vector mv_ecovec __initmv = { |
| 963 | .mv_name = "R0P7724 (EcoVec)", |
| 964 | }; |