setup.c 17 KB

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