setup.c 16 KB

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