board-ag5evm.c 17 KB

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