board-armadillo800eva.c 29 KB

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