ARM: shmobile: kzm9g: Remove the VCCQ MC0 function GPIO
[deliverable/linux.git] / arch / arm / mach-shmobile / board-kzm9g.c
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 */
19
20 #include <linux/delay.h>
21 #include <linux/gpio.h>
22 #include <linux/gpio_keys.h>
23 #include <linux/io.h>
24 #include <linux/irq.h>
25 #include <linux/i2c.h>
26 #include <linux/i2c/pcf857x.h>
27 #include <linux/input.h>
28 #include <linux/irqchip/arm-gic.h>
29 #include <linux/mmc/host.h>
30 #include <linux/mmc/sh_mmcif.h>
31 #include <linux/mmc/sh_mobile_sdhi.h>
32 #include <linux/mfd/tmio.h>
33 #include <linux/pinctrl/machine.h>
34 #include <linux/pinctrl/pinconf-generic.h>
35 #include <linux/platform_device.h>
36 #include <linux/regulator/fixed.h>
37 #include <linux/regulator/machine.h>
38 #include <linux/smsc911x.h>
39 #include <linux/usb/r8a66597.h>
40 #include <linux/usb/renesas_usbhs.h>
41 #include <linux/videodev2.h>
42 #include <sound/sh_fsi.h>
43 #include <sound/simple_card.h>
44 #include <mach/irqs.h>
45 #include <mach/sh73a0.h>
46 #include <mach/common.h>
47 #include <asm/hardware/cache-l2x0.h>
48 #include <asm/mach-types.h>
49 #include <asm/mach/arch.h>
50 #include <video/sh_mobile_lcdc.h>
51
52 /*
53 * external GPIO
54 */
55 #define GPIO_PCF8575_BASE (GPIO_NR)
56 #define GPIO_PCF8575_PORT10 (GPIO_NR + 8)
57 #define GPIO_PCF8575_PORT11 (GPIO_NR + 9)
58 #define GPIO_PCF8575_PORT12 (GPIO_NR + 10)
59 #define GPIO_PCF8575_PORT13 (GPIO_NR + 11)
60 #define GPIO_PCF8575_PORT14 (GPIO_NR + 12)
61 #define GPIO_PCF8575_PORT15 (GPIO_NR + 13)
62 #define GPIO_PCF8575_PORT16 (GPIO_NR + 14)
63
64 /* Dummy supplies, where voltage doesn't matter */
65 static struct regulator_consumer_supply dummy_supplies[] = {
66 REGULATOR_SUPPLY("vddvario", "smsc911x.0"),
67 REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
68 };
69
70 /*
71 * FSI-AK4648
72 *
73 * this command is required when playback.
74 *
75 * # amixer set "LINEOUT Mixer DACL" on
76 */
77
78 /* SMSC 9221 */
79 static struct resource smsc9221_resources[] = {
80 [0] = {
81 .start = 0x10000000, /* CS4 */
82 .end = 0x100000ff,
83 .flags = IORESOURCE_MEM,
84 },
85 [1] = {
86 .start = irq_pin(3), /* IRQ3 */
87 .flags = IORESOURCE_IRQ,
88 },
89 };
90
91 static struct smsc911x_platform_config smsc9221_platdata = {
92 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
93 .phy_interface = PHY_INTERFACE_MODE_MII,
94 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
95 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
96 };
97
98 static struct platform_device smsc_device = {
99 .name = "smsc911x",
100 .dev = {
101 .platform_data = &smsc9221_platdata,
102 },
103 .resource = smsc9221_resources,
104 .num_resources = ARRAY_SIZE(smsc9221_resources),
105 };
106
107 /* USB external chip */
108 static struct r8a66597_platdata usb_host_data = {
109 .on_chip = 0,
110 .xtal = R8A66597_PLATDATA_XTAL_48MHZ,
111 };
112
113 static struct resource usb_resources[] = {
114 [0] = {
115 .start = 0x10010000,
116 .end = 0x1001ffff - 1,
117 .flags = IORESOURCE_MEM,
118 },
119 [1] = {
120 .start = irq_pin(1), /* IRQ1 */
121 .flags = IORESOURCE_IRQ,
122 },
123 };
124
125 static struct platform_device usb_host_device = {
126 .name = "r8a66597_hcd",
127 .dev = {
128 .platform_data = &usb_host_data,
129 .dma_mask = NULL,
130 .coherent_dma_mask = 0xffffffff,
131 },
132 .num_resources = ARRAY_SIZE(usb_resources),
133 .resource = usb_resources,
134 };
135
136 /* USB Func CN17 */
137 struct usbhs_private {
138 void __iomem *phy;
139 void __iomem *cr2;
140 struct renesas_usbhs_platform_info info;
141 };
142
143 #define IRQ15 irq_pin(15)
144 #define USB_PHY_MODE (1 << 4)
145 #define USB_PHY_INT_EN ((1 << 3) | (1 << 2))
146 #define USB_PHY_ON (1 << 1)
147 #define USB_PHY_OFF (1 << 0)
148 #define USB_PHY_INT_CLR (USB_PHY_ON | USB_PHY_OFF)
149
150 #define usbhs_get_priv(pdev) \
151 container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info)
152
153 static int usbhs_get_vbus(struct platform_device *pdev)
154 {
155 struct usbhs_private *priv = usbhs_get_priv(pdev);
156
157 return !((1 << 7) & __raw_readw(priv->cr2));
158 }
159
160 static int usbhs_phy_reset(struct platform_device *pdev)
161 {
162 struct usbhs_private *priv = usbhs_get_priv(pdev);
163
164 /* init phy */
165 __raw_writew(0x8a0a, priv->cr2);
166
167 return 0;
168 }
169
170 static int usbhs_get_id(struct platform_device *pdev)
171 {
172 return USBHS_GADGET;
173 }
174
175 static irqreturn_t usbhs_interrupt(int irq, void *data)
176 {
177 struct platform_device *pdev = data;
178 struct usbhs_private *priv = usbhs_get_priv(pdev);
179
180 renesas_usbhs_call_notify_hotplug(pdev);
181
182 /* clear status */
183 __raw_writew(__raw_readw(priv->phy) | USB_PHY_INT_CLR, priv->phy);
184
185 return IRQ_HANDLED;
186 }
187
188 static int usbhs_hardware_init(struct platform_device *pdev)
189 {
190 struct usbhs_private *priv = usbhs_get_priv(pdev);
191 int ret;
192
193 /* clear interrupt status */
194 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
195
196 ret = request_irq(IRQ15, usbhs_interrupt, IRQF_TRIGGER_HIGH,
197 dev_name(&pdev->dev), pdev);
198 if (ret) {
199 dev_err(&pdev->dev, "request_irq err\n");
200 return ret;
201 }
202
203 /* enable USB phy interrupt */
204 __raw_writew(USB_PHY_MODE | USB_PHY_INT_EN, priv->phy);
205
206 return 0;
207 }
208
209 static int usbhs_hardware_exit(struct platform_device *pdev)
210 {
211 struct usbhs_private *priv = usbhs_get_priv(pdev);
212
213 /* clear interrupt status */
214 __raw_writew(USB_PHY_MODE | USB_PHY_INT_CLR, priv->phy);
215
216 free_irq(IRQ15, pdev);
217
218 return 0;
219 }
220
221 static u32 usbhs_pipe_cfg[] = {
222 USB_ENDPOINT_XFER_CONTROL,
223 USB_ENDPOINT_XFER_ISOC,
224 USB_ENDPOINT_XFER_ISOC,
225 USB_ENDPOINT_XFER_BULK,
226 USB_ENDPOINT_XFER_BULK,
227 USB_ENDPOINT_XFER_BULK,
228 USB_ENDPOINT_XFER_INT,
229 USB_ENDPOINT_XFER_INT,
230 USB_ENDPOINT_XFER_INT,
231 USB_ENDPOINT_XFER_BULK,
232 USB_ENDPOINT_XFER_BULK,
233 USB_ENDPOINT_XFER_BULK,
234 USB_ENDPOINT_XFER_BULK,
235 USB_ENDPOINT_XFER_BULK,
236 USB_ENDPOINT_XFER_BULK,
237 USB_ENDPOINT_XFER_BULK,
238 };
239
240 static struct usbhs_private usbhs_private = {
241 .phy = IOMEM(0xe60781e0), /* USBPHYINT */
242 .cr2 = IOMEM(0xe605810c), /* USBCR2 */
243 .info = {
244 .platform_callback = {
245 .hardware_init = usbhs_hardware_init,
246 .hardware_exit = usbhs_hardware_exit,
247 .get_id = usbhs_get_id,
248 .phy_reset = usbhs_phy_reset,
249 .get_vbus = usbhs_get_vbus,
250 },
251 .driver_param = {
252 .buswait_bwait = 4,
253 .has_otg = 1,
254 .pipe_type = usbhs_pipe_cfg,
255 .pipe_size = ARRAY_SIZE(usbhs_pipe_cfg),
256 },
257 },
258 };
259
260 static struct resource usbhs_resources[] = {
261 [0] = {
262 .start = 0xE6890000,
263 .end = 0xE68900e6 - 1,
264 .flags = IORESOURCE_MEM,
265 },
266 [1] = {
267 .start = gic_spi(62),
268 .end = gic_spi(62),
269 .flags = IORESOURCE_IRQ,
270 },
271 };
272
273 static struct platform_device usbhs_device = {
274 .name = "renesas_usbhs",
275 .id = -1,
276 .dev = {
277 .dma_mask = NULL,
278 .coherent_dma_mask = 0xffffffff,
279 .platform_data = &usbhs_private.info,
280 },
281 .num_resources = ARRAY_SIZE(usbhs_resources),
282 .resource = usbhs_resources,
283 };
284
285 /* LCDC */
286 static struct fb_videomode kzm_lcdc_mode = {
287 .name = "WVGA Panel",
288 .xres = 800,
289 .yres = 480,
290 .left_margin = 220,
291 .right_margin = 110,
292 .hsync_len = 70,
293 .upper_margin = 20,
294 .lower_margin = 5,
295 .vsync_len = 5,
296 .sync = 0,
297 };
298
299 static struct sh_mobile_lcdc_info lcdc_info = {
300 .clock_source = LCDC_CLK_BUS,
301 .ch[0] = {
302 .chan = LCDC_CHAN_MAINLCD,
303 .fourcc = V4L2_PIX_FMT_RGB565,
304 .interface_type = RGB24,
305 .lcd_modes = &kzm_lcdc_mode,
306 .num_modes = 1,
307 .clock_divider = 5,
308 .flags = 0,
309 .panel_cfg = {
310 .width = 152,
311 .height = 91,
312 },
313 }
314 };
315
316 static struct resource lcdc_resources[] = {
317 [0] = {
318 .name = "LCDC",
319 .start = 0xfe940000,
320 .end = 0xfe943fff,
321 .flags = IORESOURCE_MEM,
322 },
323 [1] = {
324 .start = intcs_evt2irq(0x580),
325 .flags = IORESOURCE_IRQ,
326 },
327 };
328
329 static struct platform_device lcdc_device = {
330 .name = "sh_mobile_lcdc_fb",
331 .num_resources = ARRAY_SIZE(lcdc_resources),
332 .resource = lcdc_resources,
333 .dev = {
334 .platform_data = &lcdc_info,
335 .coherent_dma_mask = ~0,
336 },
337 };
338
339 /* Fixed 1.8V regulator to be used by MMCIF */
340 static struct regulator_consumer_supply fixed1v8_power_consumers[] =
341 {
342 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
343 REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
344 };
345
346 /* MMCIF */
347 static struct resource sh_mmcif_resources[] = {
348 [0] = {
349 .name = "MMCIF",
350 .start = 0xe6bd0000,
351 .end = 0xe6bd00ff,
352 .flags = IORESOURCE_MEM,
353 },
354 [1] = {
355 .start = gic_spi(140),
356 .flags = IORESOURCE_IRQ,
357 },
358 [2] = {
359 .start = gic_spi(141),
360 .flags = IORESOURCE_IRQ,
361 },
362 };
363
364 static struct sh_mmcif_plat_data sh_mmcif_platdata = {
365 .ocr = MMC_VDD_165_195,
366 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
367 .slave_id_tx = SHDMA_SLAVE_MMCIF_TX,
368 .slave_id_rx = SHDMA_SLAVE_MMCIF_RX,
369 };
370
371 static struct platform_device mmc_device = {
372 .name = "sh_mmcif",
373 .dev = {
374 .dma_mask = NULL,
375 .coherent_dma_mask = 0xffffffff,
376 .platform_data = &sh_mmcif_platdata,
377 },
378 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
379 .resource = sh_mmcif_resources,
380 };
381
382 /* Fixed 3.3V regulators to be used by SDHI0 */
383 static struct regulator_consumer_supply vcc_sdhi0_consumers[] =
384 {
385 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
386 };
387
388 static struct regulator_init_data vcc_sdhi0_init_data = {
389 .constraints = {
390 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
391 },
392 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
393 .consumer_supplies = vcc_sdhi0_consumers,
394 };
395
396 static struct fixed_voltage_config vcc_sdhi0_info = {
397 .supply_name = "SDHI0 Vcc",
398 .microvolts = 3300000,
399 .gpio = 15,
400 .enable_high = 1,
401 .init_data = &vcc_sdhi0_init_data,
402 };
403
404 static struct platform_device vcc_sdhi0 = {
405 .name = "reg-fixed-voltage",
406 .id = 0,
407 .dev = {
408 .platform_data = &vcc_sdhi0_info,
409 },
410 };
411
412 /* Fixed 3.3V regulators to be used by SDHI2 */
413 static struct regulator_consumer_supply vcc_sdhi2_consumers[] =
414 {
415 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.2"),
416 };
417
418 static struct regulator_init_data vcc_sdhi2_init_data = {
419 .constraints = {
420 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
421 },
422 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi2_consumers),
423 .consumer_supplies = vcc_sdhi2_consumers,
424 };
425
426 static struct fixed_voltage_config vcc_sdhi2_info = {
427 .supply_name = "SDHI2 Vcc",
428 .microvolts = 3300000,
429 .gpio = 14,
430 .enable_high = 1,
431 .init_data = &vcc_sdhi2_init_data,
432 };
433
434 static struct platform_device vcc_sdhi2 = {
435 .name = "reg-fixed-voltage",
436 .id = 1,
437 .dev = {
438 .platform_data = &vcc_sdhi2_info,
439 },
440 };
441
442 /* SDHI */
443 static struct sh_mobile_sdhi_info sdhi0_info = {
444 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
445 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
446 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT,
447 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
448 MMC_CAP_POWER_OFF_CARD,
449 };
450
451 static struct resource sdhi0_resources[] = {
452 [0] = {
453 .name = "SDHI0",
454 .start = 0xee100000,
455 .end = 0xee1000ff,
456 .flags = IORESOURCE_MEM,
457 },
458 [1] = {
459 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
460 .start = gic_spi(83),
461 .flags = IORESOURCE_IRQ,
462 },
463 [2] = {
464 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
465 .start = gic_spi(84),
466 .flags = IORESOURCE_IRQ,
467 },
468 [3] = {
469 .name = SH_MOBILE_SDHI_IRQ_SDIO,
470 .start = gic_spi(85),
471 .flags = IORESOURCE_IRQ,
472 },
473 };
474
475 static struct platform_device sdhi0_device = {
476 .name = "sh_mobile_sdhi",
477 .num_resources = ARRAY_SIZE(sdhi0_resources),
478 .resource = sdhi0_resources,
479 .dev = {
480 .platform_data = &sdhi0_info,
481 },
482 };
483
484 /* Micro SD */
485 static struct sh_mobile_sdhi_info sdhi2_info = {
486 .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX,
487 .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX,
488 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT |
489 TMIO_MMC_USE_GPIO_CD |
490 TMIO_MMC_WRPROTECT_DISABLE,
491 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_POWER_OFF_CARD,
492 .cd_gpio = 13,
493 };
494
495 static struct resource sdhi2_resources[] = {
496 [0] = {
497 .name = "SDHI2",
498 .start = 0xee140000,
499 .end = 0xee1400ff,
500 .flags = IORESOURCE_MEM,
501 },
502 [1] = {
503 .name = SH_MOBILE_SDHI_IRQ_CARD_DETECT,
504 .start = gic_spi(103),
505 .flags = IORESOURCE_IRQ,
506 },
507 [2] = {
508 .name = SH_MOBILE_SDHI_IRQ_SDCARD,
509 .start = gic_spi(104),
510 .flags = IORESOURCE_IRQ,
511 },
512 [3] = {
513 .name = SH_MOBILE_SDHI_IRQ_SDIO,
514 .start = gic_spi(105),
515 .flags = IORESOURCE_IRQ,
516 },
517 };
518
519 static struct platform_device sdhi2_device = {
520 .name = "sh_mobile_sdhi",
521 .id = 2,
522 .num_resources = ARRAY_SIZE(sdhi2_resources),
523 .resource = sdhi2_resources,
524 .dev = {
525 .platform_data = &sdhi2_info,
526 },
527 };
528
529 /* KEY */
530 #define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
531
532 static struct gpio_keys_button gpio_buttons[] = {
533 GPIO_KEY(KEY_BACK, GPIO_PCF8575_PORT10, "SW3"),
534 GPIO_KEY(KEY_RIGHT, GPIO_PCF8575_PORT11, "SW2-R"),
535 GPIO_KEY(KEY_LEFT, GPIO_PCF8575_PORT12, "SW2-L"),
536 GPIO_KEY(KEY_ENTER, GPIO_PCF8575_PORT13, "SW2-P"),
537 GPIO_KEY(KEY_UP, GPIO_PCF8575_PORT14, "SW2-U"),
538 GPIO_KEY(KEY_DOWN, GPIO_PCF8575_PORT15, "SW2-D"),
539 GPIO_KEY(KEY_HOME, GPIO_PCF8575_PORT16, "SW1"),
540 };
541
542 static struct gpio_keys_platform_data gpio_key_info = {
543 .buttons = gpio_buttons,
544 .nbuttons = ARRAY_SIZE(gpio_buttons),
545 };
546
547 static struct platform_device gpio_keys_device = {
548 .name = "gpio-keys",
549 .dev = {
550 .platform_data = &gpio_key_info,
551 },
552 };
553
554 /* FSI-AK4648 */
555 static struct sh_fsi_platform_info fsi_info = {
556 .port_a = {
557 .tx_id = SHDMA_SLAVE_FSI2A_TX,
558 },
559 };
560
561 static struct resource fsi_resources[] = {
562 [0] = {
563 .name = "FSI",
564 .start = 0xEC230000,
565 .end = 0xEC230400 - 1,
566 .flags = IORESOURCE_MEM,
567 },
568 [1] = {
569 .start = gic_spi(146),
570 .flags = IORESOURCE_IRQ,
571 },
572 };
573
574 static struct platform_device fsi_device = {
575 .name = "sh_fsi2",
576 .id = -1,
577 .num_resources = ARRAY_SIZE(fsi_resources),
578 .resource = fsi_resources,
579 .dev = {
580 .platform_data = &fsi_info,
581 },
582 };
583
584 static struct asoc_simple_card_info fsi2_ak4648_info = {
585 .name = "AK4648",
586 .card = "FSI2A-AK4648",
587 .codec = "ak4642-codec.0-0012",
588 .platform = "sh_fsi2",
589 .daifmt = SND_SOC_DAIFMT_LEFT_J,
590 .cpu_dai = {
591 .name = "fsia-dai",
592 .fmt = SND_SOC_DAIFMT_CBS_CFS,
593 },
594 .codec_dai = {
595 .name = "ak4642-hifi",
596 .fmt = SND_SOC_DAIFMT_CBM_CFM,
597 .sysclk = 11289600,
598 },
599 };
600
601 static struct platform_device fsi_ak4648_device = {
602 .name = "asoc-simple-card",
603 .dev = {
604 .platform_data = &fsi2_ak4648_info,
605 },
606 };
607
608 /* I2C */
609 static struct pcf857x_platform_data pcf8575_pdata = {
610 .gpio_base = GPIO_PCF8575_BASE,
611 };
612
613 static struct i2c_board_info i2c0_devices[] = {
614 {
615 I2C_BOARD_INFO("ak4648", 0x12),
616 },
617 {
618 I2C_BOARD_INFO("r2025sd", 0x32),
619 },
620 {
621 I2C_BOARD_INFO("ak8975", 0x0c),
622 .irq = irq_pin(28), /* IRQ28 */
623 },
624 {
625 I2C_BOARD_INFO("adxl34x", 0x1d),
626 .irq = irq_pin(26), /* IRQ26 */
627 },
628 };
629
630 static struct i2c_board_info i2c1_devices[] = {
631 {
632 I2C_BOARD_INFO("st1232-ts", 0x55),
633 .irq = irq_pin(8), /* IRQ8 */
634 },
635 };
636
637 static struct i2c_board_info i2c3_devices[] = {
638 {
639 I2C_BOARD_INFO("pcf8575", 0x20),
640 .irq = irq_pin(19), /* IRQ19 */
641 .platform_data = &pcf8575_pdata,
642 },
643 };
644
645 static struct platform_device *kzm_devices[] __initdata = {
646 &smsc_device,
647 &usb_host_device,
648 &usbhs_device,
649 &lcdc_device,
650 &mmc_device,
651 &vcc_sdhi0,
652 &vcc_sdhi2,
653 &sdhi0_device,
654 &sdhi2_device,
655 &gpio_keys_device,
656 &fsi_device,
657 &fsi_ak4648_device,
658 };
659
660 static unsigned long pin_pullup_conf[] = {
661 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
662 };
663
664 static const struct pinctrl_map kzm_pinctrl_map[] = {
665 /* FSIA (AK4648) */
666 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
667 "fsia_mclk_in", "fsia"),
668 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
669 "fsia_sclk_in", "fsia"),
670 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
671 "fsia_data_in", "fsia"),
672 PIN_MAP_MUX_GROUP_DEFAULT("sh_fsi2.0", "pfc-sh73a0",
673 "fsia_data_out", "fsia"),
674 /* I2C3 */
675 PIN_MAP_MUX_GROUP_DEFAULT("i2c-sh_mobile.3", "pfc-sh73a0",
676 "i2c3_1", "i2c3"),
677 /* LCD */
678 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0",
679 "lcd_data24", "lcd"),
680 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_lcdc_fb.0", "pfc-sh73a0",
681 "lcd_sync", "lcd"),
682 /* MMCIF */
683 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
684 "mmc0_data8_0", "mmc0"),
685 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
686 "mmc0_ctrl_0", "mmc0"),
687 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
688 "PORT279", pin_pullup_conf),
689 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
690 "mmc0_data8_0", pin_pullup_conf),
691 /* SCIFA4 */
692 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
693 "scifa4_data", "scifa4"),
694 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
695 "scifa4_ctrl", "scifa4"),
696 /* SDHI0 */
697 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
698 "sdhi0_data4", "sdhi0"),
699 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
700 "sdhi0_ctrl", "sdhi0"),
701 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
702 "sdhi0_cd", "sdhi0"),
703 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
704 "sdhi0_wp", "sdhi0"),
705 /* SDHI2 */
706 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0",
707 "sdhi2_data4", "sdhi2"),
708 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-sh73a0",
709 "sdhi2_ctrl", "sdhi2"),
710 /* SMSC */
711 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
712 "bsc_cs4", "bsc"),
713 /* USB */
714 PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-sh73a0",
715 "usb_vbus", "usb"),
716 };
717
718 /*
719 * FIXME
720 *
721 * This is quick hack for enabling LCDC backlight
722 */
723 static int __init as3711_enable_lcdc_backlight(void)
724 {
725 struct i2c_adapter *a = i2c_get_adapter(0);
726 struct i2c_msg msg;
727 int i, ret;
728 __u8 magic[] = {
729 0x40, 0x2a,
730 0x43, 0x3c,
731 0x44, 0x3c,
732 0x45, 0x3c,
733 0x54, 0x03,
734 0x51, 0x00,
735 0x51, 0x01,
736 0xff, 0x00, /* wait */
737 0x43, 0xf0,
738 0x44, 0xf0,
739 0x45, 0xf0,
740 };
741
742 if (!of_machine_is_compatible("renesas,kzm9g"))
743 return 0;
744
745 if (!a)
746 return 0;
747
748 msg.addr = 0x40;
749 msg.len = 2;
750 msg.flags = 0;
751
752 for (i = 0; i < ARRAY_SIZE(magic); i += 2) {
753 msg.buf = magic + i;
754
755 if (0xff == msg.buf[0]) {
756 udelay(500);
757 continue;
758 }
759
760 ret = i2c_transfer(a, &msg, 1);
761 if (ret < 0) {
762 pr_err("i2c transfer fail\n");
763 break;
764 }
765 }
766
767 return 0;
768 }
769 device_initcall(as3711_enable_lcdc_backlight);
770
771 static void __init kzm_init(void)
772 {
773 regulator_register_always_on(2, "fixed-1.8V", fixed1v8_power_consumers,
774 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
775 regulator_register_fixed(3, dummy_supplies, ARRAY_SIZE(dummy_supplies));
776
777 pinctrl_register_mappings(kzm_pinctrl_map, ARRAY_SIZE(kzm_pinctrl_map));
778
779 sh73a0_pinmux_init();
780
781 /* SMSC */
782 gpio_request_one(224, GPIOF_IN, NULL); /* IRQ3 */
783
784 /* LCDC */
785 gpio_request_one(222, GPIOF_OUT_INIT_HIGH, NULL); /* LCDCDON */
786 gpio_request_one(226, GPIOF_OUT_INIT_HIGH, NULL); /* SC */
787
788 /* Touchscreen */
789 gpio_request_one(223, GPIOF_IN, NULL); /* IRQ8 */
790
791 #ifdef CONFIG_CACHE_L2X0
792 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
793 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
794 #endif
795
796 i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
797 i2c_register_board_info(1, i2c1_devices, ARRAY_SIZE(i2c1_devices));
798 i2c_register_board_info(3, i2c3_devices, ARRAY_SIZE(i2c3_devices));
799
800 sh73a0_add_standard_devices();
801 platform_add_devices(kzm_devices, ARRAY_SIZE(kzm_devices));
802
803 sh73a0_pm_init();
804 }
805
806 static void kzm9g_restart(char mode, const char *cmd)
807 {
808 #define RESCNT2 IOMEM(0xe6188020)
809 /* Do soft power on reset */
810 writel((1 << 31), RESCNT2);
811 }
812
813 static const char *kzm9g_boards_compat_dt[] __initdata = {
814 "renesas,kzm9g",
815 NULL,
816 };
817
818 DT_MACHINE_START(KZM9G_DT, "kzm9g")
819 .smp = smp_ops(sh73a0_smp_ops),
820 .map_io = sh73a0_map_io,
821 .init_early = sh73a0_add_early_devices,
822 .nr_irqs = NR_IRQS_LEGACY,
823 .init_irq = sh73a0_init_irq,
824 .init_machine = kzm_init,
825 .init_late = shmobile_init_late,
826 .init_time = sh73a0_earlytimer_init,
827 .restart = kzm9g_restart,
828 .dt_compat = kzm9g_boards_compat_dt,
829 MACHINE_END
This page took 0.046827 seconds and 5 git commands to generate.