board-ag5evm.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. /*
  2. * arch/arm/mach-shmobile/board-ag5evm.c
  3. *
  4. * Copyright (C) 2010 Takashi Yoshii <yoshii.takashi.zj@renesas.com>
  5. * Copyright (C) 2009 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  19. *
  20. */
  21. #include <linux/kernel.h>
  22. #include <linux/init.h>
  23. #include <linux/interrupt.h>
  24. #include <linux/irq.h>
  25. #include <linux/platform_device.h>
  26. #include <linux/delay.h>
  27. #include <linux/io.h>
  28. #include <linux/dma-mapping.h>
  29. #include <linux/regulator/fixed.h>
  30. #include <linux/regulator/machine.h>
  31. #include <linux/serial_sci.h>
  32. #include <linux/smsc911x.h>
  33. #include <linux/gpio.h>
  34. #include <linux/videodev2.h>
  35. #include <linux/input.h>
  36. #include <linux/input/sh_keysc.h>
  37. #include <linux/mmc/host.h>
  38. #include <linux/mmc/sh_mmcif.h>
  39. #include <linux/mmc/sh_mobile_sdhi.h>
  40. #include <linux/mfd/tmio.h>
  41. #include <linux/sh_clk.h>
  42. #include <video/sh_mobile_lcdc.h>
  43. #include <video/sh_mipi_dsi.h>
  44. #include <sound/sh_fsi.h>
  45. #include <mach/hardware.h>
  46. #include <mach/irqs.h>
  47. #include <mach/sh73a0.h>
  48. #include <mach/common.h>
  49. #include <asm/mach-types.h>
  50. #include <asm/mach/arch.h>
  51. #include <asm/hardware/gic.h>
  52. #include <asm/hardware/cache-l2x0.h>
  53. #include <asm/traps.h>
  54. /* Dummy supplies, where voltage doesn't matter */
  55. static struct regulator_consumer_supply dummy_supplies[] = {
  56. REGULATOR_SUPPLY("vddvario", "smsc911x"),
  57. REGULATOR_SUPPLY("vdd33a", "smsc911x"),
  58. };
  59. static struct resource smsc9220_resources[] = {
  60. [0] = {
  61. .start = 0x14000000,
  62. .end = 0x14000000 + SZ_64K - 1,
  63. .flags = IORESOURCE_MEM,
  64. },
  65. [1] = {
  66. .start = SH73A0_PINT0_IRQ(2), /* PINTA2 */
  67. .flags = IORESOURCE_IRQ,
  68. },
  69. };
  70. static struct smsc911x_platform_config smsc9220_platdata = {
  71. .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
  72. .phy_interface = PHY_INTERFACE_MODE_MII,
  73. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  74. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  75. };
  76. static struct platform_device eth_device = {
  77. .name = "smsc911x",
  78. .id = 0,
  79. .dev = {
  80. .platform_data = &smsc9220_platdata,
  81. },
  82. .resource = smsc9220_resources,
  83. .num_resources = ARRAY_SIZE(smsc9220_resources),
  84. };
  85. static struct sh_keysc_info keysc_platdata = {
  86. .mode = SH_KEYSC_MODE_6,
  87. .scan_timing = 3,
  88. .delay = 100,
  89. .keycodes = {
  90. KEY_A, KEY_B, KEY_C, KEY_D, KEY_E, KEY_F, KEY_G,
  91. KEY_H, KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, KEY_N,
  92. KEY_O, KEY_P, KEY_Q, KEY_R, KEY_S, KEY_T, KEY_U,
  93. KEY_V, KEY_W, KEY_X, KEY_Y, KEY_Z, KEY_HOME, KEY_SLEEP,
  94. KEY_SPACE, KEY_9, KEY_6, KEY_3, KEY_WAKEUP, KEY_RIGHT, \
  95. KEY_COFFEE,
  96. KEY_0, KEY_8, KEY_5, KEY_2, KEY_DOWN, KEY_ENTER, KEY_UP,
  97. KEY_KPASTERISK, KEY_7, KEY_4, KEY_1, KEY_STOP, KEY_LEFT, \
  98. KEY_COMPUTER,
  99. },
  100. };
  101. static struct resource keysc_resources[] = {
  102. [0] = {
  103. .name = "KEYSC",
  104. .start = 0xe61b0000,
  105. .end = 0xe61b0098 - 1,
  106. .flags = IORESOURCE_MEM,
  107. },
  108. [1] = {
  109. .start = gic_spi(71),
  110. .flags = IORESOURCE_IRQ,
  111. },
  112. };
  113. static struct platform_device keysc_device = {
  114. .name = "sh_keysc",
  115. .id = 0,
  116. .num_resources = ARRAY_SIZE(keysc_resources),
  117. .resource = keysc_resources,
  118. .dev = {
  119. .platform_data = &keysc_platdata,
  120. },
  121. };
  122. /* FSI A */
  123. static struct resource fsi_resources[] = {
  124. [0] = {
  125. .name = "FSI",
  126. .start = 0xEC230000,
  127. .end = 0xEC230400 - 1,
  128. .flags = IORESOURCE_MEM,
  129. },
  130. [1] = {
  131. .start = gic_spi(146),
  132. .flags = IORESOURCE_IRQ,
  133. },
  134. };
  135. static struct platform_device fsi_device = {
  136. .name = "sh_fsi2",
  137. .id = -1,
  138. .num_resources = ARRAY_SIZE(fsi_resources),
  139. .resource = fsi_resources,
  140. };
  141. /* Fixed 1.8V regulator to be used by MMCIF */
  142. static struct regulator_consumer_supply fixed1v8_power_consumers[] =
  143. {
  144. REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
  145. REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
  146. };
  147. static struct resource sh_mmcif_resources[] = {
  148. [0] = {
  149. .name = "MMCIF",
  150. .start = 0xe6bd0000,
  151. .end = 0xe6bd00ff,
  152. .flags = IORESOURCE_MEM,
  153. },
  154. [1] = {
  155. .start = gic_spi(141),
  156. .flags = IORESOURCE_IRQ,
  157. },
  158. [2] = {
  159. .start = gic_spi(140),
  160. .flags = IORESOURCE_IRQ,
  161. },
  162. };
  163. static struct sh_mmcif_plat_data sh_mmcif_platdata = {
  164. .sup_pclk = 0,
  165. .ocr = MMC_VDD_165_195,
  166. .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
  167. .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
  168. .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
  169. };
  170. static struct platform_device mmc_device = {
  171. .name = "sh_mmcif",
  172. .id = 0,
  173. .dev = {
  174. .dma_mask = NULL,
  175. .coherent_dma_mask = 0xffffffff,
  176. .platform_data = &sh_mmcif_platdata,
  177. },
  178. .num_resources = ARRAY_SIZE(sh_mmcif_resources),
  179. .resource = sh_mmcif_resources,
  180. };
  181. /* IrDA */
  182. static struct resource irda_resources[] = {
  183. [0] = {
  184. .start = 0xE6D00000,
  185. .end = 0xE6D01FD4 - 1,
  186. .flags = IORESOURCE_MEM,
  187. },
  188. [1] = {
  189. .start = gic_spi(95),
  190. .flags = IORESOURCE_IRQ,
  191. },
  192. };
  193. static struct platform_device irda_device = {
  194. .name = "sh_irda",
  195. .id = 0,
  196. .resource = irda_resources,
  197. .num_resources = ARRAY_SIZE(irda_resources),
  198. };
  199. /* MIPI-DSI */
  200. static struct resource mipidsi0_resources[] = {
  201. [0] = {
  202. .name = "DSI0",
  203. .start = 0xfeab0000,
  204. .end = 0xfeab3fff,
  205. .flags = IORESOURCE_MEM,
  206. },
  207. [1] = {
  208. .name = "DSI0",
  209. .start = 0xfeab4000,
  210. .end = 0xfeab7fff,
  211. .flags = IORESOURCE_MEM,
  212. },
  213. };
  214. static int sh_mipi_set_dot_clock(struct platform_device *pdev,
  215. void __iomem *base,
  216. int enable)
  217. {
  218. struct clk *pck, *phy;
  219. int ret;
  220. pck = clk_get(&pdev->dev, "dsip_clk");
  221. if (IS_ERR(pck)) {
  222. ret = PTR_ERR(pck);
  223. goto sh_mipi_set_dot_clock_pck_err;
  224. }
  225. phy = clk_get(&pdev->dev, "dsiphy_clk");
  226. if (IS_ERR(phy)) {
  227. ret = PTR_ERR(phy);
  228. goto sh_mipi_set_dot_clock_phy_err;
  229. }
  230. if (enable) {
  231. clk_set_rate(pck, clk_round_rate(pck, 24000000));
  232. clk_set_rate(phy, clk_round_rate(pck, 510000000));
  233. clk_enable(pck);
  234. clk_enable(phy);
  235. } else {
  236. clk_disable(pck);
  237. clk_disable(phy);
  238. }
  239. ret = 0;
  240. clk_put(phy);
  241. sh_mipi_set_dot_clock_phy_err:
  242. clk_put(pck);
  243. sh_mipi_set_dot_clock_pck_err:
  244. return ret;
  245. }
  246. static struct sh_mobile_lcdc_info lcdc0_info;
  247. static struct sh_mipi_dsi_info mipidsi0_info = {
  248. .data_format = MIPI_RGB888,
  249. .lcd_chan = &lcdc0_info.ch[0],
  250. .lane = 2,
  251. .vsynw_offset = 20,
  252. .clksrc = 1,
  253. .flags = SH_MIPI_DSI_HSABM |
  254. SH_MIPI_DSI_SYNC_PULSES_MODE |
  255. SH_MIPI_DSI_HSbyteCLK,
  256. .set_dot_clock = sh_mipi_set_dot_clock,
  257. };
  258. static struct platform_device mipidsi0_device = {
  259. .name = "sh-mipi-dsi",
  260. .num_resources = ARRAY_SIZE(mipidsi0_resources),
  261. .resource = mipidsi0_resources,
  262. .id = 0,
  263. .dev = {
  264. .platform_data = &mipidsi0_info,
  265. },
  266. };
  267. static unsigned char lcd_backlight_seq[3][2] = {
  268. { 0x04, 0x07 },
  269. { 0x23, 0x80 },
  270. { 0x03, 0x01 },
  271. };
  272. static void lcd_backlight_on(void)
  273. {
  274. struct i2c_adapter *a;
  275. struct i2c_msg msg;
  276. int k;
  277. a = i2c_get_adapter(1);
  278. for (k = 0; a && k < 3; k++) {
  279. msg.addr = 0x6d;
  280. msg.buf = &lcd_backlight_seq[k][0];
  281. msg.len = 2;
  282. msg.flags = 0;
  283. if (i2c_transfer(a, &msg, 1) != 1)
  284. break;
  285. }
  286. }
  287. static void lcd_backlight_reset(void)
  288. {
  289. gpio_set_value(GPIO_PORT235, 0);
  290. mdelay(24);
  291. gpio_set_value(GPIO_PORT235, 1);
  292. }
  293. /* LCDC0 */
  294. static const struct fb_videomode lcdc0_modes[] = {
  295. {
  296. .name = "R63302(QHD)",
  297. .xres = 544,
  298. .yres = 961,
  299. .left_margin = 72,
  300. .right_margin = 600,
  301. .hsync_len = 16,
  302. .upper_margin = 8,
  303. .lower_margin = 8,
  304. .vsync_len = 2,
  305. .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
  306. },
  307. };
  308. static struct sh_mobile_lcdc_info lcdc0_info = {
  309. .clock_source = LCDC_CLK_PERIPHERAL,
  310. .ch[0] = {
  311. .chan = LCDC_CHAN_MAINLCD,
  312. .interface_type = RGB24,
  313. .clock_divider = 1,
  314. .flags = LCDC_FLAGS_DWPOL,
  315. .fourcc = V4L2_PIX_FMT_RGB565,
  316. .lcd_modes = lcdc0_modes,
  317. .num_modes = ARRAY_SIZE(lcdc0_modes),
  318. .panel_cfg = {
  319. .width = 44,
  320. .height = 79,
  321. .display_on = lcd_backlight_on,
  322. .display_off = lcd_backlight_reset,
  323. },
  324. .tx_dev = &mipidsi0_device,
  325. }
  326. };
  327. static struct resource lcdc0_resources[] = {
  328. [0] = {
  329. .name = "LCDC0",
  330. .start = 0xfe940000, /* P4-only space */
  331. .end = 0xfe943fff,
  332. .flags = IORESOURCE_MEM,
  333. },
  334. [1] = {
  335. .start = intcs_evt2irq(0x580),
  336. .flags = IORESOURCE_IRQ,
  337. },
  338. };
  339. static struct platform_device lcdc0_device = {
  340. .name = "sh_mobile_lcdc_fb",
  341. .num_resources = ARRAY_SIZE(lcdc0_resources),
  342. .resource = lcdc0_resources,
  343. .id = 0,
  344. .dev = {
  345. .platform_data = &lcdc0_info,
  346. .coherent_dma_mask = ~0,
  347. },
  348. };
  349. /* Fixed 2.8V regulators to be used by SDHI0 */
  350. static struct regulator_consumer_supply fixed2v8_power_consumers[] =
  351. {
  352. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
  353. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
  354. };
  355. /* SDHI0 */
  356. static struct sh_mobile_sdhi_info sdhi0_info = {
  357. .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
  358. .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
  359. .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
  360. .tmio_caps = MMC_CAP_SD_HIGHSPEED,
  361. .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
  362. .cd_gpio = GPIO_PORT251,
  363. };
  364. static struct resource sdhi0_resources[] = {
  365. [0] = {
  366. .name = "SDHI0",
  367. .start = 0xee100000,
  368. .end = 0xee1000ff,
  369. .flags = IORESOURCE_MEM,
  370. },
  371. [1] = {
  372. .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
  373. .start = gic_spi(83),
  374. .flags = IORESOURCE_IRQ,
  375. },
  376. [2] = {
  377. .name = SH_MOBILE_SDHI_IRQ_SDCARD,
  378. .start = gic_spi(84),
  379. .flags = IORESOURCE_IRQ,
  380. },
  381. [3] = {
  382. .name = SH_MOBILE_SDHI_IRQ_SDIO,
  383. .start = gic_spi(85),
  384. .flags = IORESOURCE_IRQ,
  385. },
  386. };
  387. static struct platform_device sdhi0_device = {
  388. .name = "sh_mobile_sdhi",
  389. .id = 0,
  390. .num_resources = ARRAY_SIZE(sdhi0_resources),
  391. .resource = sdhi0_resources,
  392. .dev = {
  393. .platform_data = &sdhi0_info,
  394. },
  395. };
  396. /* Fixed 3.3V regulator to be used by SDHI1 */
  397. static struct regulator_consumer_supply cn4_power_consumers[] =
  398. {
  399. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
  400. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
  401. };
  402. static struct regulator_init_data cn4_power_init_data = {
  403. .constraints = {
  404. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  405. },
  406. .num_consumer_supplies = ARRAY_SIZE(cn4_power_consumers),
  407. .consumer_supplies = cn4_power_consumers,
  408. };
  409. static struct fixed_voltage_config cn4_power_info = {
  410. .supply_name = "CN4 SD/MMC Vdd",
  411. .microvolts = 3300000,
  412. .gpio = GPIO_PORT114,
  413. .enable_high = 1,
  414. .init_data = &cn4_power_init_data,
  415. };
  416. static struct platform_device cn4_power = {
  417. .name = "reg-fixed-voltage",
  418. .id = 2,
  419. .dev = {
  420. .platform_data = &cn4_power_info,
  421. },
  422. };
  423. static void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state)
  424. {
  425. static int power_gpio = -EINVAL;
  426. if (power_gpio < 0) {
  427. int ret = gpio_request(GPIO_PORT114, "sdhi1_power");
  428. if (!ret) {
  429. power_gpio = GPIO_PORT114;
  430. gpio_direction_output(power_gpio, 0);
  431. }
  432. }
  433. /*
  434. * If requesting the GPIO above failed, it means, that the regulator got
  435. * probed and grabbed the GPIO, but we don't know, whether the sdhi
  436. * driver already uses the regulator. If it doesn't, we have to toggle
  437. * the GPIO ourselves, even though it is now owned by the fixed
  438. * regulator driver. We have to live with the race in case the driver
  439. * gets unloaded and the GPIO freed between these two steps.
  440. */
  441. gpio_set_value(GPIO_PORT114, state);
  442. }
  443. static struct sh_mobile_sdhi_info sh_sdhi1_info = {
  444. .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
  445. .tmio_caps = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ,
  446. .tmio_ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  447. .set_pwr = ag5evm_sdhi1_set_pwr,
  448. };
  449. static struct resource sdhi1_resources[] = {
  450. [0] = {
  451. .name = "SDHI1",
  452. .start = 0xee120000,
  453. .end = 0xee1200ff,
  454. .flags = IORESOURCE_MEM,
  455. },
  456. [1] = {
  457. .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
  458. .start = gic_spi(87),
  459. .flags = IORESOURCE_IRQ,
  460. },
  461. [2] = {
  462. .name = SH_MOBILE_SDHI_IRQ_SDCARD,
  463. .start = gic_spi(88),
  464. .flags = IORESOURCE_IRQ,
  465. },
  466. [3] = {
  467. .name = SH_MOBILE_SDHI_IRQ_SDIO,
  468. .start = gic_spi(89),
  469. .flags = IORESOURCE_IRQ,
  470. },
  471. };
  472. static struct platform_device sdhi1_device = {
  473. .name = "sh_mobile_sdhi",
  474. .id = 1,
  475. .dev = {
  476. .platform_data = &sh_sdhi1_info,
  477. },
  478. .num_resources = ARRAY_SIZE(sdhi1_resources),
  479. .resource = sdhi1_resources,
  480. };
  481. static struct platform_device *ag5evm_devices[] __initdata = {
  482. &cn4_power,
  483. &eth_device,
  484. &keysc_device,
  485. &fsi_device,
  486. &mmc_device,
  487. &irda_device,
  488. &mipidsi0_device,
  489. &lcdc0_device,
  490. &sdhi0_device,
  491. &sdhi1_device,
  492. };
  493. static void __init ag5evm_init(void)
  494. {
  495. regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
  496. ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
  497. regulator_register_always_on(1, "fixed-2.8V", fixed2v8_power_consumers,
  498. ARRAY_SIZE(fixed2v8_power_consumers), 3300000);
  499. regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies));
  500. sh73a0_pinmux_init();
  501. /* enable SCIFA2 */
  502. gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
  503. gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
  504. gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
  505. gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
  506. /* enable KEYSC */
  507. gpio_request(GPIO_FN_KEYIN0_PU, NULL);
  508. gpio_request(GPIO_FN_KEYIN1_PU, NULL);
  509. gpio_request(GPIO_FN_KEYIN2_PU, NULL);
  510. gpio_request(GPIO_FN_KEYIN3_PU, NULL);
  511. gpio_request(GPIO_FN_KEYIN4_PU, NULL);
  512. gpio_request(GPIO_FN_KEYIN5_PU, NULL);
  513. gpio_request(GPIO_FN_KEYIN6_PU, NULL);
  514. gpio_request(GPIO_FN_KEYIN7_PU, NULL);
  515. gpio_request(GPIO_FN_KEYOUT0, NULL);
  516. gpio_request(GPIO_FN_KEYOUT1, NULL);
  517. gpio_request(GPIO_FN_KEYOUT2, NULL);
  518. gpio_request(GPIO_FN_KEYOUT3, NULL);
  519. gpio_request(GPIO_FN_KEYOUT4, NULL);
  520. gpio_request(GPIO_FN_KEYOUT5, NULL);
  521. gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL);
  522. gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL);
  523. gpio_request(GPIO_FN_KEYOUT8, NULL);
  524. gpio_request(GPIO_FN_PORT149_KEYOUT9, NULL);
  525. /* enable I2C channel 2 and 3 */
  526. gpio_request(GPIO_FN_PORT236_I2C_SDA2, NULL);
  527. gpio_request(GPIO_FN_PORT237_I2C_SCL2, NULL);
  528. gpio_request(GPIO_FN_PORT248_I2C_SCL3, NULL);
  529. gpio_request(GPIO_FN_PORT249_I2C_SDA3, NULL);
  530. /* enable MMCIF */
  531. gpio_request(GPIO_FN_MMCCLK0, NULL);
  532. gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
  533. gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
  534. gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
  535. gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
  536. gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
  537. gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
  538. gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
  539. gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
  540. gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
  541. gpio_request(GPIO_PORT208, NULL); /* Reset */
  542. gpio_direction_output(GPIO_PORT208, 1);
  543. /* enable SMSC911X */
  544. gpio_request(GPIO_PORT144, NULL); /* PINTA2 */
  545. gpio_direction_input(GPIO_PORT144);
  546. gpio_request(GPIO_PORT145, NULL); /* RESET */
  547. gpio_direction_output(GPIO_PORT145, 1);
  548. /* FSI A */
  549. gpio_request(GPIO_FN_FSIACK, NULL);
  550. gpio_request(GPIO_FN_FSIAILR, NULL);
  551. gpio_request(GPIO_FN_FSIAIBT, NULL);
  552. gpio_request(GPIO_FN_FSIAISLD, NULL);
  553. gpio_request(GPIO_FN_FSIAOSLD, NULL);
  554. /* IrDA */
  555. gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL);
  556. gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL);
  557. gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL);
  558. /* LCD panel */
  559. gpio_request(GPIO_PORT217, NULL); /* RESET */
  560. gpio_direction_output(GPIO_PORT217, 0);
  561. mdelay(1);
  562. gpio_set_value(GPIO_PORT217, 1);
  563. mdelay(100);
  564. /* LCD backlight controller */
  565. gpio_request(GPIO_PORT235, NULL); /* RESET */
  566. gpio_direction_output(GPIO_PORT235, 0);
  567. lcd_backlight_reset();
  568. /* enable SDHI0 on CN15 [SD I/F] */
  569. gpio_request(GPIO_FN_SDHIWP0, NULL);
  570. gpio_request(GPIO_FN_SDHICMD0, NULL);
  571. gpio_request(GPIO_FN_SDHICLK0, NULL);
  572. gpio_request(GPIO_FN_SDHID0_3, NULL);
  573. gpio_request(GPIO_FN_SDHID0_2, NULL);
  574. gpio_request(GPIO_FN_SDHID0_1, NULL);
  575. gpio_request(GPIO_FN_SDHID0_0, NULL);
  576. /* enable SDHI1 on CN4 [WLAN I/F] */
  577. gpio_request(GPIO_FN_SDHICLK1, NULL);
  578. gpio_request(GPIO_FN_SDHICMD1_PU, NULL);
  579. gpio_request(GPIO_FN_SDHID1_3_PU, NULL);
  580. gpio_request(GPIO_FN_SDHID1_2_PU, NULL);
  581. gpio_request(GPIO_FN_SDHID1_1_PU, NULL);
  582. gpio_request(GPIO_FN_SDHID1_0_PU, NULL);
  583. #ifdef CONFIG_CACHE_L2X0
  584. /* Shared attribute override enable, 64K*8way */
  585. l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff);
  586. #endif
  587. sh73a0_add_standard_devices();
  588. platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
  589. }
  590. MACHINE_START(AG5EVM, "ag5evm")
  591. .smp = smp_ops(sh73a0_smp_ops),
  592. .map_io = sh73a0_map_io,
  593. .init_early = sh73a0_add_early_devices,
  594. .nr_irqs = NR_IRQS_LEGACY,
  595. .init_irq = sh73a0_init_irq,
  596. .handle_irq = gic_handle_irq,
  597. .init_machine = ag5evm_init,
  598. .init_late = shmobile_init_late,
  599. .timer = &shmobile_timer,
  600. MACHINE_END