setup.c 17 KB

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