board-armadillo800eva.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  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/regulator/fixed.h>
  31. #include <linux/regulator/machine.h>
  32. #include <linux/sh_eth.h>
  33. #include <linux/videodev2.h>
  34. #include <linux/usb/renesas_usbhs.h>
  35. #include <linux/mfd/tmio.h>
  36. #include <linux/mmc/host.h>
  37. #include <linux/mmc/sh_mmcif.h>
  38. #include <linux/mmc/sh_mobile_sdhi.h>
  39. #include <mach/common.h>
  40. #include <mach/irqs.h>
  41. #include <mach/r8a7740.h>
  42. #include <media/mt9t112.h>
  43. #include <media/sh_mobile_ceu.h>
  44. #include <media/soc_camera.h>
  45. #include <asm/page.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/cache-l2x0.h>
  51. #include <video/sh_mobile_lcdc.h>
  52. #include <video/sh_mobile_hdmi.h>
  53. #include <sound/sh_fsi.h>
  54. #include <sound/simple_card.h>
  55. /*
  56. * CON1 Camera Module
  57. * CON2 Extension Bus
  58. * CON3 HDMI Output
  59. * CON4 Composite Video Output
  60. * CON5 H-UDI JTAG
  61. * CON6 ARM JTAG
  62. * CON7 SD1
  63. * CON8 SD2
  64. * CON9 RTC BackUp
  65. * CON10 Monaural Mic Input
  66. * CON11 Stereo Headphone Output
  67. * CON12 Audio Line Output(L)
  68. * CON13 Audio Line Output(R)
  69. * CON14 AWL13 Module
  70. * CON15 Extension
  71. * CON16 LCD1
  72. * CON17 LCD2
  73. * CON19 Power Input
  74. * CON20 USB1
  75. * CON21 USB2
  76. * CON22 Serial
  77. * CON23 LAN
  78. * CON24 USB3
  79. * LED1 Camera LED(Yellow)
  80. * LED2 Power LED (Green)
  81. * ED3-LED6 User LED(Yellow)
  82. * LED7 LAN link LED(Green)
  83. * LED8 LAN activity LED(Yellow)
  84. */
  85. /*
  86. * DipSwitch
  87. *
  88. * SW1
  89. *
  90. * -12345678-+---------------+----------------------------
  91. * 1 | boot | hermit
  92. * 0 | boot | OS auto boot
  93. * -12345678-+---------------+----------------------------
  94. * 00 | boot device | eMMC
  95. * 10 | boot device | SDHI0 (CON7)
  96. * 01 | boot device | -
  97. * 11 | boot device | Extension Buss (CS0)
  98. * -12345678-+---------------+----------------------------
  99. * 0 | Extension Bus | D8-D15 disable, eMMC enable
  100. * 1 | Extension Bus | D8-D15 enable, eMMC disable
  101. * -12345678-+---------------+----------------------------
  102. * 0 | SDHI1 | COM8 disable, COM14 enable
  103. * 1 | SDHI1 | COM8 enable, COM14 disable
  104. * -12345678-+---------------+----------------------------
  105. * 0 | USB0 | COM20 enable, COM24 disable
  106. * 1 | USB0 | COM20 disable, COM24 enable
  107. * -12345678-+---------------+----------------------------
  108. * 00 | JTAG | SH-X2
  109. * 10 | JTAG | ARM
  110. * 01 | JTAG | -
  111. * 11 | JTAG | Boundary Scan
  112. *-----------+---------------+----------------------------
  113. */
  114. /*
  115. * FSI-WM8978
  116. *
  117. * this command is required when playback.
  118. *
  119. * # amixer set "Headphone" 50
  120. */
  121. /*
  122. * USB function
  123. *
  124. * When you use USB Function,
  125. * set SW1.6 ON, and connect cable to CN24.
  126. *
  127. * USBF needs workaround on R8A7740 chip.
  128. * These are a little bit complex.
  129. * see
  130. * usbhsf_power_ctrl()
  131. */
  132. #define IRQ7 evt2irq(0x02e0)
  133. #define USBCR1 0xe605810a
  134. #define USBH 0xC6700000
  135. #define USBH_USBCTR 0x10834
  136. struct usbhsf_private {
  137. struct clk *phy;
  138. struct clk *usb24;
  139. struct clk *pci;
  140. struct clk *func;
  141. struct clk *host;
  142. void __iomem *usbh_base;
  143. struct renesas_usbhs_platform_info info;
  144. };
  145. #define usbhsf_get_priv(pdev) \
  146. container_of(renesas_usbhs_get_info(pdev), \
  147. struct usbhsf_private, info)
  148. static int usbhsf_get_id(struct platform_device *pdev)
  149. {
  150. return USBHS_GADGET;
  151. }
  152. static void usbhsf_power_ctrl(struct platform_device *pdev,
  153. void __iomem *base, int enable)
  154. {
  155. struct usbhsf_private *priv = usbhsf_get_priv(pdev);
  156. /*
  157. * Work around for USB Function.
  158. * It needs USB host clock, and settings
  159. */
  160. if (enable) {
  161. /*
  162. * enable all the related usb clocks
  163. * for usb workaround
  164. */
  165. clk_enable(priv->usb24);
  166. clk_enable(priv->pci);
  167. clk_enable(priv->host);
  168. clk_enable(priv->func);
  169. clk_enable(priv->phy);
  170. /*
  171. * set USBCR1
  172. *
  173. * Port1 is driven by USB function,
  174. * Port2 is driven by USB HOST
  175. * One HOST (Port1 or Port2 is HOST)
  176. * USB PLL input clock = 24MHz
  177. */
  178. __raw_writew(0xd750, USBCR1);
  179. mdelay(1);
  180. /*
  181. * start USB Host
  182. */
  183. __raw_writel(0x0000000c, priv->usbh_base + USBH_USBCTR);
  184. __raw_writel(0x00000008, priv->usbh_base + USBH_USBCTR);
  185. mdelay(10);
  186. /*
  187. * USB PHY Power ON
  188. */
  189. __raw_writew(0xd770, USBCR1);
  190. __raw_writew(0x4000, base + 0x102); /* USBF :: SUSPMODE */
  191. } else {
  192. __raw_writel(0x0000010f, priv->usbh_base + USBH_USBCTR);
  193. __raw_writew(0xd7c0, USBCR1); /* GPIO */
  194. clk_disable(priv->phy);
  195. clk_disable(priv->func); /* usb work around */
  196. clk_disable(priv->host); /* usb work around */
  197. clk_disable(priv->pci); /* usb work around */
  198. clk_disable(priv->usb24); /* usb work around */
  199. }
  200. }
  201. static int usbhsf_get_vbus(struct platform_device *pdev)
  202. {
  203. return gpio_get_value(GPIO_PORT209);
  204. }
  205. static irqreturn_t usbhsf_interrupt(int irq, void *data)
  206. {
  207. struct platform_device *pdev = data;
  208. renesas_usbhs_call_notify_hotplug(pdev);
  209. return IRQ_HANDLED;
  210. }
  211. static void usbhsf_hardware_exit(struct platform_device *pdev)
  212. {
  213. struct usbhsf_private *priv = usbhsf_get_priv(pdev);
  214. if (!IS_ERR(priv->phy))
  215. clk_put(priv->phy);
  216. if (!IS_ERR(priv->usb24))
  217. clk_put(priv->usb24);
  218. if (!IS_ERR(priv->pci))
  219. clk_put(priv->pci);
  220. if (!IS_ERR(priv->host))
  221. clk_put(priv->host);
  222. if (!IS_ERR(priv->func))
  223. clk_put(priv->func);
  224. if (priv->usbh_base)
  225. iounmap(priv->usbh_base);
  226. priv->phy = NULL;
  227. priv->usb24 = NULL;
  228. priv->pci = NULL;
  229. priv->host = NULL;
  230. priv->func = NULL;
  231. priv->usbh_base = NULL;
  232. free_irq(IRQ7, pdev);
  233. }
  234. static int usbhsf_hardware_init(struct platform_device *pdev)
  235. {
  236. struct usbhsf_private *priv = usbhsf_get_priv(pdev);
  237. int ret;
  238. priv->phy = clk_get(&pdev->dev, "phy");
  239. priv->usb24 = clk_get(&pdev->dev, "usb24");
  240. priv->pci = clk_get(&pdev->dev, "pci");
  241. priv->func = clk_get(&pdev->dev, "func");
  242. priv->host = clk_get(&pdev->dev, "host");
  243. priv->usbh_base = ioremap_nocache(USBH, 0x20000);
  244. if (IS_ERR(priv->phy) ||
  245. IS_ERR(priv->usb24) ||
  246. IS_ERR(priv->pci) ||
  247. IS_ERR(priv->host) ||
  248. IS_ERR(priv->func) ||
  249. !priv->usbh_base) {
  250. dev_err(&pdev->dev, "USB clock setting failed\n");
  251. usbhsf_hardware_exit(pdev);
  252. return -EIO;
  253. }
  254. ret = request_irq(IRQ7, usbhsf_interrupt, IRQF_TRIGGER_NONE,
  255. dev_name(&pdev->dev), pdev);
  256. if (ret) {
  257. dev_err(&pdev->dev, "request_irq err\n");
  258. return ret;
  259. }
  260. irq_set_irq_type(IRQ7, IRQ_TYPE_EDGE_BOTH);
  261. /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
  262. clk_set_rate(priv->usb24,
  263. clk_get_rate(clk_get_parent(priv->usb24)));
  264. return 0;
  265. }
  266. static struct usbhsf_private usbhsf_private = {
  267. .info = {
  268. .platform_callback = {
  269. .get_id = usbhsf_get_id,
  270. .get_vbus = usbhsf_get_vbus,
  271. .hardware_init = usbhsf_hardware_init,
  272. .hardware_exit = usbhsf_hardware_exit,
  273. .power_ctrl = usbhsf_power_ctrl,
  274. },
  275. .driver_param = {
  276. .buswait_bwait = 5,
  277. .detection_delay = 5,
  278. .d0_rx_id = SHDMA_SLAVE_USBHS_RX,
  279. .d1_tx_id = SHDMA_SLAVE_USBHS_TX,
  280. },
  281. }
  282. };
  283. static struct resource usbhsf_resources[] = {
  284. {
  285. .name = "USBHS",
  286. .start = 0xe6890000,
  287. .end = 0xe6890104 - 1,
  288. .flags = IORESOURCE_MEM,
  289. },
  290. {
  291. .start = evt2irq(0x0A20),
  292. .flags = IORESOURCE_IRQ,
  293. },
  294. };
  295. static struct platform_device usbhsf_device = {
  296. .name = "renesas_usbhs",
  297. .dev = {
  298. .platform_data = &usbhsf_private.info,
  299. },
  300. .id = -1,
  301. .num_resources = ARRAY_SIZE(usbhsf_resources),
  302. .resource = usbhsf_resources,
  303. };
  304. /* Ether */
  305. static struct sh_eth_plat_data sh_eth_platdata = {
  306. .phy = 0x00, /* LAN8710A */
  307. .edmac_endian = EDMAC_LITTLE_ENDIAN,
  308. .register_type = SH_ETH_REG_GIGABIT,
  309. .phy_interface = PHY_INTERFACE_MODE_MII,
  310. };
  311. static struct resource sh_eth_resources[] = {
  312. {
  313. .start = 0xe9a00000,
  314. .end = 0xe9a00800 - 1,
  315. .flags = IORESOURCE_MEM,
  316. }, {
  317. .start = 0xe9a01800,
  318. .end = 0xe9a02000 - 1,
  319. .flags = IORESOURCE_MEM,
  320. }, {
  321. .start = evt2irq(0x0500),
  322. .flags = IORESOURCE_IRQ,
  323. },
  324. };
  325. static struct platform_device sh_eth_device = {
  326. .name = "sh-eth",
  327. .id = -1,
  328. .dev = {
  329. .platform_data = &sh_eth_platdata,
  330. },
  331. .resource = sh_eth_resources,
  332. .num_resources = ARRAY_SIZE(sh_eth_resources),
  333. };
  334. /* LCDC */
  335. static struct fb_videomode lcdc0_mode = {
  336. .name = "AMPIER/AM-800480",
  337. .xres = 800,
  338. .yres = 480,
  339. .left_margin = 88,
  340. .right_margin = 40,
  341. .hsync_len = 128,
  342. .upper_margin = 20,
  343. .lower_margin = 5,
  344. .vsync_len = 5,
  345. .sync = 0,
  346. };
  347. static struct sh_mobile_lcdc_info lcdc0_info = {
  348. .clock_source = LCDC_CLK_BUS,
  349. .ch[0] = {
  350. .chan = LCDC_CHAN_MAINLCD,
  351. .fourcc = V4L2_PIX_FMT_RGB565,
  352. .interface_type = RGB24,
  353. .clock_divider = 5,
  354. .flags = 0,
  355. .lcd_modes = &lcdc0_mode,
  356. .num_modes = 1,
  357. .panel_cfg = {
  358. .width = 111,
  359. .height = 68,
  360. },
  361. },
  362. };
  363. static struct resource lcdc0_resources[] = {
  364. [0] = {
  365. .name = "LCD0",
  366. .start = 0xfe940000,
  367. .end = 0xfe943fff,
  368. .flags = IORESOURCE_MEM,
  369. },
  370. [1] = {
  371. .start = intcs_evt2irq(0x580),
  372. .flags = IORESOURCE_IRQ,
  373. },
  374. };
  375. static struct platform_device lcdc0_device = {
  376. .name = "sh_mobile_lcdc_fb",
  377. .num_resources = ARRAY_SIZE(lcdc0_resources),
  378. .resource = lcdc0_resources,
  379. .id = 0,
  380. .dev = {
  381. .platform_data = &lcdc0_info,
  382. .coherent_dma_mask = ~0,
  383. },
  384. };
  385. /*
  386. * LCDC1/HDMI
  387. */
  388. static struct sh_mobile_hdmi_info hdmi_info = {
  389. .flags = HDMI_OUTPUT_PUSH_PULL |
  390. HDMI_OUTPUT_POLARITY_HI |
  391. HDMI_32BIT_REG |
  392. HDMI_HAS_HTOP1 |
  393. HDMI_SND_SRC_SPDIF,
  394. };
  395. static struct resource hdmi_resources[] = {
  396. [0] = {
  397. .name = "HDMI",
  398. .start = 0xe6be0000,
  399. .end = 0xe6be03ff,
  400. .flags = IORESOURCE_MEM,
  401. },
  402. [1] = {
  403. .start = evt2irq(0x1700),
  404. .flags = IORESOURCE_IRQ,
  405. },
  406. [2] = {
  407. .name = "HDMI emma3pf",
  408. .start = 0xe6be4000,
  409. .end = 0xe6be43ff,
  410. .flags = IORESOURCE_MEM,
  411. },
  412. };
  413. static struct platform_device hdmi_device = {
  414. .name = "sh-mobile-hdmi",
  415. .num_resources = ARRAY_SIZE(hdmi_resources),
  416. .resource = hdmi_resources,
  417. .id = -1,
  418. .dev = {
  419. .platform_data = &hdmi_info,
  420. },
  421. };
  422. static const struct fb_videomode lcdc1_mode = {
  423. .name = "HDMI 720p",
  424. .xres = 1280,
  425. .yres = 720,
  426. .pixclock = 13468,
  427. .left_margin = 220,
  428. .right_margin = 110,
  429. .hsync_len = 40,
  430. .upper_margin = 20,
  431. .lower_margin = 5,
  432. .vsync_len = 5,
  433. .refresh = 60,
  434. .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
  435. };
  436. static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
  437. .clock_source = LCDC_CLK_PERIPHERAL, /* HDMI clock */
  438. .ch[0] = {
  439. .chan = LCDC_CHAN_MAINLCD,
  440. .fourcc = V4L2_PIX_FMT_RGB565,
  441. .interface_type = RGB24,
  442. .clock_divider = 1,
  443. .flags = LCDC_FLAGS_DWPOL,
  444. .lcd_modes = &lcdc1_mode,
  445. .num_modes = 1,
  446. .tx_dev = &hdmi_device,
  447. .panel_cfg = {
  448. .width = 1280,
  449. .height = 720,
  450. },
  451. },
  452. };
  453. static struct resource hdmi_lcdc_resources[] = {
  454. [0] = {
  455. .name = "LCDC1",
  456. .start = 0xfe944000,
  457. .end = 0xfe948000 - 1,
  458. .flags = IORESOURCE_MEM,
  459. },
  460. [1] = {
  461. .start = intcs_evt2irq(0x1780),
  462. .flags = IORESOURCE_IRQ,
  463. },
  464. };
  465. static struct platform_device hdmi_lcdc_device = {
  466. .name = "sh_mobile_lcdc_fb",
  467. .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
  468. .resource = hdmi_lcdc_resources,
  469. .id = 1,
  470. .dev = {
  471. .platform_data = &hdmi_lcdc_info,
  472. .coherent_dma_mask = ~0,
  473. },
  474. };
  475. /* GPIO KEY */
  476. #define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
  477. static struct gpio_keys_button gpio_buttons[] = {
  478. GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW1"),
  479. GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW2"),
  480. GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW3"),
  481. GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW4"),
  482. };
  483. static struct gpio_keys_platform_data gpio_key_info = {
  484. .buttons = gpio_buttons,
  485. .nbuttons = ARRAY_SIZE(gpio_buttons),
  486. };
  487. static struct platform_device gpio_keys_device = {
  488. .name = "gpio-keys",
  489. .id = -1,
  490. .dev = {
  491. .platform_data = &gpio_key_info,
  492. },
  493. };
  494. /* Fixed 3.3V regulator to be used by SDHI0, SDHI1, MMCIF */
  495. static struct regulator_consumer_supply fixed3v3_power_consumers[] =
  496. {
  497. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
  498. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
  499. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
  500. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
  501. REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
  502. REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
  503. };
  504. /* SDHI0 */
  505. /*
  506. * FIXME
  507. *
  508. * It use polling mode here, since
  509. * CD (= Card Detect) pin is not connected to SDHI0_CD.
  510. * We can use IRQ31 as card detect irq,
  511. * but it needs chattering removal operation
  512. */
  513. #define IRQ31 evt2irq(0x33E0)
  514. static struct sh_mobile_sdhi_info sdhi0_info = {
  515. .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
  516. .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
  517. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\
  518. MMC_CAP_NEEDS_POLL,
  519. .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
  520. .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
  521. };
  522. static struct resource sdhi0_resources[] = {
  523. {
  524. .name = "SDHI0",
  525. .start = 0xe6850000,
  526. .end = 0xe6850100 - 1,
  527. .flags = IORESOURCE_MEM,
  528. },
  529. /*
  530. * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
  531. */
  532. {
  533. .name = SH_MOBILE_SDHI_IRQ_SDCARD,
  534. .start = evt2irq(0x0E20),
  535. .flags = IORESOURCE_IRQ,
  536. },
  537. {
  538. .name = SH_MOBILE_SDHI_IRQ_SDIO,
  539. .start = evt2irq(0x0E40),
  540. .flags = IORESOURCE_IRQ,
  541. },
  542. };
  543. static struct platform_device sdhi0_device = {
  544. .name = "sh_mobile_sdhi",
  545. .id = 0,
  546. .dev = {
  547. .platform_data = &sdhi0_info,
  548. },
  549. .num_resources = ARRAY_SIZE(sdhi0_resources),
  550. .resource = sdhi0_resources,
  551. };
  552. /* SDHI1 */
  553. static struct sh_mobile_sdhi_info sdhi1_info = {
  554. .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
  555. .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
  556. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
  557. .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
  558. .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
  559. };
  560. static struct resource sdhi1_resources[] = {
  561. [0] = {
  562. .name = "SDHI1",
  563. .start = 0xe6860000,
  564. .end = 0xe6860100 - 1,
  565. .flags = IORESOURCE_MEM,
  566. },
  567. [1] = {
  568. .start = evt2irq(0x0E80),
  569. .flags = IORESOURCE_IRQ,
  570. },
  571. [2] = {
  572. .start = evt2irq(0x0EA0),
  573. .flags = IORESOURCE_IRQ,
  574. },
  575. [3] = {
  576. .start = evt2irq(0x0EC0),
  577. .flags = IORESOURCE_IRQ,
  578. },
  579. };
  580. static struct platform_device sdhi1_device = {
  581. .name = "sh_mobile_sdhi",
  582. .id = 1,
  583. .dev = {
  584. .platform_data = &sdhi1_info,
  585. },
  586. .num_resources = ARRAY_SIZE(sdhi1_resources),
  587. .resource = sdhi1_resources,
  588. };
  589. /* MMCIF */
  590. static struct sh_mmcif_plat_data sh_mmcif_plat = {
  591. .sup_pclk = 0,
  592. .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
  593. .caps = MMC_CAP_4_BIT_DATA |
  594. MMC_CAP_8_BIT_DATA |
  595. MMC_CAP_NONREMOVABLE,
  596. };
  597. static struct resource sh_mmcif_resources[] = {
  598. [0] = {
  599. .name = "MMCIF",
  600. .start = 0xe6bd0000,
  601. .end = 0xe6bd0100 - 1,
  602. .flags = IORESOURCE_MEM,
  603. },
  604. [1] = {
  605. /* MMC ERR */
  606. .start = evt2irq(0x1AC0),
  607. .flags = IORESOURCE_IRQ,
  608. },
  609. [2] = {
  610. /* MMC NOR */
  611. .start = evt2irq(0x1AE0),
  612. .flags = IORESOURCE_IRQ,
  613. },
  614. };
  615. static struct platform_device sh_mmcif_device = {
  616. .name = "sh_mmcif",
  617. .id = -1,
  618. .dev = {
  619. .platform_data = &sh_mmcif_plat,
  620. },
  621. .num_resources = ARRAY_SIZE(sh_mmcif_resources),
  622. .resource = sh_mmcif_resources,
  623. };
  624. /* Camera */
  625. static int mt9t111_power(struct device *dev, int mode)
  626. {
  627. struct clk *mclk = clk_get(NULL, "video1");
  628. if (IS_ERR(mclk)) {
  629. dev_err(dev, "can't get video1 clock\n");
  630. return -EINVAL;
  631. }
  632. if (mode) {
  633. /* video1 (= CON1 camera) expect 24MHz */
  634. clk_set_rate(mclk, clk_round_rate(mclk, 24000000));
  635. clk_enable(mclk);
  636. gpio_direction_output(GPIO_PORT158, 1);
  637. } else {
  638. gpio_direction_output(GPIO_PORT158, 0);
  639. clk_disable(mclk);
  640. }
  641. clk_put(mclk);
  642. return 0;
  643. }
  644. static struct i2c_board_info i2c_camera_mt9t111 = {
  645. I2C_BOARD_INFO("mt9t112", 0x3d),
  646. };
  647. static struct mt9t112_camera_info mt9t111_info = {
  648. .divider = { 16, 0, 0, 7, 0, 10, 14, 7, 7 },
  649. };
  650. static struct soc_camera_link mt9t111_link = {
  651. .i2c_adapter_id = 0,
  652. .bus_id = 0,
  653. .board_info = &i2c_camera_mt9t111,
  654. .power = mt9t111_power,
  655. .priv = &mt9t111_info,
  656. };
  657. static struct platform_device camera_device = {
  658. .name = "soc-camera-pdrv",
  659. .id = 0,
  660. .dev = {
  661. .platform_data = &mt9t111_link,
  662. },
  663. };
  664. /* CEU0 */
  665. static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
  666. .flags = SH_CEU_FLAG_LOWER_8BIT,
  667. };
  668. static struct resource ceu0_resources[] = {
  669. [0] = {
  670. .name = "CEU",
  671. .start = 0xfe910000,
  672. .end = 0xfe91009f,
  673. .flags = IORESOURCE_MEM,
  674. },
  675. [1] = {
  676. .start = intcs_evt2irq(0x0500),
  677. .flags = IORESOURCE_IRQ,
  678. },
  679. [2] = {
  680. /* place holder for contiguous memory */
  681. },
  682. };
  683. static struct platform_device ceu0_device = {
  684. .name = "sh_mobile_ceu",
  685. .id = 0,
  686. .num_resources = ARRAY_SIZE(ceu0_resources),
  687. .resource = ceu0_resources,
  688. .dev = {
  689. .platform_data = &sh_mobile_ceu0_info,
  690. .coherent_dma_mask = 0xffffffff,
  691. },
  692. };
  693. /* FSI */
  694. static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable)
  695. {
  696. struct clk *fsib;
  697. int ret;
  698. /* it support 48KHz only */
  699. if (48000 != rate)
  700. return -EINVAL;
  701. fsib = clk_get(dev, "ickb");
  702. if (IS_ERR(fsib))
  703. return -EINVAL;
  704. if (enable) {
  705. ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
  706. clk_enable(fsib);
  707. } else {
  708. ret = 0;
  709. clk_disable(fsib);
  710. }
  711. clk_put(fsib);
  712. return ret;
  713. }
  714. static struct sh_fsi_platform_info fsi_info = {
  715. /* FSI-WM8978 */
  716. .port_a = {
  717. .tx_id = SHDMA_SLAVE_FSIA_TX,
  718. },
  719. /* FSI-HDMI */
  720. .port_b = {
  721. .flags = SH_FSI_FMT_SPDIF |
  722. SH_FSI_ENABLE_STREAM_MODE,
  723. .set_rate = fsi_hdmi_set_rate,
  724. .tx_id = SHDMA_SLAVE_FSIB_TX,
  725. }
  726. };
  727. static struct resource fsi_resources[] = {
  728. [0] = {
  729. .name = "FSI",
  730. .start = 0xfe1f0000,
  731. .end = 0xfe1f8400 - 1,
  732. .flags = IORESOURCE_MEM,
  733. },
  734. [1] = {
  735. .start = evt2irq(0x1840),
  736. .flags = IORESOURCE_IRQ,
  737. },
  738. };
  739. static struct platform_device fsi_device = {
  740. .name = "sh_fsi2",
  741. .id = -1,
  742. .num_resources = ARRAY_SIZE(fsi_resources),
  743. .resource = fsi_resources,
  744. .dev = {
  745. .platform_data = &fsi_info,
  746. },
  747. };
  748. /* FSI-WM8978 */
  749. static struct asoc_simple_dai_init_info fsi_wm8978_init_info = {
  750. .fmt = SND_SOC_DAIFMT_I2S,
  751. .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
  752. .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
  753. .sysclk = 12288000,
  754. };
  755. static struct asoc_simple_card_info fsi_wm8978_info = {
  756. .name = "wm8978",
  757. .card = "FSI2A-WM8978",
  758. .cpu_dai = "fsia-dai",
  759. .codec = "wm8978.0-001a",
  760. .platform = "sh_fsi2",
  761. .codec_dai = "wm8978-hifi",
  762. .init = &fsi_wm8978_init_info,
  763. };
  764. static struct platform_device fsi_wm8978_device = {
  765. .name = "asoc-simple-card",
  766. .id = 0,
  767. .dev = {
  768. .platform_data = &fsi_wm8978_info,
  769. },
  770. };
  771. /* FSI-HDMI */
  772. static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
  773. .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM,
  774. };
  775. static struct asoc_simple_card_info fsi2_hdmi_info = {
  776. .name = "HDMI",
  777. .card = "FSI2B-HDMI",
  778. .cpu_dai = "fsib-dai",
  779. .codec = "sh-mobile-hdmi",
  780. .platform = "sh_fsi2",
  781. .codec_dai = "sh_mobile_hdmi-hifi",
  782. .init = &fsi2_hdmi_init_info,
  783. };
  784. static struct platform_device fsi_hdmi_device = {
  785. .name = "asoc-simple-card",
  786. .id = 1,
  787. .dev = {
  788. .platform_data = &fsi2_hdmi_info,
  789. },
  790. };
  791. /* I2C */
  792. static struct i2c_board_info i2c0_devices[] = {
  793. {
  794. I2C_BOARD_INFO("st1232-ts", 0x55),
  795. .irq = evt2irq(0x0340),
  796. },
  797. {
  798. I2C_BOARD_INFO("wm8978", 0x1a),
  799. },
  800. };
  801. /*
  802. * board devices
  803. */
  804. static struct platform_device *eva_devices[] __initdata = {
  805. &lcdc0_device,
  806. &gpio_keys_device,
  807. &sh_eth_device,
  808. &sdhi0_device,
  809. &sh_mmcif_device,
  810. &hdmi_device,
  811. &hdmi_lcdc_device,
  812. &camera_device,
  813. &ceu0_device,
  814. &fsi_device,
  815. &fsi_hdmi_device,
  816. &fsi_wm8978_device,
  817. };
  818. static void __init eva_clock_init(void)
  819. {
  820. struct clk *system = clk_get(NULL, "system_clk");
  821. struct clk *xtal1 = clk_get(NULL, "extal1");
  822. struct clk *usb24s = clk_get(NULL, "usb24s");
  823. struct clk *fsibck = clk_get(NULL, "fsibck");
  824. struct clk *fsib = clk_get(&fsi_device.dev, "ickb");
  825. if (IS_ERR(system) ||
  826. IS_ERR(xtal1) ||
  827. IS_ERR(usb24s) ||
  828. IS_ERR(fsibck) ||
  829. IS_ERR(fsib)) {
  830. pr_err("armadillo800eva board clock init failed\n");
  831. goto clock_error;
  832. }
  833. /* armadillo 800 eva extal1 is 24MHz */
  834. clk_set_rate(xtal1, 24000000);
  835. /* usb24s use extal1 (= system) clock (= 24MHz) */
  836. clk_set_parent(usb24s, system);
  837. /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
  838. clk_set_parent(fsib, fsibck);
  839. clk_set_rate(fsibck, 12288000);
  840. clk_set_rate(fsib, 12288000);
  841. clock_error:
  842. if (!IS_ERR(system))
  843. clk_put(system);
  844. if (!IS_ERR(xtal1))
  845. clk_put(xtal1);
  846. if (!IS_ERR(usb24s))
  847. clk_put(usb24s);
  848. if (!IS_ERR(fsibck))
  849. clk_put(fsibck);
  850. if (!IS_ERR(fsib))
  851. clk_put(fsib);
  852. }
  853. /*
  854. * board init
  855. */
  856. #define GPIO_PORT7CR 0xe6050007
  857. #define GPIO_PORT8CR 0xe6050008
  858. static void __init eva_init(void)
  859. {
  860. struct platform_device *usb = NULL;
  861. regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
  862. ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
  863. r8a7740_pinmux_init();
  864. r8a7740_meram_workaround();
  865. /* SCIFA1 */
  866. gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
  867. gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
  868. /* LCDC0 */
  869. gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
  870. gpio_request(GPIO_FN_LCD0_D0, NULL);
  871. gpio_request(GPIO_FN_LCD0_D1, NULL);
  872. gpio_request(GPIO_FN_LCD0_D2, NULL);
  873. gpio_request(GPIO_FN_LCD0_D3, NULL);
  874. gpio_request(GPIO_FN_LCD0_D4, NULL);
  875. gpio_request(GPIO_FN_LCD0_D5, NULL);
  876. gpio_request(GPIO_FN_LCD0_D6, NULL);
  877. gpio_request(GPIO_FN_LCD0_D7, NULL);
  878. gpio_request(GPIO_FN_LCD0_D8, NULL);
  879. gpio_request(GPIO_FN_LCD0_D9, NULL);
  880. gpio_request(GPIO_FN_LCD0_D10, NULL);
  881. gpio_request(GPIO_FN_LCD0_D11, NULL);
  882. gpio_request(GPIO_FN_LCD0_D12, NULL);
  883. gpio_request(GPIO_FN_LCD0_D13, NULL);
  884. gpio_request(GPIO_FN_LCD0_D14, NULL);
  885. gpio_request(GPIO_FN_LCD0_D15, NULL);
  886. gpio_request(GPIO_FN_LCD0_D16, NULL);
  887. gpio_request(GPIO_FN_LCD0_D17, NULL);
  888. gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
  889. gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
  890. gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
  891. gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
  892. gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
  893. gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
  894. gpio_request(GPIO_FN_LCD0_DCK, NULL);
  895. gpio_request(GPIO_FN_LCD0_VSYN, NULL);
  896. gpio_request(GPIO_FN_LCD0_HSYN, NULL);
  897. gpio_request(GPIO_FN_LCD0_DISP, NULL);
  898. gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
  899. gpio_request(GPIO_PORT61, NULL); /* LCDDON */
  900. gpio_direction_output(GPIO_PORT61, 1);
  901. gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
  902. gpio_direction_output(GPIO_PORT202, 0);
  903. /* Touchscreen */
  904. gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
  905. gpio_request(GPIO_PORT166, NULL); /* TP_RST_B */
  906. gpio_direction_output(GPIO_PORT166, 1);
  907. /* GETHER */
  908. gpio_request(GPIO_FN_ET_CRS, NULL);
  909. gpio_request(GPIO_FN_ET_MDC, NULL);
  910. gpio_request(GPIO_FN_ET_MDIO, NULL);
  911. gpio_request(GPIO_FN_ET_TX_ER, NULL);
  912. gpio_request(GPIO_FN_ET_RX_ER, NULL);
  913. gpio_request(GPIO_FN_ET_ERXD0, NULL);
  914. gpio_request(GPIO_FN_ET_ERXD1, NULL);
  915. gpio_request(GPIO_FN_ET_ERXD2, NULL);
  916. gpio_request(GPIO_FN_ET_ERXD3, NULL);
  917. gpio_request(GPIO_FN_ET_TX_CLK, NULL);
  918. gpio_request(GPIO_FN_ET_TX_EN, NULL);
  919. gpio_request(GPIO_FN_ET_ETXD0, NULL);
  920. gpio_request(GPIO_FN_ET_ETXD1, NULL);
  921. gpio_request(GPIO_FN_ET_ETXD2, NULL);
  922. gpio_request(GPIO_FN_ET_ETXD3, NULL);
  923. gpio_request(GPIO_FN_ET_PHY_INT, NULL);
  924. gpio_request(GPIO_FN_ET_COL, NULL);
  925. gpio_request(GPIO_FN_ET_RX_DV, NULL);
  926. gpio_request(GPIO_FN_ET_RX_CLK, NULL);
  927. gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
  928. gpio_direction_output(GPIO_PORT18, 1);
  929. /* USB */
  930. gpio_request(GPIO_PORT159, NULL); /* USB_DEVICE_MODE */
  931. gpio_direction_input(GPIO_PORT159);
  932. if (gpio_get_value(GPIO_PORT159)) {
  933. /* USB Host */
  934. } else {
  935. /* USB Func */
  936. /*
  937. * A1 chip has 2 IRQ7 pin and it was controled by MSEL register.
  938. * OTOH, usbhs interrupt needs its value (HI/LOW) to decide
  939. * USB connection/disconnection (usbhsf_get_vbus()).
  940. * This means we needs to select GPIO_FN_IRQ7_PORT209 first,
  941. * and select GPIO_PORT209 here
  942. */
  943. gpio_request(GPIO_FN_IRQ7_PORT209, NULL);
  944. gpio_request(GPIO_PORT209, NULL);
  945. gpio_direction_input(GPIO_PORT209);
  946. platform_device_register(&usbhsf_device);
  947. usb = &usbhsf_device;
  948. }
  949. /* SDHI0 */
  950. gpio_request(GPIO_FN_SDHI0_CMD, NULL);
  951. gpio_request(GPIO_FN_SDHI0_CLK, NULL);
  952. gpio_request(GPIO_FN_SDHI0_D0, NULL);
  953. gpio_request(GPIO_FN_SDHI0_D1, NULL);
  954. gpio_request(GPIO_FN_SDHI0_D2, NULL);
  955. gpio_request(GPIO_FN_SDHI0_D3, NULL);
  956. gpio_request(GPIO_FN_SDHI0_WP, NULL);
  957. gpio_request(GPIO_PORT17, NULL); /* SDHI0_18/33_B */
  958. gpio_request(GPIO_PORT74, NULL); /* SDHI0_PON */
  959. gpio_request(GPIO_PORT75, NULL); /* SDSLOT1_PON */
  960. gpio_direction_output(GPIO_PORT17, 0);
  961. gpio_direction_output(GPIO_PORT74, 1);
  962. gpio_direction_output(GPIO_PORT75, 1);
  963. /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
  964. /*
  965. * MMCIF
  966. *
  967. * Here doesn't care SW1.4 status,
  968. * since CON2 is not mounted.
  969. */
  970. gpio_request(GPIO_FN_MMC1_CLK_PORT103, NULL);
  971. gpio_request(GPIO_FN_MMC1_CMD_PORT104, NULL);
  972. gpio_request(GPIO_FN_MMC1_D0_PORT149, NULL);
  973. gpio_request(GPIO_FN_MMC1_D1_PORT148, NULL);
  974. gpio_request(GPIO_FN_MMC1_D2_PORT147, NULL);
  975. gpio_request(GPIO_FN_MMC1_D3_PORT146, NULL);
  976. gpio_request(GPIO_FN_MMC1_D4_PORT145, NULL);
  977. gpio_request(GPIO_FN_MMC1_D5_PORT144, NULL);
  978. gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL);
  979. gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL);
  980. /* CEU0 */
  981. gpio_request(GPIO_FN_VIO0_D7, NULL);
  982. gpio_request(GPIO_FN_VIO0_D6, NULL);
  983. gpio_request(GPIO_FN_VIO0_D5, NULL);
  984. gpio_request(GPIO_FN_VIO0_D4, NULL);
  985. gpio_request(GPIO_FN_VIO0_D3, NULL);
  986. gpio_request(GPIO_FN_VIO0_D2, NULL);
  987. gpio_request(GPIO_FN_VIO0_D1, NULL);
  988. gpio_request(GPIO_FN_VIO0_D0, NULL);
  989. gpio_request(GPIO_FN_VIO0_CLK, NULL);
  990. gpio_request(GPIO_FN_VIO0_HD, NULL);
  991. gpio_request(GPIO_FN_VIO0_VD, NULL);
  992. gpio_request(GPIO_FN_VIO0_FIELD, NULL);
  993. gpio_request(GPIO_FN_VIO_CKO, NULL);
  994. /* CON1/CON15 Camera */
  995. gpio_request(GPIO_PORT173, NULL); /* STANDBY */
  996. gpio_request(GPIO_PORT172, NULL); /* RST */
  997. gpio_request(GPIO_PORT158, NULL); /* CAM_PON */
  998. gpio_direction_output(GPIO_PORT173, 0);
  999. gpio_direction_output(GPIO_PORT172, 1);
  1000. gpio_direction_output(GPIO_PORT158, 0); /* see mt9t111_power() */
  1001. /* FSI-WM8978 */
  1002. gpio_request(GPIO_FN_FSIAIBT, NULL);
  1003. gpio_request(GPIO_FN_FSIAILR, NULL);
  1004. gpio_request(GPIO_FN_FSIAOMC, NULL);
  1005. gpio_request(GPIO_FN_FSIAOSLD, NULL);
  1006. gpio_request(GPIO_FN_FSIAISLD_PORT5, NULL);
  1007. gpio_request(GPIO_PORT7, NULL);
  1008. gpio_request(GPIO_PORT8, NULL);
  1009. gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
  1010. gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */
  1011. /* FSI-HDMI */
  1012. gpio_request(GPIO_FN_FSIBCK, NULL);
  1013. /* HDMI */
  1014. gpio_request(GPIO_FN_HDMI_HPD, NULL);
  1015. gpio_request(GPIO_FN_HDMI_CEC, NULL);
  1016. /*
  1017. * CAUTION
  1018. *
  1019. * DBGMD/LCDC0/FSIA MUX
  1020. * DBGMD_SELECT_B should be set after setting PFC Function.
  1021. */
  1022. gpio_request(GPIO_PORT176, NULL);
  1023. gpio_direction_output(GPIO_PORT176, 1);
  1024. /*
  1025. * We can switch CON8/CON14 by SW1.5,
  1026. * but it needs after DBGMD_SELECT_B
  1027. */
  1028. gpio_request(GPIO_PORT6, NULL);
  1029. gpio_direction_input(GPIO_PORT6);
  1030. if (gpio_get_value(GPIO_PORT6)) {
  1031. /* CON14 enable */
  1032. } else {
  1033. /* CON8 (SDHI1) enable */
  1034. gpio_request(GPIO_FN_SDHI1_CLK, NULL);
  1035. gpio_request(GPIO_FN_SDHI1_CMD, NULL);
  1036. gpio_request(GPIO_FN_SDHI1_D0, NULL);
  1037. gpio_request(GPIO_FN_SDHI1_D1, NULL);
  1038. gpio_request(GPIO_FN_SDHI1_D2, NULL);
  1039. gpio_request(GPIO_FN_SDHI1_D3, NULL);
  1040. gpio_request(GPIO_FN_SDHI1_CD, NULL);
  1041. gpio_request(GPIO_FN_SDHI1_WP, NULL);
  1042. gpio_request(GPIO_PORT16, NULL); /* SDSLOT2_PON */
  1043. gpio_direction_output(GPIO_PORT16, 1);
  1044. platform_device_register(&sdhi1_device);
  1045. }
  1046. #ifdef CONFIG_CACHE_L2X0
  1047. /* Early BRESP enable, Shared attribute override enable, 32K*8way */
  1048. l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
  1049. #endif
  1050. i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
  1051. r8a7740_add_standard_devices();
  1052. platform_add_devices(eva_devices,
  1053. ARRAY_SIZE(eva_devices));
  1054. eva_clock_init();
  1055. rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &lcdc0_device);
  1056. rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &hdmi_lcdc_device);
  1057. if (usb)
  1058. rmobile_add_device_to_domain(&r8a7740_pd_a3sp, usb);
  1059. }
  1060. static void __init eva_earlytimer_init(void)
  1061. {
  1062. r8a7740_clock_init(MD_CK0 | MD_CK2);
  1063. shmobile_earlytimer_init();
  1064. }
  1065. static void __init eva_add_early_devices(void)
  1066. {
  1067. r8a7740_add_early_devices();
  1068. /* override timer setup with board-specific code */
  1069. shmobile_timer.init = eva_earlytimer_init;
  1070. }
  1071. static const char *eva_boards_compat_dt[] __initdata = {
  1072. "renesas,armadillo800eva",
  1073. NULL,
  1074. };
  1075. DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
  1076. .map_io = r8a7740_map_io,
  1077. .init_early = eva_add_early_devices,
  1078. .init_irq = r8a7740_init_irq,
  1079. .handle_irq = shmobile_handle_irq_intc,
  1080. .init_machine = eva_init,
  1081. .init_late = shmobile_init_late,
  1082. .timer = &shmobile_timer,
  1083. .dt_compat = eva_boards_compat_dt,
  1084. MACHINE_END