blob: 12f9666302fc619af4e67c2fd9ab47c41c4c1bc8 [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>
Guennadi Liakhovetskif65ad7e2012-06-29 08:33:11 +020031#include <linux/regulator/fixed.h>
32#include <linux/regulator/machine.h>
Kuninori Morimotod8fed1e2012-04-06 01:32:02 -070033#include <linux/sh_eth.h>
Kuninori Morimotodad29d12012-04-06 01:30:09 -070034#include <linux/videodev2.h>
Kuninori Morimoto1c962932012-04-24 02:09:08 -070035#include <linux/usb/renesas_usbhs.h>
Kuninori Morimoto49c01112012-04-24 02:09:19 -070036#include <linux/mfd/tmio.h>
37#include <linux/mmc/host.h>
Kuninori Morimoto0a4266b2012-04-24 02:09:42 -070038#include <linux/mmc/sh_mmcif.h>
Kuninori Morimoto49c01112012-04-24 02:09:19 -070039#include <linux/mmc/sh_mobile_sdhi.h>
Kuninori Morimoto4d22e562012-04-06 01:28:59 -070040#include <mach/common.h>
41#include <mach/irqs.h>
Kuninori Morimoto3760e792012-06-12 02:40:07 -070042#include <mach/r8a7740.h>
43#include <media/mt9t112.h>
44#include <media/sh_mobile_ceu.h>
45#include <media/soc_camera.h>
Kuninori Morimoto4d22e562012-04-06 01:28:59 -070046#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>
Kuninori Morimotodad29d12012-04-06 01:30:09 -070052#include <video/sh_mobile_lcdc.h>
Kuninori Morimoto910c14d2012-06-12 02:39:11 -070053#include <video/sh_mobile_hdmi.h>
Kuninori Morimoto5389bf72012-06-25 03:32:50 -070054#include <sound/sh_fsi.h>
55#include <sound/simple_card.h>
Kuninori Morimoto4d22e562012-04-06 01:28:59 -070056
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/*
89 * DipSwitch
90 *
91 * SW1
92 *
93 * -12345678-+---------------+----------------------------
94 * 1 | boot | hermit
95 * 0 | boot | OS auto boot
96 * -12345678-+---------------+----------------------------
97 * 00 | boot device | eMMC
98 * 10 | boot device | SDHI0 (CON7)
99 * 01 | boot device | -
100 * 11 | boot device | Extension Buss (CS0)
101 * -12345678-+---------------+----------------------------
102 * 0 | Extension Bus | D8-D15 disable, eMMC enable
103 * 1 | Extension Bus | D8-D15 enable, eMMC disable
104 * -12345678-+---------------+----------------------------
Kuninori Morimoto2e3a5ef2012-04-24 02:09:31 -0700105 * 0 | SDHI1 | COM8 disable, COM14 enable
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700106 * 1 | SDHI1 | COM8 enable, COM14 disable
107 * -12345678-+---------------+----------------------------
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700108 * 0 | USB0 | COM20 enable, COM24 disable
109 * 1 | USB0 | COM20 disable, COM24 enable
110 * -12345678-+---------------+----------------------------
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700111 * 00 | JTAG | SH-X2
112 * 10 | JTAG | ARM
113 * 01 | JTAG | -
114 * 11 | JTAG | Boundary Scan
115 *-----------+---------------+----------------------------
116 */
117
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700118/*
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700119 * FSI-WM8978
120 *
121 * this command is required when playback.
122 *
123 * # amixer set "Headphone" 50
124 */
125
126/*
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700127 * USB function
128 *
129 * When you use USB Function,
130 * set SW1.6 ON, and connect cable to CN24.
131 *
132 * USBF needs workaround on R8A7740 chip.
133 * These are a little bit complex.
134 * see
135 * usbhsf_power_ctrl()
136 *
137 * CAUTION
138 *
139 * It uses autonomy mode for USB hotplug at this point
140 * (= usbhs_private.platform_callback.get_vbus is NULL),
141 * since we don't know what's happen on PM control
142 * on this workaround.
143 */
144#define USBCR1 0xe605810a
145#define USBH 0xC6700000
146#define USBH_USBCTR 0x10834
147
148struct usbhsf_private {
149 struct clk *phy;
150 struct clk *usb24;
151 struct clk *pci;
152 struct clk *func;
153 struct clk *host;
154 void __iomem *usbh_base;
155 struct renesas_usbhs_platform_info info;
156};
157
158#define usbhsf_get_priv(pdev) \
159 container_of(renesas_usbhs_get_info(pdev), \
160 struct usbhsf_private, info)
161
162static int usbhsf_get_id(struct platform_device *pdev)
163{
164 return USBHS_GADGET;
165}
166
167static void usbhsf_power_ctrl(struct platform_device *pdev,
168 void __iomem *base, int enable)
169{
170 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
171
172 /*
173 * Work around for USB Function.
174 * It needs USB host clock, and settings
175 */
176 if (enable) {
177 /*
178 * enable all the related usb clocks
179 * for usb workaround
180 */
181 clk_enable(priv->usb24);
182 clk_enable(priv->pci);
183 clk_enable(priv->host);
184 clk_enable(priv->func);
185 clk_enable(priv->phy);
186
187 /*
188 * set USBCR1
189 *
190 * Port1 is driven by USB function,
191 * Port2 is driven by USB HOST
192 * One HOST (Port1 or Port2 is HOST)
193 * USB PLL input clock = 24MHz
194 */
195 __raw_writew(0xd750, USBCR1);
196 mdelay(1);
197
198 /*
199 * start USB Host
200 */
201 __raw_writel(0x0000000c, priv->usbh_base + USBH_USBCTR);
202 __raw_writel(0x00000008, priv->usbh_base + USBH_USBCTR);
203 mdelay(10);
204
205 /*
206 * USB PHY Power ON
207 */
208 __raw_writew(0xd770, USBCR1);
209 __raw_writew(0x4000, base + 0x102); /* USBF :: SUSPMODE */
210
211 } else {
212 __raw_writel(0x0000010f, priv->usbh_base + USBH_USBCTR);
213 __raw_writew(0xd7c0, USBCR1); /* GPIO */
214
215 clk_disable(priv->phy);
216 clk_disable(priv->func); /* usb work around */
217 clk_disable(priv->host); /* usb work around */
218 clk_disable(priv->pci); /* usb work around */
219 clk_disable(priv->usb24); /* usb work around */
220 }
221}
222
223static void usbhsf_hardware_exit(struct platform_device *pdev)
224{
225 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
226
227 if (!IS_ERR(priv->phy))
228 clk_put(priv->phy);
229 if (!IS_ERR(priv->usb24))
230 clk_put(priv->usb24);
231 if (!IS_ERR(priv->pci))
232 clk_put(priv->pci);
233 if (!IS_ERR(priv->host))
234 clk_put(priv->host);
235 if (!IS_ERR(priv->func))
236 clk_put(priv->func);
237 if (priv->usbh_base)
238 iounmap(priv->usbh_base);
239
240 priv->phy = NULL;
241 priv->usb24 = NULL;
242 priv->pci = NULL;
243 priv->host = NULL;
244 priv->func = NULL;
245 priv->usbh_base = NULL;
246}
247
248static int usbhsf_hardware_init(struct platform_device *pdev)
249{
250 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
251
252 priv->phy = clk_get(&pdev->dev, "phy");
253 priv->usb24 = clk_get(&pdev->dev, "usb24");
254 priv->pci = clk_get(&pdev->dev, "pci");
255 priv->func = clk_get(&pdev->dev, "func");
256 priv->host = clk_get(&pdev->dev, "host");
257 priv->usbh_base = ioremap_nocache(USBH, 0x20000);
258
259 if (IS_ERR(priv->phy) ||
260 IS_ERR(priv->usb24) ||
261 IS_ERR(priv->pci) ||
262 IS_ERR(priv->host) ||
263 IS_ERR(priv->func) ||
264 !priv->usbh_base) {
265 dev_err(&pdev->dev, "USB clock setting failed\n");
266 usbhsf_hardware_exit(pdev);
267 return -EIO;
268 }
269
270 /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
271 clk_set_rate(priv->usb24,
272 clk_get_rate(clk_get_parent(priv->usb24)));
273
274 return 0;
275}
276
277static struct usbhsf_private usbhsf_private = {
278 .info = {
279 .platform_callback = {
280 .get_id = usbhsf_get_id,
281 .hardware_init = usbhsf_hardware_init,
282 .hardware_exit = usbhsf_hardware_exit,
283 .power_ctrl = usbhsf_power_ctrl,
284 },
285 .driver_param = {
286 .buswait_bwait = 5,
287 .detection_delay = 5,
Kuninori Morimotof7e566f2012-06-25 03:37:47 -0700288 .d0_rx_id = SHDMA_SLAVE_USBHS_RX,
289 .d1_tx_id = SHDMA_SLAVE_USBHS_TX,
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700290 },
291 }
292};
293
294static struct resource usbhsf_resources[] = {
295 {
296 .name = "USBHS",
297 .start = 0xe6890000,
298 .end = 0xe6890104 - 1,
299 .flags = IORESOURCE_MEM,
300 },
301 {
302 .start = evt2irq(0x0A20),
303 .flags = IORESOURCE_IRQ,
304 },
305};
306
307static 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
Kuninori Morimotod8fed1e2012-04-06 01:32:02 -0700317/* Ether */
318static struct sh_eth_plat_data sh_eth_platdata = {
319 .phy = 0x00, /* LAN8710A */
320 .edmac_endian = EDMAC_LITTLE_ENDIAN,
321 .register_type = SH_ETH_REG_GIGABIT,
322 .phy_interface = PHY_INTERFACE_MODE_MII,
323};
324
325static struct resource sh_eth_resources[] = {
326 {
327 .start = 0xe9a00000,
328 .end = 0xe9a00800 - 1,
329 .flags = IORESOURCE_MEM,
330 }, {
331 .start = 0xe9a01800,
332 .end = 0xe9a02000 - 1,
333 .flags = IORESOURCE_MEM,
334 }, {
335 .start = evt2irq(0x0500),
336 .flags = IORESOURCE_IRQ,
337 },
338};
339
340static struct platform_device sh_eth_device = {
341 .name = "sh-eth",
Kuninori Morimoto9c18f232012-05-06 22:58:41 -0700342 .id = -1,
Kuninori Morimotod8fed1e2012-04-06 01:32:02 -0700343 .dev = {
344 .platform_data = &sh_eth_platdata,
345 },
346 .resource = sh_eth_resources,
347 .num_resources = ARRAY_SIZE(sh_eth_resources),
348};
349
Kuninori Morimotodad29d12012-04-06 01:30:09 -0700350/* LCDC */
351static struct fb_videomode lcdc0_mode = {
352 .name = "AMPIER/AM-800480",
353 .xres = 800,
354 .yres = 480,
355 .left_margin = 88,
356 .right_margin = 40,
357 .hsync_len = 128,
358 .upper_margin = 20,
359 .lower_margin = 5,
360 .vsync_len = 5,
361 .sync = 0,
362};
363
364static struct sh_mobile_lcdc_info lcdc0_info = {
365 .clock_source = LCDC_CLK_BUS,
366 .ch[0] = {
367 .chan = LCDC_CHAN_MAINLCD,
368 .fourcc = V4L2_PIX_FMT_RGB565,
369 .interface_type = RGB24,
370 .clock_divider = 5,
371 .flags = 0,
372 .lcd_modes = &lcdc0_mode,
373 .num_modes = 1,
374 .panel_cfg = {
375 .width = 111,
376 .height = 68,
377 },
378 },
379};
380
381static struct resource lcdc0_resources[] = {
382 [0] = {
383 .name = "LCD0",
384 .start = 0xfe940000,
385 .end = 0xfe943fff,
386 .flags = IORESOURCE_MEM,
387 },
388 [1] = {
389 .start = intcs_evt2irq(0x580),
390 .flags = IORESOURCE_IRQ,
391 },
392};
393
394static struct platform_device lcdc0_device = {
395 .name = "sh_mobile_lcdc_fb",
396 .num_resources = ARRAY_SIZE(lcdc0_resources),
397 .resource = lcdc0_resources,
398 .id = 0,
399 .dev = {
400 .platform_data = &lcdc0_info,
401 .coherent_dma_mask = ~0,
402 },
403};
404
Kuninori Morimoto910c14d2012-06-12 02:39:11 -0700405/*
406 * LCDC1/HDMI
407 */
408static struct sh_mobile_hdmi_info hdmi_info = {
409 .flags = HDMI_OUTPUT_PUSH_PULL |
410 HDMI_OUTPUT_POLARITY_HI |
411 HDMI_32BIT_REG |
412 HDMI_HAS_HTOP1 |
413 HDMI_SND_SRC_SPDIF,
414};
415
416static struct resource hdmi_resources[] = {
417 [0] = {
418 .name = "HDMI",
419 .start = 0xe6be0000,
420 .end = 0xe6be03ff,
421 .flags = IORESOURCE_MEM,
422 },
423 [1] = {
424 .start = evt2irq(0x1700),
425 .flags = IORESOURCE_IRQ,
426 },
427 [2] = {
428 .name = "HDMI emma3pf",
429 .start = 0xe6be4000,
430 .end = 0xe6be43ff,
431 .flags = IORESOURCE_MEM,
432 },
433};
434
435static struct platform_device hdmi_device = {
436 .name = "sh-mobile-hdmi",
437 .num_resources = ARRAY_SIZE(hdmi_resources),
438 .resource = hdmi_resources,
439 .id = -1,
440 .dev = {
441 .platform_data = &hdmi_info,
442 },
443};
444
445static const struct fb_videomode lcdc1_mode = {
446 .name = "HDMI 720p",
447 .xres = 1280,
448 .yres = 720,
449 .pixclock = 13468,
450 .left_margin = 220,
451 .right_margin = 110,
452 .hsync_len = 40,
453 .upper_margin = 20,
454 .lower_margin = 5,
455 .vsync_len = 5,
456 .refresh = 60,
457 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
458};
459
460static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
461 .clock_source = LCDC_CLK_PERIPHERAL, /* HDMI clock */
462 .ch[0] = {
463 .chan = LCDC_CHAN_MAINLCD,
464 .fourcc = V4L2_PIX_FMT_RGB565,
465 .interface_type = RGB24,
466 .clock_divider = 1,
467 .flags = LCDC_FLAGS_DWPOL,
468 .lcd_modes = &lcdc1_mode,
469 .num_modes = 1,
470 .tx_dev = &hdmi_device,
471 .panel_cfg = {
472 .width = 1280,
473 .height = 720,
474 },
475 },
476};
477
478static struct resource hdmi_lcdc_resources[] = {
479 [0] = {
480 .name = "LCDC1",
481 .start = 0xfe944000,
482 .end = 0xfe948000 - 1,
483 .flags = IORESOURCE_MEM,
484 },
485 [1] = {
486 .start = intcs_evt2irq(0x1780),
487 .flags = IORESOURCE_IRQ,
488 },
489};
490
491static struct platform_device hdmi_lcdc_device = {
492 .name = "sh_mobile_lcdc_fb",
493 .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
494 .resource = hdmi_lcdc_resources,
495 .id = 1,
496 .dev = {
497 .platform_data = &hdmi_lcdc_info,
498 .coherent_dma_mask = ~0,
499 },
500};
501
Kuninori Morimotof7e7d312012-04-06 01:31:33 -0700502/* GPIO KEY */
503#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
504
505static struct gpio_keys_button gpio_buttons[] = {
506 GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW1"),
507 GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW2"),
508 GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW3"),
509 GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW4"),
510};
511
512static struct gpio_keys_platform_data gpio_key_info = {
513 .buttons = gpio_buttons,
514 .nbuttons = ARRAY_SIZE(gpio_buttons),
515};
516
517static struct platform_device gpio_keys_device = {
518 .name = "gpio-keys",
519 .id = -1,
520 .dev = {
521 .platform_data = &gpio_key_info,
522 },
523};
524
Guennadi Liakhovetskif65ad7e2012-06-29 08:33:11 +0200525/* Fixed 3.3V regulator to be used by SDHI0, SDHI1, MMCIF */
526static struct regulator_consumer_supply fixed3v3_power_consumers[] =
527{
528 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
529 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
530 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
531 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
532 REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
533 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
534};
535
Kuninori Morimoto49c01112012-04-24 02:09:19 -0700536/* SDHI0 */
537/*
538 * FIXME
539 *
540 * It use polling mode here, since
541 * CD (= Card Detect) pin is not connected to SDHI0_CD.
542 * We can use IRQ31 as card detect irq,
543 * but it needs chattering removal operation
544 */
545#define IRQ31 evt2irq(0x33E0)
546static struct sh_mobile_sdhi_info sdhi0_info = {
Kuninori Morimoto95798e32012-06-25 03:37:38 -0700547 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
548 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
Kuninori Morimoto49c01112012-04-24 02:09:19 -0700549 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\
550 MMC_CAP_NEEDS_POLL,
551 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
552 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
553};
554
555static struct resource sdhi0_resources[] = {
556 {
557 .name = "SDHI0",
558 .start = 0xe6850000,
559 .end = 0xe6850100 - 1,
560 .flags = IORESOURCE_MEM,
561 },
562 /*
563 * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
564 */
565 {
566 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
567 .start = evt2irq(0x0E20),
568 .flags = IORESOURCE_IRQ,
569 },
570 {
571 .name = SH_MOBILE_SDHI_IRQ_SDIO,
572 .start = evt2irq(0x0E40),
573 .flags = IORESOURCE_IRQ,
574 },
575};
576
577static struct platform_device sdhi0_device = {
578 .name = "sh_mobile_sdhi",
579 .id = 0,
580 .dev = {
581 .platform_data = &sdhi0_info,
582 },
583 .num_resources = ARRAY_SIZE(sdhi0_resources),
584 .resource = sdhi0_resources,
585};
586
Kuninori Morimoto2e3a5ef2012-04-24 02:09:31 -0700587/* SDHI1 */
588static struct sh_mobile_sdhi_info sdhi1_info = {
Kuninori Morimoto95798e32012-06-25 03:37:38 -0700589 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
590 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
Kuninori Morimoto2e3a5ef2012-04-24 02:09:31 -0700591 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
592 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
593 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
594};
595
596static struct resource sdhi1_resources[] = {
597 [0] = {
598 .name = "SDHI1",
599 .start = 0xe6860000,
600 .end = 0xe6860100 - 1,
601 .flags = IORESOURCE_MEM,
602 },
603 [1] = {
604 .start = evt2irq(0x0E80),
605 .flags = IORESOURCE_IRQ,
606 },
607 [2] = {
608 .start = evt2irq(0x0EA0),
609 .flags = IORESOURCE_IRQ,
610 },
611 [3] = {
612 .start = evt2irq(0x0EC0),
613 .flags = IORESOURCE_IRQ,
614 },
615};
616
617static struct platform_device sdhi1_device = {
618 .name = "sh_mobile_sdhi",
619 .id = 1,
620 .dev = {
621 .platform_data = &sdhi1_info,
622 },
623 .num_resources = ARRAY_SIZE(sdhi1_resources),
624 .resource = sdhi1_resources,
625};
626
Kuninori Morimoto0a4266b2012-04-24 02:09:42 -0700627/* MMCIF */
628static struct sh_mmcif_plat_data sh_mmcif_plat = {
629 .sup_pclk = 0,
630 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
631 .caps = MMC_CAP_4_BIT_DATA |
632 MMC_CAP_8_BIT_DATA |
633 MMC_CAP_NONREMOVABLE,
634};
635
636static struct resource sh_mmcif_resources[] = {
637 [0] = {
638 .name = "MMCIF",
639 .start = 0xe6bd0000,
640 .end = 0xe6bd0100 - 1,
641 .flags = IORESOURCE_MEM,
642 },
643 [1] = {
644 /* MMC ERR */
645 .start = evt2irq(0x1AC0),
646 .flags = IORESOURCE_IRQ,
647 },
648 [2] = {
649 /* MMC NOR */
650 .start = evt2irq(0x1AE0),
651 .flags = IORESOURCE_IRQ,
652 },
653};
654
655static struct platform_device sh_mmcif_device = {
656 .name = "sh_mmcif",
657 .id = -1,
658 .dev = {
659 .platform_data = &sh_mmcif_plat,
660 },
661 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
662 .resource = sh_mmcif_resources,
663};
664
Kuninori Morimoto3760e792012-06-12 02:40:07 -0700665/* Camera */
666static int mt9t111_power(struct device *dev, int mode)
667{
668 struct clk *mclk = clk_get(NULL, "video1");
669
670 if (IS_ERR(mclk)) {
671 dev_err(dev, "can't get video1 clock\n");
672 return -EINVAL;
673 }
674
675 if (mode) {
676 /* video1 (= CON1 camera) expect 24MHz */
677 clk_set_rate(mclk, clk_round_rate(mclk, 24000000));
678 clk_enable(mclk);
679 gpio_direction_output(GPIO_PORT158, 1);
680 } else {
681 gpio_direction_output(GPIO_PORT158, 0);
682 clk_disable(mclk);
683 }
684
685 clk_put(mclk);
686
687 return 0;
688}
689
690static struct i2c_board_info i2c_camera_mt9t111 = {
691 I2C_BOARD_INFO("mt9t112", 0x3d),
692};
693
694static struct mt9t112_camera_info mt9t111_info = {
695 .divider = { 16, 0, 0, 7, 0, 10, 14, 7, 7 },
696};
697
698static struct soc_camera_link mt9t111_link = {
699 .i2c_adapter_id = 0,
700 .bus_id = 0,
701 .board_info = &i2c_camera_mt9t111,
702 .power = mt9t111_power,
703 .priv = &mt9t111_info,
704};
705
706static struct platform_device camera_device = {
707 .name = "soc-camera-pdrv",
708 .id = 0,
709 .dev = {
710 .platform_data = &mt9t111_link,
711 },
712};
713
714/* CEU0 */
715static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
716 .flags = SH_CEU_FLAG_LOWER_8BIT,
717};
718
719static struct resource ceu0_resources[] = {
720 [0] = {
721 .name = "CEU",
722 .start = 0xfe910000,
723 .end = 0xfe91009f,
724 .flags = IORESOURCE_MEM,
725 },
726 [1] = {
727 .start = intcs_evt2irq(0x0500),
728 .flags = IORESOURCE_IRQ,
729 },
730 [2] = {
731 /* place holder for contiguous memory */
732 },
733};
734
735static struct platform_device ceu0_device = {
736 .name = "sh_mobile_ceu",
737 .id = 0,
738 .num_resources = ARRAY_SIZE(ceu0_resources),
739 .resource = ceu0_resources,
740 .dev = {
741 .platform_data = &sh_mobile_ceu0_info,
742 .coherent_dma_mask = 0xffffffff,
743 },
744};
745
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700746/* FSI */
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700747static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable)
748{
749 struct clk *fsib;
750 int ret;
751
752 /* it support 48KHz only */
753 if (48000 != rate)
754 return -EINVAL;
755
756 fsib = clk_get(dev, "ickb");
757 if (IS_ERR(fsib))
758 return -EINVAL;
759
760 if (enable) {
761 ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
762 clk_enable(fsib);
763 } else {
764 ret = 0;
765 clk_disable(fsib);
766 }
767
768 clk_put(fsib);
769
770 return ret;
771}
772
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700773static struct sh_fsi_platform_info fsi_info = {
774 /* FSI-WM8978 */
775 .port_a = {
Kuninori Morimotodc7dd582012-06-25 03:37:20 -0700776 .tx_id = SHDMA_SLAVE_FSIA_TX,
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700777 },
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700778 /* FSI-HDMI */
779 .port_b = {
780 .flags = SH_FSI_FMT_SPDIF |
781 SH_FSI_ENABLE_STREAM_MODE,
782 .set_rate = fsi_hdmi_set_rate,
Kuninori Morimotodc7dd582012-06-25 03:37:20 -0700783 .tx_id = SHDMA_SLAVE_FSIB_TX,
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700784 }
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700785};
786
787static struct resource fsi_resources[] = {
788 [0] = {
789 .name = "FSI",
790 .start = 0xfe1f0000,
791 .end = 0xfe1f8400 - 1,
792 .flags = IORESOURCE_MEM,
793 },
794 [1] = {
795 .start = evt2irq(0x1840),
796 .flags = IORESOURCE_IRQ,
797 },
798};
799
800static struct platform_device fsi_device = {
801 .name = "sh_fsi2",
802 .id = -1,
803 .num_resources = ARRAY_SIZE(fsi_resources),
804 .resource = fsi_resources,
805 .dev = {
806 .platform_data = &fsi_info,
807 },
808};
809
810/* FSI-WM8978 */
811static struct asoc_simple_dai_init_info fsi_wm8978_init_info = {
812 .fmt = SND_SOC_DAIFMT_I2S,
813 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_NF,
814 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
815 .sysclk = 12288000,
816};
817
818static struct asoc_simple_card_info fsi_wm8978_info = {
819 .name = "wm8978",
820 .card = "FSI2A-WM8978",
821 .cpu_dai = "fsia-dai",
822 .codec = "wm8978.0-001a",
823 .platform = "sh_fsi2",
824 .codec_dai = "wm8978-hifi",
825 .init = &fsi_wm8978_init_info,
826};
827
828static struct platform_device fsi_wm8978_device = {
829 .name = "asoc-simple-card",
830 .id = 0,
831 .dev = {
832 .platform_data = &fsi_wm8978_info,
833 },
834};
835
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700836/* FSI-HDMI */
837static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
838 .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM,
839};
840
841static struct asoc_simple_card_info fsi2_hdmi_info = {
842 .name = "HDMI",
843 .card = "FSI2B-HDMI",
844 .cpu_dai = "fsib-dai",
845 .codec = "sh-mobile-hdmi",
846 .platform = "sh_fsi2",
847 .codec_dai = "sh_mobile_hdmi-hifi",
848 .init = &fsi2_hdmi_init_info,
849};
850
851static struct platform_device fsi_hdmi_device = {
852 .name = "asoc-simple-card",
853 .id = 1,
854 .dev = {
855 .platform_data = &fsi2_hdmi_info,
856 },
857};
858
Kuninori Morimoto46cf6682012-04-06 01:30:42 -0700859/* I2C */
860static struct i2c_board_info i2c0_devices[] = {
861 {
862 I2C_BOARD_INFO("st1232-ts", 0x55),
863 .irq = evt2irq(0x0340),
864 },
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700865 {
866 I2C_BOARD_INFO("wm8978", 0x1a),
867 },
Kuninori Morimoto46cf6682012-04-06 01:30:42 -0700868};
869
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700870/*
871 * board devices
872 */
873static struct platform_device *eva_devices[] __initdata = {
Kuninori Morimotodad29d12012-04-06 01:30:09 -0700874 &lcdc0_device,
Kuninori Morimotof7e7d312012-04-06 01:31:33 -0700875 &gpio_keys_device,
Kuninori Morimotod8fed1e2012-04-06 01:32:02 -0700876 &sh_eth_device,
Kuninori Morimoto49c01112012-04-24 02:09:19 -0700877 &sdhi0_device,
Kuninori Morimoto0a4266b2012-04-24 02:09:42 -0700878 &sh_mmcif_device,
Kuninori Morimoto910c14d2012-06-12 02:39:11 -0700879 &hdmi_device,
880 &hdmi_lcdc_device,
Kuninori Morimoto3760e792012-06-12 02:40:07 -0700881 &camera_device,
882 &ceu0_device,
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700883 &fsi_device,
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700884 &fsi_hdmi_device,
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700885 &fsi_wm8978_device,
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700886};
887
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700888static void __init eva_clock_init(void)
889{
890 struct clk *system = clk_get(NULL, "system_clk");
891 struct clk *xtal1 = clk_get(NULL, "extal1");
892 struct clk *usb24s = clk_get(NULL, "usb24s");
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700893 struct clk *fsibck = clk_get(NULL, "fsibck");
894 struct clk *fsib = clk_get(&fsi_device.dev, "ickb");
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700895
896 if (IS_ERR(system) ||
897 IS_ERR(xtal1) ||
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700898 IS_ERR(usb24s) ||
899 IS_ERR(fsibck) ||
900 IS_ERR(fsib)) {
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700901 pr_err("armadillo800eva board clock init failed\n");
902 goto clock_error;
903 }
904
905 /* armadillo 800 eva extal1 is 24MHz */
906 clk_set_rate(xtal1, 24000000);
907
908 /* usb24s use extal1 (= system) clock (= 24MHz) */
909 clk_set_parent(usb24s, system);
910
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700911 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
912 clk_set_parent(fsib, fsibck);
913 clk_set_rate(fsibck, 12288000);
914 clk_set_rate(fsib, 12288000);
915
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700916clock_error:
917 if (!IS_ERR(system))
918 clk_put(system);
919 if (!IS_ERR(xtal1))
920 clk_put(xtal1);
921 if (!IS_ERR(usb24s))
922 clk_put(usb24s);
Kuninori Morimoto0676c052012-06-25 03:33:04 -0700923 if (!IS_ERR(fsibck))
924 clk_put(fsibck);
925 if (!IS_ERR(fsib))
926 clk_put(fsib);
Kuninori Morimoto1c962932012-04-24 02:09:08 -0700927}
928
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700929/*
930 * board init
931 */
Kuninori Morimoto5389bf72012-06-25 03:32:50 -0700932#define GPIO_PORT7CR 0xe6050007
933#define GPIO_PORT8CR 0xe6050008
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700934static void __init eva_init(void)
935{
Guennadi Liakhovetskif65ad7e2012-06-29 08:33:11 +0200936 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers,
937 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
938
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700939 r8a7740_pinmux_init();
Kuninori Morimotod49679e2012-06-12 02:36:21 -0700940 r8a7740_meram_workaround();
Kuninori Morimoto4d22e562012-04-06 01:28:59 -0700941
942 /* SCIFA1 */
943 gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
944 gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
945
Kuninori Morimotodad29d12012-04-06 01:30:09 -0700946 /* LCDC0 */
947 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
948 gpio_request(GPIO_FN_LCD0_D0, NULL);
949 gpio_request(GPIO_FN_LCD0_D1, NULL);
950 gpio_request(GPIO_FN_LCD0_D2, NULL);
951 gpio_request(GPIO_FN_LCD0_D3, NULL);
952 gpio_request(GPIO_FN_LCD0_D4, NULL);
953 gpio_request(GPIO_FN_LCD0_D5, NULL);
954 gpio_request(GPIO_FN_LCD0_D6, NULL);
955 gpio_request(GPIO_FN_LCD0_D7, NULL);
956 gpio_request(GPIO_FN_LCD0_D8, NULL);
957 gpio_request(GPIO_FN_LCD0_D9, NULL);
958 gpio_request(GPIO_FN_LCD0_D10, NULL);
959 gpio_request(GPIO_FN_LCD0_D11, NULL);
960 gpio_request(GPIO_FN_LCD0_D12, NULL);
961 gpio_request(GPIO_FN_LCD0_D13, NULL);
962 gpio_request(GPIO_FN_LCD0_D14, NULL);
963 gpio_request(GPIO_FN_LCD0_D15, NULL);
964 gpio_request(GPIO_FN_LCD0_D16, NULL);
965 gpio_request(GPIO_FN_LCD0_D17, NULL);
966 gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
967 gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
968 gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
969 gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
970 gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
971 gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
972 gpio_request(GPIO_FN_LCD0_DCK, NULL);
973 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
974 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
975 gpio_request(GPIO_FN_LCD0_DISP, NULL);
976 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
977
978 gpio_request(GPIO_PORT61, NULL); /* LCDDON */
979 gpio_direction_output(GPIO_PORT61, 1);
980
981 gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
982 gpio_direction_output(GPIO_PORT202, 0);
983
Kuninori Morimoto46cf6682012-04-06 01:30:42 -0700984 /* Touchscreen */
985 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
986 gpio_request(GPIO_PORT166, NULL); /* TP_RST_B */
987 gpio_direction_output(GPIO_PORT166, 1);
988
Kuninori Morimotod8fed1e2012-04-06 01:32:02 -0700989 /* GETHER */
990 gpio_request(GPIO_FN_ET_CRS, NULL);
991 gpio_request(GPIO_FN_ET_MDC, NULL);
992 gpio_request(GPIO_FN_ET_MDIO, NULL);
993 gpio_request(GPIO_FN_ET_TX_ER, NULL);
994 gpio_request(GPIO_FN_ET_RX_ER, NULL);
995 gpio_request(GPIO_FN_ET_ERXD0, NULL);
996 gpio_request(GPIO_FN_ET_ERXD1, NULL);
997 gpio_request(GPIO_FN_ET_ERXD2, NULL);
998 gpio_request(GPIO_FN_ET_ERXD3, NULL);
999 gpio_request(GPIO_FN_ET_TX_CLK, NULL);
1000 gpio_request(GPIO_FN_ET_TX_EN, NULL);
1001 gpio_request(GPIO_FN_ET_ETXD0, NULL);
1002 gpio_request(GPIO_FN_ET_ETXD1, NULL);
1003 gpio_request(GPIO_FN_ET_ETXD2, NULL);
1004 gpio_request(GPIO_FN_ET_ETXD3, NULL);
1005 gpio_request(GPIO_FN_ET_PHY_INT, NULL);
1006 gpio_request(GPIO_FN_ET_COL, NULL);
1007 gpio_request(GPIO_FN_ET_RX_DV, NULL);
1008 gpio_request(GPIO_FN_ET_RX_CLK, NULL);
1009
1010 gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
1011 gpio_direction_output(GPIO_PORT18, 1);
1012
Kuninori Morimoto1c962932012-04-24 02:09:08 -07001013 /* USB */
1014 gpio_request(GPIO_PORT159, NULL); /* USB_DEVICE_MODE */
1015 gpio_direction_input(GPIO_PORT159);
1016
1017 if (gpio_get_value(GPIO_PORT159)) {
1018 /* USB Host */
1019 } else {
1020 /* USB Func */
1021 gpio_request(GPIO_FN_VBUS, NULL);
1022 platform_device_register(&usbhsf_device);
1023 }
1024
Kuninori Morimoto49c01112012-04-24 02:09:19 -07001025 /* SDHI0 */
1026 gpio_request(GPIO_FN_SDHI0_CMD, NULL);
1027 gpio_request(GPIO_FN_SDHI0_CLK, NULL);
1028 gpio_request(GPIO_FN_SDHI0_D0, NULL);
1029 gpio_request(GPIO_FN_SDHI0_D1, NULL);
1030 gpio_request(GPIO_FN_SDHI0_D2, NULL);
1031 gpio_request(GPIO_FN_SDHI0_D3, NULL);
1032 gpio_request(GPIO_FN_SDHI0_WP, NULL);
1033
1034 gpio_request(GPIO_PORT17, NULL); /* SDHI0_18/33_B */
1035 gpio_request(GPIO_PORT74, NULL); /* SDHI0_PON */
1036 gpio_request(GPIO_PORT75, NULL); /* SDSLOT1_PON */
1037 gpio_direction_output(GPIO_PORT17, 0);
1038 gpio_direction_output(GPIO_PORT74, 1);
1039 gpio_direction_output(GPIO_PORT75, 1);
1040
1041 /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
1042
Kuninori Morimotodad29d12012-04-06 01:30:09 -07001043 /*
Kuninori Morimoto0a4266b2012-04-24 02:09:42 -07001044 * MMCIF
1045 *
1046 * Here doesn't care SW1.4 status,
1047 * since CON2 is not mounted.
1048 */
1049 gpio_request(GPIO_FN_MMC1_CLK_PORT103, NULL);
1050 gpio_request(GPIO_FN_MMC1_CMD_PORT104, NULL);
1051 gpio_request(GPIO_FN_MMC1_D0_PORT149, NULL);
1052 gpio_request(GPIO_FN_MMC1_D1_PORT148, NULL);
1053 gpio_request(GPIO_FN_MMC1_D2_PORT147, NULL);
1054 gpio_request(GPIO_FN_MMC1_D3_PORT146, NULL);
1055 gpio_request(GPIO_FN_MMC1_D4_PORT145, NULL);
1056 gpio_request(GPIO_FN_MMC1_D5_PORT144, NULL);
1057 gpio_request(GPIO_FN_MMC1_D6_PORT143, NULL);
1058 gpio_request(GPIO_FN_MMC1_D7_PORT142, NULL);
1059
Kuninori Morimoto3760e792012-06-12 02:40:07 -07001060 /* CEU0 */
1061 gpio_request(GPIO_FN_VIO0_D7, NULL);
1062 gpio_request(GPIO_FN_VIO0_D6, NULL);
1063 gpio_request(GPIO_FN_VIO0_D5, NULL);
1064 gpio_request(GPIO_FN_VIO0_D4, NULL);
1065 gpio_request(GPIO_FN_VIO0_D3, NULL);
1066 gpio_request(GPIO_FN_VIO0_D2, NULL);
1067 gpio_request(GPIO_FN_VIO0_D1, NULL);
1068 gpio_request(GPIO_FN_VIO0_D0, NULL);
1069 gpio_request(GPIO_FN_VIO0_CLK, NULL);
1070 gpio_request(GPIO_FN_VIO0_HD, NULL);
1071 gpio_request(GPIO_FN_VIO0_VD, NULL);
1072 gpio_request(GPIO_FN_VIO0_FIELD, NULL);
1073 gpio_request(GPIO_FN_VIO_CKO, NULL);
1074
1075 /* CON1/CON15 Camera */
1076 gpio_request(GPIO_PORT173, NULL); /* STANDBY */
1077 gpio_request(GPIO_PORT172, NULL); /* RST */
1078 gpio_request(GPIO_PORT158, NULL); /* CAM_PON */
1079 gpio_direction_output(GPIO_PORT173, 0);
1080 gpio_direction_output(GPIO_PORT172, 1);
1081 gpio_direction_output(GPIO_PORT158, 0); /* see mt9t111_power() */
1082
Kuninori Morimoto5389bf72012-06-25 03:32:50 -07001083 /* FSI-WM8978 */
1084 gpio_request(GPIO_FN_FSIAIBT, NULL);
1085 gpio_request(GPIO_FN_FSIAILR, NULL);
1086 gpio_request(GPIO_FN_FSIAOMC, NULL);
1087 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1088 gpio_request(GPIO_FN_FSIAISLD_PORT5, NULL);
1089
1090 gpio_request(GPIO_PORT7, NULL);
1091 gpio_request(GPIO_PORT8, NULL);
Kuninori Morimotoa01366b2012-06-25 03:41:45 -07001092 gpio_direction_none(GPIO_PORT7CR); /* FSIAOBT needs no direction */
1093 gpio_direction_none(GPIO_PORT8CR); /* FSIAOLR needs no direction */
Kuninori Morimoto5389bf72012-06-25 03:32:50 -07001094
Kuninori Morimoto0676c052012-06-25 03:33:04 -07001095 /* FSI-HDMI */
1096 gpio_request(GPIO_FN_FSIBCK, NULL);
1097
1098 /* HDMI */
1099 gpio_request(GPIO_FN_HDMI_HPD, NULL);
1100 gpio_request(GPIO_FN_HDMI_CEC, NULL);
1101
Kuninori Morimoto0a4266b2012-04-24 02:09:42 -07001102 /*
Kuninori Morimotodad29d12012-04-06 01:30:09 -07001103 * CAUTION
1104 *
1105 * DBGMD/LCDC0/FSIA MUX
1106 * DBGMD_SELECT_B should be set after setting PFC Function.
1107 */
1108 gpio_request(GPIO_PORT176, NULL);
1109 gpio_direction_output(GPIO_PORT176, 1);
1110
Kuninori Morimoto2e3a5ef2012-04-24 02:09:31 -07001111 /*
1112 * We can switch CON8/CON14 by SW1.5,
1113 * but it needs after DBGMD_SELECT_B
1114 */
1115 gpio_request(GPIO_PORT6, NULL);
1116 gpio_direction_input(GPIO_PORT6);
1117 if (gpio_get_value(GPIO_PORT6)) {
1118 /* CON14 enable */
1119 } else {
1120 /* CON8 (SDHI1) enable */
1121 gpio_request(GPIO_FN_SDHI1_CLK, NULL);
1122 gpio_request(GPIO_FN_SDHI1_CMD, NULL);
1123 gpio_request(GPIO_FN_SDHI1_D0, NULL);
1124 gpio_request(GPIO_FN_SDHI1_D1, NULL);
1125 gpio_request(GPIO_FN_SDHI1_D2, NULL);
1126 gpio_request(GPIO_FN_SDHI1_D3, NULL);
1127 gpio_request(GPIO_FN_SDHI1_CD, NULL);
1128 gpio_request(GPIO_FN_SDHI1_WP, NULL);
1129
1130 gpio_request(GPIO_PORT16, NULL); /* SDSLOT2_PON */
1131 gpio_direction_output(GPIO_PORT16, 1);
1132
1133 platform_device_register(&sdhi1_device);
1134 }
1135
1136
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001137#ifdef CONFIG_CACHE_L2X0
1138 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
1139 l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
1140#endif
1141
Kuninori Morimoto46cf6682012-04-06 01:30:42 -07001142 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
1143
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001144 r8a7740_add_standard_devices();
1145
1146 platform_add_devices(eva_devices,
1147 ARRAY_SIZE(eva_devices));
Kuninori Morimoto0676c052012-06-25 03:33:04 -07001148
1149 eva_clock_init();
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001150}
1151
1152static void __init eva_earlytimer_init(void)
1153{
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001154 r8a7740_clock_init(MD_CK0 | MD_CK2);
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001155 shmobile_earlytimer_init();
1156}
1157
1158static void __init eva_add_early_devices(void)
1159{
1160 r8a7740_add_early_devices();
1161
1162 /* override timer setup with board-specific code */
1163 shmobile_timer.init = eva_earlytimer_init;
1164}
1165
Magnus Damme6bf7052012-05-14 19:54:41 +09001166static const char *eva_boards_compat_dt[] __initdata = {
1167 "renesas,armadillo800eva",
1168 NULL,
1169};
1170
1171DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001172 .map_io = r8a7740_map_io,
1173 .init_early = eva_add_early_devices,
1174 .init_irq = r8a7740_init_irq,
1175 .handle_irq = shmobile_handle_irq_intc,
1176 .init_machine = eva_init,
1177 .timer = &shmobile_timer,
Magnus Damme6bf7052012-05-14 19:54:41 +09001178 .dt_compat = eva_boards_compat_dt,
Kuninori Morimoto4d22e562012-04-06 01:28:59 -07001179MACHINE_END