board-ag5evm.c 16 KB

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