board-ag5evm.c 15 KB

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