setup.c 15 KB

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