ARM: shmobile: kzm9g: enable DMAEngine on FSI
[deliverable/linux.git] / arch / arm / mach-shmobile / board-kzm9g.c
CommitLineData
9b93e244
KM
1/*
2 * KZM-A9-GT board support
3 *
4 * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
26786111
KM
19
20#include <linux/delay.h>
9b93e244 21#include <linux/gpio.h>
1e354641 22#include <linux/gpio_keys.h>
9b93e244
KM
23#include <linux/io.h>
24#include <linux/irq.h>
407c0526 25#include <linux/i2c.h>
1e354641
KM
26#include <linux/i2c/pcf857x.h>
27#include <linux/input.h>
cc2512bc
KM
28#include <linux/mmc/host.h>
29#include <linux/mmc/sh_mmcif.h>
7775a933
KM
30#include <linux/mmc/sh_mobile_sdhi.h>
31#include <linux/mfd/tmio.h>
9b93e244 32#include <linux/platform_device.h>
c15c4257 33#include <linux/smsc911x.h>
dd818180 34#include <linux/usb/r8a66597.h>
77bcefd9 35#include <linux/usb/renesas_usbhs.h>
26786111 36#include <linux/videodev2.h>
accb90c8
KM
37#include <sound/sh_fsi.h>
38#include <sound/simple_card.h>
c15c4257 39#include <mach/irqs.h>
9b93e244
KM
40#include <mach/sh73a0.h>
41#include <mach/common.h>
42#include <asm/hardware/cache-l2x0.h>
43#include <asm/hardware/gic.h>
44#include <asm/mach-types.h>
45#include <asm/mach/arch.h>
26786111 46#include <video/sh_mobile_lcdc.h>
9b93e244 47
1e354641
KM
48/*
49 * external GPIO
50 */
51#define GPIO_PCF8575_BASE (GPIO_NR)
52#define GPIO_PCF8575_PORT10 (GPIO_NR + 8)
53#define GPIO_PCF8575_PORT11 (GPIO_NR + 9)
54#define GPIO_PCF8575_PORT12 (GPIO_NR + 10)
55#define GPIO_PCF8575_PORT13 (GPIO_NR + 11)
56#define GPIO_PCF8575_PORT14 (GPIO_NR + 12)
57#define GPIO_PCF8575_PORT15 (GPIO_NR + 13)
58#define GPIO_PCF8575_PORT16 (GPIO_NR + 14)
59
accb90c8
KM
60/*
61 * FSI-AK4648
62 *
63 * this command is required when playback.
64 *
65 * # amixer set "LINEOUT Mixer DACL" on
66 */
67
c15c4257
KM
68/* SMSC 9221 */
69static struct resource smsc9221_resources[] = {
70 [0] = {
71 .start = 0x10000000, /* CS4 */
72 .end = 0x100000ff,
73 .flags = IORESOURCE_MEM,
74 },
75 [1] = {
76 .start = intcs_evt2irq(0x260), /* IRQ3 */
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81static struct smsc911x_platform_config smsc9221_platdata = {
82 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
83 .phy_interface = PHY_INTERFACE_MODE_MII,
84 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
85 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
86};
87
88static struct platform_device smsc_device = {
89 .name = "smsc911x",
90 .dev = {
91 .platform_data = &smsc9221_platdata,
92 },
93 .resource = smsc9221_resources,
94 .num_resources = ARRAY_SIZE(smsc9221_resources),
95};
96
dd818180
KM
97/* USB external chip */
98static struct r8a66597_platdata usb_host_data = {
99 .on_chip = 0,
100 .xtal = R8A66597_PLATDATA_XTAL_48MHZ,
101};
102
103static struct resource usb_resources[] = {
104 [0] = {
105 .start = 0x10010000,
106 .end = 0x1001ffff - 1,
107 .flags = IORESOURCE_MEM,
108 },
109 [1] = {
110 .start = intcs_evt2irq(0x220), /* IRQ1 */
111 .flags = IORESOURCE_IRQ,
112 },
113};
114
115static struct platform_device usb_host_device = {
116 .name = "r8a66597_hcd",
117 .dev = {
118 .platform_data = &usb_host_data,
119 .dma_mask = NULL,
120 .coherent_dma_mask = 0xffffffff,
121 },
122 .num_resources = ARRAY_SIZE(usb_resources),
123 .resource = usb_resources,
124};
125
77bcefd9
KM
126/* USB Func CN17 */
127struct usbhs_private {
128 unsigned int phy;
129 unsigned int cr2;
130 struct renesas_usbhs_platform_info info;
131};
132
133#define IRQ15 intcs_evt2irq(0x03e0)
134#define USB_PHY_MODE (1 << 4)
135#define USB_PHY_INT_EN ((1 << 3) | (1 << 2))
136#define USB_PHY_ON (1 << 1)
137#define USB_PHY_OFF (1 << 0)
138#define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF)
139
140#define usbhs_get_priv(pdev) \
141 container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info)
142
143static int usbhs_get_vbus(struct platform_device *pdev)
144{
145 struct usbhs_private *priv = usbhs_get_priv(pdev);
146
147 return !((1 << 7) & __raw_readw(priv->cr2));
148}
149
150static void usbhs_phy_reset(struct platform_device *pdev)
151{
152 struct usbhs_private *priv = usbhs_get_priv(pdev);
153
154 /* init phy */
155 __raw_writew(0x8a0a, priv->cr2);
156}
157
158static int usbhs_get_id(struct platform_device *pdev)
159{
160 return USBHS_GADGET;
161}
162
163static irqreturn_t usbhs_interrupt(int irq, void *data)
164{
165 struct platform_device *pdev = data;
166 struct usbhs_private *priv = usbhs_get_priv(pdev);
167
168 renesas_usbhs_call_notify_hotplug(pdev);
169
170 /* clear status */
171 __raw_writew(__raw_readw(priv->phy) | USB_PHY_INT_CLR, priv->phy);
172
173 return IRQ_HANDLED;
174}
175
176static int usbhs_hardware_init(struct platform_device *pdev)
177{
178 struct usbhs_private *priv = usbhs_get_priv(pdev);
179 int ret;
180
181 /* clear interrupt status */
182 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
183
184 ret = request_irq(IRQ15, usbhs_interrupt, IRQF_TRIGGER_HIGH,
185 dev_name(&pdev->dev), pdev);
186 if (ret) {
187 dev_err(&pdev->dev, "request_irq err\n");
188 return ret;
189 }
190
191 /* enable USB phy interrupt */
192 __raw_writew(USB_PHY_MODE | USB_PHY_INT_EN, priv->phy);
193
194 return 0;
195}
196
197static void usbhs_hardware_exit(struct platform_device *pdev)
198{
199 struct usbhs_private *priv = usbhs_get_priv(pdev);
200
201 /* clear interrupt status */
202 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
203
204 free_irq(IRQ15, pdev);
205}
206
207static u32 usbhs_pipe_cfg[] = {
208 USB_ENDPOINT_XFER_CONTROL,
209 USB_ENDPOINT_XFER_ISOC,
210 USB_ENDPOINT_XFER_ISOC,
211 USB_ENDPOINT_XFER_BULK,
212 USB_ENDPOINT_XFER_BULK,
213 USB_ENDPOINT_XFER_BULK,
214 USB_ENDPOINT_XFER_INT,
215 USB_ENDPOINT_XFER_INT,
216 USB_ENDPOINT_XFER_INT,
217 USB_ENDPOINT_XFER_BULK,
218 USB_ENDPOINT_XFER_BULK,
219 USB_ENDPOINT_XFER_BULK,
220 USB_ENDPOINT_XFER_BULK,
221 USB_ENDPOINT_XFER_BULK,
222 USB_ENDPOINT_XFER_BULK,
223 USB_ENDPOINT_XFER_BULK,
224};
225
226static struct usbhs_private usbhs_private = {
227 .phy = 0xe60781e0, /* USBPHYINT */
228 .cr2 = 0xe605810c, /* USBCR2 */
229 .info = {
230 .platform_callback = {
231 .hardware_init = usbhs_hardware_init,
232 .hardware_exit = usbhs_hardware_exit,
233 .get_id = usbhs_get_id,
234 .phy_reset = usbhs_phy_reset,
235 .get_vbus = usbhs_get_vbus,
236 },
237 .driver_param = {
238 .buswait_bwait = 4,
239 .has_otg = 1,
240 .pipe_type = usbhs_pipe_cfg,
241 .pipe_size = ARRAY_SIZE(usbhs_pipe_cfg),
242 },
243 },
244};
245
246static struct resource usbhs_resources[] = {
247 [0] = {
248 .start = 0xE6890000,
249 .end = 0xE68900e6 - 1,
250 .flags = IORESOURCE_MEM,
251 },
252 [1] = {
253 .start = gic_spi(62),
254 .end = gic_spi(62),
255 .flags = IORESOURCE_IRQ,
256 },
257};
258
259static struct platform_device usbhs_device = {
260 .name = "renesas_usbhs",
261 .id = -1,
262 .dev = {
263 .dma_mask = NULL,
264 .coherent_dma_mask = 0xffffffff,
265 .platform_data = &usbhs_private.info,
266 },
267 .num_resources = ARRAY_SIZE(usbhs_resources),
268 .resource = usbhs_resources,
269};
270
26786111
KM
271/* LCDC */
272static struct fb_videomode kzm_lcdc_mode = {
273 .name = "WVGA Panel",
274 .xres = 800,
275 .yres = 480,
276 .left_margin = 220,
277 .right_margin = 110,
278 .hsync_len = 70,
279 .upper_margin = 20,
280 .lower_margin = 5,
281 .vsync_len = 5,
282 .sync = 0,
283};
284
285static struct sh_mobile_lcdc_info lcdc_info = {
286 .clock_source = LCDC_CLK_BUS,
287 .ch[0] = {
288 .chan = LCDC_CHAN_MAINLCD,
289 .fourcc = V4L2_PIX_FMT_RGB565,
290 .interface_type = RGB24,
291 .lcd_modes = &kzm_lcdc_mode,
292 .num_modes = 1,
293 .clock_divider = 5,
294 .flags = 0,
295 .panel_cfg = {
296 .width = 152,
297 .height = 91,
298 },
299 }
300};
301
302static struct resource lcdc_resources[] = {
303 [0] = {
304 .name = "LCDC",
305 .start = 0xfe940000,
306 .end = 0xfe943fff,
307 .flags = IORESOURCE_MEM,
308 },
309 [1] = {
310 .start = intcs_evt2irq(0x580),
311 .flags = IORESOURCE_IRQ,
312 },
313};
314
315static struct platform_device lcdc_device = {
316 .name = "sh_mobile_lcdc_fb",
317 .num_resources = ARRAY_SIZE(lcdc_resources),
318 .resource = lcdc_resources,
319 .dev = {
320 .platform_data = &lcdc_info,
321 .coherent_dma_mask = ~0,
322 },
323};
324
cc2512bc
KM
325/* MMCIF */
326static struct resource sh_mmcif_resources[] = {
327 [0] = {
328 .name = "MMCIF",
329 .start = 0xe6bd0000,
330 .end = 0xe6bd00ff,
331 .flags = IORESOURCE_MEM,
332 },
333 [1] = {
334 .start = gic_spi(141),
335 .flags = IORESOURCE_IRQ,
336 },
337 [2] = {
338 .start = gic_spi(140),
339 .flags = IORESOURCE_IRQ,
340 },
341};
342
343static struct sh_mmcif_plat_data sh_mmcif_platdata = {
344 .ocr = MMC_VDD_165_195,
345 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
346};
347
348static struct platform_device mmc_device = {
349 .name = "sh_mmcif",
350 .dev = {
351 .dma_mask = NULL,
352 .coherent_dma_mask = 0xffffffff,
353 .platform_data = &sh_mmcif_platdata,
354 },
355 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
356 .resource = sh_mmcif_resources,
357};
358
7775a933
KM
359/* SDHI */
360static struct sh_mobile_sdhi_info sdhi0_info = {
361 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
362 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
363 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
364};
365
366static struct resource sdhi0_resources[] = {
367 [0] = {
368 .name = "SDHI0",
369 .start = 0xee100000,
370 .end = 0xee1000ff,
371 .flags = IORESOURCE_MEM,
372 },
373 [1] = {
374 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
375 .start = gic_spi(83),
376 .flags = IORESOURCE_IRQ,
377 },
378 [2] = {
379 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
380 .start = gic_spi(84),
381 .flags = IORESOURCE_IRQ,
382 },
383 [3] = {
384 .name = SH_MOBILE_SDHI_IRQ_SDIO,
385 .start = gic_spi(85),
386 .flags = IORESOURCE_IRQ,
387 },
388};
389
390static struct platform_device sdhi0_device = {
391 .name = "sh_mobile_sdhi",
392 .num_resources = ARRAY_SIZE(sdhi0_resources),
393 .resource = sdhi0_resources,
394 .dev = {
395 .platform_data = &sdhi0_info,
396 },
397};
398
425d6940
KM
399/* Micro SD */
400static struct sh_mobile_sdhi_info sdhi2_info = {
401 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT |
402 TMIO_MMC_USE_GPIO_CD |
403 TMIO_MMC_WRPROTECT_DISABLE,
404 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
405 .tmio_ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
406 .cd_gpio = GPIO_PORT13,
407};
408
409static struct resource sdhi2_resources[] = {
410 [0] = {
411 .name = "SDHI2",
412 .start = 0xee140000,
413 .end = 0xee1400ff,
414 .flags = IORESOURCE_MEM,
415 },
416 [1] = {
417 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
418 .start = gic_spi(103),
419 .flags = IORESOURCE_IRQ,
420 },
421 [2] = {
422 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
423 .start = gic_spi(104),
424 .flags = IORESOURCE_IRQ,
425 },
426 [3] = {
427 .name = SH_MOBILE_SDHI_IRQ_SDIO,
428 .start = gic_spi(105),
429 .flags = IORESOURCE_IRQ,
430 },
431};
432
433static struct platform_device sdhi2_device = {
434 .name = "sh_mobile_sdhi",
435 .id = 2,
436 .num_resources = ARRAY_SIZE(sdhi2_resources),
437 .resource = sdhi2_resources,
438 .dev = {
439 .platform_data = &sdhi2_info,
440 },
441};
442
1e354641
KM
443/* KEY */
444#define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
445
446static struct gpio_keys_button gpio_buttons[] = {
447 GPIO_KEY(KEY_BACK, GPIO_PCF8575_PORT10, "SW3"),
448 GPIO_KEY(KEY_RIGHT, GPIO_PCF8575_PORT11, "SW2-R"),
449 GPIO_KEY(KEY_LEFT, GPIO_PCF8575_PORT12, "SW2-L"),
450 GPIO_KEY(KEY_ENTER, GPIO_PCF8575_PORT13, "SW2-P"),
451 GPIO_KEY(KEY_UP, GPIO_PCF8575_PORT14, "SW2-U"),
452 GPIO_KEY(KEY_DOWN, GPIO_PCF8575_PORT15, "SW2-D"),
453 GPIO_KEY(KEY_HOME, GPIO_PCF8575_PORT16, "SW1"),
454};
455
456static struct gpio_keys_platform_data gpio_key_info = {
457 .buttons = gpio_buttons,
458 .nbuttons = ARRAY_SIZE(gpio_buttons),
459 .poll_interval = 250, /* poling at this point */
460};
461
462static struct platform_device gpio_keys_device = {
463 /* gpio-pcf857x.c driver doesn't support gpio_to_irq() */
464 .name = "gpio-keys-polled",
465 .dev = {
466 .platform_data = &gpio_key_info,
467 },
468};
469
accb90c8
KM
470/* FSI-AK4648 */
471static struct sh_fsi_platform_info fsi_info = {
472 .port_a = {
76b80329 473 .tx_id = SHDMA_SLAVE_FSI2A_TX,
accb90c8
KM
474 },
475};
476
477static struct resource fsi_resources[] = {
478 [0] = {
479 .name = "FSI",
480 .start = 0xEC230000,
481 .end = 0xEC230400 - 1,
482 .flags = IORESOURCE_MEM,
483 },
484 [1] = {
485 .start = gic_spi(146),
486 .flags = IORESOURCE_IRQ,
487 },
488};
489
490static struct platform_device fsi_device = {
491 .name = "sh_fsi2",
492 .id = -1,
493 .num_resources = ARRAY_SIZE(fsi_resources),
494 .resource = fsi_resources,
495 .dev = {
496 .platform_data = &fsi_info,
497 },
498};
499
500static struct asoc_simple_dai_init_info fsi2_ak4648_init_info = {
501 .fmt = SND_SOC_DAIFMT_LEFT_J,
502 .codec_daifmt = SND_SOC_DAIFMT_CBM_CFM,
503 .cpu_daifmt = SND_SOC_DAIFMT_CBS_CFS,
504 .sysclk = 11289600,
505};
506
507static struct asoc_simple_card_info fsi2_ak4648_info = {
508 .name = "AK4648",
509 .card = "FSI2A-AK4648",
510 .cpu_dai = "fsia-dai",
511 .codec = "ak4642-codec.0-0012",
512 .platform = "sh_fsi2",
513 .codec_dai = "ak4642-hifi",
514 .init = &fsi2_ak4648_init_info,
515};
516
517static struct platform_device fsi_ak4648_device = {
518 .name = "asoc-simple-card",
519 .dev = {
520 .platform_data = &fsi2_ak4648_info,
521 },
522};
523
7775a933 524/* I2C */
1e354641
KM
525static struct pcf857x_platform_data pcf8575_pdata = {
526 .gpio_base = GPIO_PCF8575_BASE,
527};
528
accb90c8
KM
529static struct i2c_board_info i2c0_devices[] = {
530 {
531 I2C_BOARD_INFO("ak4648", 0x12),
080e0d13
TK
532 },
533 {
534 I2C_BOARD_INFO("r2025sd", 0x32),
accb90c8
KM
535 }
536};
537
407c0526
KM
538static struct i2c_board_info i2c1_devices[] = {
539 {
540 I2C_BOARD_INFO("st1232-ts", 0x55),
541 .irq = intcs_evt2irq(0x300), /* IRQ8 */
542 },
543};
544
1e354641
KM
545static struct i2c_board_info i2c3_devices[] = {
546 {
547 I2C_BOARD_INFO("pcf8575", 0x20),
548 .platform_data = &pcf8575_pdata,
549 },
550};
551
9b93e244 552static struct platform_device *kzm_devices[] __initdata = {
c15c4257 553 &smsc_device,
dd818180 554 &usb_host_device,
77bcefd9 555 &usbhs_device,
26786111 556 &lcdc_device,
cc2512bc 557 &mmc_device,
7775a933 558 &sdhi0_device,
425d6940 559 &sdhi2_device,
1e354641 560 &gpio_keys_device,
accb90c8
KM
561 &fsi_device,
562 &fsi_ak4648_device,
9b93e244
KM
563};
564
26786111
KM
565/*
566 * FIXME
567 *
568 * This is quick hack for enabling LCDC backlight
569 */
570static int __init as3711_enable_lcdc_backlight(void)
571{
572 struct i2c_adapter *a = i2c_get_adapter(0);
573 struct i2c_msg msg;
574 int i, ret;
575 __u8 magic[] = {
576 0x40, 0x2a,
577 0x43, 0x3c,
578 0x44, 0x3c,
579 0x45, 0x3c,
580 0x54, 0x03,
581 0x51, 0x00,
582 0x51, 0x01,
583 0xff, 0x00, /* wait */
584 0x43, 0xf0,
585 0x44, 0xf0,
586 0x45, 0xf0,
587 };
588
589 if (!machine_is_kzm9g())
590 return 0;
591
592 if (!a)
593 return 0;
594
595 msg.addr = 0x40;
596 msg.len = 2;
597 msg.flags = 0;
598
599 for (i = 0; i < ARRAY_SIZE(magic); i += 2) {
600 msg.buf = magic + i;
601
602 if (0xff == msg.buf[0]) {
603 udelay(500);
604 continue;
605 }
606
607 ret = i2c_transfer(a, &msg, 1);
608 if (ret < 0) {
609 pr_err("i2c transfer fail\n");
610 break;
611 }
612 }
613
614 return 0;
615}
616device_initcall(as3711_enable_lcdc_backlight);
617
9b93e244
KM
618static void __init kzm_init(void)
619{
620 sh73a0_pinmux_init();
621
622 /* enable SCIFA4 */
623 gpio_request(GPIO_FN_SCIFA4_TXD, NULL);
624 gpio_request(GPIO_FN_SCIFA4_RXD, NULL);
625 gpio_request(GPIO_FN_SCIFA4_RTS_, NULL);
626 gpio_request(GPIO_FN_SCIFA4_CTS_, NULL);
627
c15c4257
KM
628 /* CS4 for SMSC/USB */
629 gpio_request(GPIO_FN_CS4_, NULL); /* CS4 */
630
631 /* SMSC */
632 gpio_request(GPIO_PORT224, NULL); /* IRQ3 */
633 gpio_direction_input(GPIO_PORT224);
634
26786111
KM
635 /* LCDC */
636 gpio_request(GPIO_FN_LCDD23, NULL);
637 gpio_request(GPIO_FN_LCDD22, NULL);
638 gpio_request(GPIO_FN_LCDD21, NULL);
639 gpio_request(GPIO_FN_LCDD20, NULL);
640 gpio_request(GPIO_FN_LCDD19, NULL);
641 gpio_request(GPIO_FN_LCDD18, NULL);
642 gpio_request(GPIO_FN_LCDD17, NULL);
643 gpio_request(GPIO_FN_LCDD16, NULL);
644 gpio_request(GPIO_FN_LCDD15, NULL);
645 gpio_request(GPIO_FN_LCDD14, NULL);
646 gpio_request(GPIO_FN_LCDD13, NULL);
647 gpio_request(GPIO_FN_LCDD12, NULL);
648 gpio_request(GPIO_FN_LCDD11, NULL);
649 gpio_request(GPIO_FN_LCDD10, NULL);
650 gpio_request(GPIO_FN_LCDD9, NULL);
651 gpio_request(GPIO_FN_LCDD8, NULL);
652 gpio_request(GPIO_FN_LCDD7, NULL);
653 gpio_request(GPIO_FN_LCDD6, NULL);
654 gpio_request(GPIO_FN_LCDD5, NULL);
655 gpio_request(GPIO_FN_LCDD4, NULL);
656 gpio_request(GPIO_FN_LCDD3, NULL);
657 gpio_request(GPIO_FN_LCDD2, NULL);
658 gpio_request(GPIO_FN_LCDD1, NULL);
659 gpio_request(GPIO_FN_LCDD0, NULL);
660 gpio_request(GPIO_FN_LCDDISP, NULL);
661 gpio_request(GPIO_FN_LCDDCK, NULL);
662
601df616
KM
663 gpio_request(GPIO_PORT222, NULL); /* LCDCDON */
664 gpio_request(GPIO_PORT226, NULL); /* SC */
26786111 665 gpio_direction_output(GPIO_PORT222, 1);
601df616 666 gpio_direction_output(GPIO_PORT226, 1);
26786111 667
407c0526
KM
668 /* Touchscreen */
669 gpio_request(GPIO_PORT223, NULL); /* IRQ8 */
670 gpio_direction_input(GPIO_PORT223);
671
cc2512bc
KM
672 /* enable MMCIF */
673 gpio_request(GPIO_FN_MMCCLK0, NULL);
674 gpio_request(GPIO_FN_MMCCMD0_PU, NULL);
675 gpio_request(GPIO_FN_MMCD0_0_PU, NULL);
676 gpio_request(GPIO_FN_MMCD0_1_PU, NULL);
677 gpio_request(GPIO_FN_MMCD0_2_PU, NULL);
678 gpio_request(GPIO_FN_MMCD0_3_PU, NULL);
679 gpio_request(GPIO_FN_MMCD0_4_PU, NULL);
680 gpio_request(GPIO_FN_MMCD0_5_PU, NULL);
681 gpio_request(GPIO_FN_MMCD0_6_PU, NULL);
682 gpio_request(GPIO_FN_MMCD0_7_PU, NULL);
683
7775a933
KM
684 /* enable SD */
685 gpio_request(GPIO_FN_SDHIWP0, NULL);
686 gpio_request(GPIO_FN_SDHICD0, NULL);
687 gpio_request(GPIO_FN_SDHICMD0, NULL);
688 gpio_request(GPIO_FN_SDHICLK0, NULL);
689 gpio_request(GPIO_FN_SDHID0_3, NULL);
690 gpio_request(GPIO_FN_SDHID0_2, NULL);
691 gpio_request(GPIO_FN_SDHID0_1, NULL);
692 gpio_request(GPIO_FN_SDHID0_0, NULL);
693 gpio_request(GPIO_FN_SDHI0_VCCQ_MC0_ON, NULL);
694 gpio_request(GPIO_PORT15, NULL);
695 gpio_direction_output(GPIO_PORT15, 1); /* power */
696
425d6940
KM
697 /* enable Micro SD */
698 gpio_request(GPIO_FN_SDHID2_0, NULL);
699 gpio_request(GPIO_FN_SDHID2_1, NULL);
700 gpio_request(GPIO_FN_SDHID2_2, NULL);
701 gpio_request(GPIO_FN_SDHID2_3, NULL);
702 gpio_request(GPIO_FN_SDHICMD2, NULL);
703 gpio_request(GPIO_FN_SDHICLK2, NULL);
704 gpio_request(GPIO_PORT14, NULL);
705 gpio_direction_output(GPIO_PORT14, 1); /* power */
706
1e354641
KM
707 /* I2C 3 */
708 gpio_request(GPIO_FN_PORT27_I2C_SCL3, NULL);
709 gpio_request(GPIO_FN_PORT28_I2C_SDA3, NULL);
710
accb90c8
KM
711 /* enable FSI2 port A (ak4648) */
712 gpio_request(GPIO_FN_FSIACK, NULL);
713 gpio_request(GPIO_FN_FSIAILR, NULL);
714 gpio_request(GPIO_FN_FSIAIBT, NULL);
715 gpio_request(GPIO_FN_FSIAISLD, NULL);
716 gpio_request(GPIO_FN_FSIAOSLD, NULL);
717
77bcefd9
KM
718 /* enable USB */
719 gpio_request(GPIO_FN_VBUS_0, NULL);
720
9b93e244
KM
721#ifdef CONFIG_CACHE_L2X0
722 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
723 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
724#endif
725
accb90c8 726 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
407c0526 727 i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices));
1e354641 728 i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices));
407c0526 729
9b93e244
KM
730 sh73a0_add_standard_devices();
731 platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices));
732}
733
7296d932
MD
734static const char *kzm9g_boards_compat_dt[] __initdata = {
735 "renesas,kzm9g",
736 NULL,
737};
738
739DT_MACHINE_START(KZM9G_DT, "kzm9g")
9b93e244
KM
740 .map_io = sh73a0_map_io,
741 .init_early = sh73a0_add_early_devices,
742 .nr_irqs = NR_IRQS_LEGACY,
743 .init_irq = sh73a0_init_irq,
744 .handle_irq = gic_handle_irq,
745 .init_machine = kzm_init,
746 .timer = &shmobile_timer,
7296d932 747 .dt_compat = kzm9g_boards_compat_dt,
9b93e244 748MACHINE_END
This page took 0.072639 seconds and 5 git commands to generate.