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