setup.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. /*
  2. * Renesas - AP-325RXA
  3. * (Compatible with Algo System ., LTD. - AP-320A)
  4. *
  5. * Copyright (C) 2008 Renesas Solutions Corp.
  6. * Author : Yusuke Goda <goda.yuske@renesas.com>
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/device.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/mmc/host.h>
  17. #include <linux/mmc/sh_mobile_sdhi.h>
  18. #include <linux/mtd/physmap.h>
  19. #include <linux/mtd/sh_flctl.h>
  20. #include <linux/delay.h>
  21. #include <linux/i2c.h>
  22. #include <linux/smsc911x.h>
  23. #include <linux/gpio.h>
  24. #include <media/ov772x.h>
  25. #include <media/soc_camera.h>
  26. #include <media/soc_camera_platform.h>
  27. #include <media/sh_mobile_ceu.h>
  28. #include <video/sh_mobile_lcdc.h>
  29. #include <asm/io.h>
  30. #include <asm/clock.h>
  31. #include <asm/suspend.h>
  32. #include <cpu/sh7723.h>
  33. static struct smsc911x_platform_config smsc911x_config = {
  34. .phy_interface = PHY_INTERFACE_MODE_MII,
  35. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  36. .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
  37. .flags = SMSC911X_USE_32BIT,
  38. };
  39. static struct resource smsc9118_resources[] = {
  40. [0] = {
  41. .start = 0xb6080000,
  42. .end = 0xb60fffff,
  43. .flags = IORESOURCE_MEM,
  44. },
  45. [1] = {
  46. .start = 35,
  47. .end = 35,
  48. .flags = IORESOURCE_IRQ,
  49. }
  50. };
  51. static struct platform_device smsc9118_device = {
  52. .name = "smsc911x",
  53. .id = -1,
  54. .num_resources = ARRAY_SIZE(smsc9118_resources),
  55. .resource = smsc9118_resources,
  56. .dev = {
  57. .platform_data = &smsc911x_config,
  58. },
  59. };
  60. /*
  61. * AP320 and AP325RXA has CPLD data in NOR Flash(0xA80000-0xABFFFF).
  62. * If this area erased, this board can not boot.
  63. */
  64. static struct mtd_partition ap325rxa_nor_flash_partitions[] = {
  65. {
  66. .name = "uboot",
  67. .offset = 0,
  68. .size = (1 * 1024 * 1024),
  69. .mask_flags = MTD_WRITEABLE, /* Read-only */
  70. }, {
  71. .name = "kernel",
  72. .offset = MTDPART_OFS_APPEND,
  73. .size = (2 * 1024 * 1024),
  74. }, {
  75. .name = "free-area0",
  76. .offset = MTDPART_OFS_APPEND,
  77. .size = ((7 * 1024 * 1024) + (512 * 1024)),
  78. }, {
  79. .name = "CPLD-Data",
  80. .offset = MTDPART_OFS_APPEND,
  81. .mask_flags = MTD_WRITEABLE, /* Read-only */
  82. .size = (1024 * 128 * 2),
  83. }, {
  84. .name = "free-area1",
  85. .offset = MTDPART_OFS_APPEND,
  86. .size = MTDPART_SIZ_FULL,
  87. },
  88. };
  89. static struct physmap_flash_data ap325rxa_nor_flash_data = {
  90. .width = 2,
  91. .parts = ap325rxa_nor_flash_partitions,
  92. .nr_parts = ARRAY_SIZE(ap325rxa_nor_flash_partitions),
  93. };
  94. static struct resource ap325rxa_nor_flash_resources[] = {
  95. [0] = {
  96. .name = "NOR Flash",
  97. .start = 0x00000000,
  98. .end = 0x00ffffff,
  99. .flags = IORESOURCE_MEM,
  100. }
  101. };
  102. static struct platform_device ap325rxa_nor_flash_device = {
  103. .name = "physmap-flash",
  104. .resource = ap325rxa_nor_flash_resources,
  105. .num_resources = ARRAY_SIZE(ap325rxa_nor_flash_resources),
  106. .dev = {
  107. .platform_data = &ap325rxa_nor_flash_data,
  108. },
  109. };
  110. static struct mtd_partition nand_partition_info[] = {
  111. {
  112. .name = "nand_data",
  113. .offset = 0,
  114. .size = MTDPART_SIZ_FULL,
  115. },
  116. };
  117. static struct resource nand_flash_resources[] = {
  118. [0] = {
  119. .start = 0xa4530000,
  120. .end = 0xa45300ff,
  121. .flags = IORESOURCE_MEM,
  122. }
  123. };
  124. static struct sh_flctl_platform_data nand_flash_data = {
  125. .parts = nand_partition_info,
  126. .nr_parts = ARRAY_SIZE(nand_partition_info),
  127. .flcmncr_val = FCKSEL_E | TYPESEL_SET | NANWF_E,
  128. .has_hwecc = 1,
  129. };
  130. static struct platform_device nand_flash_device = {
  131. .name = "sh_flctl",
  132. .resource = nand_flash_resources,
  133. .num_resources = ARRAY_SIZE(nand_flash_resources),
  134. .dev = {
  135. .platform_data = &nand_flash_data,
  136. },
  137. };
  138. #define FPGA_LCDREG 0xB4100180
  139. #define FPGA_BKLREG 0xB4100212
  140. #define FPGA_LCDREG_VAL 0x0018
  141. #define PORT_MSELCRB 0xA4050182
  142. #define PORT_HIZCRC 0xA405015C
  143. #define PORT_DRVCRA 0xA405018A
  144. #define PORT_DRVCRB 0xA405018C
  145. static void ap320_wvga_power_on(void *board_data, struct fb_info *info)
  146. {
  147. msleep(100);
  148. /* ASD AP-320/325 LCD ON */
  149. __raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG);
  150. /* backlight */
  151. gpio_set_value(GPIO_PTS3, 0);
  152. __raw_writew(0x100, FPGA_BKLREG);
  153. }
  154. static void ap320_wvga_power_off(void *board_data)
  155. {
  156. /* backlight */
  157. __raw_writew(0, FPGA_BKLREG);
  158. gpio_set_value(GPIO_PTS3, 1);
  159. /* ASD AP-320/325 LCD OFF */
  160. __raw_writew(0, FPGA_LCDREG);
  161. }
  162. const static struct fb_videomode ap325rxa_lcdc_modes[] = {
  163. {
  164. .name = "LB070WV1",
  165. .xres = 800,
  166. .yres = 480,
  167. .left_margin = 32,
  168. .right_margin = 160,
  169. .hsync_len = 8,
  170. .upper_margin = 63,
  171. .lower_margin = 80,
  172. .vsync_len = 1,
  173. .sync = 0, /* hsync and vsync are active low */
  174. },
  175. };
  176. static struct sh_mobile_lcdc_info lcdc_info = {
  177. .clock_source = LCDC_CLK_EXTERNAL,
  178. .ch[0] = {
  179. .chan = LCDC_CHAN_MAINLCD,
  180. .bpp = 16,
  181. .interface_type = RGB18,
  182. .clock_divider = 1,
  183. .lcd_cfg = ap325rxa_lcdc_modes,
  184. .num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes),
  185. .lcd_size_cfg = { /* 7.0 inch */
  186. .width = 152,
  187. .height = 91,
  188. },
  189. .board_cfg = {
  190. .display_on = ap320_wvga_power_on,
  191. .display_off = ap320_wvga_power_off,
  192. },
  193. }
  194. };
  195. static struct resource lcdc_resources[] = {
  196. [0] = {
  197. .name = "LCDC",
  198. .start = 0xfe940000, /* P4-only space */
  199. .end = 0xfe942fff,
  200. .flags = IORESOURCE_MEM,
  201. },
  202. [1] = {
  203. .start = 28,
  204. .flags = IORESOURCE_IRQ,
  205. },
  206. };
  207. static struct platform_device lcdc_device = {
  208. .name = "sh_mobile_lcdc_fb",
  209. .num_resources = ARRAY_SIZE(lcdc_resources),
  210. .resource = lcdc_resources,
  211. .dev = {
  212. .platform_data = &lcdc_info,
  213. },
  214. .archdata = {
  215. .hwblk_id = HWBLK_LCDC,
  216. },
  217. };
  218. static void camera_power(int val)
  219. {
  220. gpio_set_value(GPIO_PTZ5, val); /* RST_CAM/RSTB */
  221. mdelay(10);
  222. }
  223. #ifdef CONFIG_I2C
  224. /* support for the old ncm03j camera */
  225. static unsigned char camera_ncm03j_magic[] =
  226. {
  227. 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8,
  228. 0x1D, 0x00, 0x1E, 0x8A, 0x21, 0x00, 0x33, 0x36,
  229. 0x36, 0x60, 0x37, 0x08, 0x3B, 0x31, 0x44, 0x0F,
  230. 0x46, 0xF0, 0x4B, 0x28, 0x4C, 0x21, 0x4D, 0x55,
  231. 0x4E, 0x1B, 0x4F, 0xC7, 0x50, 0xFC, 0x51, 0x12,
  232. 0x58, 0x02, 0x66, 0xC0, 0x67, 0x46, 0x6B, 0xA0,
  233. 0x6C, 0x34, 0x7E, 0x25, 0x7F, 0x25, 0x8D, 0x0F,
  234. 0x92, 0x40, 0x93, 0x04, 0x94, 0x26, 0x95, 0x0A,
  235. 0x99, 0x03, 0x9A, 0xF0, 0x9B, 0x14, 0x9D, 0x7A,
  236. 0xC5, 0x02, 0xD6, 0x07, 0x59, 0x00, 0x5A, 0x1A,
  237. 0x5B, 0x2A, 0x5C, 0x37, 0x5D, 0x42, 0x5E, 0x56,
  238. 0xC8, 0x00, 0xC9, 0x1A, 0xCA, 0x2A, 0xCB, 0x37,
  239. 0xCC, 0x42, 0xCD, 0x56, 0xCE, 0x00, 0xCF, 0x1A,
  240. 0xD0, 0x2A, 0xD1, 0x37, 0xD2, 0x42, 0xD3, 0x56,
  241. 0x5F, 0x68, 0x60, 0x87, 0x61, 0xA3, 0x62, 0xBC,
  242. 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F,
  243. };
  244. static int camera_probe(void)
  245. {
  246. struct i2c_adapter *a = i2c_get_adapter(0);
  247. struct i2c_msg msg;
  248. int ret;
  249. if (!a)
  250. return -ENODEV;
  251. camera_power(1);
  252. msg.addr = 0x6e;
  253. msg.buf = camera_ncm03j_magic;
  254. msg.len = 2;
  255. msg.flags = 0;
  256. ret = i2c_transfer(a, &msg, 1);
  257. camera_power(0);
  258. return ret;
  259. }
  260. static int camera_set_capture(struct soc_camera_platform_info *info,
  261. int enable)
  262. {
  263. struct i2c_adapter *a = i2c_get_adapter(0);
  264. struct i2c_msg msg;
  265. int ret = 0;
  266. int i;
  267. camera_power(0);
  268. if (!enable)
  269. return 0; /* no disable for now */
  270. camera_power(1);
  271. for (i = 0; i < ARRAY_SIZE(camera_ncm03j_magic); i += 2) {
  272. u_int8_t buf[8];
  273. msg.addr = 0x6e;
  274. msg.buf = buf;
  275. msg.len = 2;
  276. msg.flags = 0;
  277. buf[0] = camera_ncm03j_magic[i];
  278. buf[1] = camera_ncm03j_magic[i + 1];
  279. ret = (ret < 0) ? ret : i2c_transfer(a, &msg, 1);
  280. }
  281. return ret;
  282. }
  283. static int ap325rxa_camera_add(struct soc_camera_link *icl, struct device *dev);
  284. static void ap325rxa_camera_del(struct soc_camera_link *icl);
  285. static struct soc_camera_platform_info camera_info = {
  286. .format_name = "UYVY",
  287. .format_depth = 16,
  288. .format = {
  289. .code = V4L2_MBUS_FMT_UYVY8_2X8,
  290. .colorspace = V4L2_COLORSPACE_SMPTE170M,
  291. .field = V4L2_FIELD_NONE,
  292. .width = 640,
  293. .height = 480,
  294. },
  295. .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
  296. SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8 |
  297. SOCAM_DATA_ACTIVE_HIGH,
  298. .set_capture = camera_set_capture,
  299. };
  300. static struct soc_camera_link camera_link = {
  301. .bus_id = 0,
  302. .add_device = ap325rxa_camera_add,
  303. .del_device = ap325rxa_camera_del,
  304. .module_name = "soc_camera_platform",
  305. .priv = &camera_info,
  306. };
  307. static void dummy_release(struct device *dev)
  308. {
  309. }
  310. static struct platform_device camera_device = {
  311. .name = "soc_camera_platform",
  312. .dev = {
  313. .platform_data = &camera_info,
  314. .release = dummy_release,
  315. },
  316. };
  317. static int ap325rxa_camera_add(struct soc_camera_link *icl,
  318. struct device *dev)
  319. {
  320. if (icl != &camera_link || camera_probe() <= 0)
  321. return -ENODEV;
  322. camera_info.dev = dev;
  323. return platform_device_register(&camera_device);
  324. }
  325. static void ap325rxa_camera_del(struct soc_camera_link *icl)
  326. {
  327. if (icl != &camera_link)
  328. return;
  329. platform_device_unregister(&camera_device);
  330. memset(&camera_device.dev.kobj, 0,
  331. sizeof(camera_device.dev.kobj));
  332. }
  333. #endif /* CONFIG_I2C */
  334. static int ov7725_power(struct device *dev, int mode)
  335. {
  336. camera_power(0);
  337. if (mode)
  338. camera_power(1);
  339. return 0;
  340. }
  341. static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
  342. .flags = SH_CEU_FLAG_USE_8BIT_BUS,
  343. };
  344. static struct resource ceu_resources[] = {
  345. [0] = {
  346. .name = "CEU",
  347. .start = 0xfe910000,
  348. .end = 0xfe91009f,
  349. .flags = IORESOURCE_MEM,
  350. },
  351. [1] = {
  352. .start = 52,
  353. .flags = IORESOURCE_IRQ,
  354. },
  355. [2] = {
  356. /* place holder for contiguous memory */
  357. },
  358. };
  359. static struct platform_device ceu_device = {
  360. .name = "sh_mobile_ceu",
  361. .id = 0, /* "ceu0" clock */
  362. .num_resources = ARRAY_SIZE(ceu_resources),
  363. .resource = ceu_resources,
  364. .dev = {
  365. .platform_data = &sh_mobile_ceu_info,
  366. },
  367. .archdata = {
  368. .hwblk_id = HWBLK_CEU,
  369. },
  370. };
  371. static struct resource sdhi0_cn3_resources[] = {
  372. [0] = {
  373. .name = "SDHI0",
  374. .start = 0x04ce0000,
  375. .end = 0x04ce00ff,
  376. .flags = IORESOURCE_MEM,
  377. },
  378. [1] = {
  379. .start = 100,
  380. .flags = IORESOURCE_IRQ,
  381. },
  382. };
  383. static struct sh_mobile_sdhi_info sdhi0_cn3_data = {
  384. .tmio_caps = MMC_CAP_SDIO_IRQ,
  385. };
  386. static struct platform_device sdhi0_cn3_device = {
  387. .name = "sh_mobile_sdhi",
  388. .id = 0, /* "sdhi0" clock */
  389. .num_resources = ARRAY_SIZE(sdhi0_cn3_resources),
  390. .resource = sdhi0_cn3_resources,
  391. .dev = {
  392. .platform_data = &sdhi0_cn3_data,
  393. },
  394. .archdata = {
  395. .hwblk_id = HWBLK_SDHI0,
  396. },
  397. };
  398. static struct resource sdhi1_cn7_resources[] = {
  399. [0] = {
  400. .name = "SDHI1",
  401. .start = 0x04cf0000,
  402. .end = 0x04cf00ff,
  403. .flags = IORESOURCE_MEM,
  404. },
  405. [1] = {
  406. .start = 23,
  407. .flags = IORESOURCE_IRQ,
  408. },
  409. };
  410. static struct sh_mobile_sdhi_info sdhi1_cn7_data = {
  411. .tmio_caps = MMC_CAP_SDIO_IRQ,
  412. };
  413. static struct platform_device sdhi1_cn7_device = {
  414. .name = "sh_mobile_sdhi",
  415. .id = 1, /* "sdhi1" clock */
  416. .num_resources = ARRAY_SIZE(sdhi1_cn7_resources),
  417. .resource = sdhi1_cn7_resources,
  418. .dev = {
  419. .platform_data = &sdhi1_cn7_data,
  420. },
  421. .archdata = {
  422. .hwblk_id = HWBLK_SDHI1,
  423. },
  424. };
  425. static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
  426. {
  427. I2C_BOARD_INFO("pcf8563", 0x51),
  428. },
  429. };
  430. static struct i2c_board_info ap325rxa_i2c_camera[] = {
  431. {
  432. I2C_BOARD_INFO("ov772x", 0x21),
  433. },
  434. };
  435. static struct ov772x_camera_info ov7725_info = {
  436. .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP | \
  437. OV772X_FLAG_8BIT,
  438. .edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0),
  439. };
  440. static struct soc_camera_link ov7725_link = {
  441. .bus_id = 0,
  442. .power = ov7725_power,
  443. .board_info = &ap325rxa_i2c_camera[0],
  444. .i2c_adapter_id = 0,
  445. .priv = &ov7725_info,
  446. };
  447. static struct platform_device ap325rxa_camera[] = {
  448. {
  449. .name = "soc-camera-pdrv",
  450. .id = 0,
  451. .dev = {
  452. .platform_data = &ov7725_link,
  453. },
  454. }, {
  455. .name = "soc-camera-pdrv",
  456. .id = 1,
  457. .dev = {
  458. .platform_data = &camera_link,
  459. },
  460. },
  461. };
  462. static struct platform_device *ap325rxa_devices[] __initdata = {
  463. &smsc9118_device,
  464. &ap325rxa_nor_flash_device,
  465. &lcdc_device,
  466. &ceu_device,
  467. &nand_flash_device,
  468. &sdhi0_cn3_device,
  469. &sdhi1_cn7_device,
  470. &ap325rxa_camera[0],
  471. &ap325rxa_camera[1],
  472. };
  473. extern char ap325rxa_sdram_enter_start;
  474. extern char ap325rxa_sdram_enter_end;
  475. extern char ap325rxa_sdram_leave_start;
  476. extern char ap325rxa_sdram_leave_end;
  477. static int __init ap325rxa_devices_setup(void)
  478. {
  479. /* register board specific self-refresh code */
  480. sh_mobile_register_self_refresh(SUSP_SH_STANDBY | SUSP_SH_SF,
  481. &ap325rxa_sdram_enter_start,
  482. &ap325rxa_sdram_enter_end,
  483. &ap325rxa_sdram_leave_start,
  484. &ap325rxa_sdram_leave_end);
  485. /* LD3 and LD4 LEDs */
  486. gpio_request(GPIO_PTX5, NULL); /* RUN */
  487. gpio_direction_output(GPIO_PTX5, 1);
  488. gpio_export(GPIO_PTX5, 0);
  489. gpio_request(GPIO_PTX4, NULL); /* INDICATOR */
  490. gpio_direction_output(GPIO_PTX4, 0);
  491. gpio_export(GPIO_PTX4, 0);
  492. /* SW1 input */
  493. gpio_request(GPIO_PTF7, NULL); /* MODE */
  494. gpio_direction_input(GPIO_PTF7);
  495. gpio_export(GPIO_PTF7, 0);
  496. /* LCDC */
  497. gpio_request(GPIO_FN_LCDD15, NULL);
  498. gpio_request(GPIO_FN_LCDD14, NULL);
  499. gpio_request(GPIO_FN_LCDD13, NULL);
  500. gpio_request(GPIO_FN_LCDD12, NULL);
  501. gpio_request(GPIO_FN_LCDD11, NULL);
  502. gpio_request(GPIO_FN_LCDD10, NULL);
  503. gpio_request(GPIO_FN_LCDD9, NULL);
  504. gpio_request(GPIO_FN_LCDD8, NULL);
  505. gpio_request(GPIO_FN_LCDD7, NULL);
  506. gpio_request(GPIO_FN_LCDD6, NULL);
  507. gpio_request(GPIO_FN_LCDD5, NULL);
  508. gpio_request(GPIO_FN_LCDD4, NULL);
  509. gpio_request(GPIO_FN_LCDD3, NULL);
  510. gpio_request(GPIO_FN_LCDD2, NULL);
  511. gpio_request(GPIO_FN_LCDD1, NULL);
  512. gpio_request(GPIO_FN_LCDD0, NULL);
  513. gpio_request(GPIO_FN_LCDLCLK_PTR, NULL);
  514. gpio_request(GPIO_FN_LCDDCK, NULL);
  515. gpio_request(GPIO_FN_LCDVEPWC, NULL);
  516. gpio_request(GPIO_FN_LCDVCPWC, NULL);
  517. gpio_request(GPIO_FN_LCDVSYN, NULL);
  518. gpio_request(GPIO_FN_LCDHSYN, NULL);
  519. gpio_request(GPIO_FN_LCDDISP, NULL);
  520. gpio_request(GPIO_FN_LCDDON, NULL);
  521. /* LCD backlight */
  522. gpio_request(GPIO_PTS3, NULL);
  523. gpio_direction_output(GPIO_PTS3, 1);
  524. /* CEU */
  525. gpio_request(GPIO_FN_VIO_CLK2, NULL);
  526. gpio_request(GPIO_FN_VIO_VD2, NULL);
  527. gpio_request(GPIO_FN_VIO_HD2, NULL);
  528. gpio_request(GPIO_FN_VIO_FLD, NULL);
  529. gpio_request(GPIO_FN_VIO_CKO, NULL);
  530. gpio_request(GPIO_FN_VIO_D15, NULL);
  531. gpio_request(GPIO_FN_VIO_D14, NULL);
  532. gpio_request(GPIO_FN_VIO_D13, NULL);
  533. gpio_request(GPIO_FN_VIO_D12, NULL);
  534. gpio_request(GPIO_FN_VIO_D11, NULL);
  535. gpio_request(GPIO_FN_VIO_D10, NULL);
  536. gpio_request(GPIO_FN_VIO_D9, NULL);
  537. gpio_request(GPIO_FN_VIO_D8, NULL);
  538. gpio_request(GPIO_PTZ7, NULL);
  539. gpio_direction_output(GPIO_PTZ7, 0); /* OE_CAM */
  540. gpio_request(GPIO_PTZ6, NULL);
  541. gpio_direction_output(GPIO_PTZ6, 0); /* STBY_CAM */
  542. gpio_request(GPIO_PTZ5, NULL);
  543. gpio_direction_output(GPIO_PTZ5, 0); /* RST_CAM */
  544. gpio_request(GPIO_PTZ4, NULL);
  545. gpio_direction_output(GPIO_PTZ4, 0); /* SADDR */
  546. __raw_writew(__raw_readw(PORT_MSELCRB) & ~0x0001, PORT_MSELCRB);
  547. /* FLCTL */
  548. gpio_request(GPIO_FN_FCE, NULL);
  549. gpio_request(GPIO_FN_NAF7, NULL);
  550. gpio_request(GPIO_FN_NAF6, NULL);
  551. gpio_request(GPIO_FN_NAF5, NULL);
  552. gpio_request(GPIO_FN_NAF4, NULL);
  553. gpio_request(GPIO_FN_NAF3, NULL);
  554. gpio_request(GPIO_FN_NAF2, NULL);
  555. gpio_request(GPIO_FN_NAF1, NULL);
  556. gpio_request(GPIO_FN_NAF0, NULL);
  557. gpio_request(GPIO_FN_FCDE, NULL);
  558. gpio_request(GPIO_FN_FOE, NULL);
  559. gpio_request(GPIO_FN_FSC, NULL);
  560. gpio_request(GPIO_FN_FWE, NULL);
  561. gpio_request(GPIO_FN_FRB, NULL);
  562. __raw_writew(0, PORT_HIZCRC);
  563. __raw_writew(0xFFFF, PORT_DRVCRA);
  564. __raw_writew(0xFFFF, PORT_DRVCRB);
  565. platform_resource_setup_memory(&ceu_device, "ceu", 4 << 20);
  566. /* SDHI0 - CN3 - SD CARD */
  567. gpio_request(GPIO_FN_SDHI0CD_PTD, NULL);
  568. gpio_request(GPIO_FN_SDHI0WP_PTD, NULL);
  569. gpio_request(GPIO_FN_SDHI0D3_PTD, NULL);
  570. gpio_request(GPIO_FN_SDHI0D2_PTD, NULL);
  571. gpio_request(GPIO_FN_SDHI0D1_PTD, NULL);
  572. gpio_request(GPIO_FN_SDHI0D0_PTD, NULL);
  573. gpio_request(GPIO_FN_SDHI0CMD_PTD, NULL);
  574. gpio_request(GPIO_FN_SDHI0CLK_PTD, NULL);
  575. /* SDHI1 - CN7 - MICRO SD CARD */
  576. gpio_request(GPIO_FN_SDHI1CD, NULL);
  577. gpio_request(GPIO_FN_SDHI1D3, NULL);
  578. gpio_request(GPIO_FN_SDHI1D2, NULL);
  579. gpio_request(GPIO_FN_SDHI1D1, NULL);
  580. gpio_request(GPIO_FN_SDHI1D0, NULL);
  581. gpio_request(GPIO_FN_SDHI1CMD, NULL);
  582. gpio_request(GPIO_FN_SDHI1CLK, NULL);
  583. i2c_register_board_info(0, ap325rxa_i2c_devices,
  584. ARRAY_SIZE(ap325rxa_i2c_devices));
  585. return platform_add_devices(ap325rxa_devices,
  586. ARRAY_SIZE(ap325rxa_devices));
  587. }
  588. arch_initcall(ap325rxa_devices_setup);
  589. /* Return the board specific boot mode pin configuration */
  590. static int ap325rxa_mode_pins(void)
  591. {
  592. /* MD0=0, MD1=0, MD2=0: Clock Mode 0
  593. * MD3=0: 16-bit Area0 Bus Width
  594. * MD5=1: Little Endian
  595. * TSTMD=1, MD8=1: Test Mode Disabled
  596. */
  597. return MODE_PIN5 | MODE_PIN8;
  598. }
  599. static struct sh_machine_vector mv_ap325rxa __initmv = {
  600. .mv_name = "AP-325RXA",
  601. .mv_mode_pins = ap325rxa_mode_pins,
  602. };