dm: do not forward ioctls from logical volumes to the underlying device
[platform/adaptation/renesas_rcar/renesas_kernel.git] / arch / sh / boards / mach-se / 7724 / setup.c
1 /*
2  * linux/arch/sh/boards/se/7724/setup.c
3  *
4  * Copyright (C) 2009 Renesas Solutions Corp.
5  *
6  * Kuninori Morimoto <morimoto.kuninori@renesas.com>
7  *
8  * This file is subject to the terms and conditions of the GNU General Public
9  * License.  See the file "COPYING" in the main directory of this archive
10  * for more details.
11  */
12
13 #include <linux/init.h>
14 #include <linux/device.h>
15 #include <linux/interrupt.h>
16 #include <linux/platform_device.h>
17 #include <linux/mmc/host.h>
18 #include <linux/mmc/sh_mobile_sdhi.h>
19 #include <linux/mtd/physmap.h>
20 #include <linux/delay.h>
21 #include <linux/smc91x.h>
22 #include <linux/gpio.h>
23 #include <linux/input.h>
24 #include <linux/input/sh_keysc.h>
25 #include <linux/usb/r8a66597.h>
26 #include <linux/sh_eth.h>
27 #include <video/sh_mobile_lcdc.h>
28 #include <media/sh_mobile_ceu.h>
29 #include <sound/sh_fsi.h>
30 #include <asm/io.h>
31 #include <asm/heartbeat.h>
32 #include <asm/clock.h>
33 #include <asm/suspend.h>
34 #include <cpu/sh7724.h>
35 #include <mach-se/mach/se7724.h>
36
37 /*
38  * SWx    1234 5678
39  * ------------------------------------
40  * SW31 : 1001 1100    : default
41  * SW32 : 0111 1111    : use on board flash
42  *
43  * SW41 : abxx xxxx  -> a = 0 : Analog  monitor
44  *                          1 : Digital monitor
45  *                      b = 0 : VGA
46  *                          1 : 720p
47  */
48
49 /*
50  * about 720p
51  *
52  * When you use 1280 x 720 lcdc output,
53  * you should change OSC6 lcdc clock from 25.175MHz to 74.25MHz,
54  * and change SW41 to use 720p
55  */
56
57 /*
58  * about sound
59  *
60  * This setup.c supports FSI slave mode.
61  * Please change J20, J21, J22 pin to 1-2 connection.
62  */
63
64 /* Heartbeat */
65 static struct resource heartbeat_resource = {
66         .start  = PA_LED,
67         .end    = PA_LED,
68         .flags  = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
69 };
70
71 static struct platform_device heartbeat_device = {
72         .name           = "heartbeat",
73         .id             = -1,
74         .num_resources  = 1,
75         .resource       = &heartbeat_resource,
76 };
77
78 /* LAN91C111 */
79 static struct smc91x_platdata smc91x_info = {
80         .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
81 };
82
83 static struct resource smc91x_eth_resources[] = {
84         [0] = {
85                 .name   = "SMC91C111" ,
86                 .start  = 0x1a300300,
87                 .end    = 0x1a30030f,
88                 .flags  = IORESOURCE_MEM,
89         },
90         [1] = {
91                 .start  = IRQ0_SMC,
92                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
93         },
94 };
95
96 static struct platform_device smc91x_eth_device = {
97         .name   = "smc91x",
98         .num_resources  = ARRAY_SIZE(smc91x_eth_resources),
99         .resource       = smc91x_eth_resources,
100         .dev    = {
101                 .platform_data  = &smc91x_info,
102         },
103 };
104
105 /* MTD */
106 static struct mtd_partition nor_flash_partitions[] = {
107         {
108                 .name = "uboot",
109                 .offset = 0,
110                 .size = (1 * 1024 * 1024),
111                 .mask_flags = MTD_WRITEABLE,    /* Read-only */
112         }, {
113                 .name = "kernel",
114                 .offset = MTDPART_OFS_APPEND,
115                 .size = (2 * 1024 * 1024),
116         }, {
117                 .name = "free-area",
118                 .offset = MTDPART_OFS_APPEND,
119                 .size = MTDPART_SIZ_FULL,
120         },
121 };
122
123 static struct physmap_flash_data nor_flash_data = {
124         .width          = 2,
125         .parts          = nor_flash_partitions,
126         .nr_parts       = ARRAY_SIZE(nor_flash_partitions),
127 };
128
129 static struct resource nor_flash_resources[] = {
130         [0] = {
131                 .name   = "NOR Flash",
132                 .start  = 0x00000000,
133                 .end    = 0x01ffffff,
134                 .flags  = IORESOURCE_MEM,
135         }
136 };
137
138 static struct platform_device nor_flash_device = {
139         .name           = "physmap-flash",
140         .resource       = nor_flash_resources,
141         .num_resources  = ARRAY_SIZE(nor_flash_resources),
142         .dev            = {
143                 .platform_data = &nor_flash_data,
144         },
145 };
146
147 /* LCDC */
148 static const struct fb_videomode lcdc_720p_modes[] = {
149         {
150                 .name           = "LB070WV1",
151                 .sync           = 0, /* hsync and vsync are active low */
152                 .xres           = 1280,
153                 .yres           = 720,
154                 .left_margin    = 220,
155                 .right_margin   = 110,
156                 .hsync_len      = 40,
157                 .upper_margin   = 20,
158                 .lower_margin   = 5,
159                 .vsync_len      = 5,
160         },
161 };
162
163 static const struct fb_videomode lcdc_vga_modes[] = {
164         {
165                 .name           = "LB070WV1",
166                 .sync           = 0, /* hsync and vsync are active low */
167                 .xres           = 640,
168                 .yres           = 480,
169                 .left_margin    = 105,
170                 .right_margin   = 50,
171                 .hsync_len      = 96,
172                 .upper_margin   = 33,
173                 .lower_margin   = 10,
174                 .vsync_len      = 2,
175         },
176 };
177
178 static struct sh_mobile_lcdc_info lcdc_info = {
179         .clock_source = LCDC_CLK_EXTERNAL,
180         .ch[0] = {
181                 .chan = LCDC_CHAN_MAINLCD,
182                 .bpp = 16,
183                 .clock_divider = 1,
184                 .lcd_size_cfg = { /* 7.0 inch */
185                         .width = 152,
186                         .height = 91,
187                 },
188                 .board_cfg = {
189                 },
190         }
191 };
192
193 static struct resource lcdc_resources[] = {
194         [0] = {
195                 .name   = "LCDC",
196                 .start  = 0xfe940000,
197                 .end    = 0xfe942fff,
198                 .flags  = IORESOURCE_MEM,
199         },
200         [1] = {
201                 .start  = 106,
202                 .flags  = IORESOURCE_IRQ,
203         },
204 };
205
206 static struct platform_device lcdc_device = {
207         .name           = "sh_mobile_lcdc_fb",
208         .num_resources  = ARRAY_SIZE(lcdc_resources),
209         .resource       = lcdc_resources,
210         .dev            = {
211                 .platform_data  = &lcdc_info,
212         },
213 };
214
215 /* CEU0 */
216 static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
217         .flags = SH_CEU_FLAG_USE_8BIT_BUS,
218 };
219
220 static struct resource ceu0_resources[] = {
221         [0] = {
222                 .name   = "CEU0",
223                 .start  = 0xfe910000,
224                 .end    = 0xfe91009f,
225                 .flags  = IORESOURCE_MEM,
226         },
227         [1] = {
228                 .start  = 52,
229                 .flags  = IORESOURCE_IRQ,
230         },
231         [2] = {
232                 /* place holder for contiguous memory */
233         },
234 };
235
236 static struct platform_device ceu0_device = {
237         .name           = "sh_mobile_ceu",
238         .id             = 0, /* "ceu0" clock */
239         .num_resources  = ARRAY_SIZE(ceu0_resources),
240         .resource       = ceu0_resources,
241         .dev    = {
242                 .platform_data  = &sh_mobile_ceu0_info,
243         },
244 };
245
246 /* CEU1 */
247 static struct sh_mobile_ceu_info sh_mobile_ceu1_info = {
248         .flags = SH_CEU_FLAG_USE_8BIT_BUS,
249 };
250
251 static struct resource ceu1_resources[] = {
252         [0] = {
253                 .name   = "CEU1",
254                 .start  = 0xfe914000,
255                 .end    = 0xfe91409f,
256                 .flags  = IORESOURCE_MEM,
257         },
258         [1] = {
259                 .start  = 63,
260                 .flags  = IORESOURCE_IRQ,
261         },
262         [2] = {
263                 /* place holder for contiguous memory */
264         },
265 };
266
267 static struct platform_device ceu1_device = {
268         .name           = "sh_mobile_ceu",
269         .id             = 1, /* "ceu1" clock */
270         .num_resources  = ARRAY_SIZE(ceu1_resources),
271         .resource       = ceu1_resources,
272         .dev    = {
273                 .platform_data  = &sh_mobile_ceu1_info,
274         },
275 };
276
277 /* FSI */
278 /* change J20, J21, J22 pin to 1-2 connection to use slave mode */
279 static struct sh_fsi_platform_info fsi_info = {
280         .porta_flags = SH_FSI_BRS_INV,
281 };
282
283 static struct resource fsi_resources[] = {
284         [0] = {
285                 .name   = "FSI",
286                 .start  = 0xFE3C0000,
287                 .end    = 0xFE3C021d,
288                 .flags  = IORESOURCE_MEM,
289         },
290         [1] = {
291                 .start  = 108,
292                 .flags  = IORESOURCE_IRQ,
293         },
294 };
295
296 static struct platform_device fsi_device = {
297         .name           = "sh_fsi",
298         .id             = 0,
299         .num_resources  = ARRAY_SIZE(fsi_resources),
300         .resource       = fsi_resources,
301         .dev    = {
302                 .platform_data  = &fsi_info,
303         },
304 };
305
306 static struct fsi_ak4642_info fsi_ak4642_info = {
307         .name           = "AK4642",
308         .card           = "FSIA-AK4642",
309         .cpu_dai        = "fsia-dai",
310         .codec          = "ak4642-codec.0-0012",
311         .platform       = "sh_fsi.0",
312         .id             = FSI_PORT_A,
313 };
314
315 static struct platform_device fsi_ak4642_device = {
316         .name   = "fsi-ak4642-audio",
317         .dev    = {
318                 .platform_data  = &fsi_ak4642_info,
319         },
320 };
321
322 /* KEYSC in SoC (Needs SW33-2 set to ON) */
323 static struct sh_keysc_info keysc_info = {
324         .mode = SH_KEYSC_MODE_1,
325         .scan_timing = 3,
326         .delay = 50,
327         .keycodes = {
328                 KEY_1, KEY_2, KEY_3, KEY_4, KEY_5,
329                 KEY_6, KEY_7, KEY_8, KEY_9, KEY_A,
330                 KEY_B, KEY_C, KEY_D, KEY_E, KEY_F,
331                 KEY_G, KEY_H, KEY_I, KEY_K, KEY_L,
332                 KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q,
333                 KEY_R, KEY_S, KEY_T, KEY_U, KEY_V,
334         },
335 };
336
337 static struct resource keysc_resources[] = {
338         [0] = {
339                 .name   = "KEYSC",
340                 .start  = 0x044b0000,
341                 .end    = 0x044b000f,
342                 .flags  = IORESOURCE_MEM,
343         },
344         [1] = {
345                 .start  = 79,
346                 .flags  = IORESOURCE_IRQ,
347         },
348 };
349
350 static struct platform_device keysc_device = {
351         .name           = "sh_keysc",
352         .id             = 0, /* "keysc0" clock */
353         .num_resources  = ARRAY_SIZE(keysc_resources),
354         .resource       = keysc_resources,
355         .dev    = {
356                 .platform_data  = &keysc_info,
357         },
358 };
359
360 /* SH Eth */
361 static struct resource sh_eth_resources[] = {
362         [0] = {
363                 .start = SH_ETH_ADDR,
364                 .end   = SH_ETH_ADDR + 0x1FC,
365                 .flags = IORESOURCE_MEM,
366         },
367         [1] = {
368                 .start = 91,
369                 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
370         },
371 };
372
373 static struct sh_eth_plat_data sh_eth_plat = {
374         .phy = 0x1f, /* SMSC LAN8187 */
375         .edmac_endian = EDMAC_LITTLE_ENDIAN,
376 };
377
378 static struct platform_device sh_eth_device = {
379         .name = "sh-eth",
380         .id     = 0,
381         .dev = {
382                 .platform_data = &sh_eth_plat,
383         },
384         .num_resources = ARRAY_SIZE(sh_eth_resources),
385         .resource = sh_eth_resources,
386 };
387
388 static struct r8a66597_platdata sh7724_usb0_host_data = {
389         .on_chip = 1,
390 };
391
392 static struct resource sh7724_usb0_host_resources[] = {
393         [0] = {
394                 .start  = 0xa4d80000,
395                 .end    = 0xa4d80124 - 1,
396                 .flags  = IORESOURCE_MEM,
397         },
398         [1] = {
399                 .start  = 65,
400                 .end    = 65,
401                 .flags  = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
402         },
403 };
404
405 static struct platform_device sh7724_usb0_host_device = {
406         .name           = "r8a66597_hcd",
407         .id             = 0,
408         .dev = {
409                 .dma_mask               = NULL,         /*  not use dma */
410                 .coherent_dma_mask      = 0xffffffff,
411                 .platform_data          = &sh7724_usb0_host_data,
412         },
413         .num_resources  = ARRAY_SIZE(sh7724_usb0_host_resources),
414         .resource       = sh7724_usb0_host_resources,
415 };
416
417 static struct r8a66597_platdata sh7724_usb1_gadget_data = {
418         .on_chip = 1,
419 };
420
421 static struct resource sh7724_usb1_gadget_resources[] = {
422         [0] = {
423                 .start  = 0xa4d90000,
424                 .end    = 0xa4d90123,
425                 .flags  = IORESOURCE_MEM,
426         },
427         [1] = {
428                 .start  = 66,
429                 .end    = 66,
430                 .flags  = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
431         },
432 };
433
434 static struct platform_device sh7724_usb1_gadget_device = {
435         .name           = "r8a66597_udc",
436         .id             = 1, /* USB1 */
437         .dev = {
438                 .dma_mask               = NULL,         /*  not use dma */
439                 .coherent_dma_mask      = 0xffffffff,
440                 .platform_data          = &sh7724_usb1_gadget_data,
441         },
442         .num_resources  = ARRAY_SIZE(sh7724_usb1_gadget_resources),
443         .resource       = sh7724_usb1_gadget_resources,
444 };
445
446 static struct resource sdhi0_cn7_resources[] = {
447         [0] = {
448                 .name   = "SDHI0",
449                 .start  = 0x04ce0000,
450                 .end    = 0x04ce00ff,
451                 .flags  = IORESOURCE_MEM,
452         },
453         [1] = {
454                 .start  = 100,
455                 .flags  = IORESOURCE_IRQ,
456         },
457 };
458
459 static struct sh_mobile_sdhi_info sh7724_sdhi0_data = {
460         .dma_slave_tx   = SHDMA_SLAVE_SDHI0_TX,
461         .dma_slave_rx   = SHDMA_SLAVE_SDHI0_RX,
462         .tmio_caps      = MMC_CAP_SDIO_IRQ,
463 };
464
465 static struct platform_device sdhi0_cn7_device = {
466         .name           = "sh_mobile_sdhi",
467         .id             = 0,
468         .num_resources  = ARRAY_SIZE(sdhi0_cn7_resources),
469         .resource       = sdhi0_cn7_resources,
470         .dev = {
471                 .platform_data  = &sh7724_sdhi0_data,
472         },
473 };
474
475 static struct resource sdhi1_cn8_resources[] = {
476         [0] = {
477                 .name   = "SDHI1",
478                 .start  = 0x04cf0000,
479                 .end    = 0x04cf00ff,
480                 .flags  = IORESOURCE_MEM,
481         },
482         [1] = {
483                 .start  = 23,
484                 .flags  = IORESOURCE_IRQ,
485         },
486 };
487
488 static struct sh_mobile_sdhi_info sh7724_sdhi1_data = {
489         .dma_slave_tx   = SHDMA_SLAVE_SDHI1_TX,
490         .dma_slave_rx   = SHDMA_SLAVE_SDHI1_RX,
491         .tmio_caps      = MMC_CAP_SDIO_IRQ,
492 };
493
494 static struct platform_device sdhi1_cn8_device = {
495         .name           = "sh_mobile_sdhi",
496         .id             = 1,
497         .num_resources  = ARRAY_SIZE(sdhi1_cn8_resources),
498         .resource       = sdhi1_cn8_resources,
499         .dev = {
500                 .platform_data  = &sh7724_sdhi1_data,
501         },
502 };
503
504 /* IrDA */
505 static struct resource irda_resources[] = {
506         [0] = {
507                 .name   = "IrDA",
508                 .start  = 0xA45D0000,
509                 .end    = 0xA45D0049,
510                 .flags  = IORESOURCE_MEM,
511         },
512         [1] = {
513                 .start  = 20,
514                 .flags  = IORESOURCE_IRQ,
515         },
516 };
517
518 static struct platform_device irda_device = {
519         .name           = "sh_sir",
520         .num_resources  = ARRAY_SIZE(irda_resources),
521         .resource       = irda_resources,
522 };
523
524 #include <media/ak881x.h>
525 #include <media/sh_vou.h>
526
527 static struct ak881x_pdata ak881x_pdata = {
528         .flags = AK881X_IF_MODE_SLAVE,
529 };
530
531 static struct i2c_board_info ak8813 = {
532         /* With open J18 jumper address is 0x21 */
533         I2C_BOARD_INFO("ak8813", 0x20),
534         .platform_data = &ak881x_pdata,
535 };
536
537 static struct sh_vou_pdata sh_vou_pdata = {
538         .bus_fmt        = SH_VOU_BUS_8BIT,
539         .flags          = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW,
540         .board_info     = &ak8813,
541         .i2c_adap       = 0,
542 };
543
544 static struct resource sh_vou_resources[] = {
545         [0] = {
546                 .start  = 0xfe960000,
547                 .end    = 0xfe962043,
548                 .flags  = IORESOURCE_MEM,
549         },
550         [1] = {
551                 .start  = 55,
552                 .flags  = IORESOURCE_IRQ,
553         },
554 };
555
556 static struct platform_device vou_device = {
557         .name           = "sh-vou",
558         .id             = -1,
559         .num_resources  = ARRAY_SIZE(sh_vou_resources),
560         .resource       = sh_vou_resources,
561         .dev            = {
562                 .platform_data  = &sh_vou_pdata,
563         },
564 };
565
566 static struct platform_device *ms7724se_devices[] __initdata = {
567         &heartbeat_device,
568         &smc91x_eth_device,
569         &lcdc_device,
570         &nor_flash_device,
571         &ceu0_device,
572         &ceu1_device,
573         &keysc_device,
574         &sh_eth_device,
575         &sh7724_usb0_host_device,
576         &sh7724_usb1_gadget_device,
577         &fsi_device,
578         &fsi_ak4642_device,
579         &sdhi0_cn7_device,
580         &sdhi1_cn8_device,
581         &irda_device,
582         &vou_device,
583 };
584
585 /* I2C device */
586 static struct i2c_board_info i2c0_devices[] = {
587         {
588                 I2C_BOARD_INFO("ak4642", 0x12),
589         },
590 };
591
592 #define EEPROM_OP   0xBA206000
593 #define EEPROM_ADR  0xBA206004
594 #define EEPROM_DATA 0xBA20600C
595 #define EEPROM_STAT 0xBA206010
596 #define EEPROM_STRT 0xBA206014
597 static int __init sh_eth_is_eeprom_ready(void)
598 {
599         int t = 10000;
600
601         while (t--) {
602                 if (!__raw_readw(EEPROM_STAT))
603                         return 1;
604                 udelay(1);
605         }
606
607         printk(KERN_ERR "ms7724se can not access to eeprom\n");
608         return 0;
609 }
610
611 static void __init sh_eth_init(void)
612 {
613         int i;
614         u16 mac;
615
616         /* check EEPROM status */
617         if (!sh_eth_is_eeprom_ready())
618                 return;
619
620         /* read MAC addr from EEPROM */
621         for (i = 0 ; i < 3 ; i++) {
622                 __raw_writew(0x0, EEPROM_OP); /* read */
623                 __raw_writew(i*2, EEPROM_ADR);
624                 __raw_writew(0x1, EEPROM_STRT);
625                 if (!sh_eth_is_eeprom_ready())
626                         return;
627
628                 mac = __raw_readw(EEPROM_DATA);
629                 sh_eth_plat.mac_addr[i << 1] = mac & 0xff;
630                 sh_eth_plat.mac_addr[(i << 1) + 1] = mac >> 8;
631         }
632 }
633
634 #define SW4140    0xBA201000
635 #define FPGA_OUT  0xBA200400
636 #define PORT_HIZA 0xA4050158
637 #define PORT_MSELCRB 0xA4050182
638
639 #define SW41_A    0x0100
640 #define SW41_B    0x0200
641 #define SW41_C    0x0400
642 #define SW41_D    0x0800
643 #define SW41_E    0x1000
644 #define SW41_F    0x2000
645 #define SW41_G    0x4000
646 #define SW41_H    0x8000
647
648 extern char ms7724se_sdram_enter_start;
649 extern char ms7724se_sdram_enter_end;
650 extern char ms7724se_sdram_leave_start;
651 extern char ms7724se_sdram_leave_end;
652
653
654 static int __init arch_setup(void)
655 {
656         /* enable I2C device */
657         i2c_register_board_info(0, i2c0_devices,
658                                 ARRAY_SIZE(i2c0_devices));
659         return 0;
660 }
661 arch_initcall(arch_setup);
662
663 static int __init devices_setup(void)
664 {
665         u16 sw = __raw_readw(SW4140); /* select camera, monitor */
666         struct clk *clk;
667         u16 fpga_out;
668
669         /* register board specific self-refresh code */
670         sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF |
671                                         SUSP_SH_RSTANDBY,
672                                         &ms7724se_sdram_enter_start,
673                                         &ms7724se_sdram_enter_end,
674                                         &ms7724se_sdram_leave_start,
675                                         &ms7724se_sdram_leave_end);
676         /* Reset Release */
677         fpga_out = __raw_readw(FPGA_OUT);
678         /* bit4: NTSC_PDN, bit5: NTSC_RESET */
679         fpga_out &= ~((1 << 1)  | /* LAN */
680                       (1 << 4)  | /* AK8813 PDN */
681                       (1 << 5)  | /* AK8813 RESET */
682                       (1 << 6)  | /* VIDEO DAC */
683                       (1 << 7)  | /* AK4643 */
684                       (1 << 8)  | /* IrDA */
685                       (1 << 12) | /* USB0 */
686                       (1 << 14)); /* RMII */
687         __raw_writew(fpga_out | (1 << 4), FPGA_OUT);
688
689         udelay(10);
690
691         /* AK8813 RESET */
692         __raw_writew(fpga_out | (1 << 5), FPGA_OUT);
693
694         udelay(10);
695
696         __raw_writew(fpga_out, FPGA_OUT);
697
698         /* turn on USB clocks, use external clock */
699         __raw_writew((__raw_readw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
700
701         /* Let LED9 show STATUS2 */
702         gpio_request(GPIO_FN_STATUS2, NULL);
703
704         /* Lit LED10 show STATUS0 */
705         gpio_request(GPIO_FN_STATUS0, NULL);
706
707         /* Lit LED11 show PDSTATUS */
708         gpio_request(GPIO_FN_PDSTATUS, NULL);
709
710         /* enable USB0 port */
711         __raw_writew(0x0600, 0xa40501d4);
712
713         /* enable USB1 port */
714         __raw_writew(0x0600, 0xa4050192);
715
716         /* enable IRQ 0,1,2 */
717         gpio_request(GPIO_FN_INTC_IRQ0, NULL);
718         gpio_request(GPIO_FN_INTC_IRQ1, NULL);
719         gpio_request(GPIO_FN_INTC_IRQ2, NULL);
720
721         /* enable SCIFA3 */
722         gpio_request(GPIO_FN_SCIF3_I_SCK, NULL);
723         gpio_request(GPIO_FN_SCIF3_I_RXD, NULL);
724         gpio_request(GPIO_FN_SCIF3_I_TXD, NULL);
725         gpio_request(GPIO_FN_SCIF3_I_CTS, NULL);
726         gpio_request(GPIO_FN_SCIF3_I_RTS, NULL);
727
728         /* enable LCDC */
729         gpio_request(GPIO_FN_LCDD23,   NULL);
730         gpio_request(GPIO_FN_LCDD22,   NULL);
731         gpio_request(GPIO_FN_LCDD21,   NULL);
732         gpio_request(GPIO_FN_LCDD20,   NULL);
733         gpio_request(GPIO_FN_LCDD19,   NULL);
734         gpio_request(GPIO_FN_LCDD18,   NULL);
735         gpio_request(GPIO_FN_LCDD17,   NULL);
736         gpio_request(GPIO_FN_LCDD16,   NULL);
737         gpio_request(GPIO_FN_LCDD15,   NULL);
738         gpio_request(GPIO_FN_LCDD14,   NULL);
739         gpio_request(GPIO_FN_LCDD13,   NULL);
740         gpio_request(GPIO_FN_LCDD12,   NULL);
741         gpio_request(GPIO_FN_LCDD11,   NULL);
742         gpio_request(GPIO_FN_LCDD10,   NULL);
743         gpio_request(GPIO_FN_LCDD9,    NULL);
744         gpio_request(GPIO_FN_LCDD8,    NULL);
745         gpio_request(GPIO_FN_LCDD7,    NULL);
746         gpio_request(GPIO_FN_LCDD6,    NULL);
747         gpio_request(GPIO_FN_LCDD5,    NULL);
748         gpio_request(GPIO_FN_LCDD4,    NULL);
749         gpio_request(GPIO_FN_LCDD3,    NULL);
750         gpio_request(GPIO_FN_LCDD2,    NULL);
751         gpio_request(GPIO_FN_LCDD1,    NULL);
752         gpio_request(GPIO_FN_LCDD0,    NULL);
753         gpio_request(GPIO_FN_LCDDISP,  NULL);
754         gpio_request(GPIO_FN_LCDHSYN,  NULL);
755         gpio_request(GPIO_FN_LCDDCK,   NULL);
756         gpio_request(GPIO_FN_LCDVSYN,  NULL);
757         gpio_request(GPIO_FN_LCDDON,   NULL);
758         gpio_request(GPIO_FN_LCDVEPWC, NULL);
759         gpio_request(GPIO_FN_LCDVCPWC, NULL);
760         gpio_request(GPIO_FN_LCDRD,    NULL);
761         gpio_request(GPIO_FN_LCDLCLK,  NULL);
762         __raw_writew((__raw_readw(PORT_HIZA) & ~0x0001), PORT_HIZA);
763
764         /* enable CEU0 */
765         gpio_request(GPIO_FN_VIO0_D15, NULL);
766         gpio_request(GPIO_FN_VIO0_D14, NULL);
767         gpio_request(GPIO_FN_VIO0_D13, NULL);
768         gpio_request(GPIO_FN_VIO0_D12, NULL);
769         gpio_request(GPIO_FN_VIO0_D11, NULL);
770         gpio_request(GPIO_FN_VIO0_D10, NULL);
771         gpio_request(GPIO_FN_VIO0_D9,  NULL);
772         gpio_request(GPIO_FN_VIO0_D8,  NULL);
773         gpio_request(GPIO_FN_VIO0_D7,  NULL);
774         gpio_request(GPIO_FN_VIO0_D6,  NULL);
775         gpio_request(GPIO_FN_VIO0_D5,  NULL);
776         gpio_request(GPIO_FN_VIO0_D4,  NULL);
777         gpio_request(GPIO_FN_VIO0_D3,  NULL);
778         gpio_request(GPIO_FN_VIO0_D2,  NULL);
779         gpio_request(GPIO_FN_VIO0_D1,  NULL);
780         gpio_request(GPIO_FN_VIO0_D0,  NULL);
781         gpio_request(GPIO_FN_VIO0_VD,  NULL);
782         gpio_request(GPIO_FN_VIO0_CLK, NULL);
783         gpio_request(GPIO_FN_VIO0_FLD, NULL);
784         gpio_request(GPIO_FN_VIO0_HD,  NULL);
785         platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20);
786
787         /* enable CEU1 */
788         gpio_request(GPIO_FN_VIO1_D7,  NULL);
789         gpio_request(GPIO_FN_VIO1_D6,  NULL);
790         gpio_request(GPIO_FN_VIO1_D5,  NULL);
791         gpio_request(GPIO_FN_VIO1_D4,  NULL);
792         gpio_request(GPIO_FN_VIO1_D3,  NULL);
793         gpio_request(GPIO_FN_VIO1_D2,  NULL);
794         gpio_request(GPIO_FN_VIO1_D1,  NULL);
795         gpio_request(GPIO_FN_VIO1_D0,  NULL);
796         gpio_request(GPIO_FN_VIO1_FLD, NULL);
797         gpio_request(GPIO_FN_VIO1_HD,  NULL);
798         gpio_request(GPIO_FN_VIO1_VD,  NULL);
799         gpio_request(GPIO_FN_VIO1_CLK, NULL);
800         platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20);
801
802         /* KEYSC */
803         gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
804         gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
805         gpio_request(GPIO_FN_KEYIN4,      NULL);
806         gpio_request(GPIO_FN_KEYIN3,      NULL);
807         gpio_request(GPIO_FN_KEYIN2,      NULL);
808         gpio_request(GPIO_FN_KEYIN1,      NULL);
809         gpio_request(GPIO_FN_KEYIN0,      NULL);
810         gpio_request(GPIO_FN_KEYOUT3,     NULL);
811         gpio_request(GPIO_FN_KEYOUT2,     NULL);
812         gpio_request(GPIO_FN_KEYOUT1,     NULL);
813         gpio_request(GPIO_FN_KEYOUT0,     NULL);
814
815         /* enable FSI */
816         gpio_request(GPIO_FN_FSIMCKA,    NULL);
817         gpio_request(GPIO_FN_FSIIASD,    NULL);
818         gpio_request(GPIO_FN_FSIOASD,    NULL);
819         gpio_request(GPIO_FN_FSIIABCK,   NULL);
820         gpio_request(GPIO_FN_FSIIALRCK,  NULL);
821         gpio_request(GPIO_FN_FSIOABCK,   NULL);
822         gpio_request(GPIO_FN_FSIOALRCK,  NULL);
823         gpio_request(GPIO_FN_CLKAUDIOAO, NULL);
824
825         /* set SPU2 clock to 83.4 MHz */
826         clk = clk_get(NULL, "spu_clk");
827         if (!IS_ERR(clk)) {
828                 clk_set_rate(clk, clk_round_rate(clk, 83333333));
829                 clk_put(clk);
830         }
831
832         /* change parent of FSI A */
833         clk = clk_get(NULL, "fsia_clk");
834         if (!IS_ERR(clk)) {
835                 /* 48kHz dummy clock was used to make sure 1/1 divide */
836                 clk_set_rate(&sh7724_fsimcka_clk, 48000);
837                 clk_set_parent(clk, &sh7724_fsimcka_clk);
838                 clk_set_rate(clk, 48000);
839                 clk_put(clk);
840         }
841
842         /* SDHI0 connected to cn7 */
843         gpio_request(GPIO_FN_SDHI0CD, NULL);
844         gpio_request(GPIO_FN_SDHI0WP, NULL);
845         gpio_request(GPIO_FN_SDHI0D3, NULL);
846         gpio_request(GPIO_FN_SDHI0D2, NULL);
847         gpio_request(GPIO_FN_SDHI0D1, NULL);
848         gpio_request(GPIO_FN_SDHI0D0, NULL);
849         gpio_request(GPIO_FN_SDHI0CMD, NULL);
850         gpio_request(GPIO_FN_SDHI0CLK, NULL);
851
852         /* SDHI1 connected to cn8 */
853         gpio_request(GPIO_FN_SDHI1CD, NULL);
854         gpio_request(GPIO_FN_SDHI1WP, NULL);
855         gpio_request(GPIO_FN_SDHI1D3, NULL);
856         gpio_request(GPIO_FN_SDHI1D2, NULL);
857         gpio_request(GPIO_FN_SDHI1D1, NULL);
858         gpio_request(GPIO_FN_SDHI1D0, NULL);
859         gpio_request(GPIO_FN_SDHI1CMD, NULL);
860         gpio_request(GPIO_FN_SDHI1CLK, NULL);
861
862         /* enable IrDA */
863         gpio_request(GPIO_FN_IRDA_OUT, NULL);
864         gpio_request(GPIO_FN_IRDA_IN,  NULL);
865
866         /*
867          * enable SH-Eth
868          *
869          * please remove J33 pin from your board !!
870          *
871          * ms7724 board should not use GPIO_FN_LNKSTA pin
872          * So, This time PTX5 is set to input pin
873          */
874         gpio_request(GPIO_FN_RMII_RXD0,    NULL);
875         gpio_request(GPIO_FN_RMII_RXD1,    NULL);
876         gpio_request(GPIO_FN_RMII_TXD0,    NULL);
877         gpio_request(GPIO_FN_RMII_TXD1,    NULL);
878         gpio_request(GPIO_FN_RMII_REF_CLK, NULL);
879         gpio_request(GPIO_FN_RMII_TX_EN,   NULL);
880         gpio_request(GPIO_FN_RMII_RX_ER,   NULL);
881         gpio_request(GPIO_FN_RMII_CRS_DV,  NULL);
882         gpio_request(GPIO_FN_MDIO,         NULL);
883         gpio_request(GPIO_FN_MDC,          NULL);
884         gpio_request(GPIO_PTX5, NULL);
885         gpio_direction_input(GPIO_PTX5);
886         sh_eth_init();
887
888         if (sw & SW41_B) {
889                 /* 720p */
890                 lcdc_info.ch[0].lcd_cfg = lcdc_720p_modes;
891                 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_720p_modes);
892         } else {
893                 /* VGA */
894                 lcdc_info.ch[0].lcd_cfg = lcdc_vga_modes;
895                 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_vga_modes);
896         }
897
898         if (sw & SW41_A) {
899                 /* Digital monitor */
900                 lcdc_info.ch[0].interface_type = RGB18;
901                 lcdc_info.ch[0].flags          = 0;
902         } else {
903                 /* Analog monitor */
904                 lcdc_info.ch[0].interface_type = RGB24;
905                 lcdc_info.ch[0].flags          = LCDC_FLAGS_DWPOL;
906         }
907
908         /* VOU */
909         gpio_request(GPIO_FN_DV_D15, NULL);
910         gpio_request(GPIO_FN_DV_D14, NULL);
911         gpio_request(GPIO_FN_DV_D13, NULL);
912         gpio_request(GPIO_FN_DV_D12, NULL);
913         gpio_request(GPIO_FN_DV_D11, NULL);
914         gpio_request(GPIO_FN_DV_D10, NULL);
915         gpio_request(GPIO_FN_DV_D9, NULL);
916         gpio_request(GPIO_FN_DV_D8, NULL);
917         gpio_request(GPIO_FN_DV_CLKI, NULL);
918         gpio_request(GPIO_FN_DV_CLK, NULL);
919         gpio_request(GPIO_FN_DV_VSYNC, NULL);
920         gpio_request(GPIO_FN_DV_HSYNC, NULL);
921
922         return platform_add_devices(ms7724se_devices,
923                                     ARRAY_SIZE(ms7724se_devices));
924 }
925 device_initcall(devices_setup);
926
927 static struct sh_machine_vector mv_ms7724se __initmv = {
928         .mv_name        = "ms7724se",
929         .mv_init_irq    = init_se7724_IRQ,
930         .mv_nr_irqs     = SE7724_FPGA_IRQ_BASE + SE7724_FPGA_IRQ_NR,
931 };