setup.c 16 KB

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