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