board-armadillo800eva.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. /*
  2. * armadillo 800 eva board support
  3. *
  4. * Copyright (C) 2012 Renesas Solutions Corp.
  5. * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@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/clk.h>
  22. #include <linux/delay.h>
  23. #include <linux/err.h>
  24. #include <linux/kernel.h>
  25. #include <linux/input.h>
  26. #include <linux/irq.h>
  27. #include <linux/platform_device.h>
  28. #include <linux/gpio.h>
  29. #include <linux/gpio_keys.h>
  30. #include <linux/sh_eth.h>
  31. #include <linux/videodev2.h>
  32. #include <linux/usb/renesas_usbhs.h>
  33. #include <linux/mfd/tmio.h>
  34. #include <linux/mmc/host.h>
  35. #include <linux/mmc/sh_mobile_sdhi.h>
  36. #include <mach/common.h>
  37. #include <mach/irqs.h>
  38. #include <asm/page.h>
  39. #include <asm/mach-types.h>
  40. #include <asm/mach/arch.h>
  41. #include <asm/mach/map.h>
  42. #include <asm/mach/time.h>
  43. #include <asm/hardware/cache-l2x0.h>
  44. #include <mach/r8a7740.h>
  45. #include <video/sh_mobile_lcdc.h>
  46. /*
  47. * CON1 Camera Module
  48. * CON2 Extension Bus
  49. * CON3 HDMI Output
  50. * CON4 Composite Video Output
  51. * CON5 H-UDI JTAG
  52. * CON6 ARM JTAG
  53. * CON7 SD1
  54. * CON8 SD2
  55. * CON9 RTC BackUp
  56. * CON10 Monaural Mic Input
  57. * CON11 Stereo Headphone Output
  58. * CON12 Audio Line Output(L)
  59. * CON13 Audio Line Output(R)
  60. * CON14 AWL13 Module
  61. * CON15 Extension
  62. * CON16 LCD1
  63. * CON17 LCD2
  64. * CON19 Power Input
  65. * CON20 USB1
  66. * CON21 USB2
  67. * CON22 Serial
  68. * CON23 LAN
  69. * CON24 USB3
  70. * LED1 Camera LED(Yellow)
  71. * LED2 Power LED (Green)
  72. * ED3-LED6 User LED(Yellow)
  73. * LED7 LAN link LED(Green)
  74. * LED8 LAN activity LED(Yellow)
  75. */
  76. /*
  77. * DipSwitch
  78. *
  79. * SW1
  80. *
  81. * -12345678-+---------------+----------------------------
  82. * 1 | boot | hermit
  83. * 0 | boot | OS auto boot
  84. * -12345678-+---------------+----------------------------
  85. * 00 | boot device | eMMC
  86. * 10 | boot device | SDHI0 (CON7)
  87. * 01 | boot device | -
  88. * 11 | boot device | Extension Buss (CS0)
  89. * -12345678-+---------------+----------------------------
  90. * 0 | Extension Bus | D8-D15 disable, eMMC enable
  91. * 1 | Extension Bus | D8-D15 enable, eMMC disable
  92. * -12345678-+---------------+----------------------------
  93. * 0 | SDHI1 | COM8 enable, COM14 disable
  94. * 1 | SDHI1 | COM8 enable, COM14 disable
  95. * -12345678-+---------------+----------------------------
  96. * 0 | USB0 | COM20 enable, COM24 disable
  97. * 1 | USB0 | COM20 disable, COM24 enable
  98. * -12345678-+---------------+----------------------------
  99. * 00 | JTAG | SH-X2
  100. * 10 | JTAG | ARM
  101. * 01 | JTAG | -
  102. * 11 | JTAG | Boundary Scan
  103. *-----------+---------------+----------------------------
  104. */
  105. /*
  106. * USB function
  107. *
  108. * When you use USB Function,
  109. * set SW1.6 ON, and connect cable to CN24.
  110. *
  111. * USBF needs workaround on R8A7740 chip.
  112. * These are a little bit complex.
  113. * see
  114. * usbhsf_power_ctrl()
  115. *
  116. * CAUTION
  117. *
  118. * It uses autonomy mode for USB hotplug at this point
  119. * (= usbhs_private.platform_callback.get_vbus is NULL),
  120. * since we don't know what's happen on PM control
  121. * on this workaround.
  122. */
  123. #define USBCR1 0xe605810a
  124. #define USBH 0xC6700000
  125. #define USBH_USBCTR 0x10834
  126. struct usbhsf_private {
  127. struct clk *phy;
  128. struct clk *usb24;
  129. struct clk *pci;
  130. struct clk *func;
  131. struct clk *host;
  132. void __iomem *usbh_base;
  133. struct renesas_usbhs_platform_info info;
  134. };
  135. #define usbhsf_get_priv(pdev) \
  136. container_of(renesas_usbhs_get_info(pdev), \
  137. struct usbhsf_private, info)
  138. static int usbhsf_get_id(struct platform_device *pdev)
  139. {
  140. return USBHS_GADGET;
  141. }
  142. static void usbhsf_power_ctrl(struct platform_device *pdev,
  143. void __iomem *base, int enable)
  144. {
  145. struct usbhsf_private *priv = usbhsf_get_priv(pdev);
  146. /*
  147. * Work around for USB Function.
  148. * It needs USB host clock, and settings
  149. */
  150. if (enable) {
  151. /*
  152. * enable all the related usb clocks
  153. * for usb workaround
  154. */
  155. clk_enable(priv->usb24);
  156. clk_enable(priv->pci);
  157. clk_enable(priv->host);
  158. clk_enable(priv->func);
  159. clk_enable(priv->phy);
  160. /*
  161. * set USBCR1
  162. *
  163. * Port1 is driven by USB function,
  164. * Port2 is driven by USB HOST
  165. * One HOST (Port1 or Port2 is HOST)
  166. * USB PLL input clock = 24MHz
  167. */
  168. __raw_writew(0xd750, USBCR1);
  169. mdelay(1);
  170. /*
  171. * start USB Host
  172. */
  173. __raw_writel(0x0000000c, priv->usbh_base + USBH_USBCTR);
  174. __raw_writel(0x00000008, priv->usbh_base + USBH_USBCTR);
  175. mdelay(10);
  176. /*
  177. * USB PHY Power ON
  178. */
  179. __raw_writew(0xd770, USBCR1);
  180. __raw_writew(0x4000, base + 0x102); /* USBF :: SUSPMODE */
  181. } else {
  182. __raw_writel(0x0000010f, priv->usbh_base + USBH_USBCTR);
  183. __raw_writew(0xd7c0, USBCR1); /* GPIO */
  184. clk_disable(priv->phy);
  185. clk_disable(priv->func); /* usb work around */
  186. clk_disable(priv->host); /* usb work around */
  187. clk_disable(priv->pci); /* usb work around */
  188. clk_disable(priv->usb24); /* usb work around */
  189. }
  190. }
  191. static void usbhsf_hardware_exit(struct platform_device *pdev)
  192. {
  193. struct usbhsf_private *priv = usbhsf_get_priv(pdev);
  194. if (!IS_ERR(priv->phy))
  195. clk_put(priv->phy);
  196. if (!IS_ERR(priv->usb24))
  197. clk_put(priv->usb24);
  198. if (!IS_ERR(priv->pci))
  199. clk_put(priv->pci);
  200. if (!IS_ERR(priv->host))
  201. clk_put(priv->host);
  202. if (!IS_ERR(priv->func))
  203. clk_put(priv->func);
  204. if (priv->usbh_base)
  205. iounmap(priv->usbh_base);
  206. priv->phy = NULL;
  207. priv->usb24 = NULL;
  208. priv->pci = NULL;
  209. priv->host = NULL;
  210. priv->func = NULL;
  211. priv->usbh_base = NULL;
  212. }
  213. static int usbhsf_hardware_init(struct platform_device *pdev)
  214. {
  215. struct usbhsf_private *priv = usbhsf_get_priv(pdev);
  216. priv->phy = clk_get(&pdev->dev, "phy");
  217. priv->usb24 = clk_get(&pdev->dev, "usb24");
  218. priv->pci = clk_get(&pdev->dev, "pci");
  219. priv->func = clk_get(&pdev->dev, "func");
  220. priv->host = clk_get(&pdev->dev, "host");
  221. priv->usbh_base = ioremap_nocache(USBH, 0x20000);
  222. if (IS_ERR(priv->phy) ||
  223. IS_ERR(priv->usb24) ||
  224. IS_ERR(priv->pci) ||
  225. IS_ERR(priv->host) ||
  226. IS_ERR(priv->func) ||
  227. !priv->usbh_base) {
  228. dev_err(&pdev->dev, "USB clock setting failed\n");
  229. usbhsf_hardware_exit(pdev);
  230. return -EIO;
  231. }
  232. /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
  233. clk_set_rate(priv->usb24,
  234. clk_get_rate(clk_get_parent(priv->usb24)));
  235. return 0;
  236. }
  237. static struct usbhsf_private usbhsf_private = {
  238. .info = {
  239. .platform_callback = {
  240. .get_id = usbhsf_get_id,
  241. .hardware_init = usbhsf_hardware_init,
  242. .hardware_exit = usbhsf_hardware_exit,
  243. .power_ctrl = usbhsf_power_ctrl,
  244. },
  245. .driver_param = {
  246. .buswait_bwait = 5,
  247. .detection_delay = 5,
  248. },
  249. }
  250. };
  251. static struct resource usbhsf_resources[] = {
  252. {
  253. .name = "USBHS",
  254. .start = 0xe6890000,
  255. .end = 0xe6890104 - 1,
  256. .flags = IORESOURCE_MEM,
  257. },
  258. {
  259. .start = evt2irq(0x0A20),
  260. .flags = IORESOURCE_IRQ,
  261. },
  262. };
  263. static struct platform_device usbhsf_device = {
  264. .name = "renesas_usbhs",
  265. .dev = {
  266. .platform_data = &usbhsf_private.info,
  267. },
  268. .id = -1,
  269. .num_resources = ARRAY_SIZE(usbhsf_resources),
  270. .resource = usbhsf_resources,
  271. };
  272. /* Ether */
  273. static struct sh_eth_plat_data sh_eth_platdata = {
  274. .phy = 0x00, /* LAN8710A */
  275. .edmac_endian = EDMAC_LITTLE_ENDIAN,
  276. .register_type = SH_ETH_REG_GIGABIT,
  277. .phy_interface = PHY_INTERFACE_MODE_MII,
  278. };
  279. static struct resource sh_eth_resources[] = {
  280. {
  281. .start = 0xe9a00000,
  282. .end = 0xe9a00800 - 1,
  283. .flags = IORESOURCE_MEM,
  284. }, {
  285. .start = 0xe9a01800,
  286. .end = 0xe9a02000 - 1,
  287. .flags = IORESOURCE_MEM,
  288. }, {
  289. .start = evt2irq(0x0500),
  290. .flags = IORESOURCE_IRQ,
  291. },
  292. };
  293. static struct platform_device sh_eth_device = {
  294. .name = "sh-eth",
  295. .dev = {
  296. .platform_data = &sh_eth_platdata,
  297. },
  298. .resource = sh_eth_resources,
  299. .num_resources = ARRAY_SIZE(sh_eth_resources),
  300. };
  301. /* LCDC */
  302. static struct fb_videomode lcdc0_mode = {
  303. .name = "AMPIER/AM-800480",
  304. .xres = 800,
  305. .yres = 480,
  306. .left_margin = 88,
  307. .right_margin = 40,
  308. .hsync_len = 128,
  309. .upper_margin = 20,
  310. .lower_margin = 5,
  311. .vsync_len = 5,
  312. .sync = 0,
  313. };
  314. static struct sh_mobile_lcdc_info lcdc0_info = {
  315. .clock_source = LCDC_CLK_BUS,
  316. .ch[0] = {
  317. .chan = LCDC_CHAN_MAINLCD,
  318. .fourcc = V4L2_PIX_FMT_RGB565,
  319. .interface_type = RGB24,
  320. .clock_divider = 5,
  321. .flags = 0,
  322. .lcd_modes = &lcdc0_mode,
  323. .num_modes = 1,
  324. .panel_cfg = {
  325. .width = 111,
  326. .height = 68,
  327. },
  328. },
  329. };
  330. static struct resource lcdc0_resources[] = {
  331. [0] = {
  332. .name = "LCD0",
  333. .start = 0xfe940000,
  334. .end = 0xfe943fff,
  335. .flags = IORESOURCE_MEM,
  336. },
  337. [1] = {
  338. .start = intcs_evt2irq(0x580),
  339. .flags = IORESOURCE_IRQ,
  340. },
  341. };
  342. static struct platform_device lcdc0_device = {
  343. .name = "sh_mobile_lcdc_fb",
  344. .num_resources = ARRAY_SIZE(lcdc0_resources),
  345. .resource = lcdc0_resources,
  346. .id = 0,
  347. .dev = {
  348. .platform_data = &lcdc0_info,
  349. .coherent_dma_mask = ~0,
  350. },
  351. };
  352. /* GPIO KEY */
  353. #define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
  354. static struct gpio_keys_button gpio_buttons[] = {
  355. GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW1"),
  356. GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW2"),
  357. GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW3"),
  358. GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW4"),
  359. };
  360. static struct gpio_keys_platform_data gpio_key_info = {
  361. .buttons = gpio_buttons,
  362. .nbuttons = ARRAY_SIZE(gpio_buttons),
  363. };
  364. static struct platform_device gpio_keys_device = {
  365. .name = "gpio-keys",
  366. .id = -1,
  367. .dev = {
  368. .platform_data = &gpio_key_info,
  369. },
  370. };
  371. /* SDHI0 */
  372. /*
  373. * FIXME
  374. *
  375. * It use polling mode here, since
  376. * CD (= Card Detect) pin is not connected to SDHI0_CD.
  377. * We can use IRQ31 as card detect irq,
  378. * but it needs chattering removal operation
  379. */
  380. #define IRQ31 evt2irq(0x33E0)
  381. static struct sh_mobile_sdhi_info sdhi0_info = {
  382. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\
  383. MMC_CAP_NEEDS_POLL,
  384. .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
  385. .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
  386. };
  387. static struct resource sdhi0_resources[] = {
  388. {
  389. .name = "SDHI0",
  390. .start = 0xe6850000,
  391. .end = 0xe6850100 - 1,
  392. .flags = IORESOURCE_MEM,
  393. },
  394. /*
  395. * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
  396. */
  397. {
  398. .name = SH_MOBILE_SDHI_IRQ_SDCARD,
  399. .start = evt2irq(0x0E20),
  400. .flags = IORESOURCE_IRQ,
  401. },
  402. {
  403. .name = SH_MOBILE_SDHI_IRQ_SDIO,
  404. .start = evt2irq(0x0E40),
  405. .flags = IORESOURCE_IRQ,
  406. },
  407. };
  408. static struct platform_device sdhi0_device = {
  409. .name = "sh_mobile_sdhi",
  410. .id = 0,
  411. .dev = {
  412. .platform_data = &sdhi0_info,
  413. },
  414. .num_resources = ARRAY_SIZE(sdhi0_resources),
  415. .resource = sdhi0_resources,
  416. };
  417. /* I2C */
  418. static struct i2c_board_info i2c0_devices[] = {
  419. {
  420. I2C_BOARD_INFO("st1232-ts", 0x55),
  421. .irq = evt2irq(0x0340),
  422. },
  423. };
  424. /*
  425. * board devices
  426. */
  427. static struct platform_device *eva_devices[] __initdata = {
  428. &lcdc0_device,
  429. &gpio_keys_device,
  430. &sh_eth_device,
  431. &sdhi0_device,
  432. };
  433. static void __init eva_clock_init(void)
  434. {
  435. struct clk *system = clk_get(NULL, "system_clk");
  436. struct clk *xtal1 = clk_get(NULL, "extal1");
  437. struct clk *usb24s = clk_get(NULL, "usb24s");
  438. if (IS_ERR(system) ||
  439. IS_ERR(xtal1) ||
  440. IS_ERR(usb24s)) {
  441. pr_err("armadillo800eva board clock init failed\n");
  442. goto clock_error;
  443. }
  444. /* armadillo 800 eva extal1 is 24MHz */
  445. clk_set_rate(xtal1, 24000000);
  446. /* usb24s use extal1 (= system) clock (= 24MHz) */
  447. clk_set_parent(usb24s, system);
  448. clock_error:
  449. if (!IS_ERR(system))
  450. clk_put(system);
  451. if (!IS_ERR(xtal1))
  452. clk_put(xtal1);
  453. if (!IS_ERR(usb24s))
  454. clk_put(usb24s);
  455. }
  456. /*
  457. * board init
  458. */
  459. static void __init eva_init(void)
  460. {
  461. eva_clock_init();
  462. r8a7740_pinmux_init();
  463. /* SCIFA1 */
  464. gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
  465. gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
  466. /* LCDC0 */
  467. gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
  468. gpio_request(GPIO_FN_LCD0_D0, NULL);
  469. gpio_request(GPIO_FN_LCD0_D1, NULL);
  470. gpio_request(GPIO_FN_LCD0_D2, NULL);
  471. gpio_request(GPIO_FN_LCD0_D3, NULL);
  472. gpio_request(GPIO_FN_LCD0_D4, NULL);
  473. gpio_request(GPIO_FN_LCD0_D5, NULL);
  474. gpio_request(GPIO_FN_LCD0_D6, NULL);
  475. gpio_request(GPIO_FN_LCD0_D7, NULL);
  476. gpio_request(GPIO_FN_LCD0_D8, NULL);
  477. gpio_request(GPIO_FN_LCD0_D9, NULL);
  478. gpio_request(GPIO_FN_LCD0_D10, NULL);
  479. gpio_request(GPIO_FN_LCD0_D11, NULL);
  480. gpio_request(GPIO_FN_LCD0_D12, NULL);
  481. gpio_request(GPIO_FN_LCD0_D13, NULL);
  482. gpio_request(GPIO_FN_LCD0_D14, NULL);
  483. gpio_request(GPIO_FN_LCD0_D15, NULL);
  484. gpio_request(GPIO_FN_LCD0_D16, NULL);
  485. gpio_request(GPIO_FN_LCD0_D17, NULL);
  486. gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
  487. gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
  488. gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
  489. gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
  490. gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
  491. gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
  492. gpio_request(GPIO_FN_LCD0_DCK, NULL);
  493. gpio_request(GPIO_FN_LCD0_VSYN, NULL);
  494. gpio_request(GPIO_FN_LCD0_HSYN, NULL);
  495. gpio_request(GPIO_FN_LCD0_DISP, NULL);
  496. gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
  497. gpio_request(GPIO_PORT61, NULL); /* LCDDON */
  498. gpio_direction_output(GPIO_PORT61, 1);
  499. gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
  500. gpio_direction_output(GPIO_PORT202, 0);
  501. /* Touchscreen */
  502. gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
  503. gpio_request(GPIO_PORT166, NULL); /* TP_RST_B */
  504. gpio_direction_output(GPIO_PORT166, 1);
  505. /* GETHER */
  506. gpio_request(GPIO_FN_ET_CRS, NULL);
  507. gpio_request(GPIO_FN_ET_MDC, NULL);
  508. gpio_request(GPIO_FN_ET_MDIO, NULL);
  509. gpio_request(GPIO_FN_ET_TX_ER, NULL);
  510. gpio_request(GPIO_FN_ET_RX_ER, NULL);
  511. gpio_request(GPIO_FN_ET_ERXD0, NULL);
  512. gpio_request(GPIO_FN_ET_ERXD1, NULL);
  513. gpio_request(GPIO_FN_ET_ERXD2, NULL);
  514. gpio_request(GPIO_FN_ET_ERXD3, NULL);
  515. gpio_request(GPIO_FN_ET_TX_CLK, NULL);
  516. gpio_request(GPIO_FN_ET_TX_EN, NULL);
  517. gpio_request(GPIO_FN_ET_ETXD0, NULL);
  518. gpio_request(GPIO_FN_ET_ETXD1, NULL);
  519. gpio_request(GPIO_FN_ET_ETXD2, NULL);
  520. gpio_request(GPIO_FN_ET_ETXD3, NULL);
  521. gpio_request(GPIO_FN_ET_PHY_INT, NULL);
  522. gpio_request(GPIO_FN_ET_COL, NULL);
  523. gpio_request(GPIO_FN_ET_RX_DV, NULL);
  524. gpio_request(GPIO_FN_ET_RX_CLK, NULL);
  525. gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
  526. gpio_direction_output(GPIO_PORT18, 1);
  527. /* USB */
  528. gpio_request(GPIO_PORT159, NULL); /* USB_DEVICE_MODE */
  529. gpio_direction_input(GPIO_PORT159);
  530. if (gpio_get_value(GPIO_PORT159)) {
  531. /* USB Host */
  532. } else {
  533. /* USB Func */
  534. gpio_request(GPIO_FN_VBUS, NULL);
  535. platform_device_register(&usbhsf_device);
  536. }
  537. /* SDHI0 */
  538. gpio_request(GPIO_FN_SDHI0_CMD, NULL);
  539. gpio_request(GPIO_FN_SDHI0_CLK, NULL);
  540. gpio_request(GPIO_FN_SDHI0_D0, NULL);
  541. gpio_request(GPIO_FN_SDHI0_D1, NULL);
  542. gpio_request(GPIO_FN_SDHI0_D2, NULL);
  543. gpio_request(GPIO_FN_SDHI0_D3, NULL);
  544. gpio_request(GPIO_FN_SDHI0_WP, NULL);
  545. gpio_request(GPIO_PORT17, NULL); /* SDHI0_18/33_B */
  546. gpio_request(GPIO_PORT74, NULL); /* SDHI0_PON */
  547. gpio_request(GPIO_PORT75, NULL); /* SDSLOT1_PON */
  548. gpio_direction_output(GPIO_PORT17, 0);
  549. gpio_direction_output(GPIO_PORT74, 1);
  550. gpio_direction_output(GPIO_PORT75, 1);
  551. /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
  552. /*
  553. * CAUTION
  554. *
  555. * DBGMD/LCDC0/FSIA MUX
  556. * DBGMD_SELECT_B should be set after setting PFC Function.
  557. */
  558. gpio_request(GPIO_PORT176, NULL);
  559. gpio_direction_output(GPIO_PORT176, 1);
  560. #ifdef CONFIG_CACHE_L2X0
  561. /* Early BRESP enable, Shared attribute override enable, 32K*8way */
  562. l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
  563. #endif
  564. i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
  565. r8a7740_add_standard_devices();
  566. platform_add_devices(eva_devices,
  567. ARRAY_SIZE(eva_devices));
  568. }
  569. static void __init eva_earlytimer_init(void)
  570. {
  571. r8a7740_clock_init(MD_CK0 | MD_CK2);
  572. shmobile_earlytimer_init();
  573. }
  574. static void __init eva_add_early_devices(void)
  575. {
  576. r8a7740_add_early_devices();
  577. /* override timer setup with board-specific code */
  578. shmobile_timer.init = eva_earlytimer_init;
  579. }
  580. MACHINE_START(ARMADILLO800EVA, "armadillo800eva")
  581. .map_io = r8a7740_map_io,
  582. .init_early = eva_add_early_devices,
  583. .init_irq = r8a7740_init_irq,
  584. .handle_irq = shmobile_handle_irq_intc,
  585. .init_machine = eva_init,
  586. .timer = &shmobile_timer,
  587. MACHINE_END