setup.c 15 KB

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