board-ag5evm.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  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/irqchip/arm-gic.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/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_mipi_dsi_info mipidsi0_info = {
  247. .data_format = MIPI_RGB888,
  248. .channel = LCDC_CHAN_MAINLCD,
  249. .lane = 2,
  250. .vsynw_offset = 20,
  251. .clksrc = 1,
  252. .flags = SH_MIPI_DSI_HSABM |
  253. SH_MIPI_DSI_SYNC_PULSES_MODE |
  254. SH_MIPI_DSI_HSbyteCLK,
  255. .set_dot_clock = sh_mipi_set_dot_clock,
  256. };
  257. static struct platform_device mipidsi0_device = {
  258. .name = "sh-mipi-dsi",
  259. .num_resources = ARRAY_SIZE(mipidsi0_resources),
  260. .resource = mipidsi0_resources,
  261. .id = 0,
  262. .dev = {
  263. .platform_data = &mipidsi0_info,
  264. },
  265. };
  266. static unsigned char lcd_backlight_seq[3][2] = {
  267. { 0x04, 0x07 },
  268. { 0x23, 0x80 },
  269. { 0x03, 0x01 },
  270. };
  271. static int lcd_backlight_set_brightness(int brightness)
  272. {
  273. struct i2c_adapter *adap;
  274. struct i2c_msg msg;
  275. unsigned int i;
  276. int ret;
  277. if (brightness == 0) {
  278. /* Reset the chip */
  279. gpio_set_value(GPIO_PORT235, 0);
  280. mdelay(24);
  281. gpio_set_value(GPIO_PORT235, 1);
  282. return 0;
  283. }
  284. adap = i2c_get_adapter(1);
  285. if (adap == NULL)
  286. return -ENODEV;
  287. for (i = 0; i < ARRAY_SIZE(lcd_backlight_seq); i++) {
  288. msg.addr = 0x6d;
  289. msg.buf = &lcd_backlight_seq[i][0];
  290. msg.len = 2;
  291. msg.flags = 0;
  292. ret = i2c_transfer(adap, &msg, 1);
  293. if (ret < 0)
  294. break;
  295. }
  296. i2c_put_adapter(adap);
  297. return ret < 0 ? ret : 0;
  298. }
  299. /* LCDC0 */
  300. static const struct fb_videomode lcdc0_modes[] = {
  301. {
  302. .name = "R63302(QHD)",
  303. .xres = 544,
  304. .yres = 961,
  305. .left_margin = 72,
  306. .right_margin = 600,
  307. .hsync_len = 16,
  308. .upper_margin = 8,
  309. .lower_margin = 8,
  310. .vsync_len = 2,
  311. .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
  312. },
  313. };
  314. static struct sh_mobile_lcdc_info lcdc0_info = {
  315. .clock_source = LCDC_CLK_PERIPHERAL,
  316. .ch[0] = {
  317. .chan = LCDC_CHAN_MAINLCD,
  318. .interface_type = RGB24,
  319. .clock_divider = 1,
  320. .flags = LCDC_FLAGS_DWPOL,
  321. .fourcc = V4L2_PIX_FMT_RGB565,
  322. .lcd_modes = lcdc0_modes,
  323. .num_modes = ARRAY_SIZE(lcdc0_modes),
  324. .panel_cfg = {
  325. .width = 44,
  326. .height = 79,
  327. },
  328. .bl_info = {
  329. .name = "sh_mobile_lcdc_bl",
  330. .max_brightness = 1,
  331. .set_brightness = lcd_backlight_set_brightness,
  332. },
  333. .tx_dev = &mipidsi0_device,
  334. }
  335. };
  336. static struct resource lcdc0_resources[] = {
  337. [0] = {
  338. .name = "LCDC0",
  339. .start = 0xfe940000, /* P4-only space */
  340. .end = 0xfe943fff,
  341. .flags = IORESOURCE_MEM,
  342. },
  343. [1] = {
  344. .start = intcs_evt2irq(0x580),
  345. .flags = IORESOURCE_IRQ,
  346. },
  347. };
  348. static struct platform_device lcdc0_device = {
  349. .name = "sh_mobile_lcdc_fb",
  350. .num_resources = ARRAY_SIZE(lcdc0_resources),
  351. .resource = lcdc0_resources,
  352. .id = 0,
  353. .dev = {
  354. .platform_data = &lcdc0_info,
  355. .coherent_dma_mask = ~0,
  356. },
  357. };
  358. /* Fixed 2.8V regulators to be used by SDHI0 */
  359. static struct regulator_consumer_supply fixed2v8_power_consumers[] =
  360. {
  361. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
  362. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
  363. };
  364. /* SDHI0 */
  365. static struct sh_mobile_sdhi_info sdhi0_info = {
  366. .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
  367. .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
  368. .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
  369. .tmio_caps = MMC_CAP_SD_HIGHSPEED,
  370. .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
  371. .cd_gpio = GPIO_PORT251,
  372. };
  373. static struct resource sdhi0_resources[] = {
  374. [0] = {
  375. .name = "SDHI0",
  376. .start = 0xee100000,
  377. .end = 0xee1000ff,
  378. .flags = IORESOURCE_MEM,
  379. },
  380. [1] = {
  381. .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
  382. .start = gic_spi(83),
  383. .flags = IORESOURCE_IRQ,
  384. },
  385. [2] = {
  386. .name = SH_MOBILE_SDHI_IRQ_SDCARD,
  387. .start = gic_spi(84),
  388. .flags = IORESOURCE_IRQ,
  389. },
  390. [3] = {
  391. .name = SH_MOBILE_SDHI_IRQ_SDIO,
  392. .start = gic_spi(85),
  393. .flags = IORESOURCE_IRQ,
  394. },
  395. };
  396. static struct platform_device sdhi0_device = {
  397. .name = "sh_mobile_sdhi",
  398. .id = 0,
  399. .num_resources = ARRAY_SIZE(sdhi0_resources),
  400. .resource = sdhi0_resources,
  401. .dev = {
  402. .platform_data = &sdhi0_info,
  403. },
  404. };
  405. /* Fixed 3.3V regulator to be used by SDHI1 */
  406. static struct regulator_consumer_supply cn4_power_consumers[] =
  407. {
  408. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
  409. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
  410. };
  411. static struct regulator_init_data cn4_power_init_data = {
  412. .constraints = {
  413. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  414. },
  415. .num_consumer_supplies = ARRAY_SIZE(cn4_power_consumers),
  416. .consumer_supplies = cn4_power_consumers,
  417. };
  418. static struct fixed_voltage_config cn4_power_info = {
  419. .supply_name = "CN4 SD/MMC Vdd",
  420. .microvolts = 3300000,
  421. .gpio = GPIO_PORT114,
  422. .enable_high = 1,
  423. .init_data = &cn4_power_init_data,
  424. };
  425. static struct platform_device cn4_power = {
  426. .name = "reg-fixed-voltage",
  427. .id = 2,
  428. .dev = {
  429. .platform_data = &cn4_power_info,
  430. },
  431. };
  432. static void ag5evm_sdhi1_set_pwr(struct platform_device *pdev, int state)
  433. {
  434. static int power_gpio = -EINVAL;
  435. if (power_gpio < 0) {
  436. int ret = gpio_request_one(GPIO_PORT114, GPIOF_OUT_INIT_LOW,
  437. "sdhi1_power");
  438. if (!ret)
  439. power_gpio = GPIO_PORT114;
  440. }
  441. /*
  442. * If requesting the GPIO above failed, it means, that the regulator got
  443. * probed and grabbed the GPIO, but we don't know, whether the sdhi
  444. * driver already uses the regulator. If it doesn't, we have to toggle
  445. * the GPIO ourselves, even though it is now owned by the fixed
  446. * regulator driver. We have to live with the race in case the driver
  447. * gets unloaded and the GPIO freed between these two steps.
  448. */
  449. gpio_set_value(GPIO_PORT114, state);
  450. }
  451. static struct sh_mobile_sdhi_info sh_sdhi1_info = {
  452. .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
  453. .tmio_caps = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ,
  454. .tmio_ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  455. .set_pwr = ag5evm_sdhi1_set_pwr,
  456. };
  457. static struct resource sdhi1_resources[] = {
  458. [0] = {
  459. .name = "SDHI1",
  460. .start = 0xee120000,
  461. .end = 0xee1200ff,
  462. .flags = IORESOURCE_MEM,
  463. },
  464. [1] = {
  465. .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
  466. .start = gic_spi(87),
  467. .flags = IORESOURCE_IRQ,
  468. },
  469. [2] = {
  470. .name = SH_MOBILE_SDHI_IRQ_SDCARD,
  471. .start = gic_spi(88),
  472. .flags = IORESOURCE_IRQ,
  473. },
  474. [3] = {
  475. .name = SH_MOBILE_SDHI_IRQ_SDIO,
  476. .start = gic_spi(89),
  477. .flags = IORESOURCE_IRQ,
  478. },
  479. };
  480. static struct platform_device sdhi1_device = {
  481. .name = "sh_mobile_sdhi",
  482. .id = 1,
  483. .dev = {
  484. .platform_data = &sh_sdhi1_info,
  485. },
  486. .num_resources = ARRAY_SIZE(sdhi1_resources),
  487. .resource = sdhi1_resources,
  488. };
  489. static struct platform_device *ag5evm_devices[] __initdata = {
  490. &cn4_power,
  491. &eth_device,
  492. &keysc_device,
  493. &fsi_device,
  494. &mmc_device,
  495. &irda_device,
  496. &mipidsi0_device,
  497. &lcdc0_device,
  498. &sdhi0_device,
  499. &sdhi1_device,
  500. };
  501. static void __init ag5evm_init(void)
  502. {
  503. regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
  504. ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
  505. regulator_register_always_on(1, "fixed-2.8V", fixed2v8_power_consumers,
  506. ARRAY_SIZE(fixed2v8_power_consumers), 3300000);
  507. regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies));
  508. sh73a0_pinmux_init();
  509. /* enable SCIFA2 */
  510. gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
  511. gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
  512. gpio_request(GPIO_FN_SCIFA2_RTS1_, NULL);
  513. gpio_request(GPIO_FN_SCIFA2_CTS1_, NULL);
  514. /* enable KEYSC */
  515. gpio_request(GPIO_FN_KEYIN0_PU, NULL);
  516. gpio_request(GPIO_FN_KEYIN1_PU, NULL);
  517. gpio_request(GPIO_FN_KEYIN2_PU, NULL);
  518. gpio_request(GPIO_FN_KEYIN3_PU, NULL);
  519. gpio_request(GPIO_FN_KEYIN4_PU, NULL);
  520. gpio_request(GPIO_FN_KEYIN5_PU, NULL);
  521. gpio_request(GPIO_FN_KEYIN6_PU, NULL);
  522. gpio_request(GPIO_FN_KEYIN7_PU, NULL);
  523. gpio_request(GPIO_FN_KEYOUT0, NULL);
  524. gpio_request(GPIO_FN_KEYOUT1, NULL);
  525. gpio_request(GPIO_FN_KEYOUT2, NULL);
  526. gpio_request(GPIO_FN_KEYOUT3, NULL);
  527. gpio_request(GPIO_FN_KEYOUT4, NULL);
  528. gpio_request(GPIO_FN_KEYOUT5, NULL);
  529. gpio_request(GPIO_FN_PORT59_KEYOUT6, NULL);
  530. gpio_request(GPIO_FN_PORT58_KEYOUT7, NULL);
  531. gpio_request(GPIO_FN_KEYOUT8, NULL);
  532. gpio_request(GPIO_FN_PORT149_KEYOUT9, NULL);
  533. /* enable I2C channel 2 and 3 */
  534. gpio_request(GPIO_FN_PORT236_I2C_SDA2, NULL);
  535. gpio_request(GPIO_FN_PORT237_I2C_SCL2, NULL);
  536. gpio_request(GPIO_FN_PORT248_I2C_SCL3, NULL);
  537. gpio_request(GPIO_FN_PORT249_I2C_SDA3, NULL);
  538. /* enable MMCIF */
  539. gpio_request(GPIO_FN_MMCCLK0, NULL);
  540. gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
  541. gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
  542. gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
  543. gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
  544. gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
  545. gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
  546. gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
  547. gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
  548. gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
  549. gpio_request_one(GPIO_PORT208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */
  550. /* enable SMSC911X */
  551. gpio_request_one(GPIO_PORT144, GPIOF_IN, NULL); /* PINTA2 */
  552. gpio_request_one(GPIO_PORT145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */
  553. /* FSI A */
  554. gpio_request(GPIO_FN_FSIACK, NULL);
  555. gpio_request(GPIO_FN_FSIAILR, NULL);
  556. gpio_request(GPIO_FN_FSIAIBT, NULL);
  557. gpio_request(GPIO_FN_FSIAISLD, NULL);
  558. gpio_request(GPIO_FN_FSIAOSLD, NULL);
  559. /* IrDA */
  560. gpio_request(GPIO_FN_PORT241_IRDA_OUT, NULL);
  561. gpio_request(GPIO_FN_PORT242_IRDA_IN, NULL);
  562. gpio_request(GPIO_FN_PORT243_IRDA_FIRSEL, NULL);
  563. /* LCD panel */
  564. gpio_request_one(GPIO_PORT217, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
  565. mdelay(1);
  566. gpio_set_value(GPIO_PORT217, 1);
  567. mdelay(100);
  568. /* LCD backlight controller */
  569. gpio_request_one(GPIO_PORT235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
  570. lcd_backlight_set_brightness(0);
  571. /* enable SDHI0 on CN15 [SD I/F] */
  572. gpio_request(GPIO_FN_SDHIWP0, NULL);
  573. gpio_request(GPIO_FN_SDHICMD0, NULL);
  574. gpio_request(GPIO_FN_SDHICLK0, NULL);
  575. gpio_request(GPIO_FN_SDHID0_3, NULL);
  576. gpio_request(GPIO_FN_SDHID0_2, NULL);
  577. gpio_request(GPIO_FN_SDHID0_1, NULL);
  578. gpio_request(GPIO_FN_SDHID0_0, NULL);
  579. /* enable SDHI1 on CN4 [WLAN I/F] */
  580. gpio_request(GPIO_FN_SDHICLK1, NULL);
  581. gpio_request(GPIO_FN_SDHICMD1_PU, NULL);
  582. gpio_request(GPIO_FN_SDHID1_3_PU, NULL);
  583. gpio_request(GPIO_FN_SDHID1_2_PU, NULL);
  584. gpio_request(GPIO_FN_SDHID1_1_PU, NULL);
  585. gpio_request(GPIO_FN_SDHID1_0_PU, NULL);
  586. #ifdef CONFIG_CACHE_L2X0
  587. /* Shared attribute override enable, 64K*8way */
  588. l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff);
  589. #endif
  590. sh73a0_add_standard_devices();
  591. platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
  592. }
  593. MACHINE_START(AG5EVM, "ag5evm")
  594. .smp = smp_ops(sh73a0_smp_ops),
  595. .map_io = sh73a0_map_io,
  596. .init_early = sh73a0_add_early_devices,
  597. .nr_irqs = NR_IRQS_LEGACY,
  598. .init_irq = sh73a0_init_irq,
  599. .init_machine = ag5evm_init,
  600. .init_late = shmobile_init_late,
  601. .init_time = sh73a0_earlytimer_init,
  602. MACHINE_END