blob: 4488b3e774df024ce8eca9928e33d63ccda08f71 [file] [log] [blame]
Kuninori Morimoto287c1292009-05-26 07:04:52 +00001/*
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/mtd/physmap.h>
18#include <linux/delay.h>
19#include <linux/smc91x.h>
20#include <linux/gpio.h>
21#include <linux/input.h>
Magnus Damm9731f4a2009-07-03 09:40:03 +000022#include <linux/usb/r8a66597.h>
Kuninori Morimoto287c1292009-05-26 07:04:52 +000023#include <video/sh_mobile_lcdc.h>
24#include <media/sh_mobile_ceu.h>
Kuninori Morimoto3e9ad522009-08-21 01:24:54 +000025#include <sound/sh_fsi.h>
Kuninori Morimoto287c1292009-05-26 07:04:52 +000026#include <asm/io.h>
27#include <asm/heartbeat.h>
Kuninori Morimotoa80cad92009-06-26 07:05:39 +000028#include <asm/sh_eth.h>
29#include <asm/clock.h>
Kuninori Morimoto287c1292009-05-26 07:04:52 +000030#include <asm/sh_keysc.h>
31#include <cpu/sh7724.h>
32#include <mach-se/mach/se7724.h>
33
34/*
35 * SWx 1234 5678
36 * ------------------------------------
37 * SW31 : 1001 1100 : default
38 * SW32 : 0111 1111 : use on board flash
39 *
40 * SW41 : abxx xxxx -> a = 0 : Analog monitor
41 * 1 : Digital monitor
42 * b = 0 : VGA
Kuninori Morimoto4f324312009-08-03 04:52:03 +000043 * 1 : 720p
44 */
45
46/*
47 * about 720p
48 *
49 * When you use 1280 x 720 lcdc output,
50 * you should change OSC6 lcdc clock from 25.175MHz to 74.25MHz,
51 * and change SW41 to use 720p
Kuninori Morimoto287c1292009-05-26 07:04:52 +000052 */
53
54/* Heartbeat */
55static struct heartbeat_data heartbeat_data = {
56 .regsize = 16,
57};
58
59static struct resource heartbeat_resources[] = {
60 [0] = {
61 .start = PA_LED,
62 .end = PA_LED,
63 .flags = IORESOURCE_MEM,
64 },
65};
66
67static struct platform_device heartbeat_device = {
68 .name = "heartbeat",
69 .id = -1,
70 .dev = {
71 .platform_data = &heartbeat_data,
72 },
73 .num_resources = ARRAY_SIZE(heartbeat_resources),
74 .resource = heartbeat_resources,
75};
76
77/* LAN91C111 */
78static struct smc91x_platdata smc91x_info = {
79 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
80};
81
82static struct resource smc91x_eth_resources[] = {
83 [0] = {
84 .name = "SMC91C111" ,
85 .start = 0x1a300300,
86 .end = 0x1a30030f,
87 .flags = IORESOURCE_MEM,
88 },
89 [1] = {
90 .start = IRQ0_SMC,
91 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
92 },
93};
94
95static struct platform_device smc91x_eth_device = {
96 .name = "smc91x",
97 .num_resources = ARRAY_SIZE(smc91x_eth_resources),
98 .resource = smc91x_eth_resources,
99 .dev = {
100 .platform_data = &smc91x_info,
101 },
102};
103
104/* MTD */
105static struct mtd_partition nor_flash_partitions[] = {
106 {
107 .name = "uboot",
108 .offset = 0,
109 .size = (1 * 1024 * 1024),
110 .mask_flags = MTD_WRITEABLE, /* Read-only */
111 }, {
112 .name = "kernel",
113 .offset = MTDPART_OFS_APPEND,
114 .size = (2 * 1024 * 1024),
115 }, {
116 .name = "free-area",
117 .offset = MTDPART_OFS_APPEND,
118 .size = MTDPART_SIZ_FULL,
119 },
120};
121
122static struct physmap_flash_data nor_flash_data = {
123 .width = 2,
124 .parts = nor_flash_partitions,
125 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
126};
127
128static struct resource nor_flash_resources[] = {
129 [0] = {
130 .name = "NOR Flash",
131 .start = 0x00000000,
132 .end = 0x01ffffff,
133 .flags = IORESOURCE_MEM,
134 }
135};
136
137static struct platform_device nor_flash_device = {
138 .name = "physmap-flash",
139 .resource = nor_flash_resources,
140 .num_resources = ARRAY_SIZE(nor_flash_resources),
141 .dev = {
142 .platform_data = &nor_flash_data,
143 },
144};
145
146/* LCDC */
147static struct sh_mobile_lcdc_info lcdc_info = {
148 .clock_source = LCDC_CLK_EXTERNAL,
149 .ch[0] = {
150 .chan = LCDC_CHAN_MAINLCD,
151 .bpp = 16,
152 .clock_divider = 1,
153 .lcd_cfg = {
154 .name = "LB070WV1",
155 .sync = 0, /* hsync and vsync are active low */
156 },
157 .lcd_size_cfg = { /* 7.0 inch */
158 .width = 152,
159 .height = 91,
160 },
161 .board_cfg = {
162 },
163 }
164};
165
166static struct resource lcdc_resources[] = {
167 [0] = {
168 .name = "LCDC",
169 .start = 0xfe940000,
Phil Edworthya6f15ad2009-09-15 12:00:30 +0000170 .end = 0xfe942fff,
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000171 .flags = IORESOURCE_MEM,
172 },
173 [1] = {
174 .start = 106,
175 .flags = IORESOURCE_IRQ,
176 },
177};
178
179static struct platform_device lcdc_device = {
180 .name = "sh_mobile_lcdc_fb",
181 .num_resources = ARRAY_SIZE(lcdc_resources),
182 .resource = lcdc_resources,
183 .dev = {
184 .platform_data = &lcdc_info,
185 },
Magnus Dammdf47cd02009-07-31 07:48:29 +0000186 .archdata = {
187 .hwblk_id = HWBLK_LCDC,
188 },
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000189};
190
191/* CEU0 */
192static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
193 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
194};
195
196static struct resource ceu0_resources[] = {
197 [0] = {
198 .name = "CEU0",
199 .start = 0xfe910000,
200 .end = 0xfe91009f,
201 .flags = IORESOURCE_MEM,
202 },
203 [1] = {
204 .start = 52,
205 .flags = IORESOURCE_IRQ,
206 },
207 [2] = {
208 /* place holder for contiguous memory */
209 },
210};
211
212static struct platform_device ceu0_device = {
213 .name = "sh_mobile_ceu",
214 .id = 0, /* "ceu0" clock */
215 .num_resources = ARRAY_SIZE(ceu0_resources),
216 .resource = ceu0_resources,
217 .dev = {
218 .platform_data = &sh_mobile_ceu0_info,
219 },
Magnus Dammdf47cd02009-07-31 07:48:29 +0000220 .archdata = {
221 .hwblk_id = HWBLK_CEU0,
222 },
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000223};
224
225/* CEU1 */
226static struct sh_mobile_ceu_info sh_mobile_ceu1_info = {
227 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
228};
229
230static struct resource ceu1_resources[] = {
231 [0] = {
232 .name = "CEU1",
233 .start = 0xfe914000,
234 .end = 0xfe91409f,
235 .flags = IORESOURCE_MEM,
236 },
237 [1] = {
238 .start = 63,
239 .flags = IORESOURCE_IRQ,
240 },
241 [2] = {
242 /* place holder for contiguous memory */
243 },
244};
245
246static struct platform_device ceu1_device = {
247 .name = "sh_mobile_ceu",
248 .id = 1, /* "ceu1" clock */
249 .num_resources = ARRAY_SIZE(ceu1_resources),
250 .resource = ceu1_resources,
251 .dev = {
252 .platform_data = &sh_mobile_ceu1_info,
253 },
Magnus Dammdf47cd02009-07-31 07:48:29 +0000254 .archdata = {
255 .hwblk_id = HWBLK_CEU1,
256 },
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000257};
258
Kuninori Morimoto3e9ad522009-08-21 01:24:54 +0000259/* FSI */
260/*
261 * FSI-A use external clock which came from ak464x.
262 * So, we should change parent of fsi
263 */
264#define FCLKACR 0xa4150008
265static void fsimck_init(struct clk *clk)
266{
267 u32 status = ctrl_inl(clk->enable_reg);
268
269 /* use external clock */
270 status &= ~0x000000ff;
271 status |= 0x00000080;
272 ctrl_outl(status, clk->enable_reg);
273}
274
275static struct clk_ops fsimck_clk_ops = {
276 .init = fsimck_init,
277};
278
279static struct clk fsimcka_clk = {
280 .name = "fsimcka_clk",
281 .id = -1,
282 .ops = &fsimck_clk_ops,
283 .enable_reg = (void __iomem *)FCLKACR,
284 .rate = 0, /* unknown */
285};
286
287struct sh_fsi_platform_info fsi_info = {
288 .porta_flags = SH_FSI_BRS_INV |
289 SH_FSI_OUT_SLAVE_MODE |
290 SH_FSI_IN_SLAVE_MODE |
291 SH_FSI_OFMT(PCM) |
292 SH_FSI_IFMT(PCM),
293};
294
295static struct resource fsi_resources[] = {
296 [0] = {
297 .name = "FSI",
298 .start = 0xFE3C0000,
299 .end = 0xFE3C021d,
300 .flags = IORESOURCE_MEM,
301 },
302 [1] = {
303 .start = 108,
304 .flags = IORESOURCE_IRQ,
305 },
306};
307
308static struct platform_device fsi_device = {
309 .name = "sh_fsi",
310 .id = 0,
311 .num_resources = ARRAY_SIZE(fsi_resources),
312 .resource = fsi_resources,
313 .dev = {
314 .platform_data = &fsi_info,
315 },
316};
317
Magnus Damm9747e782009-08-15 02:53:34 +0000318/* KEYSC in SoC (Needs SW33-2 set to ON) */
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000319static struct sh_keysc_info keysc_info = {
320 .mode = SH_KEYSC_MODE_1,
321 .scan_timing = 10,
322 .delay = 50,
323 .keycodes = {
324 KEY_1, KEY_2, KEY_3, KEY_4, KEY_5,
325 KEY_6, KEY_7, KEY_8, KEY_9, KEY_A,
326 KEY_B, KEY_C, KEY_D, KEY_E, KEY_F,
327 KEY_G, KEY_H, KEY_I, KEY_K, KEY_L,
328 KEY_M, KEY_N, KEY_O, KEY_P, KEY_Q,
329 KEY_R, KEY_S, KEY_T, KEY_U, KEY_V,
330 },
331};
332
333static struct resource keysc_resources[] = {
334 [0] = {
Magnus Damm9747e782009-08-15 02:53:34 +0000335 .name = "KEYSC",
336 .start = 0x044b0000,
337 .end = 0x044b000f,
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000338 .flags = IORESOURCE_MEM,
339 },
340 [1] = {
Magnus Damm9747e782009-08-15 02:53:34 +0000341 .start = 79,
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000342 .flags = IORESOURCE_IRQ,
343 },
344};
345
346static struct platform_device keysc_device = {
347 .name = "sh_keysc",
348 .id = 0, /* "keysc0" clock */
349 .num_resources = ARRAY_SIZE(keysc_resources),
350 .resource = keysc_resources,
351 .dev = {
352 .platform_data = &keysc_info,
353 },
Magnus Dammdf47cd02009-07-31 07:48:29 +0000354 .archdata = {
355 .hwblk_id = HWBLK_KEYSC,
356 },
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000357};
358
Kuninori Morimotoa80cad92009-06-26 07:05:39 +0000359/* SH Eth */
360static struct resource sh_eth_resources[] = {
361 [0] = {
362 .start = SH_ETH_ADDR,
363 .end = SH_ETH_ADDR + 0x1FC,
364 .flags = IORESOURCE_MEM,
365 },
366 [1] = {
367 .start = 91,
368 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
369 },
370};
371
372struct sh_eth_plat_data sh_eth_plat = {
373 .phy = 0x1f, /* SMSC LAN8187 */
374 .edmac_endian = EDMAC_LITTLE_ENDIAN,
375};
376
377static struct platform_device sh_eth_device = {
378 .name = "sh-eth",
379 .id = 0,
380 .dev = {
381 .platform_data = &sh_eth_plat,
382 },
383 .num_resources = ARRAY_SIZE(sh_eth_resources),
384 .resource = sh_eth_resources,
Magnus Dammdf47cd02009-07-31 07:48:29 +0000385 .archdata = {
386 .hwblk_id = HWBLK_ETHER,
387 },
Kuninori Morimotoa80cad92009-06-26 07:05:39 +0000388};
389
Magnus Damm9731f4a2009-07-03 09:40:03 +0000390static struct r8a66597_platdata sh7724_usb0_host_data = {
Magnus Damm719a72b2009-07-17 14:59:55 +0000391 .on_chip = 1,
Magnus Damm9731f4a2009-07-03 09:40:03 +0000392};
393
394static struct resource sh7724_usb0_host_resources[] = {
395 [0] = {
396 .start = 0xa4d80000,
Kuninori Morimoto1bc265d02009-08-19 00:12:15 +0000397 .end = 0xa4d80124 - 1,
Magnus Damm9731f4a2009-07-03 09:40:03 +0000398 .flags = IORESOURCE_MEM,
399 },
400 [1] = {
401 .start = 65,
402 .end = 65,
403 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
404 },
405};
406
407static struct platform_device sh7724_usb0_host_device = {
408 .name = "r8a66597_hcd",
409 .id = 0,
410 .dev = {
411 .dma_mask = NULL, /* not use dma */
412 .coherent_dma_mask = 0xffffffff,
413 .platform_data = &sh7724_usb0_host_data,
414 },
415 .num_resources = ARRAY_SIZE(sh7724_usb0_host_resources),
416 .resource = sh7724_usb0_host_resources,
Magnus Dammdf47cd02009-07-31 07:48:29 +0000417 .archdata = {
418 .hwblk_id = HWBLK_USB0,
419 },
Magnus Damm9731f4a2009-07-03 09:40:03 +0000420};
421
Magnus Dammf8f8c072009-08-19 09:52:02 +0000422static struct r8a66597_platdata sh7724_usb1_gadget_data = {
423 .on_chip = 1,
424};
425
426static struct resource sh7724_usb1_gadget_resources[] = {
427 [0] = {
428 .start = 0xa4d90000,
429 .end = 0xa4d90123,
430 .flags = IORESOURCE_MEM,
431 },
432 [1] = {
433 .start = 66,
434 .end = 66,
435 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
436 },
437};
438
439static struct platform_device sh7724_usb1_gadget_device = {
440 .name = "r8a66597_udc",
441 .id = 1, /* USB1 */
442 .dev = {
443 .dma_mask = NULL, /* not use dma */
444 .coherent_dma_mask = 0xffffffff,
445 .platform_data = &sh7724_usb1_gadget_data,
446 },
447 .num_resources = ARRAY_SIZE(sh7724_usb1_gadget_resources),
448 .resource = sh7724_usb1_gadget_resources,
449};
450
Magnus Damm0f79af62009-10-02 02:23:07 +0000451static struct resource sdhi0_cn7_resources[] = {
452 [0] = {
453 .name = "SDHI0",
454 .start = 0x04ce0000,
455 .end = 0x04ce01ff,
456 .flags = IORESOURCE_MEM,
457 },
458 [1] = {
459 .start = 101,
460 .flags = IORESOURCE_IRQ,
461 },
462};
463
464static struct platform_device sdhi0_cn7_device = {
465 .name = "sh_mobile_sdhi",
466 .num_resources = ARRAY_SIZE(sdhi0_cn7_resources),
467 .resource = sdhi0_cn7_resources,
468 .archdata = {
469 .hwblk_id = HWBLK_SDHI0,
470 },
471};
472
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000473static struct platform_device *ms7724se_devices[] __initdata = {
474 &heartbeat_device,
475 &smc91x_eth_device,
476 &lcdc_device,
477 &nor_flash_device,
478 &ceu0_device,
479 &ceu1_device,
480 &keysc_device,
Kuninori Morimotoa80cad92009-06-26 07:05:39 +0000481 &sh_eth_device,
Magnus Damm9731f4a2009-07-03 09:40:03 +0000482 &sh7724_usb0_host_device,
Magnus Dammf8f8c072009-08-19 09:52:02 +0000483 &sh7724_usb1_gadget_device,
Kuninori Morimoto3e9ad522009-08-21 01:24:54 +0000484 &fsi_device,
Magnus Damm0f79af62009-10-02 02:23:07 +0000485 &sdhi0_cn7_device,
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000486};
487
Kuninori Morimotoa80cad92009-06-26 07:05:39 +0000488#define EEPROM_OP 0xBA206000
489#define EEPROM_ADR 0xBA206004
490#define EEPROM_DATA 0xBA20600C
491#define EEPROM_STAT 0xBA206010
492#define EEPROM_STRT 0xBA206014
493static int __init sh_eth_is_eeprom_ready(void)
494{
495 int t = 10000;
496
497 while (t--) {
498 if (!ctrl_inw(EEPROM_STAT))
499 return 1;
500 cpu_relax();
501 }
502
503 printk(KERN_ERR "ms7724se can not access to eeprom\n");
504 return 0;
505}
506
507static void __init sh_eth_init(void)
508{
509 int i;
Magnus Damm8013cc92009-10-27 10:47:34 +0000510 u16 mac;
Kuninori Morimotoa80cad92009-06-26 07:05:39 +0000511
512 /* check EEPROM status */
513 if (!sh_eth_is_eeprom_ready())
514 return;
515
516 /* read MAC addr from EEPROM */
517 for (i = 0 ; i < 3 ; i++) {
518 ctrl_outw(0x0, EEPROM_OP); /* read */
519 ctrl_outw(i*2, EEPROM_ADR);
520 ctrl_outw(0x1, EEPROM_STRT);
521 if (!sh_eth_is_eeprom_ready())
522 return;
523
Magnus Damm8013cc92009-10-27 10:47:34 +0000524 mac = ctrl_inw(EEPROM_DATA);
525 sh_eth_plat.mac_addr[i << 1] = mac & 0xff;
526 sh_eth_plat.mac_addr[(i << 1) + 1] = mac >> 8;
Kuninori Morimotoa80cad92009-06-26 07:05:39 +0000527 }
Kuninori Morimotoa80cad92009-06-26 07:05:39 +0000528}
529
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000530#define SW4140 0xBA201000
531#define FPGA_OUT 0xBA200400
532#define PORT_HIZA 0xA4050158
Magnus Damm9731f4a2009-07-03 09:40:03 +0000533#define PORT_MSELCRB 0xA4050182
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000534
535#define SW41_A 0x0100
536#define SW41_B 0x0200
537#define SW41_C 0x0400
538#define SW41_D 0x0800
539#define SW41_E 0x1000
540#define SW41_F 0x2000
541#define SW41_G 0x4000
542#define SW41_H 0x8000
Magnus Damm9731f4a2009-07-03 09:40:03 +0000543
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000544static int __init devices_setup(void)
545{
546 u16 sw = ctrl_inw(SW4140); /* select camera, monitor */
Kuninori Morimoto3e9ad522009-08-21 01:24:54 +0000547 struct clk *fsia_clk;
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000548
549 /* Reset Release */
550 ctrl_outw(ctrl_inw(FPGA_OUT) &
551 ~((1 << 1) | /* LAN */
552 (1 << 6) | /* VIDEO DAC */
Kuninori Morimoto3e9ad522009-08-21 01:24:54 +0000553 (1 << 7) | /* AK4643 */
Kuninori Morimotoa80cad92009-06-26 07:05:39 +0000554 (1 << 12) | /* USB0 */
555 (1 << 14)), /* RMII */
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000556 FPGA_OUT);
557
Magnus Damm9731f4a2009-07-03 09:40:03 +0000558 /* turn on USB clocks, use external clock */
559 ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
560
Magnus Damm7766e162009-08-06 15:03:43 +0000561#ifdef CONFIG_PM
562 /* Let LED9 show STATUS2 */
563 gpio_request(GPIO_FN_STATUS2, NULL);
564
565 /* Lit LED10 show STATUS0 */
566 gpio_request(GPIO_FN_STATUS0, NULL);
567
568 /* Lit LED11 show PDSTATUS */
569 gpio_request(GPIO_FN_PDSTATUS, NULL);
570#else
571 /* Lit LED9 */
572 gpio_request(GPIO_PTJ6, NULL);
573 gpio_direction_output(GPIO_PTJ6, 1);
574 gpio_export(GPIO_PTJ6, 0);
575
576 /* Lit LED10 */
577 gpio_request(GPIO_PTJ5, NULL);
578 gpio_direction_output(GPIO_PTJ5, 1);
579 gpio_export(GPIO_PTJ5, 0);
580
581 /* Lit LED11 */
582 gpio_request(GPIO_PTJ7, NULL);
583 gpio_direction_output(GPIO_PTJ7, 1);
584 gpio_export(GPIO_PTJ7, 0);
585#endif
586
Magnus Damm9731f4a2009-07-03 09:40:03 +0000587 /* enable USB0 port */
588 ctrl_outw(0x0600, 0xa40501d4);
589
Magnus Dammf8f8c072009-08-19 09:52:02 +0000590 /* enable USB1 port */
591 ctrl_outw(0x0600, 0xa4050192);
592
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000593 /* enable IRQ 0,1,2 */
594 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
595 gpio_request(GPIO_FN_INTC_IRQ1, NULL);
596 gpio_request(GPIO_FN_INTC_IRQ2, NULL);
597
598 /* enable SCIFA3 */
599 gpio_request(GPIO_FN_SCIF3_I_SCK, NULL);
600 gpio_request(GPIO_FN_SCIF3_I_RXD, NULL);
601 gpio_request(GPIO_FN_SCIF3_I_TXD, NULL);
602 gpio_request(GPIO_FN_SCIF3_I_CTS, NULL);
603 gpio_request(GPIO_FN_SCIF3_I_RTS, NULL);
604
605 /* enable LCDC */
606 gpio_request(GPIO_FN_LCDD23, NULL);
607 gpio_request(GPIO_FN_LCDD22, NULL);
608 gpio_request(GPIO_FN_LCDD21, NULL);
609 gpio_request(GPIO_FN_LCDD20, NULL);
610 gpio_request(GPIO_FN_LCDD19, NULL);
611 gpio_request(GPIO_FN_LCDD18, NULL);
612 gpio_request(GPIO_FN_LCDD17, NULL);
613 gpio_request(GPIO_FN_LCDD16, NULL);
614 gpio_request(GPIO_FN_LCDD15, NULL);
615 gpio_request(GPIO_FN_LCDD14, NULL);
616 gpio_request(GPIO_FN_LCDD13, NULL);
617 gpio_request(GPIO_FN_LCDD12, NULL);
618 gpio_request(GPIO_FN_LCDD11, NULL);
619 gpio_request(GPIO_FN_LCDD10, NULL);
620 gpio_request(GPIO_FN_LCDD9, NULL);
621 gpio_request(GPIO_FN_LCDD8, NULL);
622 gpio_request(GPIO_FN_LCDD7, NULL);
623 gpio_request(GPIO_FN_LCDD6, NULL);
624 gpio_request(GPIO_FN_LCDD5, NULL);
625 gpio_request(GPIO_FN_LCDD4, NULL);
626 gpio_request(GPIO_FN_LCDD3, NULL);
627 gpio_request(GPIO_FN_LCDD2, NULL);
628 gpio_request(GPIO_FN_LCDD1, NULL);
629 gpio_request(GPIO_FN_LCDD0, NULL);
630 gpio_request(GPIO_FN_LCDDISP, NULL);
631 gpio_request(GPIO_FN_LCDHSYN, NULL);
632 gpio_request(GPIO_FN_LCDDCK, NULL);
633 gpio_request(GPIO_FN_LCDVSYN, NULL);
634 gpio_request(GPIO_FN_LCDDON, NULL);
635 gpio_request(GPIO_FN_LCDVEPWC, NULL);
636 gpio_request(GPIO_FN_LCDVCPWC, NULL);
637 gpio_request(GPIO_FN_LCDRD, NULL);
638 gpio_request(GPIO_FN_LCDLCLK, NULL);
639 ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
640
641 /* enable CEU0 */
642 gpio_request(GPIO_FN_VIO0_D15, NULL);
643 gpio_request(GPIO_FN_VIO0_D14, NULL);
644 gpio_request(GPIO_FN_VIO0_D13, NULL);
645 gpio_request(GPIO_FN_VIO0_D12, NULL);
646 gpio_request(GPIO_FN_VIO0_D11, NULL);
647 gpio_request(GPIO_FN_VIO0_D10, NULL);
648 gpio_request(GPIO_FN_VIO0_D9, NULL);
649 gpio_request(GPIO_FN_VIO0_D8, NULL);
650 gpio_request(GPIO_FN_VIO0_D7, NULL);
651 gpio_request(GPIO_FN_VIO0_D6, NULL);
652 gpio_request(GPIO_FN_VIO0_D5, NULL);
653 gpio_request(GPIO_FN_VIO0_D4, NULL);
654 gpio_request(GPIO_FN_VIO0_D3, NULL);
655 gpio_request(GPIO_FN_VIO0_D2, NULL);
656 gpio_request(GPIO_FN_VIO0_D1, NULL);
657 gpio_request(GPIO_FN_VIO0_D0, NULL);
658 gpio_request(GPIO_FN_VIO0_VD, NULL);
659 gpio_request(GPIO_FN_VIO0_CLK, NULL);
660 gpio_request(GPIO_FN_VIO0_FLD, NULL);
661 gpio_request(GPIO_FN_VIO0_HD, NULL);
Magnus Damm84f75972009-07-01 04:55:35 +0000662 platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20);
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000663
664 /* enable CEU1 */
665 gpio_request(GPIO_FN_VIO1_D7, NULL);
666 gpio_request(GPIO_FN_VIO1_D6, NULL);
667 gpio_request(GPIO_FN_VIO1_D5, NULL);
668 gpio_request(GPIO_FN_VIO1_D4, NULL);
669 gpio_request(GPIO_FN_VIO1_D3, NULL);
670 gpio_request(GPIO_FN_VIO1_D2, NULL);
671 gpio_request(GPIO_FN_VIO1_D1, NULL);
672 gpio_request(GPIO_FN_VIO1_D0, NULL);
673 gpio_request(GPIO_FN_VIO1_FLD, NULL);
674 gpio_request(GPIO_FN_VIO1_HD, NULL);
675 gpio_request(GPIO_FN_VIO1_VD, NULL);
676 gpio_request(GPIO_FN_VIO1_CLK, NULL);
Magnus Damm84f75972009-07-01 04:55:35 +0000677 platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20);
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000678
679 /* KEYSC */
680 gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
681 gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
682 gpio_request(GPIO_FN_KEYIN4, NULL);
683 gpio_request(GPIO_FN_KEYIN3, NULL);
684 gpio_request(GPIO_FN_KEYIN2, NULL);
685 gpio_request(GPIO_FN_KEYIN1, NULL);
686 gpio_request(GPIO_FN_KEYIN0, NULL);
687 gpio_request(GPIO_FN_KEYOUT3, NULL);
688 gpio_request(GPIO_FN_KEYOUT2, NULL);
689 gpio_request(GPIO_FN_KEYOUT1, NULL);
690 gpio_request(GPIO_FN_KEYOUT0, NULL);
691
Kuninori Morimoto3e9ad522009-08-21 01:24:54 +0000692 /* enable FSI */
693 gpio_request(GPIO_FN_FSIMCKB, NULL);
694 gpio_request(GPIO_FN_FSIMCKA, NULL);
695 gpio_request(GPIO_FN_FSIOASD, NULL);
696 gpio_request(GPIO_FN_FSIIABCK, NULL);
697 gpio_request(GPIO_FN_FSIIALRCK, NULL);
698 gpio_request(GPIO_FN_FSIOABCK, NULL);
699 gpio_request(GPIO_FN_FSIOALRCK, NULL);
700 gpio_request(GPIO_FN_CLKAUDIOAO, NULL);
701 gpio_request(GPIO_FN_FSIIBSD, NULL);
702 gpio_request(GPIO_FN_FSIOBSD, NULL);
703 gpio_request(GPIO_FN_FSIIBBCK, NULL);
704 gpio_request(GPIO_FN_FSIIBLRCK, NULL);
705 gpio_request(GPIO_FN_FSIOBBCK, NULL);
706 gpio_request(GPIO_FN_FSIOBLRCK, NULL);
707 gpio_request(GPIO_FN_CLKAUDIOBO, NULL);
708 gpio_request(GPIO_FN_FSIIASD, NULL);
709
710 /* change parent of FSI A */
711 fsia_clk = clk_get(NULL, "fsia_clk");
712 clk_register(&fsimcka_clk);
713 clk_set_parent(fsia_clk, &fsimcka_clk);
714 clk_set_rate(fsia_clk, 11000);
715 clk_set_rate(&fsimcka_clk, 11000);
716 clk_put(fsia_clk);
717
Magnus Damm0f79af62009-10-02 02:23:07 +0000718 /* SDHI0 connected to cn7 */
719 gpio_request(GPIO_FN_SDHI0CD, NULL);
720 gpio_request(GPIO_FN_SDHI0WP, NULL);
721 gpio_request(GPIO_FN_SDHI0D3, NULL);
722 gpio_request(GPIO_FN_SDHI0D2, NULL);
723 gpio_request(GPIO_FN_SDHI0D1, NULL);
724 gpio_request(GPIO_FN_SDHI0D0, NULL);
725 gpio_request(GPIO_FN_SDHI0CMD, NULL);
726 gpio_request(GPIO_FN_SDHI0CLK, NULL);
727
Kuninori Morimotoa80cad92009-06-26 07:05:39 +0000728 /*
729 * enable SH-Eth
730 *
731 * please remove J33 pin from your board !!
732 *
733 * ms7724 board should not use GPIO_FN_LNKSTA pin
734 * So, This time PTX5 is set to input pin
735 */
736 gpio_request(GPIO_FN_RMII_RXD0, NULL);
737 gpio_request(GPIO_FN_RMII_RXD1, NULL);
738 gpio_request(GPIO_FN_RMII_TXD0, NULL);
739 gpio_request(GPIO_FN_RMII_TXD1, NULL);
740 gpio_request(GPIO_FN_RMII_REF_CLK, NULL);
741 gpio_request(GPIO_FN_RMII_TX_EN, NULL);
742 gpio_request(GPIO_FN_RMII_RX_ER, NULL);
743 gpio_request(GPIO_FN_RMII_CRS_DV, NULL);
744 gpio_request(GPIO_FN_MDIO, NULL);
745 gpio_request(GPIO_FN_MDC, NULL);
746 gpio_request(GPIO_PTX5, NULL);
747 gpio_direction_input(GPIO_PTX5);
748 sh_eth_init();
749
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000750 if (sw & SW41_B) {
Kuninori Morimoto4f324312009-08-03 04:52:03 +0000751 /* 720p */
752 lcdc_info.ch[0].lcd_cfg.xres = 1280;
753 lcdc_info.ch[0].lcd_cfg.yres = 720;
754 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
755 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
756 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
757 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
758 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
759 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000760 } else {
761 /* VGA */
762 lcdc_info.ch[0].lcd_cfg.xres = 640;
763 lcdc_info.ch[0].lcd_cfg.yres = 480;
764 lcdc_info.ch[0].lcd_cfg.left_margin = 105;
765 lcdc_info.ch[0].lcd_cfg.right_margin = 50;
766 lcdc_info.ch[0].lcd_cfg.hsync_len = 96;
767 lcdc_info.ch[0].lcd_cfg.upper_margin = 33;
768 lcdc_info.ch[0].lcd_cfg.lower_margin = 10;
769 lcdc_info.ch[0].lcd_cfg.vsync_len = 2;
770 }
771
772 if (sw & SW41_A) {
773 /* Digital monitor */
774 lcdc_info.ch[0].interface_type = RGB18;
775 lcdc_info.ch[0].flags = 0;
776 } else {
777 /* Analog monitor */
778 lcdc_info.ch[0].interface_type = RGB24;
779 lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
780 }
781
782 return platform_add_devices(ms7724se_devices,
Kuninori Morimotoa80cad92009-06-26 07:05:39 +0000783 ARRAY_SIZE(ms7724se_devices));
Kuninori Morimoto287c1292009-05-26 07:04:52 +0000784}
785device_initcall(devices_setup);
786
787static struct sh_machine_vector mv_ms7724se __initmv = {
788 .mv_name = "ms7724se",
789 .mv_init_irq = init_se7724_IRQ,
790 .mv_nr_irqs = SE7724_FPGA_IRQ_BASE + SE7724_FPGA_IRQ_NR,
791};