board-armadillo800eva.c 29 KB

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