setup.c 16 KB

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