setup.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. /*
  2. * Renesas System Solutions Asia Pte. Ltd - Migo-R
  3. *
  4. * Copyright (C) 2008 Magnus Damm
  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/platform_device.h>
  12. #include <linux/interrupt.h>
  13. #include <linux/input.h>
  14. #include <linux/input/sh_keysc.h>
  15. #include <linux/mtd/physmap.h>
  16. #include <linux/mtd/nand.h>
  17. #include <linux/i2c.h>
  18. #include <linux/smc91x.h>
  19. #include <linux/delay.h>
  20. #include <linux/clk.h>
  21. #include <linux/gpio.h>
  22. #include <video/sh_mobile_lcdc.h>
  23. #include <media/sh_mobile_ceu.h>
  24. #include <media/ov772x.h>
  25. #include <media/tw9910.h>
  26. #include <asm/clock.h>
  27. #include <asm/machvec.h>
  28. #include <asm/io.h>
  29. #include <asm/suspend.h>
  30. #include <mach/migor.h>
  31. #include <cpu/sh7722.h>
  32. /* Address IRQ Size Bus Description
  33. * 0x00000000 64MB 16 NOR Flash (SP29PL256N)
  34. * 0x0c000000 64MB 64 SDRAM (2xK4M563233G)
  35. * 0x10000000 IRQ0 16 Ethernet (SMC91C111)
  36. * 0x14000000 IRQ4 16 USB 2.0 Host Controller (M66596)
  37. * 0x18000000 8GB 8 NAND Flash (K9K8G08U0A)
  38. */
  39. static struct smc91x_platdata smc91x_info = {
  40. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  41. };
  42. static struct resource smc91x_eth_resources[] = {
  43. [0] = {
  44. .name = "SMC91C111" ,
  45. .start = 0x10000300,
  46. .end = 0x1000030f,
  47. .flags = IORESOURCE_MEM,
  48. },
  49. [1] = {
  50. .start = 32, /* IRQ0 */
  51. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  52. },
  53. };
  54. static struct platform_device smc91x_eth_device = {
  55. .name = "smc91x",
  56. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  57. .resource = smc91x_eth_resources,
  58. .dev = {
  59. .platform_data = &smc91x_info,
  60. },
  61. };
  62. static struct sh_keysc_info sh_keysc_info = {
  63. .mode = SH_KEYSC_MODE_2, /* KEYOUT0->4, KEYIN1->5 */
  64. .scan_timing = 3,
  65. .delay = 5,
  66. .keycodes = {
  67. 0, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_ENTER,
  68. 0, KEY_F, KEY_C, KEY_D, KEY_H, KEY_1,
  69. 0, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6,
  70. 0, KEY_7, KEY_8, KEY_9, KEY_S, KEY_0,
  71. 0, KEY_P, KEY_STOP, KEY_REWIND, KEY_PLAY, KEY_FASTFORWARD,
  72. },
  73. };
  74. static struct resource sh_keysc_resources[] = {
  75. [0] = {
  76. .start = 0x044b0000,
  77. .end = 0x044b000f,
  78. .flags = IORESOURCE_MEM,
  79. },
  80. [1] = {
  81. .start = 79,
  82. .flags = IORESOURCE_IRQ,
  83. },
  84. };
  85. static struct platform_device sh_keysc_device = {
  86. .name = "sh_keysc",
  87. .id = 0, /* "keysc0" clock */
  88. .num_resources = ARRAY_SIZE(sh_keysc_resources),
  89. .resource = sh_keysc_resources,
  90. .dev = {
  91. .platform_data = &sh_keysc_info,
  92. },
  93. .archdata = {
  94. .hwblk_id = HWBLK_KEYSC,
  95. },
  96. };
  97. static struct mtd_partition migor_nor_flash_partitions[] =
  98. {
  99. {
  100. .name = "uboot",
  101. .offset = 0,
  102. .size = (1 * 1024 * 1024),
  103. .mask_flags = MTD_WRITEABLE, /* Read-only */
  104. },
  105. {
  106. .name = "rootfs",
  107. .offset = MTDPART_OFS_APPEND,
  108. .size = (15 * 1024 * 1024),
  109. },
  110. {
  111. .name = "other",
  112. .offset = MTDPART_OFS_APPEND,
  113. .size = MTDPART_SIZ_FULL,
  114. },
  115. };
  116. static struct physmap_flash_data migor_nor_flash_data = {
  117. .width = 2,
  118. .parts = migor_nor_flash_partitions,
  119. .nr_parts = ARRAY_SIZE(migor_nor_flash_partitions),
  120. };
  121. static struct resource migor_nor_flash_resources[] = {
  122. [0] = {
  123. .name = "NOR Flash",
  124. .start = 0x00000000,
  125. .end = 0x03ffffff,
  126. .flags = IORESOURCE_MEM,
  127. }
  128. };
  129. static struct platform_device migor_nor_flash_device = {
  130. .name = "physmap-flash",
  131. .resource = migor_nor_flash_resources,
  132. .num_resources = ARRAY_SIZE(migor_nor_flash_resources),
  133. .dev = {
  134. .platform_data = &migor_nor_flash_data,
  135. },
  136. };
  137. static struct mtd_partition migor_nand_flash_partitions[] = {
  138. {
  139. .name = "nanddata1",
  140. .offset = 0x0,
  141. .size = 512 * 1024 * 1024,
  142. },
  143. {
  144. .name = "nanddata2",
  145. .offset = MTDPART_OFS_APPEND,
  146. .size = 512 * 1024 * 1024,
  147. },
  148. };
  149. static void migor_nand_flash_cmd_ctl(struct mtd_info *mtd, int cmd,
  150. unsigned int ctrl)
  151. {
  152. struct nand_chip *chip = mtd->priv;
  153. if (cmd == NAND_CMD_NONE)
  154. return;
  155. if (ctrl & NAND_CLE)
  156. writeb(cmd, chip->IO_ADDR_W + 0x00400000);
  157. else if (ctrl & NAND_ALE)
  158. writeb(cmd, chip->IO_ADDR_W + 0x00800000);
  159. else
  160. writeb(cmd, chip->IO_ADDR_W);
  161. }
  162. static int migor_nand_flash_ready(struct mtd_info *mtd)
  163. {
  164. return gpio_get_value(GPIO_PTA1); /* NAND_RBn */
  165. }
  166. struct platform_nand_data migor_nand_flash_data = {
  167. .chip = {
  168. .nr_chips = 1,
  169. .partitions = migor_nand_flash_partitions,
  170. .nr_partitions = ARRAY_SIZE(migor_nand_flash_partitions),
  171. .chip_delay = 20,
  172. .part_probe_types = (const char *[]) { "cmdlinepart", NULL },
  173. },
  174. .ctrl = {
  175. .dev_ready = migor_nand_flash_ready,
  176. .cmd_ctrl = migor_nand_flash_cmd_ctl,
  177. },
  178. };
  179. static struct resource migor_nand_flash_resources[] = {
  180. [0] = {
  181. .name = "NAND Flash",
  182. .start = 0x18000000,
  183. .end = 0x18ffffff,
  184. .flags = IORESOURCE_MEM,
  185. },
  186. };
  187. static struct platform_device migor_nand_flash_device = {
  188. .name = "gen_nand",
  189. .resource = migor_nand_flash_resources,
  190. .num_resources = ARRAY_SIZE(migor_nand_flash_resources),
  191. .dev = {
  192. .platform_data = &migor_nand_flash_data,
  193. }
  194. };
  195. static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
  196. #ifdef CONFIG_SH_MIGOR_RTA_WVGA
  197. .clock_source = LCDC_CLK_BUS,
  198. .ch[0] = {
  199. .chan = LCDC_CHAN_MAINLCD,
  200. .bpp = 16,
  201. .interface_type = RGB16,
  202. .clock_divider = 2,
  203. .lcd_cfg = {
  204. .name = "LB070WV1",
  205. .xres = 800,
  206. .yres = 480,
  207. .left_margin = 64,
  208. .right_margin = 16,
  209. .hsync_len = 120,
  210. .upper_margin = 1,
  211. .lower_margin = 17,
  212. .vsync_len = 2,
  213. .sync = 0,
  214. },
  215. .lcd_size_cfg = { /* 7.0 inch */
  216. .width = 152,
  217. .height = 91,
  218. },
  219. }
  220. #endif
  221. #ifdef CONFIG_SH_MIGOR_QVGA
  222. .clock_source = LCDC_CLK_PERIPHERAL,
  223. .ch[0] = {
  224. .chan = LCDC_CHAN_MAINLCD,
  225. .bpp = 16,
  226. .interface_type = SYS16A,
  227. .clock_divider = 10,
  228. .lcd_cfg = {
  229. .name = "PH240320T",
  230. .xres = 320,
  231. .yres = 240,
  232. .left_margin = 0,
  233. .right_margin = 16,
  234. .hsync_len = 8,
  235. .upper_margin = 1,
  236. .lower_margin = 17,
  237. .vsync_len = 2,
  238. .sync = FB_SYNC_HOR_HIGH_ACT,
  239. },
  240. .lcd_size_cfg = { /* 2.4 inch */
  241. .width = 49,
  242. .height = 37,
  243. },
  244. .board_cfg = {
  245. .setup_sys = migor_lcd_qvga_setup,
  246. },
  247. .sys_bus_cfg = {
  248. .ldmt2r = 0x06000a09,
  249. .ldmt3r = 0x180e3418,
  250. /* set 1s delay to encourage fsync() */
  251. .deferred_io_msec = 1000,
  252. },
  253. }
  254. #endif
  255. };
  256. static struct resource migor_lcdc_resources[] = {
  257. [0] = {
  258. .name = "LCDC",
  259. .start = 0xfe940000, /* P4-only space */
  260. .end = 0xfe942fff,
  261. .flags = IORESOURCE_MEM,
  262. },
  263. [1] = {
  264. .start = 28,
  265. .flags = IORESOURCE_IRQ,
  266. },
  267. };
  268. static struct platform_device migor_lcdc_device = {
  269. .name = "sh_mobile_lcdc_fb",
  270. .num_resources = ARRAY_SIZE(migor_lcdc_resources),
  271. .resource = migor_lcdc_resources,
  272. .dev = {
  273. .platform_data = &sh_mobile_lcdc_info,
  274. },
  275. .archdata = {
  276. .hwblk_id = HWBLK_LCDC,
  277. },
  278. };
  279. static struct clk *camera_clk;
  280. static DEFINE_MUTEX(camera_lock);
  281. static void camera_power_on(int is_tw)
  282. {
  283. mutex_lock(&camera_lock);
  284. /* Use 10 MHz VIO_CKO instead of 24 MHz to work
  285. * around signal quality issues on Panel Board V2.1.
  286. */
  287. camera_clk = clk_get(NULL, "video_clk");
  288. clk_set_rate(camera_clk, 10000000);
  289. clk_enable(camera_clk); /* start VIO_CKO */
  290. /* use VIO_RST to take camera out of reset */
  291. mdelay(10);
  292. if (is_tw) {
  293. gpio_set_value(GPIO_PTT2, 0);
  294. gpio_set_value(GPIO_PTT0, 0);
  295. } else {
  296. gpio_set_value(GPIO_PTT0, 1);
  297. }
  298. gpio_set_value(GPIO_PTT3, 0);
  299. mdelay(10);
  300. gpio_set_value(GPIO_PTT3, 1);
  301. mdelay(10); /* wait to let chip come out of reset */
  302. }
  303. static void camera_power_off(void)
  304. {
  305. clk_disable(camera_clk); /* stop VIO_CKO */
  306. clk_put(camera_clk);
  307. gpio_set_value(GPIO_PTT3, 0);
  308. mutex_unlock(&camera_lock);
  309. }
  310. static int ov7725_power(struct device *dev, int mode)
  311. {
  312. if (mode)
  313. camera_power_on(0);
  314. else
  315. camera_power_off();
  316. return 0;
  317. }
  318. static int tw9910_power(struct device *dev, int mode)
  319. {
  320. if (mode)
  321. camera_power_on(1);
  322. else
  323. camera_power_off();
  324. return 0;
  325. }
  326. static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
  327. .flags = SH_CEU_FLAG_USE_8BIT_BUS,
  328. };
  329. static struct resource migor_ceu_resources[] = {
  330. [0] = {
  331. .name = "CEU",
  332. .start = 0xfe910000,
  333. .end = 0xfe91009f,
  334. .flags = IORESOURCE_MEM,
  335. },
  336. [1] = {
  337. .start = 52,
  338. .flags = IORESOURCE_IRQ,
  339. },
  340. [2] = {
  341. /* place holder for contiguous memory */
  342. },
  343. };
  344. static struct platform_device migor_ceu_device = {
  345. .name = "sh_mobile_ceu",
  346. .id = 0, /* "ceu0" clock */
  347. .num_resources = ARRAY_SIZE(migor_ceu_resources),
  348. .resource = migor_ceu_resources,
  349. .dev = {
  350. .platform_data = &sh_mobile_ceu_info,
  351. },
  352. .archdata = {
  353. .hwblk_id = HWBLK_CEU,
  354. },
  355. };
  356. static struct resource sdhi_cn9_resources[] = {
  357. [0] = {
  358. .name = "SDHI",
  359. .start = 0x04ce0000,
  360. .end = 0x04ce01ff,
  361. .flags = IORESOURCE_MEM,
  362. },
  363. [1] = {
  364. .start = 101,
  365. .flags = IORESOURCE_IRQ,
  366. },
  367. };
  368. static struct platform_device sdhi_cn9_device = {
  369. .name = "sh_mobile_sdhi",
  370. .num_resources = ARRAY_SIZE(sdhi_cn9_resources),
  371. .resource = sdhi_cn9_resources,
  372. .archdata = {
  373. .hwblk_id = HWBLK_SDHI,
  374. },
  375. };
  376. static struct i2c_board_info migor_i2c_devices[] = {
  377. {
  378. I2C_BOARD_INFO("rs5c372b", 0x32),
  379. },
  380. {
  381. I2C_BOARD_INFO("migor_ts", 0x51),
  382. .irq = 38, /* IRQ6 */
  383. },
  384. };
  385. static struct i2c_board_info migor_i2c_camera[] = {
  386. {
  387. I2C_BOARD_INFO("ov772x", 0x21),
  388. },
  389. {
  390. I2C_BOARD_INFO("tw9910", 0x45),
  391. },
  392. };
  393. static struct ov772x_camera_info ov7725_info = {
  394. .buswidth = SOCAM_DATAWIDTH_8,
  395. };
  396. static struct soc_camera_link ov7725_link = {
  397. .power = ov7725_power,
  398. .board_info = &migor_i2c_camera[0],
  399. .i2c_adapter_id = 0,
  400. .module_name = "ov772x",
  401. .priv = &ov7725_info,
  402. };
  403. static struct tw9910_video_info tw9910_info = {
  404. .buswidth = SOCAM_DATAWIDTH_8,
  405. .mpout = TW9910_MPO_FIELD,
  406. };
  407. static struct soc_camera_link tw9910_link = {
  408. .power = tw9910_power,
  409. .board_info = &migor_i2c_camera[1],
  410. .i2c_adapter_id = 0,
  411. .module_name = "tw9910",
  412. .priv = &tw9910_info,
  413. };
  414. static struct platform_device migor_camera[] = {
  415. {
  416. .name = "soc-camera-pdrv",
  417. .id = 0,
  418. .dev = {
  419. .platform_data = &ov7725_link,
  420. },
  421. }, {
  422. .name = "soc-camera-pdrv",
  423. .id = 1,
  424. .dev = {
  425. .platform_data = &tw9910_link,
  426. },
  427. },
  428. };
  429. static struct platform_device *migor_devices[] __initdata = {
  430. &smc91x_eth_device,
  431. &sh_keysc_device,
  432. &migor_lcdc_device,
  433. &migor_ceu_device,
  434. &migor_nor_flash_device,
  435. &migor_nand_flash_device,
  436. &sdhi_cn9_device,
  437. &migor_camera[0],
  438. &migor_camera[1],
  439. };
  440. extern char migor_sdram_enter_start;
  441. extern char migor_sdram_enter_end;
  442. extern char migor_sdram_leave_start;
  443. extern char migor_sdram_leave_end;
  444. static int __init migor_devices_setup(void)
  445. {
  446. /* register board specific self-refresh code */
  447. sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
  448. &migor_sdram_enter_start,
  449. &migor_sdram_enter_end,
  450. &migor_sdram_leave_start,
  451. &migor_sdram_leave_end);
  452. #ifdef CONFIG_PM
  453. /* Let D11 LED show STATUS0 */
  454. gpio_request(GPIO_FN_STATUS0, NULL);
  455. /* Lit D12 LED show PDSTATUS */
  456. gpio_request(GPIO_FN_PDSTATUS, NULL);
  457. #else
  458. /* Lit D11 LED */
  459. gpio_request(GPIO_PTJ7, NULL);
  460. gpio_direction_output(GPIO_PTJ7, 1);
  461. gpio_export(GPIO_PTJ7, 0);
  462. /* Lit D12 LED */
  463. gpio_request(GPIO_PTJ5, NULL);
  464. gpio_direction_output(GPIO_PTJ5, 1);
  465. gpio_export(GPIO_PTJ5, 0);
  466. #endif
  467. /* SMC91C111 - Enable IRQ0, Setup CS4 for 16-bit fast access */
  468. gpio_request(GPIO_FN_IRQ0, NULL);
  469. ctrl_outl(0x00003400, BSC_CS4BCR);
  470. ctrl_outl(0x00110080, BSC_CS4WCR);
  471. /* KEYSC */
  472. gpio_request(GPIO_FN_KEYOUT0, NULL);
  473. gpio_request(GPIO_FN_KEYOUT1, NULL);
  474. gpio_request(GPIO_FN_KEYOUT2, NULL);
  475. gpio_request(GPIO_FN_KEYOUT3, NULL);
  476. gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
  477. gpio_request(GPIO_FN_KEYIN1, NULL);
  478. gpio_request(GPIO_FN_KEYIN2, NULL);
  479. gpio_request(GPIO_FN_KEYIN3, NULL);
  480. gpio_request(GPIO_FN_KEYIN4, NULL);
  481. gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
  482. /* NAND Flash */
  483. gpio_request(GPIO_FN_CS6A_CE2B, NULL);
  484. ctrl_outl((ctrl_inl(BSC_CS6ABCR) & ~0x0600) | 0x0200, BSC_CS6ABCR);
  485. gpio_request(GPIO_PTA1, NULL);
  486. gpio_direction_input(GPIO_PTA1);
  487. /* SDHI */
  488. gpio_request(GPIO_FN_SDHICD, NULL);
  489. gpio_request(GPIO_FN_SDHIWP, NULL);
  490. gpio_request(GPIO_FN_SDHID3, NULL);
  491. gpio_request(GPIO_FN_SDHID2, NULL);
  492. gpio_request(GPIO_FN_SDHID1, NULL);
  493. gpio_request(GPIO_FN_SDHID0, NULL);
  494. gpio_request(GPIO_FN_SDHICMD, NULL);
  495. gpio_request(GPIO_FN_SDHICLK, NULL);
  496. /* Touch Panel */
  497. gpio_request(GPIO_FN_IRQ6, NULL);
  498. /* LCD Panel */
  499. #ifdef CONFIG_SH_MIGOR_QVGA /* LCDC - QVGA - Enable SYS Interface signals */
  500. gpio_request(GPIO_FN_LCDD17, NULL);
  501. gpio_request(GPIO_FN_LCDD16, NULL);
  502. gpio_request(GPIO_FN_LCDD15, NULL);
  503. gpio_request(GPIO_FN_LCDD14, NULL);
  504. gpio_request(GPIO_FN_LCDD13, NULL);
  505. gpio_request(GPIO_FN_LCDD12, NULL);
  506. gpio_request(GPIO_FN_LCDD11, NULL);
  507. gpio_request(GPIO_FN_LCDD10, NULL);
  508. gpio_request(GPIO_FN_LCDD8, NULL);
  509. gpio_request(GPIO_FN_LCDD7, NULL);
  510. gpio_request(GPIO_FN_LCDD6, NULL);
  511. gpio_request(GPIO_FN_LCDD5, NULL);
  512. gpio_request(GPIO_FN_LCDD4, NULL);
  513. gpio_request(GPIO_FN_LCDD3, NULL);
  514. gpio_request(GPIO_FN_LCDD2, NULL);
  515. gpio_request(GPIO_FN_LCDD1, NULL);
  516. gpio_request(GPIO_FN_LCDRS, NULL);
  517. gpio_request(GPIO_FN_LCDCS, NULL);
  518. gpio_request(GPIO_FN_LCDRD, NULL);
  519. gpio_request(GPIO_FN_LCDWR, NULL);
  520. gpio_request(GPIO_PTH2, NULL); /* LCD_DON */
  521. gpio_direction_output(GPIO_PTH2, 1);
  522. #endif
  523. #ifdef CONFIG_SH_MIGOR_RTA_WVGA /* LCDC - WVGA - Enable RGB Interface signals */
  524. gpio_request(GPIO_FN_LCDD15, NULL);
  525. gpio_request(GPIO_FN_LCDD14, NULL);
  526. gpio_request(GPIO_FN_LCDD13, NULL);
  527. gpio_request(GPIO_FN_LCDD12, NULL);
  528. gpio_request(GPIO_FN_LCDD11, NULL);
  529. gpio_request(GPIO_FN_LCDD10, NULL);
  530. gpio_request(GPIO_FN_LCDD9, NULL);
  531. gpio_request(GPIO_FN_LCDD8, NULL);
  532. gpio_request(GPIO_FN_LCDD7, NULL);
  533. gpio_request(GPIO_FN_LCDD6, NULL);
  534. gpio_request(GPIO_FN_LCDD5, NULL);
  535. gpio_request(GPIO_FN_LCDD4, NULL);
  536. gpio_request(GPIO_FN_LCDD3, NULL);
  537. gpio_request(GPIO_FN_LCDD2, NULL);
  538. gpio_request(GPIO_FN_LCDD1, NULL);
  539. gpio_request(GPIO_FN_LCDD0, NULL);
  540. gpio_request(GPIO_FN_LCDLCLK, NULL);
  541. gpio_request(GPIO_FN_LCDDCK, NULL);
  542. gpio_request(GPIO_FN_LCDVEPWC, NULL);
  543. gpio_request(GPIO_FN_LCDVCPWC, NULL);
  544. gpio_request(GPIO_FN_LCDVSYN, NULL);
  545. gpio_request(GPIO_FN_LCDHSYN, NULL);
  546. gpio_request(GPIO_FN_LCDDISP, NULL);
  547. gpio_request(GPIO_FN_LCDDON, NULL);
  548. #endif
  549. /* CEU */
  550. gpio_request(GPIO_FN_VIO_CLK2, NULL);
  551. gpio_request(GPIO_FN_VIO_VD2, NULL);
  552. gpio_request(GPIO_FN_VIO_HD2, NULL);
  553. gpio_request(GPIO_FN_VIO_FLD, NULL);
  554. gpio_request(GPIO_FN_VIO_CKO, NULL);
  555. gpio_request(GPIO_FN_VIO_D15, NULL);
  556. gpio_request(GPIO_FN_VIO_D14, NULL);
  557. gpio_request(GPIO_FN_VIO_D13, NULL);
  558. gpio_request(GPIO_FN_VIO_D12, NULL);
  559. gpio_request(GPIO_FN_VIO_D11, NULL);
  560. gpio_request(GPIO_FN_VIO_D10, NULL);
  561. gpio_request(GPIO_FN_VIO_D9, NULL);
  562. gpio_request(GPIO_FN_VIO_D8, NULL);
  563. gpio_request(GPIO_PTT3, NULL); /* VIO_RST */
  564. gpio_direction_output(GPIO_PTT3, 0);
  565. gpio_request(GPIO_PTT2, NULL); /* TV_IN_EN */
  566. gpio_direction_output(GPIO_PTT2, 1);
  567. gpio_request(GPIO_PTT0, NULL); /* CAM_EN */
  568. #ifdef CONFIG_SH_MIGOR_RTA_WVGA
  569. gpio_direction_output(GPIO_PTT0, 0);
  570. #else
  571. gpio_direction_output(GPIO_PTT0, 1);
  572. #endif
  573. ctrl_outw(ctrl_inw(PORT_MSELCRB) | 0x2000, PORT_MSELCRB); /* D15->D8 */
  574. platform_resource_setup_memory(&migor_ceu_device, "ceu", 4 << 20);
  575. i2c_register_board_info(0, migor_i2c_devices,
  576. ARRAY_SIZE(migor_i2c_devices));
  577. return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
  578. }
  579. arch_initcall(migor_devices_setup);
  580. /* Return the board specific boot mode pin configuration */
  581. static int migor_mode_pins(void)
  582. {
  583. /* MD0=1, MD1=1, MD2=0: Clock Mode 3
  584. * MD3=0: 16-bit Area0 Bus Width
  585. * MD5=1: Little Endian
  586. * TSTMD=1, MD8=0: Test Mode Disabled
  587. */
  588. return MODE_PIN0 | MODE_PIN1 | MODE_PIN5;
  589. }
  590. /*
  591. * The Machine Vector
  592. */
  593. static struct sh_machine_vector mv_migor __initmv = {
  594. .mv_name = "Migo-R",
  595. .mv_mode_pins = migor_mode_pins,
  596. };