setup.c 17 KB

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