ARM: mach-shmobile: armadillo800eva: add SDHI1 support
[deliverable/linux.git] / arch / arm / mach-shmobile / board-armadillo800eva.c
CommitLineData
4d22e564
KM
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
22#include <linux/clk.h>
1c96293e 23#include <linux/delay.h>
4d22e564
KM
24#include <linux/err.h>
25#include <linux/kernel.h>
f7e7d31a 26#include <linux/input.h>
1c96293e 27#include <linux/irq.h>
4d22e564
KM
28#include <linux/platform_device.h>
29#include <linux/gpio.h>
f7e7d31a 30#include <linux/gpio_keys.h>
d8fed1e2 31#include <linux/sh_eth.h>
dad29d1c 32#include <linux/videodev2.h>
1c96293e 33#include <linux/usb/renesas_usbhs.h>
49c01112
KM
34#include <linux/mfd/tmio.h>
35#include <linux/mmc/host.h>
36#include <linux/mmc/sh_mobile_sdhi.h>
4d22e564
KM
37#include <mach/common.h>
38#include <mach/irqs.h>
39#include <asm/page.h>
40#include <asm/mach-types.h>
41#include <asm/mach/arch.h>
42#include <asm/mach/map.h>
43#include <asm/mach/time.h>
44#include <asm/hardware/cache-l2x0.h>
45#include <mach/r8a7740.h>
dad29d1c 46#include <video/sh_mobile_lcdc.h>
4d22e564
KM
47
48/*
49 * CON1 Camera Module
50 * CON2 Extension Bus
51 * CON3 HDMI Output
52 * CON4 Composite Video Output
53 * CON5 H-UDI JTAG
54 * CON6 ARM JTAG
55 * CON7 SD1
56 * CON8 SD2
57 * CON9 RTC BackUp
58 * CON10 Monaural Mic Input
59 * CON11 Stereo Headphone Output
60 * CON12 Audio Line Output(L)
61 * CON13 Audio Line Output(R)
62 * CON14 AWL13 Module
63 * CON15 Extension
64 * CON16 LCD1
65 * CON17 LCD2
66 * CON19 Power Input
67 * CON20 USB1
68 * CON21 USB2
69 * CON22 Serial
70 * CON23 LAN
71 * CON24 USB3
72 * LED1 Camera LED(Yellow)
73 * LED2 Power LED (Green)
74 * ED3-LED6 User LED(Yellow)
75 * LED7 LAN link LED(Green)
76 * LED8 LAN activity LED(Yellow)
77 */
78
79/*
80 * DipSwitch
81 *
82 * SW1
83 *
84 * -12345678-+---------------+----------------------------
85 * 1 | boot | hermit
86 * 0 | boot | OS auto boot
87 * -12345678-+---------------+----------------------------
88 * 00 | boot device | eMMC
89 * 10 | boot device | SDHI0 (CON7)
90 * 01 | boot device | -
91 * 11 | boot device | Extension Buss (CS0)
92 * -12345678-+---------------+----------------------------
93 * 0 | Extension Bus | D8-D15 disable, eMMC enable
94 * 1 | Extension Bus | D8-D15 enable, eMMC disable
95 * -12345678-+---------------+----------------------------
2e3a5ef2 96 * 0 | SDHI1 | COM8 disable, COM14 enable
4d22e564
KM
97 * 1 | SDHI1 | COM8 enable, COM14 disable
98 * -12345678-+---------------+----------------------------
1c96293e
KM
99 * 0 | USB0 | COM20 enable, COM24 disable
100 * 1 | USB0 | COM20 disable, COM24 enable
101 * -12345678-+---------------+----------------------------
4d22e564
KM
102 * 00 | JTAG | SH-X2
103 * 10 | JTAG | ARM
104 * 01 | JTAG | -
105 * 11 | JTAG | Boundary Scan
106 *-----------+---------------+----------------------------
107 */
108
1c96293e
KM
109/*
110 * USB function
111 *
112 * When you use USB Function,
113 * set SW1.6 ON, and connect cable to CN24.
114 *
115 * USBF needs workaround on R8A7740 chip.
116 * These are a little bit complex.
117 * see
118 * usbhsf_power_ctrl()
119 *
120 * CAUTION
121 *
122 * It uses autonomy mode for USB hotplug at this point
123 * (= usbhs_private.platform_callback.get_vbus is NULL),
124 * since we don't know what's happen on PM control
125 * on this workaround.
126 */
127#define USBCR1 0xe605810a
128#define USBH 0xC6700000
129#define USBH_USBCTR 0x10834
130
131struct usbhsf_private {
132 struct clk *phy;
133 struct clk *usb24;
134 struct clk *pci;
135 struct clk *func;
136 struct clk *host;
137 void __iomem *usbh_base;
138 struct renesas_usbhs_platform_info info;
139};
140
141#define usbhsf_get_priv(pdev) \
142 container_of(renesas_usbhs_get_info(pdev), \
143 struct usbhsf_private, info)
144
145static int usbhsf_get_id(struct platform_device *pdev)
146{
147 return USBHS_GADGET;
148}
149
150static void usbhsf_power_ctrl(struct platform_device *pdev,
151 void __iomem *base, int enable)
152{
153 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
154
155 /*
156 * Work around for USB Function.
157 * It needs USB host clock, and settings
158 */
159 if (enable) {
160 /*
161 * enable all the related usb clocks
162 * for usb workaround
163 */
164 clk_enable(priv->usb24);
165 clk_enable(priv->pci);
166 clk_enable(priv->host);
167 clk_enable(priv->func);
168 clk_enable(priv->phy);
169
170 /*
171 * set USBCR1
172 *
173 * Port1 is driven by USB function,
174 * Port2 is driven by USB HOST
175 * One HOST (Port1 or Port2 is HOST)
176 * USB PLL input clock = 24MHz
177 */
178 __raw_writew(0xd750, USBCR1);
179 mdelay(1);
180
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 /*
189 * USB PHY Power ON
190 */
191 __raw_writew(0xd770, USBCR1);
192 __raw_writew(0x4000, base + 0x102); /* USBF :: SUSPMODE */
193
194 } else {
195 __raw_writel(0x0000010f, priv->usbh_base + USBH_USBCTR);
196 __raw_writew(0xd7c0, USBCR1); /* GPIO */
197
198 clk_disable(priv->phy);
199 clk_disable(priv->func); /* usb work around */
200 clk_disable(priv->host); /* usb work around */
201 clk_disable(priv->pci); /* usb work around */
202 clk_disable(priv->usb24); /* usb work around */
203 }
204}
205
206static void usbhsf_hardware_exit(struct platform_device *pdev)
207{
208 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
209
210 if (!IS_ERR(priv->phy))
211 clk_put(priv->phy);
212 if (!IS_ERR(priv->usb24))
213 clk_put(priv->usb24);
214 if (!IS_ERR(priv->pci))
215 clk_put(priv->pci);
216 if (!IS_ERR(priv->host))
217 clk_put(priv->host);
218 if (!IS_ERR(priv->func))
219 clk_put(priv->func);
220 if (priv->usbh_base)
221 iounmap(priv->usbh_base);
222
223 priv->phy = NULL;
224 priv->usb24 = NULL;
225 priv->pci = NULL;
226 priv->host = NULL;
227 priv->func = NULL;
228 priv->usbh_base = NULL;
229}
230
231static int usbhsf_hardware_init(struct platform_device *pdev)
232{
233 struct usbhsf_private *priv = usbhsf_get_priv(pdev);
234
235 priv->phy = clk_get(&pdev->dev, "phy");
236 priv->usb24 = clk_get(&pdev->dev, "usb24");
237 priv->pci = clk_get(&pdev->dev, "pci");
238 priv->func = clk_get(&pdev->dev, "func");
239 priv->host = clk_get(&pdev->dev, "host");
240 priv->usbh_base = ioremap_nocache(USBH, 0x20000);
241
242 if (IS_ERR(priv->phy) ||
243 IS_ERR(priv->usb24) ||
244 IS_ERR(priv->pci) ||
245 IS_ERR(priv->host) ||
246 IS_ERR(priv->func) ||
247 !priv->usbh_base) {
248 dev_err(&pdev->dev, "USB clock setting failed\n");
249 usbhsf_hardware_exit(pdev);
250 return -EIO;
251 }
252
253 /* usb24 use 1/1 of parent clock (= usb24s = 24MHz) */
254 clk_set_rate(priv->usb24,
255 clk_get_rate(clk_get_parent(priv->usb24)));
256
257 return 0;
258}
259
260static struct usbhsf_private usbhsf_private = {
261 .info = {
262 .platform_callback = {
263 .get_id = usbhsf_get_id,
264 .hardware_init = usbhsf_hardware_init,
265 .hardware_exit = usbhsf_hardware_exit,
266 .power_ctrl = usbhsf_power_ctrl,
267 },
268 .driver_param = {
269 .buswait_bwait = 5,
270 .detection_delay = 5,
271 },
272 }
273};
274
275static struct resource usbhsf_resources[] = {
276 {
277 .name = "USBHS",
278 .start = 0xe6890000,
279 .end = 0xe6890104 - 1,
280 .flags = IORESOURCE_MEM,
281 },
282 {
283 .start = evt2irq(0x0A20),
284 .flags = IORESOURCE_IRQ,
285 },
286};
287
288static struct platform_device usbhsf_device = {
289 .name = "renesas_usbhs",
290 .dev = {
291 .platform_data = &usbhsf_private.info,
292 },
293 .id = -1,
294 .num_resources = ARRAY_SIZE(usbhsf_resources),
295 .resource = usbhsf_resources,
296};
297
d8fed1e2
KM
298/* Ether */
299static struct sh_eth_plat_data sh_eth_platdata = {
300 .phy = 0x00, /* LAN8710A */
301 .edmac_endian = EDMAC_LITTLE_ENDIAN,
302 .register_type = SH_ETH_REG_GIGABIT,
303 .phy_interface = PHY_INTERFACE_MODE_MII,
304};
305
306static struct resource sh_eth_resources[] = {
307 {
308 .start = 0xe9a00000,
309 .end = 0xe9a00800 - 1,
310 .flags = IORESOURCE_MEM,
311 }, {
312 .start = 0xe9a01800,
313 .end = 0xe9a02000 - 1,
314 .flags = IORESOURCE_MEM,
315 }, {
316 .start = evt2irq(0x0500),
317 .flags = IORESOURCE_IRQ,
318 },
319};
320
321static struct platform_device sh_eth_device = {
322 .name = "sh-eth",
323 .dev = {
324 .platform_data = &sh_eth_platdata,
325 },
326 .resource = sh_eth_resources,
327 .num_resources = ARRAY_SIZE(sh_eth_resources),
328};
329
dad29d1c
KM
330/* LCDC */
331static struct fb_videomode lcdc0_mode = {
332 .name = "AMPIER/AM-800480",
333 .xres = 800,
334 .yres = 480,
335 .left_margin = 88,
336 .right_margin = 40,
337 .hsync_len = 128,
338 .upper_margin = 20,
339 .lower_margin = 5,
340 .vsync_len = 5,
341 .sync = 0,
342};
343
344static struct sh_mobile_lcdc_info lcdc0_info = {
345 .clock_source = LCDC_CLK_BUS,
346 .ch[0] = {
347 .chan = LCDC_CHAN_MAINLCD,
348 .fourcc = V4L2_PIX_FMT_RGB565,
349 .interface_type = RGB24,
350 .clock_divider = 5,
351 .flags = 0,
352 .lcd_modes = &lcdc0_mode,
353 .num_modes = 1,
354 .panel_cfg = {
355 .width = 111,
356 .height = 68,
357 },
358 },
359};
360
361static struct resource lcdc0_resources[] = {
362 [0] = {
363 .name = "LCD0",
364 .start = 0xfe940000,
365 .end = 0xfe943fff,
366 .flags = IORESOURCE_MEM,
367 },
368 [1] = {
369 .start = intcs_evt2irq(0x580),
370 .flags = IORESOURCE_IRQ,
371 },
372};
373
374static struct platform_device lcdc0_device = {
375 .name = "sh_mobile_lcdc_fb",
376 .num_resources = ARRAY_SIZE(lcdc0_resources),
377 .resource = lcdc0_resources,
378 .id = 0,
379 .dev = {
380 .platform_data = &lcdc0_info,
381 .coherent_dma_mask = ~0,
382 },
383};
384
f7e7d31a
KM
385/* GPIO KEY */
386#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
387
388static struct gpio_keys_button gpio_buttons[] = {
389 GPIO_KEY(KEY_POWER, GPIO_PORT99, "SW1"),
390 GPIO_KEY(KEY_BACK, GPIO_PORT100, "SW2"),
391 GPIO_KEY(KEY_MENU, GPIO_PORT97, "SW3"),
392 GPIO_KEY(KEY_HOME, GPIO_PORT98, "SW4"),
393};
394
395static struct gpio_keys_platform_data gpio_key_info = {
396 .buttons = gpio_buttons,
397 .nbuttons = ARRAY_SIZE(gpio_buttons),
398};
399
400static struct platform_device gpio_keys_device = {
401 .name = "gpio-keys",
402 .id = -1,
403 .dev = {
404 .platform_data = &gpio_key_info,
405 },
406};
407
49c01112
KM
408/* SDHI0 */
409/*
410 * FIXME
411 *
412 * It use polling mode here, since
413 * CD (= Card Detect) pin is not connected to SDHI0_CD.
414 * We can use IRQ31 as card detect irq,
415 * but it needs chattering removal operation
416 */
417#define IRQ31 evt2irq(0x33E0)
418static struct sh_mobile_sdhi_info sdhi0_info = {
419 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |\
420 MMC_CAP_NEEDS_POLL,
421 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
422 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
423};
424
425static struct resource sdhi0_resources[] = {
426 {
427 .name = "SDHI0",
428 .start = 0xe6850000,
429 .end = 0xe6850100 - 1,
430 .flags = IORESOURCE_MEM,
431 },
432 /*
433 * no SH_MOBILE_SDHI_IRQ_CARD_DETECT here
434 */
435 {
436 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
437 .start = evt2irq(0x0E20),
438 .flags = IORESOURCE_IRQ,
439 },
440 {
441 .name = SH_MOBILE_SDHI_IRQ_SDIO,
442 .start = evt2irq(0x0E40),
443 .flags = IORESOURCE_IRQ,
444 },
445};
446
447static struct platform_device sdhi0_device = {
448 .name = "sh_mobile_sdhi",
449 .id = 0,
450 .dev = {
451 .platform_data = &sdhi0_info,
452 },
453 .num_resources = ARRAY_SIZE(sdhi0_resources),
454 .resource = sdhi0_resources,
455};
456
2e3a5ef2
KM
457/* SDHI1 */
458static struct sh_mobile_sdhi_info sdhi1_info = {
459 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
460 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
461 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
462};
463
464static struct resource sdhi1_resources[] = {
465 [0] = {
466 .name = "SDHI1",
467 .start = 0xe6860000,
468 .end = 0xe6860100 - 1,
469 .flags = IORESOURCE_MEM,
470 },
471 [1] = {
472 .start = evt2irq(0x0E80),
473 .flags = IORESOURCE_IRQ,
474 },
475 [2] = {
476 .start = evt2irq(0x0EA0),
477 .flags = IORESOURCE_IRQ,
478 },
479 [3] = {
480 .start = evt2irq(0x0EC0),
481 .flags = IORESOURCE_IRQ,
482 },
483};
484
485static struct platform_device sdhi1_device = {
486 .name = "sh_mobile_sdhi",
487 .id = 1,
488 .dev = {
489 .platform_data = &sdhi1_info,
490 },
491 .num_resources = ARRAY_SIZE(sdhi1_resources),
492 .resource = sdhi1_resources,
493};
494
46cf6687
KM
495/* I2C */
496static struct i2c_board_info i2c0_devices[] = {
497 {
498 I2C_BOARD_INFO("st1232-ts", 0x55),
499 .irq = evt2irq(0x0340),
500 },
501};
502
4d22e564
KM
503/*
504 * board devices
505 */
506static struct platform_device *eva_devices[] __initdata = {
dad29d1c 507 &lcdc0_device,
f7e7d31a 508 &gpio_keys_device,
d8fed1e2 509 &sh_eth_device,
49c01112 510 &sdhi0_device,
4d22e564
KM
511};
512
1c96293e
KM
513static void __init eva_clock_init(void)
514{
515 struct clk *system = clk_get(NULL, "system_clk");
516 struct clk *xtal1 = clk_get(NULL, "extal1");
517 struct clk *usb24s = clk_get(NULL, "usb24s");
518
519 if (IS_ERR(system) ||
520 IS_ERR(xtal1) ||
521 IS_ERR(usb24s)) {
522 pr_err("armadillo800eva board clock init failed\n");
523 goto clock_error;
524 }
525
526 /* armadillo 800 eva extal1 is 24MHz */
527 clk_set_rate(xtal1, 24000000);
528
529 /* usb24s use extal1 (= system) clock (= 24MHz) */
530 clk_set_parent(usb24s, system);
531
532clock_error:
533 if (!IS_ERR(system))
534 clk_put(system);
535 if (!IS_ERR(xtal1))
536 clk_put(xtal1);
537 if (!IS_ERR(usb24s))
538 clk_put(usb24s);
539}
540
4d22e564
KM
541/*
542 * board init
543 */
544static void __init eva_init(void)
545{
1c96293e
KM
546 eva_clock_init();
547
4d22e564
KM
548 r8a7740_pinmux_init();
549
550 /* SCIFA1 */
551 gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
552 gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
553
dad29d1c
KM
554 /* LCDC0 */
555 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
556 gpio_request(GPIO_FN_LCD0_D0, NULL);
557 gpio_request(GPIO_FN_LCD0_D1, NULL);
558 gpio_request(GPIO_FN_LCD0_D2, NULL);
559 gpio_request(GPIO_FN_LCD0_D3, NULL);
560 gpio_request(GPIO_FN_LCD0_D4, NULL);
561 gpio_request(GPIO_FN_LCD0_D5, NULL);
562 gpio_request(GPIO_FN_LCD0_D6, NULL);
563 gpio_request(GPIO_FN_LCD0_D7, NULL);
564 gpio_request(GPIO_FN_LCD0_D8, NULL);
565 gpio_request(GPIO_FN_LCD0_D9, NULL);
566 gpio_request(GPIO_FN_LCD0_D10, NULL);
567 gpio_request(GPIO_FN_LCD0_D11, NULL);
568 gpio_request(GPIO_FN_LCD0_D12, NULL);
569 gpio_request(GPIO_FN_LCD0_D13, NULL);
570 gpio_request(GPIO_FN_LCD0_D14, NULL);
571 gpio_request(GPIO_FN_LCD0_D15, NULL);
572 gpio_request(GPIO_FN_LCD0_D16, NULL);
573 gpio_request(GPIO_FN_LCD0_D17, NULL);
574 gpio_request(GPIO_FN_LCD0_D18_PORT40, NULL);
575 gpio_request(GPIO_FN_LCD0_D19_PORT4, NULL);
576 gpio_request(GPIO_FN_LCD0_D20_PORT3, NULL);
577 gpio_request(GPIO_FN_LCD0_D21_PORT2, NULL);
578 gpio_request(GPIO_FN_LCD0_D22_PORT0, NULL);
579 gpio_request(GPIO_FN_LCD0_D23_PORT1, NULL);
580 gpio_request(GPIO_FN_LCD0_DCK, NULL);
581 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
582 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
583 gpio_request(GPIO_FN_LCD0_DISP, NULL);
584 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
585
586 gpio_request(GPIO_PORT61, NULL); /* LCDDON */
587 gpio_direction_output(GPIO_PORT61, 1);
588
589 gpio_request(GPIO_PORT202, NULL); /* LCD0_LED_CONT */
590 gpio_direction_output(GPIO_PORT202, 0);
591
46cf6687
KM
592 /* Touchscreen */
593 gpio_request(GPIO_FN_IRQ10, NULL); /* TP_INT */
594 gpio_request(GPIO_PORT166, NULL); /* TP_RST_B */
595 gpio_direction_output(GPIO_PORT166, 1);
596
d8fed1e2
KM
597 /* GETHER */
598 gpio_request(GPIO_FN_ET_CRS, NULL);
599 gpio_request(GPIO_FN_ET_MDC, NULL);
600 gpio_request(GPIO_FN_ET_MDIO, NULL);
601 gpio_request(GPIO_FN_ET_TX_ER, NULL);
602 gpio_request(GPIO_FN_ET_RX_ER, NULL);
603 gpio_request(GPIO_FN_ET_ERXD0, NULL);
604 gpio_request(GPIO_FN_ET_ERXD1, NULL);
605 gpio_request(GPIO_FN_ET_ERXD2, NULL);
606 gpio_request(GPIO_FN_ET_ERXD3, NULL);
607 gpio_request(GPIO_FN_ET_TX_CLK, NULL);
608 gpio_request(GPIO_FN_ET_TX_EN, NULL);
609 gpio_request(GPIO_FN_ET_ETXD0, NULL);
610 gpio_request(GPIO_FN_ET_ETXD1, NULL);
611 gpio_request(GPIO_FN_ET_ETXD2, NULL);
612 gpio_request(GPIO_FN_ET_ETXD3, NULL);
613 gpio_request(GPIO_FN_ET_PHY_INT, NULL);
614 gpio_request(GPIO_FN_ET_COL, NULL);
615 gpio_request(GPIO_FN_ET_RX_DV, NULL);
616 gpio_request(GPIO_FN_ET_RX_CLK, NULL);
617
618 gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
619 gpio_direction_output(GPIO_PORT18, 1);
620
1c96293e
KM
621 /* USB */
622 gpio_request(GPIO_PORT159, NULL); /* USB_DEVICE_MODE */
623 gpio_direction_input(GPIO_PORT159);
624
625 if (gpio_get_value(GPIO_PORT159)) {
626 /* USB Host */
627 } else {
628 /* USB Func */
629 gpio_request(GPIO_FN_VBUS, NULL);
630 platform_device_register(&usbhsf_device);
631 }
632
49c01112
KM
633 /* SDHI0 */
634 gpio_request(GPIO_FN_SDHI0_CMD, NULL);
635 gpio_request(GPIO_FN_SDHI0_CLK, NULL);
636 gpio_request(GPIO_FN_SDHI0_D0, NULL);
637 gpio_request(GPIO_FN_SDHI0_D1, NULL);
638 gpio_request(GPIO_FN_SDHI0_D2, NULL);
639 gpio_request(GPIO_FN_SDHI0_D3, NULL);
640 gpio_request(GPIO_FN_SDHI0_WP, NULL);
641
642 gpio_request(GPIO_PORT17, NULL); /* SDHI0_18/33_B */
643 gpio_request(GPIO_PORT74, NULL); /* SDHI0_PON */
644 gpio_request(GPIO_PORT75, NULL); /* SDSLOT1_PON */
645 gpio_direction_output(GPIO_PORT17, 0);
646 gpio_direction_output(GPIO_PORT74, 1);
647 gpio_direction_output(GPIO_PORT75, 1);
648
649 /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
650
dad29d1c
KM
651 /*
652 * CAUTION
653 *
654 * DBGMD/LCDC0/FSIA MUX
655 * DBGMD_SELECT_B should be set after setting PFC Function.
656 */
657 gpio_request(GPIO_PORT176, NULL);
658 gpio_direction_output(GPIO_PORT176, 1);
659
2e3a5ef2
KM
660 /*
661 * We can switch CON8/CON14 by SW1.5,
662 * but it needs after DBGMD_SELECT_B
663 */
664 gpio_request(GPIO_PORT6, NULL);
665 gpio_direction_input(GPIO_PORT6);
666 if (gpio_get_value(GPIO_PORT6)) {
667 /* CON14 enable */
668 } else {
669 /* CON8 (SDHI1) enable */
670 gpio_request(GPIO_FN_SDHI1_CLK, NULL);
671 gpio_request(GPIO_FN_SDHI1_CMD, NULL);
672 gpio_request(GPIO_FN_SDHI1_D0, NULL);
673 gpio_request(GPIO_FN_SDHI1_D1, NULL);
674 gpio_request(GPIO_FN_SDHI1_D2, NULL);
675 gpio_request(GPIO_FN_SDHI1_D3, NULL);
676 gpio_request(GPIO_FN_SDHI1_CD, NULL);
677 gpio_request(GPIO_FN_SDHI1_WP, NULL);
678
679 gpio_request(GPIO_PORT16, NULL); /* SDSLOT2_PON */
680 gpio_direction_output(GPIO_PORT16, 1);
681
682 platform_device_register(&sdhi1_device);
683 }
684
685
4d22e564
KM
686#ifdef CONFIG_CACHE_L2X0
687 /* Early BRESP enable, Shared attribute override enable, 32K*8way */
688 l2x0_init(__io(0xf0002000), 0x40440000, 0x82000fff);
689#endif
690
46cf6687
KM
691 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
692
4d22e564
KM
693 r8a7740_add_standard_devices();
694
695 platform_add_devices(eva_devices,
696 ARRAY_SIZE(eva_devices));
697}
698
699static void __init eva_earlytimer_init(void)
700{
4d22e564 701 r8a7740_clock_init(MD_CK0 | MD_CK2);
4d22e564
KM
702 shmobile_earlytimer_init();
703}
704
705static void __init eva_add_early_devices(void)
706{
707 r8a7740_add_early_devices();
708
709 /* override timer setup with board-specific code */
710 shmobile_timer.init = eva_earlytimer_init;
711}
712
713MACHINE_START(ARMADILLO800EVA, "armadillo800eva")
714 .map_io = r8a7740_map_io,
715 .init_early = eva_add_early_devices,
716 .init_irq = r8a7740_init_irq,
717 .handle_irq = shmobile_handle_irq_intc,
718 .init_machine = eva_init,
719 .timer = &shmobile_timer,
720MACHINE_END
This page took 0.053548 seconds and 5 git commands to generate.