blob: 0fb665d28603ddc7efffd3acc79a9db461eb518e [file] [log] [blame]
Kuninori Morimoto4138b742009-08-19 12:08:33 +00001/*
2 * Copyright (C) 2009 Renesas Solutions Corp.
3 *
4 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/init.h>
12#include <linux/device.h>
13#include <linux/platform_device.h>
14#include <linux/mtd/physmap.h>
15#include <linux/gpio.h>
16#include <linux/interrupt.h>
Kuninori Morimoto35a35402009-08-26 11:04:26 +000017#include <linux/io.h>
18#include <linux/delay.h>
Kuninori Morimoto907050a2009-08-26 11:04:31 +000019#include <linux/usb/r8a66597.h>
Kuninori Morimoto4907d572009-09-10 01:39:58 +000020#include <linux/i2c.h>
Kuninori Morimoto8810e052009-09-28 08:21:41 +000021#include <linux/i2c/tsc2007.h>
Kuninori Morimotoe9103e72009-09-14 11:23:00 +000022#include <linux/input.h>
Kuninori Morimotofa3ba512009-08-26 11:04:34 +000023#include <video/sh_mobile_lcdc.h>
Kuninori Morimoto2153ad32009-08-26 11:04:36 +000024#include <media/sh_mobile_ceu.h>
Kuninori Morimoto4138b742009-08-19 12:08:33 +000025#include <asm/heartbeat.h>
Kuninori Morimoto35a35402009-08-26 11:04:26 +000026#include <asm/sh_eth.h>
Kuninori Morimotoe9103e72009-09-14 11:23:00 +000027#include <asm/sh_keysc.h>
Kuninori Morimotoa9918012009-09-14 11:23:16 +000028#include <asm/clock.h>
Kuninori Morimoto4138b742009-08-19 12:08:33 +000029#include <cpu/sh7724.h>
30
31/*
Kuninori Morimotob7056bc2009-08-26 11:04:22 +000032 * Address Interface BusWidth
33 *-----------------------------------------
34 * 0x0000_0000 uboot 16bit
35 * 0x0004_0000 Linux romImage 16bit
36 * 0x0014_0000 MTD for Linux 16bit
37 * 0x0400_0000 Internal I/O 16/32bit
38 * 0x0800_0000 DRAM 32bit
39 * 0x1800_0000 MFI 16bit
Kuninori Morimoto4138b742009-08-19 12:08:33 +000040 */
41
42/* Heartbeat */
43static unsigned char led_pos[] = { 0, 1, 2, 3 };
44static struct heartbeat_data heartbeat_data = {
45 .regsize = 8,
46 .nr_bits = 4,
47 .bit_pos = led_pos,
48};
49
50static struct resource heartbeat_resources[] = {
51 [0] = {
52 .start = 0xA405012C, /* PTG */
53 .end = 0xA405012E - 1,
54 .flags = IORESOURCE_MEM,
55 },
56};
57
58static struct platform_device heartbeat_device = {
59 .name = "heartbeat",
60 .id = -1,
61 .dev = {
62 .platform_data = &heartbeat_data,
63 },
64 .num_resources = ARRAY_SIZE(heartbeat_resources),
65 .resource = heartbeat_resources,
66};
67
68/* MTD */
69static struct mtd_partition nor_flash_partitions[] = {
70 {
Kuninori Morimotob7056bc2009-08-26 11:04:22 +000071 .name = "boot loader",
Kuninori Morimoto4138b742009-08-19 12:08:33 +000072 .offset = 0,
Kuninori Morimotob7056bc2009-08-26 11:04:22 +000073 .size = (5 * 1024 * 1024),
Kuninori Morimotod5ce0102009-09-30 00:50:30 +000074 .mask_flags = MTD_WRITEABLE, /* force read-only */
Kuninori Morimoto4138b742009-08-19 12:08:33 +000075 }, {
Kuninori Morimoto4138b742009-08-19 12:08:33 +000076 .name = "free-area",
77 .offset = MTDPART_OFS_APPEND,
78 .size = MTDPART_SIZ_FULL,
79 },
80};
81
82static struct physmap_flash_data nor_flash_data = {
83 .width = 2,
84 .parts = nor_flash_partitions,
85 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
86};
87
88static struct resource nor_flash_resources[] = {
89 [0] = {
90 .name = "NOR Flash",
91 .start = 0x00000000,
92 .end = 0x03ffffff,
93 .flags = IORESOURCE_MEM,
94 }
95};
96
97static struct platform_device nor_flash_device = {
98 .name = "physmap-flash",
99 .resource = nor_flash_resources,
100 .num_resources = ARRAY_SIZE(nor_flash_resources),
101 .dev = {
102 .platform_data = &nor_flash_data,
103 },
104};
105
Kuninori Morimoto35a35402009-08-26 11:04:26 +0000106/* SH Eth */
107#define SH_ETH_ADDR (0xA4600000)
108#define SH_ETH_MAHR (SH_ETH_ADDR + 0x1C0)
109#define SH_ETH_MALR (SH_ETH_ADDR + 0x1C8)
110static struct resource sh_eth_resources[] = {
111 [0] = {
112 .start = SH_ETH_ADDR,
113 .end = SH_ETH_ADDR + 0x1FC,
114 .flags = IORESOURCE_MEM,
115 },
116 [1] = {
117 .start = 91,
118 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
119 },
120};
121
122struct sh_eth_plat_data sh_eth_plat = {
123 .phy = 0x1f, /* SMSC LAN8700 */
124 .edmac_endian = EDMAC_LITTLE_ENDIAN,
Kuninori Morimotoacf3cc22009-09-24 06:28:27 +0000125 .ether_link_active_low = 1
Kuninori Morimoto35a35402009-08-26 11:04:26 +0000126};
127
128static struct platform_device sh_eth_device = {
129 .name = "sh-eth",
130 .id = 0,
131 .dev = {
132 .platform_data = &sh_eth_plat,
133 },
134 .num_resources = ARRAY_SIZE(sh_eth_resources),
135 .resource = sh_eth_resources,
136};
137
Kuninori Morimoto907050a2009-08-26 11:04:31 +0000138/* USB0 host */
139void usb0_port_power(int port, int power)
140{
141 gpio_set_value(GPIO_PTB4, power);
142}
143
144static struct r8a66597_platdata usb0_host_data = {
145 .on_chip = 1,
146 .port_power = usb0_port_power,
147};
148
149static struct resource usb0_host_resources[] = {
150 [0] = {
151 .start = 0xa4d80000,
152 .end = 0xa4d80124 - 1,
153 .flags = IORESOURCE_MEM,
154 },
155 [1] = {
156 .start = 65,
157 .end = 65,
158 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
159 },
160};
161
162static struct platform_device usb0_host_device = {
163 .name = "r8a66597_hcd",
164 .id = 0,
165 .dev = {
166 .dma_mask = NULL, /* not use dma */
167 .coherent_dma_mask = 0xffffffff,
168 .platform_data = &usb0_host_data,
169 },
170 .num_resources = ARRAY_SIZE(usb0_host_resources),
171 .resource = usb0_host_resources,
172};
173
174/*
175 * USB1
176 *
177 * CN5 can use both host/function,
178 * and we can determine it by checking PTB[3]
179 *
180 * This time only USB1 host is supported.
181 */
182void usb1_port_power(int port, int power)
183{
184 if (!gpio_get_value(GPIO_PTB3)) {
185 printk(KERN_ERR "USB1 function is not supported\n");
186 return;
187 }
188
189 gpio_set_value(GPIO_PTB5, power);
190}
191
192static struct r8a66597_platdata usb1_host_data = {
193 .on_chip = 1,
194 .port_power = usb1_port_power,
195};
196
197static struct resource usb1_host_resources[] = {
198 [0] = {
199 .start = 0xa4d90000,
200 .end = 0xa4d90124 - 1,
201 .flags = IORESOURCE_MEM,
202 },
203 [1] = {
204 .start = 66,
205 .end = 66,
206 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
207 },
208};
209
210static struct platform_device usb1_host_device = {
211 .name = "r8a66597_hcd",
212 .id = 1,
213 .dev = {
214 .dma_mask = NULL, /* not use dma */
215 .coherent_dma_mask = 0xffffffff,
216 .platform_data = &usb1_host_data,
217 },
218 .num_resources = ARRAY_SIZE(usb1_host_resources),
219 .resource = usb1_host_resources,
220};
221
Kuninori Morimotofa3ba512009-08-26 11:04:34 +0000222/* LCDC */
223static struct sh_mobile_lcdc_info lcdc_info = {
224 .ch[0] = {
225 .interface_type = RGB18,
226 .chan = LCDC_CHAN_MAINLCD,
227 .bpp = 16,
Kuninori Morimotofa3ba512009-08-26 11:04:34 +0000228 .lcd_cfg = {
229 .sync = 0, /* hsync and vsync are active low */
230 },
231 .lcd_size_cfg = { /* 7.0 inch */
232 .width = 152,
233 .height = 91,
234 },
235 .board_cfg = {
236 },
237 }
238};
239
240static struct resource lcdc_resources[] = {
241 [0] = {
242 .name = "LCDC",
243 .start = 0xfe940000,
Phil Edworthya6f15ad2009-09-15 12:00:30 +0000244 .end = 0xfe942fff,
Kuninori Morimotofa3ba512009-08-26 11:04:34 +0000245 .flags = IORESOURCE_MEM,
246 },
247 [1] = {
248 .start = 106,
249 .flags = IORESOURCE_IRQ,
250 },
251};
252
253static struct platform_device lcdc_device = {
254 .name = "sh_mobile_lcdc_fb",
255 .num_resources = ARRAY_SIZE(lcdc_resources),
256 .resource = lcdc_resources,
257 .dev = {
258 .platform_data = &lcdc_info,
259 },
260 .archdata = {
261 .hwblk_id = HWBLK_LCDC,
262 },
263};
264
Kuninori Morimoto2153ad32009-08-26 11:04:36 +0000265/* CEU0 */
266static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
267 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
268};
269
270static struct resource ceu0_resources[] = {
271 [0] = {
272 .name = "CEU0",
273 .start = 0xfe910000,
274 .end = 0xfe91009f,
275 .flags = IORESOURCE_MEM,
276 },
277 [1] = {
278 .start = 52,
279 .flags = IORESOURCE_IRQ,
280 },
281 [2] = {
282 /* place holder for contiguous memory */
283 },
284};
285
286static struct platform_device ceu0_device = {
287 .name = "sh_mobile_ceu",
288 .id = 0, /* "ceu0" clock */
289 .num_resources = ARRAY_SIZE(ceu0_resources),
290 .resource = ceu0_resources,
291 .dev = {
292 .platform_data = &sh_mobile_ceu0_info,
293 },
294 .archdata = {
295 .hwblk_id = HWBLK_CEU0,
296 },
297};
298
299/* CEU1 */
300static struct sh_mobile_ceu_info sh_mobile_ceu1_info = {
301 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
302};
303
304static struct resource ceu1_resources[] = {
305 [0] = {
306 .name = "CEU1",
307 .start = 0xfe914000,
308 .end = 0xfe91409f,
309 .flags = IORESOURCE_MEM,
310 },
311 [1] = {
312 .start = 63,
313 .flags = IORESOURCE_IRQ,
314 },
315 [2] = {
316 /* place holder for contiguous memory */
317 },
318};
319
320static struct platform_device ceu1_device = {
321 .name = "sh_mobile_ceu",
322 .id = 1, /* "ceu1" clock */
323 .num_resources = ARRAY_SIZE(ceu1_resources),
324 .resource = ceu1_resources,
325 .dev = {
326 .platform_data = &sh_mobile_ceu1_info,
327 },
328 .archdata = {
329 .hwblk_id = HWBLK_CEU1,
330 },
331};
332
Kuninori Morimoto125ecce2009-09-10 01:39:37 +0000333/* I2C device */
334static struct i2c_board_info i2c1_devices[] = {
335 {
336 I2C_BOARD_INFO("r2025sd", 0x32),
337 },
338};
339
Kuninori Morimotoe9103e72009-09-14 11:23:00 +0000340/* KEYSC */
341static struct sh_keysc_info keysc_info = {
342 .mode = SH_KEYSC_MODE_1,
343 .scan_timing = 3,
344 .delay = 50,
345 .kycr2_delay = 100,
346 .keycodes = { KEY_1, 0, 0, 0, 0,
347 KEY_2, 0, 0, 0, 0,
348 KEY_3, 0, 0, 0, 0,
349 KEY_4, 0, 0, 0, 0,
350 KEY_5, 0, 0, 0, 0,
351 KEY_6, 0, 0, 0, 0, },
352};
353
354static struct resource keysc_resources[] = {
355 [0] = {
356 .name = "KEYSC",
357 .start = 0x044b0000,
358 .end = 0x044b000f,
359 .flags = IORESOURCE_MEM,
360 },
361 [1] = {
362 .start = 79,
363 .flags = IORESOURCE_IRQ,
364 },
365};
366
367static struct platform_device keysc_device = {
368 .name = "sh_keysc",
369 .id = 0, /* keysc0 clock */
370 .num_resources = ARRAY_SIZE(keysc_resources),
371 .resource = keysc_resources,
372 .dev = {
373 .platform_data = &keysc_info,
374 },
375 .archdata = {
376 .hwblk_id = HWBLK_KEYSC,
377 },
378};
379
Kuninori Morimoto8810e052009-09-28 08:21:41 +0000380/* TouchScreen */
381#define IRQ0 32
382static int ts_get_pendown_state(void)
383{
384 int val = 0;
385 gpio_free(GPIO_FN_INTC_IRQ0);
386 gpio_request(GPIO_PTZ0, NULL);
387 gpio_direction_input(GPIO_PTZ0);
388
389 val = gpio_get_value(GPIO_PTZ0);
390
391 gpio_free(GPIO_PTZ0);
392 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
393
394 return val ? 0 : 1;
395}
396
397static int ts_init(void)
398{
399 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
400 return 0;
401}
402
403struct tsc2007_platform_data tsc2007_info = {
404 .model = 2007,
405 .x_plate_ohms = 180,
406 .get_pendown_state = ts_get_pendown_state,
407 .init_platform_hw = ts_init,
408};
409
410static struct i2c_board_info ts_i2c_clients = {
411 I2C_BOARD_INFO("tsc2007", 0x48),
412 .type = "tsc2007",
413 .platform_data = &tsc2007_info,
414 .irq = IRQ0,
415};
416
Kuninori Morimoto4138b742009-08-19 12:08:33 +0000417static struct platform_device *ecovec_devices[] __initdata = {
418 &heartbeat_device,
419 &nor_flash_device,
Kuninori Morimoto35a35402009-08-26 11:04:26 +0000420 &sh_eth_device,
Kuninori Morimoto907050a2009-08-26 11:04:31 +0000421 &usb0_host_device,
422 &usb1_host_device, /* USB1 host support */
Kuninori Morimotofa3ba512009-08-26 11:04:34 +0000423 &lcdc_device,
Kuninori Morimoto2153ad32009-08-26 11:04:36 +0000424 &ceu0_device,
425 &ceu1_device,
Kuninori Morimotoe9103e72009-09-14 11:23:00 +0000426 &keysc_device,
Kuninori Morimoto4138b742009-08-19 12:08:33 +0000427};
428
Kuninori Morimoto4907d572009-09-10 01:39:58 +0000429#define EEPROM_ADDR 0x50
430static u8 mac_read(struct i2c_adapter *a, u8 command)
431{
432 struct i2c_msg msg[2];
433 u8 buf;
434 int ret;
435
436 msg[0].addr = EEPROM_ADDR;
437 msg[0].flags = 0;
438 msg[0].len = 1;
439 msg[0].buf = &command;
440
441 msg[1].addr = EEPROM_ADDR;
442 msg[1].flags = I2C_M_RD;
443 msg[1].len = 1;
444 msg[1].buf = &buf;
445
446 ret = i2c_transfer(a, msg, 2);
447 if (ret < 0) {
448 printk(KERN_ERR "error %d\n", ret);
449 buf = 0xff;
450 }
451
452 return buf;
453}
454
455#define MAC_LEN 6
456static void __init sh_eth_init(void)
457{
458 struct i2c_adapter *a = i2c_get_adapter(1);
459 struct clk *eth_clk;
460 u8 mac[MAC_LEN];
461 int i;
462
463 if (!a) {
464 pr_err("can not get I2C 1\n");
465 return;
466 }
467
468 eth_clk = clk_get(NULL, "eth0");
469 if (!eth_clk) {
470 pr_err("can not get eth0 clk\n");
471 return;
472 }
473
474 /* read MAC address frome EEPROM */
475 for (i = 0; i < MAC_LEN; i++) {
476 mac[i] = mac_read(a, 0x10 + i);
477 msleep(10);
478 }
479
480 /* clock enable */
481 clk_enable(eth_clk);
482
483 /* reset sh-eth */
484 ctrl_outl(0x1, SH_ETH_ADDR + 0x0);
485
486 /* set MAC addr */
487 ctrl_outl((mac[0] << 24) |
488 (mac[1] << 16) |
489 (mac[2] << 8) |
490 (mac[3] << 0), SH_ETH_MAHR);
491 ctrl_outl((mac[4] << 8) |
492 (mac[5] << 0), SH_ETH_MALR);
493
494 clk_put(eth_clk);
495}
496
Kuninori Morimotofa3ba512009-08-26 11:04:34 +0000497#define PORT_HIZA 0xA4050158
Kuninori Morimotoea15edb2009-08-26 11:04:39 +0000498#define IODRIVEA 0xA405018A
Kuninori Morimoto4907d572009-09-10 01:39:58 +0000499static int __init arch_setup(void)
Kuninori Morimoto4138b742009-08-19 12:08:33 +0000500{
501 /* enable SCIFA0 */
502 gpio_request(GPIO_FN_SCIF0_TXD, NULL);
503 gpio_request(GPIO_FN_SCIF0_RXD, NULL);
Kuninori Morimoto4138b742009-08-19 12:08:33 +0000504
505 /* enable debug LED */
506 gpio_request(GPIO_PTG0, NULL);
507 gpio_request(GPIO_PTG1, NULL);
508 gpio_request(GPIO_PTG2, NULL);
509 gpio_request(GPIO_PTG3, NULL);
Kuninori Morimotob7056bc2009-08-26 11:04:22 +0000510 gpio_direction_output(GPIO_PTG0, 0);
511 gpio_direction_output(GPIO_PTG1, 0);
512 gpio_direction_output(GPIO_PTG2, 0);
513 gpio_direction_output(GPIO_PTG3, 0);
Kuninori Morimoto643e9d12009-09-10 01:40:00 +0000514 ctrl_outw((ctrl_inw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA);
Kuninori Morimoto4138b742009-08-19 12:08:33 +0000515
Kuninori Morimoto35a35402009-08-26 11:04:26 +0000516 /* enable SH-Eth */
517 gpio_request(GPIO_PTA1, NULL);
518 gpio_direction_output(GPIO_PTA1, 1);
519 mdelay(20);
520
521 gpio_request(GPIO_FN_RMII_RXD0, NULL);
522 gpio_request(GPIO_FN_RMII_RXD1, NULL);
523 gpio_request(GPIO_FN_RMII_TXD0, NULL);
524 gpio_request(GPIO_FN_RMII_TXD1, NULL);
525 gpio_request(GPIO_FN_RMII_REF_CLK, NULL);
526 gpio_request(GPIO_FN_RMII_TX_EN, NULL);
527 gpio_request(GPIO_FN_RMII_RX_ER, NULL);
528 gpio_request(GPIO_FN_RMII_CRS_DV, NULL);
529 gpio_request(GPIO_FN_MDIO, NULL);
530 gpio_request(GPIO_FN_MDC, NULL);
531 gpio_request(GPIO_FN_LNKSTA, NULL);
532
Kuninori Morimoto907050a2009-08-26 11:04:31 +0000533 /* enable USB */
Kuninori Morimotobe4ebf92009-09-10 01:39:55 +0000534 ctrl_outw(0x0000, 0xA4D80000);
Kuninori Morimoto147df2d2009-09-14 11:22:31 +0000535 ctrl_outw(0x0000, 0xA4D90000);
Kuninori Morimoto907050a2009-08-26 11:04:31 +0000536 gpio_request(GPIO_PTB3, NULL);
537 gpio_request(GPIO_PTB4, NULL);
538 gpio_request(GPIO_PTB5, NULL);
539 gpio_direction_input(GPIO_PTB3);
540 gpio_direction_output(GPIO_PTB4, 0);
541 gpio_direction_output(GPIO_PTB5, 0);
542 ctrl_outw(0x0600, 0xa40501d4);
543 ctrl_outw(0x0600, 0xa4050192);
544
Kuninori Morimotofa3ba512009-08-26 11:04:34 +0000545 /* enable LCDC */
546 gpio_request(GPIO_FN_LCDD23, NULL);
547 gpio_request(GPIO_FN_LCDD22, NULL);
548 gpio_request(GPIO_FN_LCDD21, NULL);
549 gpio_request(GPIO_FN_LCDD20, NULL);
550 gpio_request(GPIO_FN_LCDD19, NULL);
551 gpio_request(GPIO_FN_LCDD18, NULL);
552 gpio_request(GPIO_FN_LCDD17, NULL);
553 gpio_request(GPIO_FN_LCDD16, NULL);
554 gpio_request(GPIO_FN_LCDD15, NULL);
555 gpio_request(GPIO_FN_LCDD14, NULL);
556 gpio_request(GPIO_FN_LCDD13, NULL);
557 gpio_request(GPIO_FN_LCDD12, NULL);
558 gpio_request(GPIO_FN_LCDD11, NULL);
559 gpio_request(GPIO_FN_LCDD10, NULL);
560 gpio_request(GPIO_FN_LCDD9, NULL);
561 gpio_request(GPIO_FN_LCDD8, NULL);
562 gpio_request(GPIO_FN_LCDD7, NULL);
563 gpio_request(GPIO_FN_LCDD6, NULL);
564 gpio_request(GPIO_FN_LCDD5, NULL);
565 gpio_request(GPIO_FN_LCDD4, NULL);
566 gpio_request(GPIO_FN_LCDD3, NULL);
567 gpio_request(GPIO_FN_LCDD2, NULL);
568 gpio_request(GPIO_FN_LCDD1, NULL);
569 gpio_request(GPIO_FN_LCDD0, NULL);
570 gpio_request(GPIO_FN_LCDDISP, NULL);
571 gpio_request(GPIO_FN_LCDHSYN, NULL);
572 gpio_request(GPIO_FN_LCDDCK, NULL);
573 gpio_request(GPIO_FN_LCDVSYN, NULL);
574 gpio_request(GPIO_FN_LCDDON, NULL);
575 gpio_request(GPIO_FN_LCDLCLK, NULL);
576 ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
577
578 gpio_request(GPIO_PTE6, NULL);
579 gpio_request(GPIO_PTU1, NULL);
580 gpio_request(GPIO_PTR1, NULL);
581 gpio_request(GPIO_PTA2, NULL);
582 gpio_direction_input(GPIO_PTE6);
583 gpio_direction_output(GPIO_PTU1, 0);
584 gpio_direction_output(GPIO_PTR1, 0);
585 gpio_direction_output(GPIO_PTA2, 0);
586
Kuninori Morimotoea15edb2009-08-26 11:04:39 +0000587 /* I/O buffer drive ability is low */
588 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x00c0) | 0x0040 , IODRIVEA);
589
Kuninori Morimotofa3ba512009-08-26 11:04:34 +0000590 if (gpio_get_value(GPIO_PTE6)) {
591 /* DVI */
592 lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
Kuninori Morimotoea15edb2009-08-26 11:04:39 +0000593 lcdc_info.ch[0].clock_divider = 1,
Kuninori Morimotofa3ba512009-08-26 11:04:34 +0000594 lcdc_info.ch[0].lcd_cfg.name = "DVI";
595 lcdc_info.ch[0].lcd_cfg.xres = 1280;
596 lcdc_info.ch[0].lcd_cfg.yres = 720;
597 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
598 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
599 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
600 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
601 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
602 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
603
604 gpio_set_value(GPIO_PTA2, 1);
605 gpio_set_value(GPIO_PTU1, 1);
606 } else {
607 /* Panel */
Kuninori Morimotoea15edb2009-08-26 11:04:39 +0000608
609 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
610 lcdc_info.ch[0].clock_divider = 2,
611 lcdc_info.ch[0].lcd_cfg.name = "Panel";
612 lcdc_info.ch[0].lcd_cfg.xres = 800;
613 lcdc_info.ch[0].lcd_cfg.yres = 480;
614 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
615 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
616 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
617 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
618 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
619 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
620
621 gpio_set_value(GPIO_PTR1, 1);
622
623 /* FIXME
624 *
625 * LCDDON control is needed for Panel,
626 * but current sh_mobile_lcdc driver doesn't control it.
627 * It is temporary correspondence
628 */
629 gpio_request(GPIO_PTF4, NULL);
630 gpio_direction_output(GPIO_PTF4, 1);
Kuninori Morimoto8810e052009-09-28 08:21:41 +0000631
632 /* enable TouchScreen */
633 i2c_register_board_info(0, &ts_i2c_clients, 1);
634 set_irq_type(IRQ0, IRQ_TYPE_LEVEL_LOW);
Kuninori Morimotofa3ba512009-08-26 11:04:34 +0000635 }
636
Kuninori Morimoto2153ad32009-08-26 11:04:36 +0000637 /* enable CEU0 */
638 gpio_request(GPIO_FN_VIO0_D15, NULL);
639 gpio_request(GPIO_FN_VIO0_D14, NULL);
640 gpio_request(GPIO_FN_VIO0_D13, NULL);
641 gpio_request(GPIO_FN_VIO0_D12, NULL);
642 gpio_request(GPIO_FN_VIO0_D11, NULL);
643 gpio_request(GPIO_FN_VIO0_D10, NULL);
644 gpio_request(GPIO_FN_VIO0_D9, NULL);
645 gpio_request(GPIO_FN_VIO0_D8, NULL);
646 gpio_request(GPIO_FN_VIO0_D7, NULL);
647 gpio_request(GPIO_FN_VIO0_D6, NULL);
648 gpio_request(GPIO_FN_VIO0_D5, NULL);
649 gpio_request(GPIO_FN_VIO0_D4, NULL);
650 gpio_request(GPIO_FN_VIO0_D3, NULL);
651 gpio_request(GPIO_FN_VIO0_D2, NULL);
652 gpio_request(GPIO_FN_VIO0_D1, NULL);
653 gpio_request(GPIO_FN_VIO0_D0, NULL);
654 gpio_request(GPIO_FN_VIO0_VD, NULL);
655 gpio_request(GPIO_FN_VIO0_CLK, NULL);
656 gpio_request(GPIO_FN_VIO0_FLD, NULL);
657 gpio_request(GPIO_FN_VIO0_HD, NULL);
658 platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20);
659
660 /* enable CEU1 */
661 gpio_request(GPIO_FN_VIO1_D7, NULL);
662 gpio_request(GPIO_FN_VIO1_D6, NULL);
663 gpio_request(GPIO_FN_VIO1_D5, NULL);
664 gpio_request(GPIO_FN_VIO1_D4, NULL);
665 gpio_request(GPIO_FN_VIO1_D3, NULL);
666 gpio_request(GPIO_FN_VIO1_D2, NULL);
667 gpio_request(GPIO_FN_VIO1_D1, NULL);
668 gpio_request(GPIO_FN_VIO1_D0, NULL);
669 gpio_request(GPIO_FN_VIO1_FLD, NULL);
670 gpio_request(GPIO_FN_VIO1_HD, NULL);
671 gpio_request(GPIO_FN_VIO1_VD, NULL);
672 gpio_request(GPIO_FN_VIO1_CLK, NULL);
673 platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20);
674
Kuninori Morimotoe9103e72009-09-14 11:23:00 +0000675 /* enable KEYSC */
676 gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
677 gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
678 gpio_request(GPIO_FN_KEYOUT3, NULL);
679 gpio_request(GPIO_FN_KEYOUT2, NULL);
680 gpio_request(GPIO_FN_KEYOUT1, NULL);
681 gpio_request(GPIO_FN_KEYOUT0, NULL);
682 gpio_request(GPIO_FN_KEYIN0, NULL);
683
Kuninori Morimoto064a16d2009-09-16 11:34:34 +0000684 /* enable user debug switch */
685 gpio_request(GPIO_PTR0, NULL);
686 gpio_request(GPIO_PTR4, NULL);
687 gpio_request(GPIO_PTR5, NULL);
688 gpio_request(GPIO_PTR6, NULL);
689 gpio_direction_input(GPIO_PTR0);
690 gpio_direction_input(GPIO_PTR4);
691 gpio_direction_input(GPIO_PTR5);
692 gpio_direction_input(GPIO_PTR6);
693
Kuninori Morimoto125ecce2009-09-10 01:39:37 +0000694 /* enable I2C device */
695 i2c_register_board_info(1, i2c1_devices,
696 ARRAY_SIZE(i2c1_devices));
697
Kuninori Morimoto4138b742009-08-19 12:08:33 +0000698 return platform_add_devices(ecovec_devices,
699 ARRAY_SIZE(ecovec_devices));
700}
Kuninori Morimoto4907d572009-09-10 01:39:58 +0000701arch_initcall(arch_setup);
702
703static int __init devices_setup(void)
704{
705 sh_eth_init();
706 return 0;
707}
708device_initcall(devices_setup);
709
Kuninori Morimoto4138b742009-08-19 12:08:33 +0000710
711static struct sh_machine_vector mv_ecovec __initmv = {
712 .mv_name = "R0P7724 (EcoVec)",
713};