blob: 5f8f571665a027b4a84808beb058787ff33fb841 [file] [log] [blame]
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001/*
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
22#include <linux/clk.h>
Kuninori Morimoto1c962932012-04-24 02:09:08 -070023#include <linux/delay.h>
Kuninori Morimoto4d22e562012-04-06 01:28:59 -070024#include <linux/err.h>
25#include <linux/kernel.h>
Kuninori Morimotof7e7d312012-04-06 01:31:33 -070026#include <linux/input.h>
Kuninori Morimoto1c962932012-04-24 02:09:08 -070027#include <linux/irq.h>
Kuninori Morimoto4d22e562012-04-06 01:28:59 -070028#include <linux/platform_device.h>
29#include <linux/gpio.h>
Kuninori Morimotof7e7d312012-04-06 01:31:33 -070030#include <linux/gpio_keys.h>
Kuninori Morimotod8fed1e2012-04-06 01:32:02 -070031#include <linux/sh_eth.h>
Kuninori Morimotodad29d12012-04-06 01:30:09 -070032#include <linux/videodev2.h>
Kuninori Morimoto1c962932012-04-24 02:09:08 -070033#include <linux/usb/renesas_usbhs.h>
Kuninori Morimoto49c01112012-04-24 02:09:19 -070034#include <linux/mfd/tmio.h>
35#include <linux/mmc/host.h>
Kuninori Morimoto0a4266b2012-04-24 02:09:42 -070036#include <linux/mmc/sh_mmcif.h>
Kuninori Morimoto49c01112012-04-24 02:09:19 -070037#include <linux/mmc/sh_mobile_sdhi.h>
Kuninori Morimoto4d22e562012-04-06 01:28:59 -070038#include <mach/common.h>
39#include <mach/irqs.h>
Kuninori Morimoto3760e792012-06-12 02:40:07 -070040#include <mach/r8a7740.h>
41#include <media/mt9t112.h>
42#include <media/sh_mobile_ceu.h>
43#include <media/soc_camera.h>
Kuninori Morimoto4d22e562012-04-06 01:28:59 -070044#include <asm/page.h>
45#include <asm/mach-types.h>
46#include <asm/mach/arch.h>
47#include <asm/mach/map.h>
48#include <asm/mach/time.h>
49#include <asm/hardware/cache-l2x0.h>
Kuninori Morimotodad29d12012-04-06 01:30:09 -070050#include <video/sh_mobile_lcdc.h>
Kuninori Morimoto910c14d2012-06-12 02:39:11 -070051#include <video/sh_mobile_hdmi.h>
Kuninori Morimoto5389bf72012-06-25 03:32:50 -070052#include <sound/sh_fsi.h>
53#include <sound/simple_card.h>
Kuninori Morimoto4d22e562012-04-06 01:28:59 -070054
55/*
56 * CON1 Camera Module
57 * CON2 Extension Bus
58 * CON3 HDMI Output
59 * CON4 Composite Video Output
60 * CON5 H-UDI JTAG
61 * CON6 ARM JTAG
62 * CON7 SD1
63 * CON8 SD2
64 * CON9 RTC BackUp
65 * CON10 Monaural Mic Input
66 * CON11 Stereo Headphone Output
67 * CON12 Audio Line Output(L)
68 * CON13 Audio Line Output(R)
69 * CON14 AWL13 Module
70 * CON15 Extension
71 * CON16 LCD1
72 * CON17 LCD2
73 * CON19 Power Input
74 * CON20 USB1
75 * CON21 USB2
76 * CON22 Serial
77 * CON23 LAN
78 * CON24 USB3
79 * LED1 Camera LED(Yellow)
80 * LED2 Power LED (Green)
81 * ED3-LED6 User LED(Yellow)
82 * LED7 LAN link LED(Green)
83 * LED8 LAN activity LED(Yellow)
84 */
85
86/*
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-+---------------+----------------------------
Kuninori Morimoto2e3a5ef2012-04-24 02:09:31 -0700103 * 0 | SDHI1 | COM8 disable, COM14 enable
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700104 * 1 | SDHI1 | COM8 enable, COM14 disable
105 * -12345678-+---------------+----------------------------
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700106 * 0 | USB0 | COM20 enable, COM24 disable
107 * 1 | USB0 | COM20 disable, COM24 enable
108 * -12345678-+---------------+----------------------------
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700109 * 00 | JTAG | SH-X2
110 * 10 | JTAG | ARM
111 * 01 | JTAG | -
112 * 11 | JTAG | Boundary Scan
113 *-----------+---------------+----------------------------
114 */
115
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700116/*
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700117 * FSI-WM8978
118 *
119 * this command is required when playback.
120 *
121 * # amixer set "Headphone" 50
122 */
123
124/*
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700125 * USB function
126 *
127 * When you use USB Function,
128 * set SW1.6 ON, and connect cable to CN24.
129 *
130 * USBF needs workaround on R8A7740 chip.
131 * These are a little bit complex.
132 * see
133 * usbhsf_power_ctrl()
134 *
135 * CAUTION
136 *
137 * It uses autonomy mode for USB hotplug at this point
138 * (= usbhs_private.platform_callback.get_vbus is NULL),
139 * since we don't know what's happen on PM control
140 * on this workaround.
141 */
142#define USBCR1 0xe605810a
143#define USBH 0xC6700000
144#define USBH_USBCTR 0x10834
145
146struct 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
156#define usbhsf_get_priv(pdev) \
157 container_of(renesas_usbhs_get_info(pdev), \
158 struct usbhsf_private, info)
159
160static int usbhsf_get_id(struct platform_device *pdev)
161{
162 return USBHS_GADGET;
163}
164
165static void usbhsf_power_ctrl(struct platform_device *pdev,
166 void __iomem *base, int enable)
167{
168 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
169
170 /*
171 * Work around for USB Function.
172 * It needs USB host clock, and settings
173 */
174 if (enable) {
175 /*
176 * enable all the related usb clocks
177 * for usb workaround
178 */
179 clk_enable(priv->usb24);
180 clk_enable(priv->pci);
181 clk_enable(priv->host);
182 clk_enable(priv->func);
183 clk_enable(priv->phy);
184
185 /*
186 * set USBCR1
187 *
188 * Port1 is driven by USB function,
189 * Port2 is driven by USB HOST
190 * One HOST (Port1 or Port2 is HOST)
191 * USB PLL input clock = 24MHz
192 */
193 __raw_writew(0xd750, USBCR1);
194 mdelay(1);
195
196 /*
197 * start USB Host
198 */
199 __raw_writel(0x0000000c, priv->usbh_base + USBH_USBCTR);
200 __raw_writel(0x00000008, priv->usbh_base + USBH_USBCTR);
201 mdelay(10);
202
203 /*
204 * USB PHY Power ON
205 */
206 __raw_writew(0xd770, USBCR1);
207 __raw_writew(0x4000, base + 0x102); /* USBF :: SUSPMODE */
208
209 } else {
210 __raw_writel(0x0000010f, priv->usbh_base + USBH_USBCTR);
211 __raw_writew(0xd7c0, USBCR1); /* GPIO */
212
213 clk_disable(priv->phy);
214 clk_disable(priv->func); /* usb work around */
215 clk_disable(priv->host); /* usb work around */
216 clk_disable(priv->pci); /* usb work around */
217 clk_disable(priv->usb24); /* usb work around */
218 }
219}
220
221static void usbhsf_hardware_exit(struct platform_device *pdev)
222{
223 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
224
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
238 priv->phy = NULL;
239 priv->usb24 = NULL;
240 priv->pci = NULL;
241 priv->host = NULL;
242 priv->func = NULL;
243 priv->usbh_base = NULL;
244}
245
246static int usbhsf_hardware_init(struct platform_device *pdev)
247{
248 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
249
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
257 if (IS_ERR(priv->phy) ||
258 IS_ERR(priv->usb24) ||
259 IS_ERR(priv->pci) ||
260 IS_ERR(priv->host) ||
261 IS_ERR(priv->func) ||
262 !priv->usbh_base) {
263 dev_err(&pdev->dev, "USB clock setting failed\n");
264 usbhsf_hardware_exit(pdev);
265 return -EIO;
266 }
267
268 /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
269 clk_set_rate(priv->usb24,
270 clk_get_rate(clk_get_parent(priv->usb24)));
271
272 return 0;
273}
274
275static struct usbhsf_private usbhsf_private = {
276 .info = {
277 .platform_callback = {
278 .get_id = usbhsf_get_id,
279 .hardware_init = usbhsf_hardware_init,
280 .hardware_exit = usbhsf_hardware_exit,
281 .power_ctrl = usbhsf_power_ctrl,
282 },
283 .driver_param = {
284 .buswait_bwait = 5,
285 .detection_delay = 5,
Kuninori Morimotof7e566f2012-06-25 03:37:47 -0700286 .d0_rx_id = SHDMA_SLAVE_USBHS_RX,
287 .d1_tx_id = SHDMA_SLAVE_USBHS_TX,
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700288 },
289 }
290};
291
292static struct resource usbhsf_resources[] = {
293 {
294 .name = "USBHS",
295 .start = 0xe6890000,
296 .end = 0xe6890104 - 1,
297 .flags = IORESOURCE_MEM,
298 },
299 {
300 .start = evt2irq(0x0A20),
301 .flags = IORESOURCE_IRQ,
302 },
303};
304
305static 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
Kuninori Morimotod8fed1e2012-04-06 01:32:02 -0700315/* Ether */
316static struct sh_eth_plat_data sh_eth_platdata = {
317 .phy = 0x00, /* LAN8710A */
318 .edmac_endian = EDMAC_LITTLE_ENDIAN,
319 .register_type = SH_ETH_REG_GIGABIT,
320 .phy_interface = PHY_INTERFACE_MODE_MII,
321};
322
323static 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
338static struct platform_device sh_eth_device = {
339 .name = "sh-eth",
Kuninori Morimoto9c18f232012-05-06 22:58:41 -0700340 .id = -1,
Kuninori Morimotod8fed1e2012-04-06 01:32:02 -0700341 .dev = {
342 .platform_data = &sh_eth_platdata,
343 },
344 .resource = sh_eth_resources,
345 .num_resources = ARRAY_SIZE(sh_eth_resources),
346};
347
Kuninori Morimotodad29d12012-04-06 01:30:09 -0700348/* LCDC */
349static struct fb_videomode lcdc0_mode = {
350 .name = "AMPIER/AM-800480",
351 .xres = 800,
352 .yres = 480,
353 .left_margin = 88,
354 .right_margin = 40,
355 .hsync_len = 128,
356 .upper_margin = 20,
357 .lower_margin = 5,
358 .vsync_len = 5,
359 .sync = 0,
360};
361
362static struct sh_mobile_lcdc_info lcdc0_info = {
363 .clock_source = LCDC_CLK_BUS,
364 .ch[0] = {
365 .chan = LCDC_CHAN_MAINLCD,
366 .fourcc = V4L2_PIX_FMT_RGB565,
367 .interface_type = RGB24,
368 .clock_divider = 5,
369 .flags = 0,
370 .lcd_modes = &lcdc0_mode,
371 .num_modes = 1,
372 .panel_cfg = {
373 .width = 111,
374 .height = 68,
375 },
376 },
377};
378
379static struct resource lcdc0_resources[] = {
380 [0] = {
381 .name = "LCD0",
382 .start = 0xfe940000,
383 .end = 0xfe943fff,
384 .flags = IORESOURCE_MEM,
385 },
386 [1] = {
387 .start = intcs_evt2irq(0x580),
388 .flags = IORESOURCE_IRQ,
389 },
390};
391
392static struct platform_device lcdc0_device = {
393 .name = "sh_mobile_lcdc_fb",
394 .num_resources = ARRAY_SIZE(lcdc0_resources),
395 .resource = lcdc0_resources,
396 .id = 0,
397 .dev = {
398 .platform_data = &lcdc0_info,
399 .coherent_dma_mask = ~0,
400 },
401};
402
Kuninori Morimoto910c14d2012-06-12 02:39:11 -0700403/*
404 * LCDC1/HDMI
405 */
406static struct sh_mobile_hdmi_info hdmi_info = {
407 .flags = HDMI_OUTPUT_PUSH_PULL |
408 HDMI_OUTPUT_POLARITY_HI |
409 HDMI_32BIT_REG |
410 HDMI_HAS_HTOP1 |
411 HDMI_SND_SRC_SPDIF,
412};
413
414static struct resource hdmi_resources[] = {
415 [0] = {
416 .name = "HDMI",
417 .start = 0xe6be0000,
418 .end = 0xe6be03ff,
419 .flags = IORESOURCE_MEM,
420 },
421 [1] = {
422 .start = evt2irq(0x1700),
423 .flags = IORESOURCE_IRQ,
424 },
425 [2] = {
426 .name = "HDMI emma3pf",
427 .start = 0xe6be4000,
428 .end = 0xe6be43ff,
429 .flags = IORESOURCE_MEM,
430 },
431};
432
433static struct platform_device hdmi_device = {
434 .name = "sh-mobile-hdmi",
435 .num_resources = ARRAY_SIZE(hdmi_resources),
436 .resource = hdmi_resources,
437 .id = -1,
438 .dev = {
439 .platform_data = &hdmi_info,
440 },
441};
442
443static const struct fb_videomode lcdc1_mode = {
444 .name = "HDMI 720p",
445 .xres = 1280,
446 .yres = 720,
447 .pixclock = 13468,
448 .left_margin = 220,
449 .right_margin = 110,
450 .hsync_len = 40,
451 .upper_margin = 20,
452 .lower_margin = 5,
453 .vsync_len = 5,
454 .refresh = 60,
455 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
456};
457
458static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
459 .clock_source = LCDC_CLK_PERIPHERAL, /* HDMI clock */
460 .ch[0] = {
461 .chan = LCDC_CHAN_MAINLCD,
462 .fourcc = V4L2_PIX_FMT_RGB565,
463 .interface_type = RGB24,
464 .clock_divider = 1,
465 .flags = LCDC_FLAGS_DWPOL,
466 .lcd_modes = &lcdc1_mode,
467 .num_modes = 1,
468 .tx_dev = &hdmi_device,
469 .panel_cfg = {
470 .width = 1280,
471 .height = 720,
472 },
473 },
474};
475
476static struct resource hdmi_lcdc_resources[] = {
477 [0] = {
478 .name = "LCDC1",
479 .start = 0xfe944000,
480 .end = 0xfe948000 - 1,
481 .flags = IORESOURCE_MEM,
482 },
483 [1] = {
484 .start = intcs_evt2irq(0x1780),
485 .flags = IORESOURCE_IRQ,
486 },
487};
488
489static struct platform_device hdmi_lcdc_device = {
490 .name = "sh_mobile_lcdc_fb",
491 .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
492 .resource = hdmi_lcdc_resources,
493 .id = 1,
494 .dev = {
495 .platform_data = &hdmi_lcdc_info,
496 .coherent_dma_mask = ~0,
497 },
498};
499
Kuninori Morimotof7e7d312012-04-06 01:31:33 -0700500/* GPIO KEY */
501#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
502
503static struct gpio_keys_button gpio_buttons[] = {
504 GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW1"),
505 GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW2"),
506 GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW3"),
507 GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW4"),
508};
509
510static struct gpio_keys_platform_data gpio_key_info = {
511 .buttons = gpio_buttons,
512 .nbuttons = ARRAY_SIZE(gpio_buttons),
513};
514
515static struct platform_device gpio_keys_device = {
516 .name = "gpio-keys",
517 .id = -1,
518 .dev = {
519 .platform_data = &gpio_key_info,
520 },
521};
522
Kuninori Morimoto49c01112012-04-24 02:09:19 -0700523/* SDHI0 */
524/*
525 * FIXME
526 *
527 * It use polling mode here, since
528 * CD (= Card Detect) pin is not connected to SDHI0_CD.
529 * We can use IRQ31 as card detect irq,
530 * but it needs chattering removal operation
531 */
532#define IRQ31 evt2irq(0x33E0)
533static struct sh_mobile_sdhi_info sdhi0_info = {
Kuninori Morimoto95798e32012-06-25 03:37:38 -0700534 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
535 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
Kuninori Morimoto49c01112012-04-24 02:09:19 -0700536 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\
537 MMC_CAP_NEEDS_POLL,
538 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
539 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
540};
541
542static struct resource sdhi0_resources[] = {
543 {
544 .name = "SDHI0",
545 .start = 0xe6850000,
546 .end = 0xe6850100 - 1,
547 .flags = IORESOURCE_MEM,
548 },
549 /*
550 * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
551 */
552 {
553 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
554 .start = evt2irq(0x0E20),
555 .flags = IORESOURCE_IRQ,
556 },
557 {
558 .name = SH_MOBILE_SDHI_IRQ_SDIO,
559 .start = evt2irq(0x0E40),
560 .flags = IORESOURCE_IRQ,
561 },
562};
563
564static struct platform_device sdhi0_device = {
565 .name = "sh_mobile_sdhi",
566 .id = 0,
567 .dev = {
568 .platform_data = &sdhi0_info,
569 },
570 .num_resources = ARRAY_SIZE(sdhi0_resources),
571 .resource = sdhi0_resources,
572};
573
Kuninori Morimoto2e3a5ef2012-04-24 02:09:31 -0700574/* SDHI1 */
575static struct sh_mobile_sdhi_info sdhi1_info = {
Kuninori Morimoto95798e32012-06-25 03:37:38 -0700576 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
577 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
Kuninori Morimoto2e3a5ef2012-04-24 02:09:31 -0700578 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
579 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
580 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
581};
582
583static struct resource sdhi1_resources[] = {
584 [0] = {
585 .name = "SDHI1",
586 .start = 0xe6860000,
587 .end = 0xe6860100 - 1,
588 .flags = IORESOURCE_MEM,
589 },
590 [1] = {
591 .start = evt2irq(0x0E80),
592 .flags = IORESOURCE_IRQ,
593 },
594 [2] = {
595 .start = evt2irq(0x0EA0),
596 .flags = IORESOURCE_IRQ,
597 },
598 [3] = {
599 .start = evt2irq(0x0EC0),
600 .flags = IORESOURCE_IRQ,
601 },
602};
603
604static struct platform_device sdhi1_device = {
605 .name = "sh_mobile_sdhi",
606 .id = 1,
607 .dev = {
608 .platform_data = &sdhi1_info,
609 },
610 .num_resources = ARRAY_SIZE(sdhi1_resources),
611 .resource = sdhi1_resources,
612};
613
Kuninori Morimoto0a4266b2012-04-24 02:09:42 -0700614/* MMCIF */
615static struct sh_mmcif_plat_data sh_mmcif_plat = {
616 .sup_pclk = 0,
617 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
618 .caps = MMC_CAP_4_BIT_DATA |
619 MMC_CAP_8_BIT_DATA |
620 MMC_CAP_NONREMOVABLE,
621};
622
623static struct resource sh_mmcif_resources[] = {
624 [0] = {
625 .name = "MMCIF",
626 .start = 0xe6bd0000,
627 .end = 0xe6bd0100 - 1,
628 .flags = IORESOURCE_MEM,
629 },
630 [1] = {
631 /* MMC ERR */
632 .start = evt2irq(0x1AC0),
633 .flags = IORESOURCE_IRQ,
634 },
635 [2] = {
636 /* MMC NOR */
637 .start = evt2irq(0x1AE0),
638 .flags = IORESOURCE_IRQ,
639 },
640};
641
642static struct platform_device sh_mmcif_device = {
643 .name = "sh_mmcif",
644 .id = -1,
645 .dev = {
646 .platform_data = &sh_mmcif_plat,
647 },
648 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
649 .resource = sh_mmcif_resources,
650};
651
Kuninori Morimoto3760e792012-06-12 02:40:07 -0700652/* Camera */
653static int mt9t111_power(struct device *dev, int mode)
654{
655 struct clk *mclk = clk_get(NULL, "video1");
656
657 if (IS_ERR(mclk)) {
658 dev_err(dev, "can't get video1 clock\n");
659 return -EINVAL;
660 }
661
662 if (mode) {
663 /* video1 (= CON1 camera) expect 24MHz */
664 clk_set_rate(mclk, clk_round_rate(mclk, 24000000));
665 clk_enable(mclk);
666 gpio_direction_output(GPIO_PORT158, 1);
667 } else {
668 gpio_direction_output(GPIO_PORT158, 0);
669 clk_disable(mclk);
670 }
671
672 clk_put(mclk);
673
674 return 0;
675}
676
677static struct i2c_board_info i2c_camera_mt9t111 = {
678 I2C_BOARD_INFO("mt9t112", 0x3d),
679};
680
681static struct mt9t112_camera_info mt9t111_info = {
682 .divider = { 16, 0, 0, 7, 0, 10, 14, 7, 7 },
683};
684
685static struct soc_camera_link mt9t111_link = {
686 .i2c_adapter_id = 0,
687 .bus_id = 0,
688 .board_info = &i2c_camera_mt9t111,
689 .power = mt9t111_power,
690 .priv = &mt9t111_info,
691};
692
693static struct platform_device camera_device = {
694 .name = "soc-camera-pdrv",
695 .id = 0,
696 .dev = {
697 .platform_data = &mt9t111_link,
698 },
699};
700
701/* CEU0 */
702static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
703 .flags = SH_CEU_FLAG_LOWER_8BIT,
704};
705
706static struct resource ceu0_resources[] = {
707 [0] = {
708 .name = "CEU",
709 .start = 0xfe910000,
710 .end = 0xfe91009f,
711 .flags = IORESOURCE_MEM,
712 },
713 [1] = {
714 .start = intcs_evt2irq(0x0500),
715 .flags = IORESOURCE_IRQ,
716 },
717 [2] = {
718 /* place holder for contiguous memory */
719 },
720};
721
722static struct platform_device ceu0_device = {
723 .name = "sh_mobile_ceu",
724 .id = 0,
725 .num_resources = ARRAY_SIZE(ceu0_resources),
726 .resource = ceu0_resources,
727 .dev = {
728 .platform_data = &sh_mobile_ceu0_info,
729 .coherent_dma_mask = 0xffffffff,
730 },
731};
732
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700733/* FSI */
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700734static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable)
735{
736 struct clk *fsib;
737 int ret;
738
739 /* it support 48KHz only */
740 if (48000 != rate)
741 return -EINVAL;
742
743 fsib = clk_get(dev, "ickb");
744 if (IS_ERR(fsib))
745 return -EINVAL;
746
747 if (enable) {
748 ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
749 clk_enable(fsib);
750 } else {
751 ret = 0;
752 clk_disable(fsib);
753 }
754
755 clk_put(fsib);
756
757 return ret;
758}
759
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700760static struct sh_fsi_platform_info fsi_info = {
761 /* FSI-WM8978 */
762 .port_a = {
Kuninori Morimotodc7dd582012-06-25 03:37:20 -0700763 .tx_id = SHDMA_SLAVE_FSIA_TX,
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700764 },
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700765 /* FSI-HDMI */
766 .port_b = {
767 .flags = SH_FSI_FMT_SPDIF |
768 SH_FSI_ENABLE_STREAM_MODE,
769 .set_rate = fsi_hdmi_set_rate,
Kuninori Morimotodc7dd582012-06-25 03:37:20 -0700770 .tx_id = SHDMA_SLAVE_FSIB_TX,
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700771 }
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700772};
773
774static struct resource fsi_resources[] = {
775 [0] = {
776 .name = "FSI",
777 .start = 0xfe1f0000,
778 .end = 0xfe1f8400 - 1,
779 .flags = IORESOURCE_MEM,
780 },
781 [1] = {
782 .start = evt2irq(0x1840),
783 .flags = IORESOURCE_IRQ,
784 },
785};
786
787static struct platform_device fsi_device = {
788 .name = "sh_fsi2",
789 .id = -1,
790 .num_resources = ARRAY_SIZE(fsi_resources),
791 .resource = fsi_resources,
792 .dev = {
793 .platform_data = &fsi_info,
794 },
795};
796
797/* FSI-WM8978 */
798static struct asoc_simple_dai_init_info fsi_wm8978_init_info = {
799 .fmt = SND_SOC_DAIFMT_I2S,
800 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
801 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
802 .sysclk = 12288000,
803};
804
805static struct asoc_simple_card_info fsi_wm8978_info = {
806 .name = "wm8978",
807 .card = "FSI2A-WM8978",
808 .cpu_dai = "fsia-dai",
809 .codec = "wm8978.0-001a",
810 .platform = "sh_fsi2",
811 .codec_dai = "wm8978-hifi",
812 .init = &fsi_wm8978_init_info,
813};
814
815static struct platform_device fsi_wm8978_device = {
816 .name = "asoc-simple-card",
817 .id = 0,
818 .dev = {
819 .platform_data = &fsi_wm8978_info,
820 },
821};
822
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700823/* FSI-HDMI */
824static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
825 .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM,
826};
827
828static struct asoc_simple_card_info fsi2_hdmi_info = {
829 .name = "HDMI",
830 .card = "FSI2B-HDMI",
831 .cpu_dai = "fsib-dai",
832 .codec = "sh-mobile-hdmi",
833 .platform = "sh_fsi2",
834 .codec_dai = "sh_mobile_hdmi-hifi",
835 .init = &fsi2_hdmi_init_info,
836};
837
838static struct platform_device fsi_hdmi_device = {
839 .name = "asoc-simple-card",
840 .id = 1,
841 .dev = {
842 .platform_data = &fsi2_hdmi_info,
843 },
844};
845
Kuninori Morimoto46cf6682012-04-06 01:30:42 -0700846/* I2C */
847static struct i2c_board_info i2c0_devices[] = {
848 {
849 I2C_BOARD_INFO("st1232-ts", 0x55),
850 .irq = evt2irq(0x0340),
851 },
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700852 {
853 I2C_BOARD_INFO("wm8978", 0x1a),
854 },
Kuninori Morimoto46cf6682012-04-06 01:30:42 -0700855};
856
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700857/*
858 * board devices
859 */
860static struct platform_device *eva_devices[] __initdata = {
Kuninori Morimotodad29d12012-04-06 01:30:09 -0700861 &lcdc0_device,
Kuninori Morimotof7e7d312012-04-06 01:31:33 -0700862 &gpio_keys_device,
Kuninori Morimotod8fed1e2012-04-06 01:32:02 -0700863 &sh_eth_device,
Kuninori Morimoto49c01112012-04-24 02:09:19 -0700864 &sdhi0_device,
Kuninori Morimoto0a4266b2012-04-24 02:09:42 -0700865 &sh_mmcif_device,
Kuninori Morimoto910c14d2012-06-12 02:39:11 -0700866 &hdmi_device,
867 &hdmi_lcdc_device,
Kuninori Morimoto3760e792012-06-12 02:40:07 -0700868 &camera_device,
869 &ceu0_device,
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700870 &fsi_device,
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700871 &fsi_hdmi_device,
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700872 &fsi_wm8978_device,
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700873};
874
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700875static void __init eva_clock_init(void)
876{
877 struct clk *system = clk_get(NULL, "system_clk");
878 struct clk *xtal1 = clk_get(NULL, "extal1");
879 struct clk *usb24s = clk_get(NULL, "usb24s");
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700880 struct clk *fsibck = clk_get(NULL, "fsibck");
881 struct clk *fsib = clk_get(&fsi_device.dev, "ickb");
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700882
883 if (IS_ERR(system) ||
884 IS_ERR(xtal1) ||
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700885 IS_ERR(usb24s) ||
886 IS_ERR(fsibck) ||
887 IS_ERR(fsib)) {
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700888 pr_err("armadillo800eva board clock init failed\n");
889 goto clock_error;
890 }
891
892 /* armadillo 800 eva extal1 is 24MHz */
893 clk_set_rate(xtal1, 24000000);
894
895 /* usb24s use extal1 (= system) clock (= 24MHz) */
896 clk_set_parent(usb24s, system);
897
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700898 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
899 clk_set_parent(fsib, fsibck);
900 clk_set_rate(fsibck, 12288000);
901 clk_set_rate(fsib, 12288000);
902
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700903clock_error:
904 if (!IS_ERR(system))
905 clk_put(system);
906 if (!IS_ERR(xtal1))
907 clk_put(xtal1);
908 if (!IS_ERR(usb24s))
909 clk_put(usb24s);
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700910 if (!IS_ERR(fsibck))
911 clk_put(fsibck);
912 if (!IS_ERR(fsib))
913 clk_put(fsib);
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700914}
915
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700916/*
917 * board init
918 */
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700919#define GPIO_PORT7CR 0xe6050007
920#define GPIO_PORT8CR 0xe6050008
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700921static void __init eva_init(void)
922{
923 r8a7740_pinmux_init();
Kuninori Morimotod49679e2012-06-12 02:36:21 -0700924 r8a7740_meram_workaround();
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700925
926 /* SCIFA1 */
927 gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
928 gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
929
Kuninori Morimotodad29d12012-04-06 01:30:09 -0700930 /* LCDC0 */
931 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
932 gpio_request(GPIO_FN_LCD0_D0, NULL);
933 gpio_request(GPIO_FN_LCD0_D1, NULL);
934 gpio_request(GPIO_FN_LCD0_D2, NULL);
935 gpio_request(GPIO_FN_LCD0_D3, NULL);
936 gpio_request(GPIO_FN_LCD0_D4, NULL);
937 gpio_request(GPIO_FN_LCD0_D5, NULL);
938 gpio_request(GPIO_FN_LCD0_D6, NULL);
939 gpio_request(GPIO_FN_LCD0_D7, NULL);
940 gpio_request(GPIO_FN_LCD0_D8, NULL);
941 gpio_request(GPIO_FN_LCD0_D9, NULL);
942 gpio_request(GPIO_FN_LCD0_D10, NULL);
943 gpio_request(GPIO_FN_LCD0_D11, NULL);
944 gpio_request(GPIO_FN_LCD0_D12, NULL);
945 gpio_request(GPIO_FN_LCD0_D13, NULL);
946 gpio_request(GPIO_FN_LCD0_D14, NULL);
947 gpio_request(GPIO_FN_LCD0_D15, NULL);
948 gpio_request(GPIO_FN_LCD0_D16, NULL);
949 gpio_request(GPIO_FN_LCD0_D17, NULL);
950 gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
951 gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
952 gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
953 gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
954 gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
955 gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
956 gpio_request(GPIO_FN_LCD0_DCK, NULL);
957 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
958 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
959 gpio_request(GPIO_FN_LCD0_DISP, NULL);
960 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
961
962 gpio_request(GPIO_PORT61, NULL); /* LCDDON */
963 gpio_direction_output(GPIO_PORT61, 1);
964
965 gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
966 gpio_direction_output(GPIO_PORT202, 0);
967
Kuninori Morimoto46cf6682012-04-06 01:30:42 -0700968 /* Touchscreen */
969 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
970 gpio_request(GPIO_PORT166, NULL); /* TP_RST_B */
971 gpio_direction_output(GPIO_PORT166, 1);
972
Kuninori Morimotod8fed1e2012-04-06 01:32:02 -0700973 /* GETHER */
974 gpio_request(GPIO_FN_ET_CRS, NULL);
975 gpio_request(GPIO_FN_ET_MDC, NULL);
976 gpio_request(GPIO_FN_ET_MDIO, NULL);
977 gpio_request(GPIO_FN_ET_TX_ER, NULL);
978 gpio_request(GPIO_FN_ET_RX_ER, NULL);
979 gpio_request(GPIO_FN_ET_ERXD0, NULL);
980 gpio_request(GPIO_FN_ET_ERXD1, NULL);
981 gpio_request(GPIO_FN_ET_ERXD2, NULL);
982 gpio_request(GPIO_FN_ET_ERXD3, NULL);
983 gpio_request(GPIO_FN_ET_TX_CLK, NULL);
984 gpio_request(GPIO_FN_ET_TX_EN, NULL);
985 gpio_request(GPIO_FN_ET_ETXD0, NULL);
986 gpio_request(GPIO_FN_ET_ETXD1, NULL);
987 gpio_request(GPIO_FN_ET_ETXD2, NULL);
988 gpio_request(GPIO_FN_ET_ETXD3, NULL);
989 gpio_request(GPIO_FN_ET_PHY_INT, NULL);
990 gpio_request(GPIO_FN_ET_COL, NULL);
991 gpio_request(GPIO_FN_ET_RX_DV, NULL);
992 gpio_request(GPIO_FN_ET_RX_CLK, NULL);
993
994 gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
995 gpio_direction_output(GPIO_PORT18, 1);
996
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700997 /* USB */
998 gpio_request(GPIO_PORT159, NULL); /* USB_DEVICE_MODE */
999 gpio_direction_input(GPIO_PORT159);
1000
1001 if (gpio_get_value(GPIO_PORT159)) {
1002 /* USB Host */
1003 } else {
1004 /* USB Func */
1005 gpio_request(GPIO_FN_VBUS, NULL);
1006 platform_device_register(&usbhsf_device);
1007 }
1008
Kuninori Morimoto49c01112012-04-24 02:09:19 -07001009 /* SDHI0 */
1010 gpio_request(GPIO_FN_SDHI0_CMD, NULL);
1011 gpio_request(GPIO_FN_SDHI0_CLK, NULL);
1012 gpio_request(GPIO_FN_SDHI0_D0, NULL);
1013 gpio_request(GPIO_FN_SDHI0_D1, NULL);
1014 gpio_request(GPIO_FN_SDHI0_D2, NULL);
1015 gpio_request(GPIO_FN_SDHI0_D3, NULL);
1016 gpio_request(GPIO_FN_SDHI0_WP, NULL);
1017
1018 gpio_request(GPIO_PORT17, NULL); /* SDHI0_18/33_B */
1019 gpio_request(GPIO_PORT74, NULL); /* SDHI0_PON */
1020 gpio_request(GPIO_PORT75, NULL); /* SDSLOT1_PON */
1021 gpio_direction_output(GPIO_PORT17, 0);
1022 gpio_direction_output(GPIO_PORT74, 1);
1023 gpio_direction_output(GPIO_PORT75, 1);
1024
1025 /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
1026
Kuninori Morimotodad29d12012-04-06 01:30:09 -07001027 /*
Kuninori Morimoto0a4266b2012-04-24 02:09:42 -07001028 * MMCIF
1029 *
1030 * Here doesn't care SW1.4 status,
1031 * since CON2 is not mounted.
1032 */
1033 gpio_request(GPIO_FN_MMC1_CLK_PORT103, NULL);
1034 gpio_request(GPIO_FN_MMC1_CMD_PORT104, NULL);
1035 gpio_request(GPIO_FN_MMC1_D0_PORT149, NULL);
1036 gpio_request(GPIO_FN_MMC1_D1_PORT148, NULL);
1037 gpio_request(GPIO_FN_MMC1_D2_PORT147, NULL);
1038 gpio_request(GPIO_FN_MMC1_D3_PORT146, NULL);
1039 gpio_request(GPIO_FN_MMC1_D4_PORT145, NULL);
1040 gpio_request(GPIO_FN_MMC1_D5_PORT144, NULL);
1041 gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL);
1042 gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL);
1043
Kuninori Morimoto3760e792012-06-12 02:40:07 -07001044 /* CEU0 */
1045 gpio_request(GPIO_FN_VIO0_D7, NULL);
1046 gpio_request(GPIO_FN_VIO0_D6, NULL);
1047 gpio_request(GPIO_FN_VIO0_D5, NULL);
1048 gpio_request(GPIO_FN_VIO0_D4, NULL);
1049 gpio_request(GPIO_FN_VIO0_D3, NULL);
1050 gpio_request(GPIO_FN_VIO0_D2, NULL);
1051 gpio_request(GPIO_FN_VIO0_D1, NULL);
1052 gpio_request(GPIO_FN_VIO0_D0, NULL);
1053 gpio_request(GPIO_FN_VIO0_CLK, NULL);
1054 gpio_request(GPIO_FN_VIO0_HD, NULL);
1055 gpio_request(GPIO_FN_VIO0_VD, NULL);
1056 gpio_request(GPIO_FN_VIO0_FIELD, NULL);
1057 gpio_request(GPIO_FN_VIO_CKO, NULL);
1058
1059 /* CON1/CON15 Camera */
1060 gpio_request(GPIO_PORT173, NULL); /* STANDBY */
1061 gpio_request(GPIO_PORT172, NULL); /* RST */
1062 gpio_request(GPIO_PORT158, NULL); /* CAM_PON */
1063 gpio_direction_output(GPIO_PORT173, 0);
1064 gpio_direction_output(GPIO_PORT172, 1);
1065 gpio_direction_output(GPIO_PORT158, 0); /* see mt9t111_power() */
1066
Kuninori Morimoto5389bf72012-06-25 03:32:50 -07001067 /* FSI-WM8978 */
1068 gpio_request(GPIO_FN_FSIAIBT, NULL);
1069 gpio_request(GPIO_FN_FSIAILR, NULL);
1070 gpio_request(GPIO_FN_FSIAOMC, NULL);
1071 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1072 gpio_request(GPIO_FN_FSIAISLD_PORT5, NULL);
1073
1074 gpio_request(GPIO_PORT7, NULL);
1075 gpio_request(GPIO_PORT8, NULL);
Kuninori Morimotoa01366b2012-06-25 03:41:45 -07001076 gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
1077 gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */
Kuninori Morimoto5389bf72012-06-25 03:32:50 -07001078
Kuninori Morimoto0676c052012-06-25 03:33:04 -07001079 /* FSI-HDMI */
1080 gpio_request(GPIO_FN_FSIBCK, NULL);
1081
1082 /* HDMI */
1083 gpio_request(GPIO_FN_HDMI_HPD, NULL);
1084 gpio_request(GPIO_FN_HDMI_CEC, NULL);
1085
Kuninori Morimoto0a4266b2012-04-24 02:09:42 -07001086 /*
Kuninori Morimotodad29d12012-04-06 01:30:09 -07001087 * CAUTION
1088 *
1089 * DBGMD/LCDC0/FSIA MUX
1090 * DBGMD_SELECT_B should be set after setting PFC Function.
1091 */
1092 gpio_request(GPIO_PORT176, NULL);
1093 gpio_direction_output(GPIO_PORT176, 1);
1094
Kuninori Morimoto2e3a5ef2012-04-24 02:09:31 -07001095 /*
1096 * We can switch CON8/CON14 by SW1.5,
1097 * but it needs after DBGMD_SELECT_B
1098 */
1099 gpio_request(GPIO_PORT6, NULL);
1100 gpio_direction_input(GPIO_PORT6);
1101 if (gpio_get_value(GPIO_PORT6)) {
1102 /* CON14 enable */
1103 } else {
1104 /* CON8 (SDHI1) enable */
1105 gpio_request(GPIO_FN_SDHI1_CLK, NULL);
1106 gpio_request(GPIO_FN_SDHI1_CMD, NULL);
1107 gpio_request(GPIO_FN_SDHI1_D0, NULL);
1108 gpio_request(GPIO_FN_SDHI1_D1, NULL);
1109 gpio_request(GPIO_FN_SDHI1_D2, NULL);
1110 gpio_request(GPIO_FN_SDHI1_D3, NULL);
1111 gpio_request(GPIO_FN_SDHI1_CD, NULL);
1112 gpio_request(GPIO_FN_SDHI1_WP, NULL);
1113
1114 gpio_request(GPIO_PORT16, NULL); /* SDSLOT2_PON */
1115 gpio_direction_output(GPIO_PORT16, 1);
1116
1117 platform_device_register(&sdhi1_device);
1118 }
1119
1120
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001121#ifdef CONFIG_CACHE_L2X0
1122 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
1123 l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
1124#endif
1125
Kuninori Morimoto46cf6682012-04-06 01:30:42 -07001126 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
1127
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001128 r8a7740_add_standard_devices();
1129
1130 platform_add_devices(eva_devices,
1131 ARRAY_SIZE(eva_devices));
Kuninori Morimoto0676c052012-06-25 03:33:04 -07001132
1133 eva_clock_init();
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001134}
1135
1136static void __init eva_earlytimer_init(void)
1137{
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001138 r8a7740_clock_init(MD_CK0 | MD_CK2);
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001139 shmobile_earlytimer_init();
1140}
1141
1142static void __init eva_add_early_devices(void)
1143{
1144 r8a7740_add_early_devices();
1145
1146 /* override timer setup with board-specific code */
1147 shmobile_timer.init = eva_earlytimer_init;
1148}
1149
Magnus Damme6bf7052012-05-14 19:54:41 +09001150static const char *eva_boards_compat_dt[] __initdata = {
1151 "renesas,armadillo800eva",
1152 NULL,
1153};
1154
1155DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001156 .map_io = r8a7740_map_io,
1157 .init_early = eva_add_early_devices,
1158 .init_irq = r8a7740_init_irq,
1159 .handle_irq = shmobile_handle_irq_intc,
1160 .init_machine = eva_init,
1161 .timer = &shmobile_timer,
Magnus Damme6bf7052012-05-14 19:54:41 +09001162 .dt_compat = eva_boards_compat_dt,
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001163MACHINE_END