setup.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  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 <media/soc_camera_platform.h>
  22. #include <media/sh_mobile_ceu.h>
  23. #include <video/sh_mobile_lcdc.h>
  24. #include <asm/clock.h>
  25. #include <asm/machvec.h>
  26. #include <asm/io.h>
  27. #include <asm/sh_keysc.h>
  28. #include <mach/migor.h>
  29. #include <cpu/sh7722.h>
  30. /* Address IRQ Size Bus Description
  31. * 0x00000000 64MB 16 NOR Flash (SP29PL256N)
  32. * 0x0c000000 64MB 64 SDRAM (2xK4M563233G)
  33. * 0x10000000 IRQ0 16 Ethernet (SMC91C111)
  34. * 0x14000000 IRQ4 16 USB 2.0 Host Controller (M66596)
  35. * 0x18000000 8GB 8 NAND Flash (K9K8G08U0A)
  36. */
  37. static struct smc91x_platdata smc91x_info = {
  38. .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
  39. };
  40. static struct resource smc91x_eth_resources[] = {
  41. [0] = {
  42. .name = "SMC91C111" ,
  43. .start = 0x10000300,
  44. .end = 0x1000030f,
  45. .flags = IORESOURCE_MEM,
  46. },
  47. [1] = {
  48. .start = 32, /* IRQ0 */
  49. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  50. },
  51. };
  52. static struct platform_device smc91x_eth_device = {
  53. .name = "smc91x",
  54. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  55. .resource = smc91x_eth_resources,
  56. .dev = {
  57. .platform_data = &smc91x_info,
  58. },
  59. };
  60. static struct sh_keysc_info sh_keysc_info = {
  61. .mode = SH_KEYSC_MODE_2, /* KEYOUT0->4, KEYIN1->5 */
  62. .scan_timing = 3,
  63. .delay = 5,
  64. .keycodes = {
  65. 0, KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_ENTER,
  66. 0, KEY_F, KEY_C, KEY_D, KEY_H, KEY_1,
  67. 0, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6,
  68. 0, KEY_7, KEY_8, KEY_9, KEY_S, KEY_0,
  69. 0, KEY_P, KEY_STOP, KEY_REWIND, KEY_PLAY, KEY_FASTFORWARD,
  70. },
  71. };
  72. static struct resource sh_keysc_resources[] = {
  73. [0] = {
  74. .start = 0x044b0000,
  75. .end = 0x044b000f,
  76. .flags = IORESOURCE_MEM,
  77. },
  78. [1] = {
  79. .start = 79,
  80. .flags = IORESOURCE_IRQ,
  81. },
  82. };
  83. static struct platform_device sh_keysc_device = {
  84. .name = "sh_keysc",
  85. .num_resources = ARRAY_SIZE(sh_keysc_resources),
  86. .resource = sh_keysc_resources,
  87. .dev = {
  88. .platform_data = &sh_keysc_info,
  89. },
  90. };
  91. static struct mtd_partition migor_nor_flash_partitions[] =
  92. {
  93. {
  94. .name = "uboot",
  95. .offset = 0,
  96. .size = (1 * 1024 * 1024),
  97. .mask_flags = MTD_WRITEABLE, /* Read-only */
  98. },
  99. {
  100. .name = "rootfs",
  101. .offset = MTDPART_OFS_APPEND,
  102. .size = (15 * 1024 * 1024),
  103. },
  104. {
  105. .name = "other",
  106. .offset = MTDPART_OFS_APPEND,
  107. .size = MTDPART_SIZ_FULL,
  108. },
  109. };
  110. static struct physmap_flash_data migor_nor_flash_data = {
  111. .width = 2,
  112. .parts = migor_nor_flash_partitions,
  113. .nr_parts = ARRAY_SIZE(migor_nor_flash_partitions),
  114. };
  115. static struct resource migor_nor_flash_resources[] = {
  116. [0] = {
  117. .name = "NOR Flash",
  118. .start = 0x00000000,
  119. .end = 0x03ffffff,
  120. .flags = IORESOURCE_MEM,
  121. }
  122. };
  123. static struct platform_device migor_nor_flash_device = {
  124. .name = "physmap-flash",
  125. .resource = migor_nor_flash_resources,
  126. .num_resources = ARRAY_SIZE(migor_nor_flash_resources),
  127. .dev = {
  128. .platform_data = &migor_nor_flash_data,
  129. },
  130. };
  131. static struct mtd_partition migor_nand_flash_partitions[] = {
  132. {
  133. .name = "nanddata1",
  134. .offset = 0x0,
  135. .size = 512 * 1024 * 1024,
  136. },
  137. {
  138. .name = "nanddata2",
  139. .offset = MTDPART_OFS_APPEND,
  140. .size = 512 * 1024 * 1024,
  141. },
  142. };
  143. static void migor_nand_flash_cmd_ctl(struct mtd_info *mtd, int cmd,
  144. unsigned int ctrl)
  145. {
  146. struct nand_chip *chip = mtd->priv;
  147. if (cmd == NAND_CMD_NONE)
  148. return;
  149. if (ctrl & NAND_CLE)
  150. writeb(cmd, chip->IO_ADDR_W + 0x00400000);
  151. else if (ctrl & NAND_ALE)
  152. writeb(cmd, chip->IO_ADDR_W + 0x00800000);
  153. else
  154. writeb(cmd, chip->IO_ADDR_W);
  155. }
  156. static int migor_nand_flash_ready(struct mtd_info *mtd)
  157. {
  158. return gpio_get_value(GPIO_PTA1); /* NAND_RBn */
  159. }
  160. struct platform_nand_data migor_nand_flash_data = {
  161. .chip = {
  162. .nr_chips = 1,
  163. .partitions = migor_nand_flash_partitions,
  164. .nr_partitions = ARRAY_SIZE(migor_nand_flash_partitions),
  165. .chip_delay = 20,
  166. .part_probe_types = (const char *[]) { "cmdlinepart", NULL },
  167. },
  168. .ctrl = {
  169. .dev_ready = migor_nand_flash_ready,
  170. .cmd_ctrl = migor_nand_flash_cmd_ctl,
  171. },
  172. };
  173. static struct resource migor_nand_flash_resources[] = {
  174. [0] = {
  175. .name = "NAND Flash",
  176. .start = 0x18000000,
  177. .end = 0x18ffffff,
  178. .flags = IORESOURCE_MEM,
  179. },
  180. };
  181. static struct platform_device migor_nand_flash_device = {
  182. .name = "gen_nand",
  183. .resource = migor_nand_flash_resources,
  184. .num_resources = ARRAY_SIZE(migor_nand_flash_resources),
  185. .dev = {
  186. .platform_data = &migor_nand_flash_data,
  187. }
  188. };
  189. static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
  190. #ifdef CONFIG_SH_MIGOR_RTA_WVGA
  191. .clock_source = LCDC_CLK_BUS,
  192. .ch[0] = {
  193. .chan = LCDC_CHAN_MAINLCD,
  194. .bpp = 16,
  195. .interface_type = RGB16,
  196. .clock_divider = 2,
  197. .lcd_cfg = {
  198. .name = "LB070WV1",
  199. .xres = 800,
  200. .yres = 480,
  201. .left_margin = 64,
  202. .right_margin = 16,
  203. .hsync_len = 120,
  204. .upper_margin = 1,
  205. .lower_margin = 17,
  206. .vsync_len = 2,
  207. .sync = 0,
  208. },
  209. .lcd_size_cfg = { /* 7.0 inch */
  210. .width = 152,
  211. .height = 91,
  212. },
  213. }
  214. #endif
  215. #ifdef CONFIG_SH_MIGOR_QVGA
  216. .clock_source = LCDC_CLK_PERIPHERAL,
  217. .ch[0] = {
  218. .chan = LCDC_CHAN_MAINLCD,
  219. .bpp = 16,
  220. .interface_type = SYS16A,
  221. .clock_divider = 10,
  222. .lcd_cfg = {
  223. .name = "PH240320T",
  224. .xres = 320,
  225. .yres = 240,
  226. .left_margin = 0,
  227. .right_margin = 16,
  228. .hsync_len = 8,
  229. .upper_margin = 1,
  230. .lower_margin = 17,
  231. .vsync_len = 2,
  232. .sync = FB_SYNC_HOR_HIGH_ACT,
  233. },
  234. .lcd_size_cfg = { /* 2.4 inch */
  235. .width = 49,
  236. .height = 37,
  237. },
  238. .board_cfg = {
  239. .setup_sys = migor_lcd_qvga_setup,
  240. },
  241. .sys_bus_cfg = {
  242. .ldmt2r = 0x06000a09,
  243. .ldmt3r = 0x180e3418,
  244. },
  245. }
  246. #endif
  247. };
  248. static struct resource migor_lcdc_resources[] = {
  249. [0] = {
  250. .name = "LCDC",
  251. .start = 0xfe940000, /* P4-only space */
  252. .end = 0xfe941fff,
  253. .flags = IORESOURCE_MEM,
  254. },
  255. };
  256. static struct platform_device migor_lcdc_device = {
  257. .name = "sh_mobile_lcdc_fb",
  258. .num_resources = ARRAY_SIZE(migor_lcdc_resources),
  259. .resource = migor_lcdc_resources,
  260. .dev = {
  261. .platform_data = &sh_mobile_lcdc_info,
  262. },
  263. };
  264. static struct clk *camera_clk;
  265. static void camera_power_on(void)
  266. {
  267. /* Use 10 MHz VIO_CKO instead of 24 MHz to work
  268. * around signal quality issues on Panel Board V2.1.
  269. */
  270. camera_clk = clk_get(NULL, "video_clk");
  271. clk_set_rate(camera_clk, 10000000);
  272. clk_enable(camera_clk); /* start VIO_CKO */
  273. /* use VIO_RST to take camera out of reset */
  274. mdelay(10);
  275. gpio_set_value(GPIO_PTT3, 0);
  276. mdelay(10);
  277. gpio_set_value(GPIO_PTT3, 1);
  278. }
  279. static void camera_power_off(void)
  280. {
  281. clk_disable(camera_clk); /* stop VIO_CKO */
  282. clk_put(camera_clk);
  283. gpio_set_value(GPIO_PTT3, 0);
  284. }
  285. static void camera_power(int mode)
  286. {
  287. if (mode)
  288. camera_power_on();
  289. else
  290. camera_power_off();
  291. }
  292. #ifdef CONFIG_I2C
  293. static unsigned char camera_ov772x_magic[] =
  294. {
  295. 0x09, 0x01, 0x0c, 0x20, 0x0d, 0x41, 0x0e, 0x01,
  296. 0x12, 0x00, 0x13, 0x8F, 0x14, 0x4A, 0x15, 0x00,
  297. 0x16, 0x00, 0x17, 0x23, 0x18, 0xa0, 0x19, 0x07,
  298. 0x1a, 0xf0, 0x1b, 0x40, 0x1f, 0x00, 0x20, 0x10,
  299. 0x22, 0xff, 0x23, 0x01, 0x28, 0x00, 0x29, 0xa0,
  300. 0x2a, 0x00, 0x2b, 0x00, 0x2c, 0xf0, 0x2d, 0x00,
  301. 0x2e, 0x00, 0x30, 0x80, 0x31, 0x60, 0x32, 0x00,
  302. 0x33, 0x00, 0x34, 0x00, 0x3d, 0x80, 0x3e, 0xe2,
  303. 0x3f, 0x1f, 0x42, 0x80, 0x43, 0x80, 0x44, 0x80,
  304. 0x45, 0x80, 0x46, 0x00, 0x47, 0x00, 0x48, 0x00,
  305. 0x49, 0x50, 0x4a, 0x30, 0x4b, 0x50, 0x4c, 0x50,
  306. 0x4d, 0x00, 0x4e, 0xef, 0x4f, 0x10, 0x50, 0x60,
  307. 0x51, 0x00, 0x52, 0x00, 0x53, 0x24, 0x54, 0x7a,
  308. 0x55, 0xfc, 0x62, 0xff, 0x63, 0xf0, 0x64, 0x1f,
  309. 0x65, 0x00, 0x66, 0x10, 0x67, 0x00, 0x68, 0x00,
  310. 0x69, 0x5c, 0x6a, 0x11, 0x6b, 0xa2, 0x6c, 0x01,
  311. 0x6d, 0x50, 0x6e, 0x80, 0x6f, 0x80, 0x70, 0x0f,
  312. 0x71, 0x00, 0x72, 0x00, 0x73, 0x0f, 0x74, 0x0f,
  313. 0x75, 0xff, 0x78, 0x10, 0x79, 0x70, 0x7a, 0x70,
  314. 0x7b, 0xf0, 0x7c, 0xf0, 0x7d, 0xf0, 0x7e, 0x0e,
  315. 0x7f, 0x1a, 0x80, 0x31, 0x81, 0x5a, 0x82, 0x69,
  316. 0x83, 0x75, 0x84, 0x7e, 0x85, 0x88, 0x86, 0x8f,
  317. 0x87, 0x96, 0x88, 0xa3, 0x89, 0xaf, 0x8a, 0xc4,
  318. 0x8b, 0xd7, 0x8c, 0xe8, 0x8d, 0x20, 0x8e, 0x00,
  319. 0x8f, 0x00, 0x90, 0x08, 0x91, 0x10, 0x92, 0x1f,
  320. 0x93, 0x01, 0x94, 0x2c, 0x95, 0x24, 0x96, 0x08,
  321. 0x97, 0x14, 0x98, 0x24, 0x99, 0x38, 0x9a, 0x9e,
  322. 0x9b, 0x00, 0x9c, 0x40, 0x9e, 0x11, 0x9f, 0x02,
  323. 0xa0, 0x00, 0xa1, 0x40, 0xa2, 0x40, 0xa3, 0x06,
  324. 0xa4, 0x00, 0xa6, 0x00, 0xa7, 0x40, 0xa8, 0x40,
  325. 0xa9, 0x80, 0xaa, 0x80, 0xab, 0x06, 0xac, 0xff,
  326. 0x12, 0x06, 0x64, 0x3f, 0x12, 0x46, 0x17, 0x3f,
  327. 0x18, 0x50, 0x19, 0x03, 0x1a, 0x78, 0x29, 0x50,
  328. 0x2c, 0x78,
  329. };
  330. static int ov772x_set_capture(struct soc_camera_platform_info *info,
  331. int enable)
  332. {
  333. struct i2c_adapter *a = i2c_get_adapter(0);
  334. struct i2c_msg msg;
  335. int ret = 0;
  336. int i;
  337. if (!enable)
  338. return 0; /* camera_power_off() is enough */
  339. for (i = 0; i < ARRAY_SIZE(camera_ov772x_magic); i += 2) {
  340. u_int8_t buf[8];
  341. msg.addr = 0x21;
  342. msg.buf = buf;
  343. msg.len = 2;
  344. msg.flags = 0;
  345. buf[0] = camera_ov772x_magic[i];
  346. buf[1] = camera_ov772x_magic[i + 1];
  347. ret = (ret < 0) ? ret : i2c_transfer(a, &msg, 1);
  348. }
  349. return ret;
  350. }
  351. static struct soc_camera_platform_info ov772x_info = {
  352. .iface = 0,
  353. .format_name = "RGB565",
  354. .format_depth = 16,
  355. .format = {
  356. .pixelformat = V4L2_PIX_FMT_RGB565,
  357. .colorspace = V4L2_COLORSPACE_SRGB,
  358. .width = 320,
  359. .height = 240,
  360. },
  361. .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
  362. SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8,
  363. .power = camera_power,
  364. .set_capture = ov772x_set_capture,
  365. };
  366. static struct platform_device migor_camera_device = {
  367. .name = "soc_camera_platform",
  368. .dev = {
  369. .platform_data = &ov772x_info,
  370. },
  371. };
  372. #endif /* CONFIG_I2C */
  373. static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
  374. .flags = SOCAM_MASTER | SOCAM_DATAWIDTH_8 | SOCAM_PCLK_SAMPLE_RISING \
  375. | SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH,
  376. };
  377. static struct resource migor_ceu_resources[] = {
  378. [0] = {
  379. .name = "CEU",
  380. .start = 0xfe910000,
  381. .end = 0xfe91009f,
  382. .flags = IORESOURCE_MEM,
  383. },
  384. [1] = {
  385. .start = 52,
  386. .flags = IORESOURCE_IRQ,
  387. },
  388. [2] = {
  389. /* place holder for contiguous memory */
  390. },
  391. };
  392. static struct platform_device migor_ceu_device = {
  393. .name = "sh_mobile_ceu",
  394. .num_resources = ARRAY_SIZE(migor_ceu_resources),
  395. .resource = migor_ceu_resources,
  396. .dev = {
  397. .platform_data = &sh_mobile_ceu_info,
  398. },
  399. };
  400. static struct platform_device *migor_devices[] __initdata = {
  401. &smc91x_eth_device,
  402. &sh_keysc_device,
  403. &migor_lcdc_device,
  404. &migor_ceu_device,
  405. #ifdef CONFIG_I2C
  406. &migor_camera_device,
  407. #endif
  408. &migor_nor_flash_device,
  409. &migor_nand_flash_device,
  410. };
  411. static struct i2c_board_info migor_i2c_devices[] = {
  412. {
  413. I2C_BOARD_INFO("rs5c372b", 0x32),
  414. },
  415. {
  416. I2C_BOARD_INFO("migor_ts", 0x51),
  417. .irq = 38, /* IRQ6 */
  418. },
  419. };
  420. static int __init migor_devices_setup(void)
  421. {
  422. /* Lit D11 LED */
  423. gpio_request(GPIO_PTJ7, NULL);
  424. gpio_direction_output(GPIO_PTJ7, 1);
  425. gpio_export(GPIO_PTJ7, 0);
  426. /* Lit D12 LED */
  427. gpio_request(GPIO_PTJ5, NULL);
  428. gpio_direction_output(GPIO_PTJ5, 1);
  429. gpio_export(GPIO_PTJ5, 0);
  430. /* SMC91C111 - Enable IRQ0, Setup CS4 for 16-bit fast access */
  431. gpio_request(GPIO_FN_IRQ0, NULL);
  432. ctrl_outl(0x00003400, BSC_CS4BCR);
  433. ctrl_outl(0x00110080, BSC_CS4WCR);
  434. /* KEYSC */
  435. clk_always_enable("mstp214"); /* KEYSC */
  436. gpio_request(GPIO_FN_KEYOUT0, NULL);
  437. gpio_request(GPIO_FN_KEYOUT1, NULL);
  438. gpio_request(GPIO_FN_KEYOUT2, NULL);
  439. gpio_request(GPIO_FN_KEYOUT3, NULL);
  440. gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
  441. gpio_request(GPIO_FN_KEYIN1, NULL);
  442. gpio_request(GPIO_FN_KEYIN2, NULL);
  443. gpio_request(GPIO_FN_KEYIN3, NULL);
  444. gpio_request(GPIO_FN_KEYIN4, NULL);
  445. gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
  446. /* NAND Flash */
  447. gpio_request(GPIO_FN_CS6A_CE2B, NULL);
  448. ctrl_outl((ctrl_inl(BSC_CS6ABCR) & ~0x0600) | 0x0200, BSC_CS6ABCR);
  449. gpio_request(GPIO_PTA1, NULL);
  450. gpio_direction_input(GPIO_PTA1);
  451. /* Touch Panel */
  452. gpio_request(GPIO_FN_IRQ6, NULL);
  453. /* LCD Panel */
  454. clk_always_enable("mstp200"); /* LCDC */
  455. #ifdef CONFIG_SH_MIGOR_QVGA /* LCDC - QVGA - Enable SYS Interface signals */
  456. gpio_request(GPIO_FN_LCDD17, NULL);
  457. gpio_request(GPIO_FN_LCDD16, NULL);
  458. gpio_request(GPIO_FN_LCDD15, NULL);
  459. gpio_request(GPIO_FN_LCDD14, NULL);
  460. gpio_request(GPIO_FN_LCDD13, NULL);
  461. gpio_request(GPIO_FN_LCDD12, NULL);
  462. gpio_request(GPIO_FN_LCDD11, NULL);
  463. gpio_request(GPIO_FN_LCDD10, NULL);
  464. gpio_request(GPIO_FN_LCDD8, NULL);
  465. gpio_request(GPIO_FN_LCDD7, NULL);
  466. gpio_request(GPIO_FN_LCDD6, NULL);
  467. gpio_request(GPIO_FN_LCDD5, NULL);
  468. gpio_request(GPIO_FN_LCDD4, NULL);
  469. gpio_request(GPIO_FN_LCDD3, NULL);
  470. gpio_request(GPIO_FN_LCDD2, NULL);
  471. gpio_request(GPIO_FN_LCDD1, NULL);
  472. gpio_request(GPIO_FN_LCDRS, NULL);
  473. gpio_request(GPIO_FN_LCDCS, NULL);
  474. gpio_request(GPIO_FN_LCDRD, NULL);
  475. gpio_request(GPIO_FN_LCDWR, NULL);
  476. gpio_request(GPIO_PTH2, NULL); /* LCD_DON */
  477. gpio_direction_output(GPIO_PTH2, 1);
  478. #endif
  479. #ifdef CONFIG_SH_MIGOR_RTA_WVGA /* LCDC - WVGA - Enable RGB Interface signals */
  480. gpio_request(GPIO_FN_LCDD15, NULL);
  481. gpio_request(GPIO_FN_LCDD14, NULL);
  482. gpio_request(GPIO_FN_LCDD13, NULL);
  483. gpio_request(GPIO_FN_LCDD12, NULL);
  484. gpio_request(GPIO_FN_LCDD11, NULL);
  485. gpio_request(GPIO_FN_LCDD10, NULL);
  486. gpio_request(GPIO_FN_LCDD9, NULL);
  487. gpio_request(GPIO_FN_LCDD8, NULL);
  488. gpio_request(GPIO_FN_LCDD7, NULL);
  489. gpio_request(GPIO_FN_LCDD6, NULL);
  490. gpio_request(GPIO_FN_LCDD5, NULL);
  491. gpio_request(GPIO_FN_LCDD4, NULL);
  492. gpio_request(GPIO_FN_LCDD3, NULL);
  493. gpio_request(GPIO_FN_LCDD2, NULL);
  494. gpio_request(GPIO_FN_LCDD1, NULL);
  495. gpio_request(GPIO_FN_LCDD0, NULL);
  496. gpio_request(GPIO_FN_LCDLCLK, NULL);
  497. gpio_request(GPIO_FN_LCDDCK, NULL);
  498. gpio_request(GPIO_FN_LCDVEPWC, NULL);
  499. gpio_request(GPIO_FN_LCDVCPWC, NULL);
  500. gpio_request(GPIO_FN_LCDVSYN, NULL);
  501. gpio_request(GPIO_FN_LCDHSYN, NULL);
  502. gpio_request(GPIO_FN_LCDDISP, NULL);
  503. gpio_request(GPIO_FN_LCDDON, NULL);
  504. #endif
  505. /* CEU */
  506. clk_always_enable("mstp203"); /* CEU */
  507. gpio_request(GPIO_FN_VIO_CLK2, NULL);
  508. gpio_request(GPIO_FN_VIO_VD2, NULL);
  509. gpio_request(GPIO_FN_VIO_HD2, NULL);
  510. gpio_request(GPIO_FN_VIO_FLD, NULL);
  511. gpio_request(GPIO_FN_VIO_CKO, NULL);
  512. gpio_request(GPIO_FN_VIO_D15, NULL);
  513. gpio_request(GPIO_FN_VIO_D14, NULL);
  514. gpio_request(GPIO_FN_VIO_D13, NULL);
  515. gpio_request(GPIO_FN_VIO_D12, NULL);
  516. gpio_request(GPIO_FN_VIO_D11, NULL);
  517. gpio_request(GPIO_FN_VIO_D10, NULL);
  518. gpio_request(GPIO_FN_VIO_D9, NULL);
  519. gpio_request(GPIO_FN_VIO_D8, NULL);
  520. gpio_request(GPIO_PTT3, NULL); /* VIO_RST */
  521. gpio_direction_output(GPIO_PTT3, 0);
  522. gpio_request(GPIO_PTT2, NULL); /* TV_IN_EN */
  523. gpio_direction_output(GPIO_PTT2, 1);
  524. gpio_request(GPIO_PTT0, NULL); /* CAM_EN */
  525. #ifdef CONFIG_SH_MIGOR_RTA_WVGA
  526. gpio_direction_output(GPIO_PTT0, 0);
  527. #else
  528. gpio_direction_output(GPIO_PTT0, 1);
  529. #endif
  530. ctrl_outw(ctrl_inw(PORT_MSELCRB) | 0x2000, PORT_MSELCRB); /* D15->D8 */
  531. platform_resource_setup_memory(&migor_ceu_device, "ceu", 4 << 20);
  532. i2c_register_board_info(0, migor_i2c_devices,
  533. ARRAY_SIZE(migor_i2c_devices));
  534. return platform_add_devices(migor_devices, ARRAY_SIZE(migor_devices));
  535. }
  536. __initcall(migor_devices_setup);
  537. static void __init migor_setup(char **cmdline_p)
  538. {
  539. }
  540. static struct sh_machine_vector mv_migor __initmv = {
  541. .mv_name = "Migo-R",
  542. .mv_setup = migor_setup,
  543. };