setup.c 16 KB

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