board-armadillo800eva.c 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220
  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 int 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. return 0;
  211. }
  212. static int usbhsf_get_vbus(struct platform_device *pdev)
  213. {
  214. return gpio_get_value(GPIO_PORT209);
  215. }
  216. static irqreturn_t usbhsf_interrupt(int irq, void *data)
  217. {
  218. struct platform_device *pdev = data;
  219. renesas_usbhs_call_notify_hotplug(pdev);
  220. return IRQ_HANDLED;
  221. }
  222. static int usbhsf_hardware_exit(struct platform_device *pdev)
  223. {
  224. struct usbhsf_private *priv = usbhsf_get_priv(pdev);
  225. if (!IS_ERR(priv->phy))
  226. clk_put(priv->phy);
  227. if (!IS_ERR(priv->usb24))
  228. clk_put(priv->usb24);
  229. if (!IS_ERR(priv->pci))
  230. clk_put(priv->pci);
  231. if (!IS_ERR(priv->host))
  232. clk_put(priv->host);
  233. if (!IS_ERR(priv->func))
  234. clk_put(priv->func);
  235. if (priv->usbh_base)
  236. iounmap(priv->usbh_base);
  237. priv->phy = NULL;
  238. priv->usb24 = NULL;
  239. priv->pci = NULL;
  240. priv->host = NULL;
  241. priv->func = NULL;
  242. priv->usbh_base = NULL;
  243. free_irq(IRQ7, pdev);
  244. return 0;
  245. }
  246. static int usbhsf_hardware_init(struct platform_device *pdev)
  247. {
  248. struct usbhsf_private *priv = usbhsf_get_priv(pdev);
  249. int ret;
  250. priv->phy = clk_get(&pdev->dev, "phy");
  251. priv->usb24 = clk_get(&pdev->dev, "usb24");
  252. priv->pci = clk_get(&pdev->dev, "pci");
  253. priv->func = clk_get(&pdev->dev, "func");
  254. priv->host = clk_get(&pdev->dev, "host");
  255. priv->usbh_base = ioremap_nocache(USBH, 0x20000);
  256. if (IS_ERR(priv->phy) ||
  257. IS_ERR(priv->usb24) ||
  258. IS_ERR(priv->pci) ||
  259. IS_ERR(priv->host) ||
  260. IS_ERR(priv->func) ||
  261. !priv->usbh_base) {
  262. dev_err(&pdev->dev, "USB clock setting failed\n");
  263. usbhsf_hardware_exit(pdev);
  264. return -EIO;
  265. }
  266. ret = request_irq(IRQ7, usbhsf_interrupt, IRQF_TRIGGER_NONE,
  267. dev_name(&pdev->dev), pdev);
  268. if (ret) {
  269. dev_err(&pdev->dev, "request_irq err\n");
  270. return ret;
  271. }
  272. irq_set_irq_type(IRQ7, IRQ_TYPE_EDGE_BOTH);
  273. /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
  274. clk_set_rate(priv->usb24,
  275. clk_get_rate(clk_get_parent(priv->usb24)));
  276. return 0;
  277. }
  278. static struct usbhsf_private usbhsf_private = {
  279. .info = {
  280. .platform_callback = {
  281. .get_id = usbhsf_get_id,
  282. .get_vbus = usbhsf_get_vbus,
  283. .hardware_init = usbhsf_hardware_init,
  284. .hardware_exit = usbhsf_hardware_exit,
  285. .power_ctrl = usbhsf_power_ctrl,
  286. },
  287. .driver_param = {
  288. .buswait_bwait = 5,
  289. .detection_delay = 5,
  290. .d0_rx_id = SHDMA_SLAVE_USBHS_RX,
  291. .d1_tx_id = SHDMA_SLAVE_USBHS_TX,
  292. },
  293. }
  294. };
  295. static struct resource usbhsf_resources[] = {
  296. {
  297. .name = "USBHS",
  298. .start = 0xe6890000,
  299. .end = 0xe6890104 - 1,
  300. .flags = IORESOURCE_MEM,
  301. },
  302. {
  303. .start = evt2irq(0x0A20),
  304. .flags = IORESOURCE_IRQ,
  305. },
  306. };
  307. static struct platform_device usbhsf_device = {
  308. .name = "renesas_usbhs",
  309. .dev = {
  310. .platform_data = &usbhsf_private.info,
  311. },
  312. .id = -1,
  313. .num_resources = ARRAY_SIZE(usbhsf_resources),
  314. .resource = usbhsf_resources,
  315. };
  316. /* Ether */
  317. static struct sh_eth_plat_data sh_eth_platdata = {
  318. .phy = 0x00, /* LAN8710A */
  319. .edmac_endian = EDMAC_LITTLE_ENDIAN,
  320. .register_type = SH_ETH_REG_GIGABIT,
  321. .phy_interface = PHY_INTERFACE_MODE_MII,
  322. };
  323. static struct resource sh_eth_resources[] = {
  324. {
  325. .start = 0xe9a00000,
  326. .end = 0xe9a00800 - 1,
  327. .flags = IORESOURCE_MEM,
  328. }, {
  329. .start = 0xe9a01800,
  330. .end = 0xe9a02000 - 1,
  331. .flags = IORESOURCE_MEM,
  332. }, {
  333. .start = evt2irq(0x0500),
  334. .flags = IORESOURCE_IRQ,
  335. },
  336. };
  337. static struct platform_device sh_eth_device = {
  338. .name = "sh-eth",
  339. .id = -1,
  340. .dev = {
  341. .platform_data = &sh_eth_platdata,
  342. },
  343. .resource = sh_eth_resources,
  344. .num_resources = ARRAY_SIZE(sh_eth_resources),
  345. };
  346. /* LCDC */
  347. static struct fb_videomode lcdc0_mode = {
  348. .name = "AMPIER/AM-800480",
  349. .xres = 800,
  350. .yres = 480,
  351. .left_margin = 88,
  352. .right_margin = 40,
  353. .hsync_len = 128,
  354. .upper_margin = 20,
  355. .lower_margin = 5,
  356. .vsync_len = 5,
  357. .sync = 0,
  358. };
  359. static struct sh_mobile_lcdc_info lcdc0_info = {
  360. .clock_source = LCDC_CLK_BUS,
  361. .ch[0] = {
  362. .chan = LCDC_CHAN_MAINLCD,
  363. .fourcc = V4L2_PIX_FMT_RGB565,
  364. .interface_type = RGB24,
  365. .clock_divider = 5,
  366. .flags = 0,
  367. .lcd_modes = &lcdc0_mode,
  368. .num_modes = 1,
  369. .panel_cfg = {
  370. .width = 111,
  371. .height = 68,
  372. },
  373. },
  374. };
  375. static struct resource lcdc0_resources[] = {
  376. [0] = {
  377. .name = "LCD0",
  378. .start = 0xfe940000,
  379. .end = 0xfe943fff,
  380. .flags = IORESOURCE_MEM,
  381. },
  382. [1] = {
  383. .start = intcs_evt2irq(0x580),
  384. .flags = IORESOURCE_IRQ,
  385. },
  386. };
  387. static struct platform_device lcdc0_device = {
  388. .name = "sh_mobile_lcdc_fb",
  389. .num_resources = ARRAY_SIZE(lcdc0_resources),
  390. .resource = lcdc0_resources,
  391. .id = 0,
  392. .dev = {
  393. .platform_data = &lcdc0_info,
  394. .coherent_dma_mask = ~0,
  395. },
  396. };
  397. /*
  398. * LCDC1/HDMI
  399. */
  400. static struct sh_mobile_hdmi_info hdmi_info = {
  401. .flags = HDMI_OUTPUT_PUSH_PULL |
  402. HDMI_OUTPUT_POLARITY_HI |
  403. HDMI_32BIT_REG |
  404. HDMI_HAS_HTOP1 |
  405. HDMI_SND_SRC_SPDIF,
  406. };
  407. static struct resource hdmi_resources[] = {
  408. [0] = {
  409. .name = "HDMI",
  410. .start = 0xe6be0000,
  411. .end = 0xe6be03ff,
  412. .flags = IORESOURCE_MEM,
  413. },
  414. [1] = {
  415. .start = evt2irq(0x1700),
  416. .flags = IORESOURCE_IRQ,
  417. },
  418. [2] = {
  419. .name = "HDMI emma3pf",
  420. .start = 0xe6be4000,
  421. .end = 0xe6be43ff,
  422. .flags = IORESOURCE_MEM,
  423. },
  424. };
  425. static struct platform_device hdmi_device = {
  426. .name = "sh-mobile-hdmi",
  427. .num_resources = ARRAY_SIZE(hdmi_resources),
  428. .resource = hdmi_resources,
  429. .id = -1,
  430. .dev = {
  431. .platform_data = &hdmi_info,
  432. },
  433. };
  434. static const struct fb_videomode lcdc1_mode = {
  435. .name = "HDMI 720p",
  436. .xres = 1280,
  437. .yres = 720,
  438. .pixclock = 13468,
  439. .left_margin = 220,
  440. .right_margin = 110,
  441. .hsync_len = 40,
  442. .upper_margin = 20,
  443. .lower_margin = 5,
  444. .vsync_len = 5,
  445. .refresh = 60,
  446. .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
  447. };
  448. static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
  449. .clock_source = LCDC_CLK_PERIPHERAL, /* HDMI clock */
  450. .ch[0] = {
  451. .chan = LCDC_CHAN_MAINLCD,
  452. .fourcc = V4L2_PIX_FMT_RGB565,
  453. .interface_type = RGB24,
  454. .clock_divider = 1,
  455. .flags = LCDC_FLAGS_DWPOL,
  456. .lcd_modes = &lcdc1_mode,
  457. .num_modes = 1,
  458. .tx_dev = &hdmi_device,
  459. .panel_cfg = {
  460. .width = 1280,
  461. .height = 720,
  462. },
  463. },
  464. };
  465. static struct resource hdmi_lcdc_resources[] = {
  466. [0] = {
  467. .name = "LCDC1",
  468. .start = 0xfe944000,
  469. .end = 0xfe948000 - 1,
  470. .flags = IORESOURCE_MEM,
  471. },
  472. [1] = {
  473. .start = intcs_evt2irq(0x1780),
  474. .flags = IORESOURCE_IRQ,
  475. },
  476. };
  477. static struct platform_device hdmi_lcdc_device = {
  478. .name = "sh_mobile_lcdc_fb",
  479. .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
  480. .resource = hdmi_lcdc_resources,
  481. .id = 1,
  482. .dev = {
  483. .platform_data = &hdmi_lcdc_info,
  484. .coherent_dma_mask = ~0,
  485. },
  486. };
  487. /* GPIO KEY */
  488. #define GPIO_KEY(c, g, d, ...) \
  489. { .code = c, .gpio = g, .desc = d, .active_low = 1, __VA_ARGS__ }
  490. static struct gpio_keys_button gpio_buttons[] = {
  491. GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW3", .wakeup = 1),
  492. GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW4"),
  493. GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW5"),
  494. GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW6"),
  495. };
  496. static struct gpio_keys_platform_data gpio_key_info = {
  497. .buttons = gpio_buttons,
  498. .nbuttons = ARRAY_SIZE(gpio_buttons),
  499. };
  500. static struct platform_device gpio_keys_device = {
  501. .name = "gpio-keys",
  502. .id = -1,
  503. .dev = {
  504. .platform_data = &gpio_key_info,
  505. },
  506. };
  507. /* Fixed 3.3V regulator to be used by SDHI0, SDHI1, MMCIF */
  508. static struct regulator_consumer_supply fixed3v3_power_consumers[] =
  509. {
  510. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
  511. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
  512. REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
  513. REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
  514. REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
  515. REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
  516. };
  517. /* SDHI0 */
  518. /*
  519. * FIXME
  520. *
  521. * It use polling mode here, since
  522. * CD (= Card Detect) pin is not connected to SDHI0_CD.
  523. * We can use IRQ31 as card detect irq,
  524. * but it needs chattering removal operation
  525. */
  526. #define IRQ31 evt2irq(0x33E0)
  527. static struct sh_mobile_sdhi_info sdhi0_info = {
  528. .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
  529. .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
  530. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\
  531. MMC_CAP_NEEDS_POLL,
  532. .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
  533. .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
  534. };
  535. static struct resource sdhi0_resources[] = {
  536. {
  537. .name = "SDHI0",
  538. .start = 0xe6850000,
  539. .end = 0xe6850100 - 1,
  540. .flags = IORESOURCE_MEM,
  541. },
  542. /*
  543. * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
  544. */
  545. {
  546. .name = SH_MOBILE_SDHI_IRQ_SDCARD,
  547. .start = evt2irq(0x0E20),
  548. .flags = IORESOURCE_IRQ,
  549. },
  550. {
  551. .name = SH_MOBILE_SDHI_IRQ_SDIO,
  552. .start = evt2irq(0x0E40),
  553. .flags = IORESOURCE_IRQ,
  554. },
  555. };
  556. static struct platform_device sdhi0_device = {
  557. .name = "sh_mobile_sdhi",
  558. .id = 0,
  559. .dev = {
  560. .platform_data = &sdhi0_info,
  561. },
  562. .num_resources = ARRAY_SIZE(sdhi0_resources),
  563. .resource = sdhi0_resources,
  564. };
  565. /* SDHI1 */
  566. static struct sh_mobile_sdhi_info sdhi1_info = {
  567. .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
  568. .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
  569. .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
  570. .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
  571. .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
  572. };
  573. static struct resource sdhi1_resources[] = {
  574. [0] = {
  575. .name = "SDHI1",
  576. .start = 0xe6860000,
  577. .end = 0xe6860100 - 1,
  578. .flags = IORESOURCE_MEM,
  579. },
  580. [1] = {
  581. .start = evt2irq(0x0E80),
  582. .flags = IORESOURCE_IRQ,
  583. },
  584. [2] = {
  585. .start = evt2irq(0x0EA0),
  586. .flags = IORESOURCE_IRQ,
  587. },
  588. [3] = {
  589. .start = evt2irq(0x0EC0),
  590. .flags = IORESOURCE_IRQ,
  591. },
  592. };
  593. static struct platform_device sdhi1_device = {
  594. .name = "sh_mobile_sdhi",
  595. .id = 1,
  596. .dev = {
  597. .platform_data = &sdhi1_info,
  598. },
  599. .num_resources = ARRAY_SIZE(sdhi1_resources),
  600. .resource = sdhi1_resources,
  601. };
  602. /* MMCIF */
  603. static struct sh_mmcif_plat_data sh_mmcif_plat = {
  604. .sup_pclk = 0,
  605. .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
  606. .caps = MMC_CAP_4_BIT_DATA |
  607. MMC_CAP_8_BIT_DATA |
  608. MMC_CAP_NONREMOVABLE,
  609. };
  610. static struct resource sh_mmcif_resources[] = {
  611. [0] = {
  612. .name = "MMCIF",
  613. .start = 0xe6bd0000,
  614. .end = 0xe6bd0100 - 1,
  615. .flags = IORESOURCE_MEM,
  616. },
  617. [1] = {
  618. /* MMC ERR */
  619. .start = evt2irq(0x1AC0),
  620. .flags = IORESOURCE_IRQ,
  621. },
  622. [2] = {
  623. /* MMC NOR */
  624. .start = evt2irq(0x1AE0),
  625. .flags = IORESOURCE_IRQ,
  626. },
  627. };
  628. static struct platform_device sh_mmcif_device = {
  629. .name = "sh_mmcif",
  630. .id = -1,
  631. .dev = {
  632. .platform_data = &sh_mmcif_plat,
  633. },
  634. .num_resources = ARRAY_SIZE(sh_mmcif_resources),
  635. .resource = sh_mmcif_resources,
  636. };
  637. /* Camera */
  638. static int mt9t111_power(struct device *dev, int mode)
  639. {
  640. struct clk *mclk = clk_get(NULL, "video1");
  641. if (IS_ERR(mclk)) {
  642. dev_err(dev, "can't get video1 clock\n");
  643. return -EINVAL;
  644. }
  645. if (mode) {
  646. /* video1 (= CON1 camera) expect 24MHz */
  647. clk_set_rate(mclk, clk_round_rate(mclk, 24000000));
  648. clk_enable(mclk);
  649. gpio_set_value(GPIO_PORT158, 1);
  650. } else {
  651. gpio_set_value(GPIO_PORT158, 0);
  652. clk_disable(mclk);
  653. }
  654. clk_put(mclk);
  655. return 0;
  656. }
  657. static struct i2c_board_info i2c_camera_mt9t111 = {
  658. I2C_BOARD_INFO("mt9t112", 0x3d),
  659. };
  660. static struct mt9t112_camera_info mt9t111_info = {
  661. .divider = { 16, 0, 0, 7, 0, 10, 14, 7, 7 },
  662. };
  663. static struct soc_camera_link mt9t111_link = {
  664. .i2c_adapter_id = 0,
  665. .bus_id = 0,
  666. .board_info = &i2c_camera_mt9t111,
  667. .power = mt9t111_power,
  668. .priv = &mt9t111_info,
  669. };
  670. static struct platform_device camera_device = {
  671. .name = "soc-camera-pdrv",
  672. .id = 0,
  673. .dev = {
  674. .platform_data = &mt9t111_link,
  675. },
  676. };
  677. /* CEU0 */
  678. static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
  679. .flags = SH_CEU_FLAG_LOWER_8BIT,
  680. };
  681. static struct resource ceu0_resources[] = {
  682. [0] = {
  683. .name = "CEU",
  684. .start = 0xfe910000,
  685. .end = 0xfe91009f,
  686. .flags = IORESOURCE_MEM,
  687. },
  688. [1] = {
  689. .start = intcs_evt2irq(0x0500),
  690. .flags = IORESOURCE_IRQ,
  691. },
  692. [2] = {
  693. /* place holder for contiguous memory */
  694. },
  695. };
  696. static struct platform_device ceu0_device = {
  697. .name = "sh_mobile_ceu",
  698. .id = 0,
  699. .num_resources = ARRAY_SIZE(ceu0_resources),
  700. .resource = ceu0_resources,
  701. .dev = {
  702. .platform_data = &sh_mobile_ceu0_info,
  703. .coherent_dma_mask = 0xffffffff,
  704. },
  705. };
  706. /* FSI */
  707. static struct sh_fsi_platform_info fsi_info = {
  708. /* FSI-WM8978 */
  709. .port_a = {
  710. .tx_id = SHDMA_SLAVE_FSIA_TX,
  711. },
  712. /* FSI-HDMI */
  713. .port_b = {
  714. .flags = SH_FSI_FMT_SPDIF |
  715. SH_FSI_ENABLE_STREAM_MODE |
  716. SH_FSI_CLK_CPG,
  717. .tx_id = SHDMA_SLAVE_FSIB_TX,
  718. }
  719. };
  720. static struct resource fsi_resources[] = {
  721. [0] = {
  722. .name = "FSI",
  723. .start = 0xfe1f0000,
  724. .end = 0xfe1f8400 - 1,
  725. .flags = IORESOURCE_MEM,
  726. },
  727. [1] = {
  728. .start = evt2irq(0x1840),
  729. .flags = IORESOURCE_IRQ,
  730. },
  731. };
  732. static struct platform_device fsi_device = {
  733. .name = "sh_fsi2",
  734. .id = -1,
  735. .num_resources = ARRAY_SIZE(fsi_resources),
  736. .resource = fsi_resources,
  737. .dev = {
  738. .platform_data = &fsi_info,
  739. },
  740. };
  741. /* FSI-WM8978 */
  742. static struct asoc_simple_card_info fsi_wm8978_info = {
  743. .name = "wm8978",
  744. .card = "FSI2A-WM8978",
  745. .codec = "wm8978.0-001a",
  746. .platform = "sh_fsi2",
  747. .daifmt = SND_SOC_DAIFMT_I2S,
  748. .cpu_dai = {
  749. .name = "fsia-dai",
  750. .fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_IB_NF,
  751. },
  752. .codec_dai = {
  753. .name = "wm8978-hifi",
  754. .fmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
  755. .sysclk = 12288000,
  756. },
  757. };
  758. static struct platform_device fsi_wm8978_device = {
  759. .name = "asoc-simple-card",
  760. .id = 0,
  761. .dev = {
  762. .platform_data = &fsi_wm8978_info,
  763. },
  764. };
  765. /* FSI-HDMI */
  766. static struct asoc_simple_card_info fsi2_hdmi_info = {
  767. .name = "HDMI",
  768. .card = "FSI2B-HDMI",
  769. .codec = "sh-mobile-hdmi",
  770. .platform = "sh_fsi2",
  771. .cpu_dai = {
  772. .name = "fsib-dai",
  773. .fmt = SND_SOC_DAIFMT_CBM_CFM,
  774. },
  775. .codec_dai = {
  776. .name = "sh_mobile_hdmi-hifi",
  777. },
  778. };
  779. static struct platform_device fsi_hdmi_device = {
  780. .name = "asoc-simple-card",
  781. .id = 1,
  782. .dev = {
  783. .platform_data = &fsi2_hdmi_info,
  784. },
  785. };
  786. /* RTC: RTC connects i2c-gpio. */
  787. static struct i2c_gpio_platform_data i2c_gpio_data = {
  788. .sda_pin = GPIO_PORT208,
  789. .scl_pin = GPIO_PORT91,
  790. .udelay = 5, /* 100 kHz */
  791. };
  792. static struct platform_device i2c_gpio_device = {
  793. .name = "i2c-gpio",
  794. .id = 2,
  795. .dev = {
  796. .platform_data = &i2c_gpio_data,
  797. },
  798. };
  799. /* I2C */
  800. static struct i2c_board_info i2c0_devices[] = {
  801. {
  802. I2C_BOARD_INFO("st1232-ts", 0x55),
  803. .irq = evt2irq(0x0340),
  804. },
  805. {
  806. I2C_BOARD_INFO("wm8978", 0x1a),
  807. },
  808. };
  809. static struct i2c_board_info i2c2_devices[] = {
  810. {
  811. I2C_BOARD_INFO("s35390a", 0x30),
  812. .type = "s35390a",
  813. },
  814. };
  815. /*
  816. * board devices
  817. */
  818. static struct platform_device *eva_devices[] __initdata = {
  819. &lcdc0_device,
  820. &gpio_keys_device,
  821. &sh_eth_device,
  822. &sdhi0_device,
  823. &sh_mmcif_device,
  824. &hdmi_device,
  825. &hdmi_lcdc_device,
  826. &camera_device,
  827. &ceu0_device,
  828. &fsi_device,
  829. &fsi_wm8978_device,
  830. &fsi_hdmi_device,
  831. &i2c_gpio_device,
  832. };
  833. static void __init eva_clock_init(void)
  834. {
  835. struct clk *system = clk_get(NULL, "system_clk");
  836. struct clk *xtal1 = clk_get(NULL, "extal1");
  837. struct clk *usb24s = clk_get(NULL, "usb24s");
  838. struct clk *fsibck = clk_get(NULL, "fsibck");
  839. if (IS_ERR(system) ||
  840. IS_ERR(xtal1) ||
  841. IS_ERR(usb24s) ||
  842. IS_ERR(fsibck)) {
  843. pr_err("armadillo800eva board clock init failed\n");
  844. goto clock_error;
  845. }
  846. /* armadillo 800 eva extal1 is 24MHz */
  847. clk_set_rate(xtal1, 24000000);
  848. /* usb24s use extal1 (= system) clock (= 24MHz) */
  849. clk_set_parent(usb24s, system);
  850. /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
  851. clk_set_rate(fsibck, 12288000);
  852. clock_error:
  853. if (!IS_ERR(system))
  854. clk_put(system);
  855. if (!IS_ERR(xtal1))
  856. clk_put(xtal1);
  857. if (!IS_ERR(usb24s))
  858. clk_put(usb24s);
  859. if (!IS_ERR(fsibck))
  860. clk_put(fsibck);
  861. }
  862. /*
  863. * board init
  864. */
  865. #define GPIO_PORT7CR IOMEM(0xe6050007)
  866. #define GPIO_PORT8CR IOMEM(0xe6050008)
  867. static void __init eva_init(void)
  868. {
  869. struct platform_device *usb = NULL;
  870. regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
  871. ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
  872. r8a7740_pinmux_init();
  873. r8a7740_meram_workaround();
  874. /* SCIFA1 */
  875. gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
  876. gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
  877. /* LCDC0 */
  878. gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
  879. gpio_request(GPIO_FN_LCD0_D0, NULL);
  880. gpio_request(GPIO_FN_LCD0_D1, NULL);
  881. gpio_request(GPIO_FN_LCD0_D2, NULL);
  882. gpio_request(GPIO_FN_LCD0_D3, NULL);
  883. gpio_request(GPIO_FN_LCD0_D4, NULL);
  884. gpio_request(GPIO_FN_LCD0_D5, NULL);
  885. gpio_request(GPIO_FN_LCD0_D6, NULL);
  886. gpio_request(GPIO_FN_LCD0_D7, NULL);
  887. gpio_request(GPIO_FN_LCD0_D8, NULL);
  888. gpio_request(GPIO_FN_LCD0_D9, NULL);
  889. gpio_request(GPIO_FN_LCD0_D10, NULL);
  890. gpio_request(GPIO_FN_LCD0_D11, NULL);
  891. gpio_request(GPIO_FN_LCD0_D12, NULL);
  892. gpio_request(GPIO_FN_LCD0_D13, NULL);
  893. gpio_request(GPIO_FN_LCD0_D14, NULL);
  894. gpio_request(GPIO_FN_LCD0_D15, NULL);
  895. gpio_request(GPIO_FN_LCD0_D16, NULL);
  896. gpio_request(GPIO_FN_LCD0_D17, NULL);
  897. gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
  898. gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
  899. gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
  900. gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
  901. gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
  902. gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
  903. gpio_request(GPIO_FN_LCD0_DCK, NULL);
  904. gpio_request(GPIO_FN_LCD0_VSYN, NULL);
  905. gpio_request(GPIO_FN_LCD0_HSYN, NULL);
  906. gpio_request(GPIO_FN_LCD0_DISP, NULL);
  907. gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
  908. gpio_request_one(GPIO_PORT61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
  909. gpio_request_one(GPIO_PORT202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */
  910. /* Touchscreen */
  911. gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
  912. gpio_request_one(GPIO_PORT166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
  913. /* GETHER */
  914. gpio_request(GPIO_FN_ET_CRS, NULL);
  915. gpio_request(GPIO_FN_ET_MDC, NULL);
  916. gpio_request(GPIO_FN_ET_MDIO, NULL);
  917. gpio_request(GPIO_FN_ET_TX_ER, NULL);
  918. gpio_request(GPIO_FN_ET_RX_ER, NULL);
  919. gpio_request(GPIO_FN_ET_ERXD0, NULL);
  920. gpio_request(GPIO_FN_ET_ERXD1, NULL);
  921. gpio_request(GPIO_FN_ET_ERXD2, NULL);
  922. gpio_request(GPIO_FN_ET_ERXD3, NULL);
  923. gpio_request(GPIO_FN_ET_TX_CLK, NULL);
  924. gpio_request(GPIO_FN_ET_TX_EN, NULL);
  925. gpio_request(GPIO_FN_ET_ETXD0, NULL);
  926. gpio_request(GPIO_FN_ET_ETXD1, NULL);
  927. gpio_request(GPIO_FN_ET_ETXD2, NULL);
  928. gpio_request(GPIO_FN_ET_ETXD3, NULL);
  929. gpio_request(GPIO_FN_ET_PHY_INT, NULL);
  930. gpio_request(GPIO_FN_ET_COL, NULL);
  931. gpio_request(GPIO_FN_ET_RX_DV, NULL);
  932. gpio_request(GPIO_FN_ET_RX_CLK, NULL);
  933. gpio_request_one(GPIO_PORT18, GPIOF_OUT_INIT_HIGH, NULL); /* PHY_RST */
  934. /* USB */
  935. gpio_request_one(GPIO_PORT159, GPIOF_IN, NULL); /* USB_DEVICE_MODE */
  936. if (gpio_get_value(GPIO_PORT159)) {
  937. /* USB Host */
  938. } else {
  939. /* USB Func */
  940. /*
  941. * A1 chip has 2 IRQ7 pin and it was controled by MSEL register.
  942. * OTOH, usbhs interrupt needs its value (HI/LOW) to decide
  943. * USB connection/disconnection (usbhsf_get_vbus()).
  944. * This means we needs to select GPIO_FN_IRQ7_PORT209 first,
  945. * and select GPIO_PORT209 here
  946. */
  947. gpio_request(GPIO_FN_IRQ7_PORT209, NULL);
  948. gpio_request_one(GPIO_PORT209, GPIOF_IN, NULL);
  949. platform_device_register(&usbhsf_device);
  950. usb = &usbhsf_device;
  951. }
  952. /* SDHI0 */
  953. gpio_request(GPIO_FN_SDHI0_CMD, NULL);
  954. gpio_request(GPIO_FN_SDHI0_CLK, NULL);
  955. gpio_request(GPIO_FN_SDHI0_D0, NULL);
  956. gpio_request(GPIO_FN_SDHI0_D1, NULL);
  957. gpio_request(GPIO_FN_SDHI0_D2, NULL);
  958. gpio_request(GPIO_FN_SDHI0_D3, NULL);
  959. gpio_request(GPIO_FN_SDHI0_WP, NULL);
  960. gpio_request_one(GPIO_PORT17, GPIOF_OUT_INIT_LOW, NULL); /* SDHI0_18/33_B */
  961. gpio_request_one(GPIO_PORT74, GPIOF_OUT_INIT_HIGH, NULL); /* SDHI0_PON */
  962. gpio_request_one(GPIO_PORT75, GPIOF_OUT_INIT_HIGH, NULL); /* SDSLOT1_PON */
  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_one(GPIO_PORT173, GPIOF_OUT_INIT_LOW, NULL); /* STANDBY */
  996. gpio_request_one(GPIO_PORT172, GPIOF_OUT_INIT_HIGH, NULL); /* RST */
  997. /* see mt9t111_power() */
  998. gpio_request_one(GPIO_PORT158, GPIOF_OUT_INIT_LOW, NULL); /* CAM_PON */
  999. /* FSI-WM8978 */
  1000. gpio_request(GPIO_FN_FSIAIBT, NULL);
  1001. gpio_request(GPIO_FN_FSIAILR, NULL);
  1002. gpio_request(GPIO_FN_FSIAOMC, NULL);
  1003. gpio_request(GPIO_FN_FSIAOSLD, NULL);
  1004. gpio_request(GPIO_FN_FSIAISLD_PORT5, NULL);
  1005. gpio_request(GPIO_PORT7, NULL);
  1006. gpio_request(GPIO_PORT8, NULL);
  1007. gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
  1008. gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */
  1009. /* FSI-HDMI */
  1010. gpio_request(GPIO_FN_FSIBCK, NULL);
  1011. /* HDMI */
  1012. gpio_request(GPIO_FN_HDMI_HPD, NULL);
  1013. gpio_request(GPIO_FN_HDMI_CEC, NULL);
  1014. /*
  1015. * CAUTION
  1016. *
  1017. * DBGMD/LCDC0/FSIA MUX
  1018. * DBGMD_SELECT_B should be set after setting PFC Function.
  1019. */
  1020. gpio_request_one(GPIO_PORT176, GPIOF_OUT_INIT_HIGH, NULL);
  1021. /*
  1022. * We can switch CON8/CON14 by SW1.5,
  1023. * but it needs after DBGMD_SELECT_B
  1024. */
  1025. gpio_request_one(GPIO_PORT6, GPIOF_IN, NULL);
  1026. if (gpio_get_value(GPIO_PORT6)) {
  1027. /* CON14 enable */
  1028. } else {
  1029. /* CON8 (SDHI1) enable */
  1030. gpio_request(GPIO_FN_SDHI1_CLK, NULL);
  1031. gpio_request(GPIO_FN_SDHI1_CMD, NULL);
  1032. gpio_request(GPIO_FN_SDHI1_D0, NULL);
  1033. gpio_request(GPIO_FN_SDHI1_D1, NULL);
  1034. gpio_request(GPIO_FN_SDHI1_D2, NULL);
  1035. gpio_request(GPIO_FN_SDHI1_D3, NULL);
  1036. gpio_request(GPIO_FN_SDHI1_CD, NULL);
  1037. gpio_request(GPIO_FN_SDHI1_WP, NULL);
  1038. /* SDSLOT2_PON */
  1039. gpio_request_one(GPIO_PORT16, GPIOF_OUT_INIT_HIGH, NULL);
  1040. platform_device_register(&sdhi1_device);
  1041. }
  1042. #ifdef CONFIG_CACHE_L2X0
  1043. /* Early BRESP enable, Shared attribute override enable, 32K*8way */
  1044. l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
  1045. #endif
  1046. i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
  1047. i2c_register_board_info(2, i2c2_devices, ARRAY_SIZE(i2c2_devices));
  1048. r8a7740_add_standard_devices();
  1049. platform_add_devices(eva_devices,
  1050. ARRAY_SIZE(eva_devices));
  1051. rmobile_add_device_to_domain("A4LC", &lcdc0_device);
  1052. rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
  1053. if (usb)
  1054. rmobile_add_device_to_domain("A3SP", usb);
  1055. r8a7740_pm_init();
  1056. }
  1057. static void __init eva_earlytimer_init(void)
  1058. {
  1059. r8a7740_clock_init(MD_CK0 | MD_CK2);
  1060. shmobile_earlytimer_init();
  1061. /* the rate of extal1 clock must be set before late_time_init */
  1062. eva_clock_init();
  1063. }
  1064. static void __init eva_add_early_devices(void)
  1065. {
  1066. r8a7740_add_early_devices();
  1067. }
  1068. #define RESCNT2 IOMEM(0xe6188020)
  1069. static void eva_restart(char mode, const char *cmd)
  1070. {
  1071. /* Do soft power on reset */
  1072. writel((1 << 31), RESCNT2);
  1073. }
  1074. static const char *eva_boards_compat_dt[] __initdata = {
  1075. "renesas,armadillo800eva",
  1076. NULL,
  1077. };
  1078. DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
  1079. .map_io = r8a7740_map_io,
  1080. .init_early = eva_add_early_devices,
  1081. .init_irq = r8a7740_init_irq,
  1082. .handle_irq = shmobile_handle_irq_intc,
  1083. .init_machine = eva_init,
  1084. .init_late = shmobile_init_late,
  1085. .init_time = eva_earlytimer_init,
  1086. .dt_compat = eva_boards_compat_dt,
  1087. .restart = eva_restart,
  1088. MACHINE_END