blob: 425962d5b29c8133872f74ad85fc3e8d64c96c36 [file] [log] [blame]
Kuninori Morimoto920adc72010-11-29 02:21:21 +00001/*
2 * mackerel board support
3 *
4 * Copyright (C) 2010 Renesas Solutions Corp.
5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
6 *
7 * based on ap4evb
8 * Copyright (C) 2010 Magnus Damm
9 * Copyright (C) 2008 Yoshihiro Shimoda
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; version 2 of the License.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 */
Kuninori Morimoto12c43092011-01-06 02:44:09 +000024#include <linux/delay.h>
Kuninori Morimoto920adc72010-11-29 02:21:21 +000025#include <linux/kernel.h>
26#include <linux/init.h>
27#include <linux/interrupt.h>
28#include <linux/irq.h>
29#include <linux/platform_device.h>
30#include <linux/gpio.h>
31#include <linux/input.h>
32#include <linux/io.h>
Kuninori Morimoto1a44d722010-12-01 00:31:46 +000033#include <linux/i2c.h>
Kuninori Morimotod44deb32010-11-30 06:52:18 +000034#include <linux/leds.h>
Yusuke Goda6dff7da2010-12-14 14:18:03 +090035#include <linux/mfd/sh_mobile_sdhi.h>
36#include <linux/mfd/tmio.h>
37#include <linux/mmc/host.h>
Yusuke Goda41491b92010-12-15 08:31:04 +000038#include <linux/mmc/sh_mmcif.h>
Kuninori Morimoto920adc72010-11-29 02:21:21 +000039#include <linux/mtd/mtd.h>
40#include <linux/mtd/partitions.h>
41#include <linux/mtd/physmap.h>
Kuninori Morimoto2264c152010-11-29 02:21:37 +000042#include <linux/smsc911x.h>
Kuninori Morimoto1a44d722010-12-01 00:31:46 +000043#include <linux/sh_intc.h>
Tony SIMcd8ab002010-12-09 01:55:55 +000044#include <linux/tca6416_keypad.h>
Kuninori Morimoto25338f22010-11-30 04:37:33 +000045#include <linux/usb/r8a66597.h>
Kuninori Morimoto920adc72010-11-29 02:21:21 +000046
Kuninori Morimoto12c43092011-01-06 02:44:09 +000047#include <video/sh_mobile_hdmi.h>
Kuninori Morimoto11fee462010-11-29 02:21:43 +000048#include <video/sh_mobile_lcdc.h>
Magnus Dammae37c8d2010-12-22 14:47:40 +000049#include <media/sh_mobile_ceu.h>
50#include <media/soc_camera.h>
51#include <media/soc_camera_platform.h>
Kuninori Morimoto1a44d722010-12-01 00:31:46 +000052#include <sound/sh_fsi.h>
53
Kuninori Morimoto920adc72010-11-29 02:21:21 +000054#include <mach/common.h>
55#include <mach/sh7372.h>
56
57#include <asm/mach/arch.h>
58#include <asm/mach/time.h>
59#include <asm/mach/map.h>
60#include <asm/mach-types.h>
61
62/*
63 * Address Interface BusWidth note
64 * ------------------------------------------------------------------
65 * 0x0000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = ON
66 * 0x0800_0000 user area -
67 * 0x1000_0000 NOR Flash ROM (MCP) 16bit SW7 : bit1 = OFF
68 * 0x1400_0000 Ether (LAN9220) 16bit
69 * 0x1600_0000 user area - cannot use with NAND
70 * 0x1800_0000 user area -
71 * 0x1A00_0000 -
72 * 0x4000_0000 LPDDR2-SDRAM (POP) 32bit
73 */
74
Kuninori Morimoto4b82b682010-11-29 02:21:48 +000075/*
76 * CPU mode
77 *
78 * SW4 | Boot Area| Master | Remarks
79 * 1 | 2 | 3 | 4 | 5 | 6 | 8 | | Processor|
80 * ----+-----+-----+-----+-----+-----+-----+----------+----------+--------------
81 * ON | ON | OFF | ON | ON | OFF | OFF | External | System | External ROM
82 * ON | ON | ON | ON | ON | OFF | OFF | External | System | ROM Debug
83 * ON | ON | X | ON | OFF | OFF | OFF | Built-in | System | ROM Debug
84 * X | OFF | X | X | X | X | OFF | Built-in | System | MaskROM
85 * OFF | X | X | X | X | X | OFF | Built-in | System | MaskROM
86 * X | X | X | OFF | X | X | OFF | Built-in | System | MaskROM
87 * OFF | ON | OFF | X | X | OFF | ON | External | System | Standalone
88 * ON | OFF | OFF | X | X | OFF | ON | External | Realtime | Standalone
89*/
90
91/*
92 * NOR Flash ROM
93 *
94 * SW1 | SW2 | SW7 | NOR Flash ROM
95 * bit1 | bit1 bit2 | bit1 | Memory allocation
96 * ------+------------+------+------------------
97 * OFF | ON OFF | ON | Area 0
98 * OFF | ON OFF | OFF | Area 4
99 */
100
101/*
102 * SMSC 9220
103 *
104 * SW1 SMSC 9220
105 * -----------------------
106 * ON access disable
107 * OFF access enable
108 */
109
110/*
111 * NAND Flash ROM
112 *
113 * SW1 | SW2 | SW7 | NAND Flash ROM
114 * bit1 | bit1 bit2 | bit2 | Memory allocation
115 * ------+------------+------+------------------
116 * OFF | ON OFF | ON | FCE 0
117 * OFF | ON OFF | OFF | FCE 1
118 */
119
120/*
121 * External interrupt pin settings
122 *
123 * IRQX | pin setting | device | level
124 * ------+--------------------+--------------------+-------
125 * IRQ0 | ICR1A.IRQ0SA=0010 | SDHI2 card detect | Low
126 * IRQ6 | ICR1A.IRQ6SA=0011 | Ether(LAN9220) | High
127 * IRQ7 | ICR1A.IRQ7SA=0010 | LCD Tuch Panel | Low
128 * IRQ8 | ICR2A.IRQ8SA=0010 | MMC/SD card detect | Low
129 * IRQ9 | ICR2A.IRQ9SA=0010 | KEY(TCA6408) | Low
130 * IRQ21 | ICR4A.IRQ21SA=0011 | Sensor(ADXL345) | High
131 * IRQ22 | ICR4A.IRQ22SA=0011 | Sensor(AK8975) | High
Kuninori Morimoto25338f22010-11-30 04:37:33 +0000132 */
Kuninori Morimoto4b82b682010-11-29 02:21:48 +0000133
Kuninori Morimoto25338f22010-11-30 04:37:33 +0000134/*
135 * USB
136 *
137 * USB0 : CN22 : Function
138 * USB1 : CN31 : Function/Host *1
139 *
140 * J30 (for CN31) *1
141 * ----------+---------------+-------------
142 * 1-2 short | VBUS 5V | Host
143 * open | external VBUS | Function
144 *
145 * *1
146 * CN31 is used as Host in Linux.
147 */
Kuninori Morimoto4b82b682010-11-29 02:21:48 +0000148
Kuninori Morimoto1a44d722010-12-01 00:31:46 +0000149/*
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900150 * SDHI0 (CN12)
151 *
152 * SW56 : OFF
153 *
154 */
155
156/* MMC /SDHI1 (CN7)
157 *
158 * I/O voltage : 1.8v
159 *
160 * Power voltage : 1.8v or 3.3v
Yusuke Goda41491b92010-12-15 08:31:04 +0000161 * J22 : select power voltage *1
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900162 * 1-2 pin : 1.8v
163 * 2-3 pin : 3.3v
164 *
Yusuke Goda41491b92010-12-15 08:31:04 +0000165 * *1
166 * Please change J22 depends the card to be used.
167 * MMC's OCR field set to support either voltage for the card inserted.
168 *
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900169 * SW1 | SW33
170 * | bit1 | bit2 | bit3 | bit4
171 * -------------+------+------+------+-------
172 * MMC0 OFF | OFF | ON | ON | X
173 * MMC1 ON | OFF | ON | X | ON
174 * SDHI1 OFF | ON | X | OFF | ON
175 *
176 */
177
178/*
179 * SDHI2 (CN23)
180 *
181 * microSD card sloct
182 *
183 */
184
185/*
Kuninori Morimoto1a44d722010-12-01 00:31:46 +0000186 * FIXME !!
187 *
188 * gpio_no_direction
189 * are quick_hack.
190 *
191 * current gpio frame work doesn't have
192 * the method to control only pull up/down/free.
193 * this function should be replaced by correct gpio function
194 */
195static void __init gpio_no_direction(u32 addr)
196{
197 __raw_writeb(0x00, addr);
198}
199
Kuninori Morimoto920adc72010-11-29 02:21:21 +0000200/* MTD */
201static struct mtd_partition nor_flash_partitions[] = {
202 {
203 .name = "loader",
204 .offset = 0x00000000,
205 .size = 512 * 1024,
206 .mask_flags = MTD_WRITEABLE,
207 },
208 {
209 .name = "bootenv",
210 .offset = MTDPART_OFS_APPEND,
211 .size = 512 * 1024,
212 .mask_flags = MTD_WRITEABLE,
213 },
214 {
215 .name = "kernel_ro",
216 .offset = MTDPART_OFS_APPEND,
217 .size = 8 * 1024 * 1024,
218 .mask_flags = MTD_WRITEABLE,
219 },
220 {
221 .name = "kernel",
222 .offset = MTDPART_OFS_APPEND,
223 .size = 8 * 1024 * 1024,
224 },
225 {
226 .name = "data",
227 .offset = MTDPART_OFS_APPEND,
228 .size = MTDPART_SIZ_FULL,
229 },
230};
231
232static struct physmap_flash_data nor_flash_data = {
233 .width = 2,
234 .parts = nor_flash_partitions,
235 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
236};
237
238static struct resource nor_flash_resources[] = {
239 [0] = {
240 .start = 0x00000000,
241 .end = 0x08000000 - 1,
242 .flags = IORESOURCE_MEM,
243 }
244};
245
246static struct platform_device nor_flash_device = {
247 .name = "physmap-flash",
248 .dev = {
249 .platform_data = &nor_flash_data,
250 },
251 .num_resources = ARRAY_SIZE(nor_flash_resources),
252 .resource = nor_flash_resources,
253};
254
Kuninori Morimoto2264c152010-11-29 02:21:37 +0000255/* SMSC */
256static struct resource smc911x_resources[] = {
257 {
258 .start = 0x14000000,
259 .end = 0x16000000 - 1,
260 .flags = IORESOURCE_MEM,
261 }, {
262 .start = evt2irq(0x02c0) /* IRQ6A */,
263 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
264 },
265};
266
267static struct smsc911x_platform_config smsc911x_info = {
268 .flags = SMSC911X_USE_16BIT | SMSC911X_SAVE_MAC_ADDRESS,
269 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
270 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
271};
272
273static struct platform_device smc911x_device = {
274 .name = "smsc911x",
275 .id = -1,
276 .num_resources = ARRAY_SIZE(smc911x_resources),
277 .resource = smc911x_resources,
278 .dev = {
279 .platform_data = &smsc911x_info,
280 },
281};
282
Kuninori Morimoto11fee462010-11-29 02:21:43 +0000283/* LCDC */
284static struct fb_videomode mackerel_lcdc_modes[] = {
285 {
286 .name = "WVGA Panel",
287 .xres = 800,
288 .yres = 480,
289 .left_margin = 220,
290 .right_margin = 110,
291 .hsync_len = 70,
292 .upper_margin = 20,
293 .lower_margin = 5,
294 .vsync_len = 5,
295 .sync = 0,
296 },
297};
298
299static struct sh_mobile_lcdc_info lcdc_info = {
300 .clock_source = LCDC_CLK_BUS,
301 .ch[0] = {
302 .chan = LCDC_CHAN_MAINLCD,
303 .bpp = 16,
304 .lcd_cfg = mackerel_lcdc_modes,
305 .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes),
306 .interface_type = RGB24,
307 .clock_divider = 2,
308 .flags = 0,
309 .lcd_size_cfg.width = 152,
310 .lcd_size_cfg.height = 91,
311 }
312};
313
314static struct resource lcdc_resources[] = {
315 [0] = {
316 .name = "LCDC",
317 .start = 0xfe940000,
318 .end = 0xfe943fff,
319 .flags = IORESOURCE_MEM,
320 },
321 [1] = {
322 .start = intcs_evt2irq(0x580),
323 .flags = IORESOURCE_IRQ,
324 },
325};
326
327static struct platform_device lcdc_device = {
328 .name = "sh_mobile_lcdc_fb",
329 .num_resources = ARRAY_SIZE(lcdc_resources),
330 .resource = lcdc_resources,
331 .dev = {
332 .platform_data = &lcdc_info,
333 .coherent_dma_mask = ~0,
334 },
335};
336
Kuninori Morimoto12c43092011-01-06 02:44:09 +0000337/* HDMI */
338static struct sh_mobile_lcdc_info hdmi_lcdc_info = {
339 .clock_source = LCDC_CLK_EXTERNAL,
340 .ch[0] = {
341 .chan = LCDC_CHAN_MAINLCD,
342 .bpp = 16,
343 .interface_type = RGB24,
344 .clock_divider = 1,
345 .flags = LCDC_FLAGS_DWPOL,
346 }
347};
348
349static struct resource hdmi_lcdc_resources[] = {
350 [0] = {
351 .name = "LCDC1",
352 .start = 0xfe944000,
353 .end = 0xfe947fff,
354 .flags = IORESOURCE_MEM,
355 },
356 [1] = {
357 .start = intcs_evt2irq(0x1780),
358 .flags = IORESOURCE_IRQ,
359 },
360};
361
362static struct platform_device hdmi_lcdc_device = {
363 .name = "sh_mobile_lcdc_fb",
364 .num_resources = ARRAY_SIZE(hdmi_lcdc_resources),
365 .resource = hdmi_lcdc_resources,
366 .id = 1,
367 .dev = {
368 .platform_data = &hdmi_lcdc_info,
369 .coherent_dma_mask = ~0,
370 },
371};
372
373static struct sh_mobile_hdmi_info hdmi_info = {
374 .lcd_chan = &hdmi_lcdc_info.ch[0],
375 .lcd_dev = &hdmi_lcdc_device.dev,
Kuninori Morimoto98d27b82011-01-06 02:44:15 +0000376 .flags = HDMI_SND_SRC_SPDIF,
Kuninori Morimoto12c43092011-01-06 02:44:09 +0000377};
378
379static struct resource hdmi_resources[] = {
380 [0] = {
381 .name = "HDMI",
382 .start = 0xe6be0000,
383 .end = 0xe6be00ff,
384 .flags = IORESOURCE_MEM,
385 },
386 [1] = {
387 /* There's also an HDMI interrupt on INTCS @ 0x18e0 */
388 .start = evt2irq(0x17e0),
389 .flags = IORESOURCE_IRQ,
390 },
391};
392
393static struct platform_device hdmi_device = {
394 .name = "sh-mobile-hdmi",
395 .num_resources = ARRAY_SIZE(hdmi_resources),
396 .resource = hdmi_resources,
397 .id = -1,
398 .dev = {
399 .platform_data = &hdmi_info,
400 },
401};
402
403static int __init hdmi_init_pm_clock(void)
404{
405 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
406 int ret;
407 long rate;
408
409 if (IS_ERR(hdmi_ick)) {
410 ret = PTR_ERR(hdmi_ick);
411 pr_err("Cannot get HDMI ICK: %d\n", ret);
412 goto out;
413 }
414
415 ret = clk_set_parent(&sh7372_pllc2_clk, &sh7372_dv_clki_div2_clk);
416 if (ret < 0) {
417 pr_err("Cannot set PLLC2 parent: %d, %d users\n",
418 ret, sh7372_pllc2_clk.usecount);
419 goto out;
420 }
421
422 pr_debug("PLLC2 initial frequency %lu\n",
423 clk_get_rate(&sh7372_pllc2_clk));
424
425 rate = clk_round_rate(&sh7372_pllc2_clk, 594000000);
426 if (rate < 0) {
427 pr_err("Cannot get suitable rate: %ld\n", rate);
428 ret = rate;
429 goto out;
430 }
431
432 ret = clk_set_rate(&sh7372_pllc2_clk, rate);
433 if (ret < 0) {
434 pr_err("Cannot set rate %ld: %d\n", rate, ret);
435 goto out;
436 }
437
438 ret = clk_enable(&sh7372_pllc2_clk);
439 if (ret < 0) {
440 pr_err("Cannot enable pllc2 clock\n");
441 goto out;
442 }
443
444 pr_debug("PLLC2 set frequency %lu\n", rate);
445
446 ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk);
447 if (ret < 0) {
448 pr_err("Cannot set HDMI parent: %d\n", ret);
449 goto out;
450 }
451
452out:
453 if (!IS_ERR(hdmi_ick))
454 clk_put(hdmi_ick);
455 return ret;
456}
457device_initcall(hdmi_init_pm_clock);
458
Kuninori Morimoto25338f22010-11-30 04:37:33 +0000459/* USB1 (Host) */
460static void usb1_host_port_power(int port, int power)
461{
462 if (!power) /* only power-on is supported for now */
463 return;
464
465 /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
466 __raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008);
467}
468
469static struct r8a66597_platdata usb1_host_data = {
470 .on_chip = 1,
471 .port_power = usb1_host_port_power,
472};
473
474static struct resource usb1_host_resources[] = {
475 [0] = {
476 .name = "USBHS",
477 .start = 0xE68B0000,
478 .end = 0xE68B00E6 - 1,
479 .flags = IORESOURCE_MEM,
480 },
481 [1] = {
482 .start = evt2irq(0x1ce0) /* USB1_USB1I0 */,
483 .flags = IORESOURCE_IRQ,
484 },
485};
486
487static struct platform_device usb1_host_device = {
488 .name = "r8a66597_hcd",
489 .id = 1,
490 .dev = {
491 .dma_mask = NULL, /* not use dma */
492 .coherent_dma_mask = 0xffffffff,
493 .platform_data = &usb1_host_data,
494 },
495 .num_resources = ARRAY_SIZE(usb1_host_resources),
496 .resource = usb1_host_resources,
497};
498
Kuninori Morimotod44deb32010-11-30 06:52:18 +0000499/* LED */
500static struct gpio_led mackerel_leds[] = {
501 {
502 .name = "led0",
503 .gpio = GPIO_PORT0,
504 .default_state = LEDS_GPIO_DEFSTATE_ON,
505 },
506 {
507 .name = "led1",
508 .gpio = GPIO_PORT1,
509 .default_state = LEDS_GPIO_DEFSTATE_ON,
510 },
511 {
512 .name = "led2",
513 .gpio = GPIO_PORT2,
514 .default_state = LEDS_GPIO_DEFSTATE_ON,
515 },
516 {
517 .name = "led3",
518 .gpio = GPIO_PORT159,
519 .default_state = LEDS_GPIO_DEFSTATE_ON,
520 }
521};
522
523static struct gpio_led_platform_data mackerel_leds_pdata = {
524 .leds = mackerel_leds,
525 .num_leds = ARRAY_SIZE(mackerel_leds),
526};
527
528static struct platform_device leds_device = {
529 .name = "leds-gpio",
530 .id = 0,
531 .dev = {
532 .platform_data = &mackerel_leds_pdata,
533 },
534};
535
Kuninori Morimoto1a44d722010-12-01 00:31:46 +0000536/* FSI */
537#define IRQ_FSI evt2irq(0x1840)
Kuninori Morimoto98d27b82011-01-06 02:44:15 +0000538static int __fsi_set_round_rate(struct clk *clk, long rate, int enable)
539{
540 int ret;
541
542 if (rate <= 0)
543 return 0;
544
545 if (!enable) {
546 clk_disable(clk);
547 return 0;
548 }
549
550 ret = clk_set_rate(clk, clk_round_rate(clk, rate));
551 if (ret < 0)
552 return ret;
553
554 return clk_enable(clk);
555}
556
557static int fsi_set_rate(struct device *dev, int is_porta, int rate, int enable)
558{
559 struct clk *fsib_clk;
560 struct clk *fdiv_clk = &sh7372_fsidivb_clk;
561 long fsib_rate = 0;
562 long fdiv_rate = 0;
563 int ackmd_bpfmd;
564 int ret;
565
566 /* FSIA is slave mode. nothing to do here */
567 if (is_porta)
568 return 0;
569
570 /* clock start */
571 switch (rate) {
572 case 44100:
573 fsib_rate = rate * 256;
574 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
575 break;
576 case 48000:
577 fsib_rate = 85428000; /* around 48kHz x 256 x 7 */
578 fdiv_rate = rate * 256;
579 ackmd_bpfmd = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
580 break;
581 default:
582 pr_err("unsupported rate in FSI2 port B\n");
583 return -EINVAL;
584 }
585
586 /* FSI B setting */
587 fsib_clk = clk_get(dev, "ickb");
588 if (IS_ERR(fsib_clk))
589 return -EIO;
590
591 /* fsib */
592 ret = __fsi_set_round_rate(fsib_clk, fsib_rate, enable);
593 if (ret < 0)
594 goto fsi_set_rate_end;
595
596 /* FSI DIV */
597 ret = __fsi_set_round_rate(fdiv_clk, fdiv_rate, enable);
598 if (ret < 0) {
599 /* disable FSI B */
600 if (enable)
601 __fsi_set_round_rate(fsib_clk, fsib_rate, 0);
602 goto fsi_set_rate_end;
603 }
604
605 ret = ackmd_bpfmd;
606
607fsi_set_rate_end:
608 clk_put(fsib_clk);
609 return ret;
610}
611
Kuninori Morimoto1a44d722010-12-01 00:31:46 +0000612static struct sh_fsi_platform_info fsi_info = {
613 .porta_flags = SH_FSI_BRS_INV |
Kuninori Morimoto1a44d722010-12-01 00:31:46 +0000614 SH_FSI_OFMT(PCM) |
615 SH_FSI_IFMT(PCM),
Kuninori Morimoto98d27b82011-01-06 02:44:15 +0000616
617 .portb_flags = SH_FSI_BRS_INV |
618 SH_FSI_BRM_INV |
619 SH_FSI_LRS_INV |
620 SH_FSI_OFMT(SPDIF),
621
622 .set_rate = fsi_set_rate,
Kuninori Morimoto1a44d722010-12-01 00:31:46 +0000623};
624
625static struct resource fsi_resources[] = {
626 [0] = {
627 .name = "FSI",
628 .start = 0xFE3C0000,
629 .end = 0xFE3C0400 - 1,
630 .flags = IORESOURCE_MEM,
631 },
632 [1] = {
633 .start = IRQ_FSI,
634 .flags = IORESOURCE_IRQ,
635 },
636};
637
638static struct platform_device fsi_device = {
639 .name = "sh_fsi2",
640 .id = -1,
641 .num_resources = ARRAY_SIZE(fsi_resources),
642 .resource = fsi_resources,
643 .dev = {
644 .platform_data = &fsi_info,
645 },
646};
647
648static struct platform_device fsi_ak4643_device = {
649 .name = "sh_fsi2_a_ak4643",
650};
Kuninori Morimotod44deb32010-11-30 06:52:18 +0000651
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900652/*
653 * The card detect pin of the top SD/MMC slot (CN7) is active low and is
654 * connected to GPIO A22 of SH7372 (GPIO_PORT41).
655 */
656static int slot_cn7_get_cd(struct platform_device *pdev)
657{
Magnus Dammceb50f32011-01-12 10:43:07 +0000658 return !gpio_get_value(GPIO_PORT41);
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900659}
660
661/* SDHI0 */
662static struct sh_mobile_sdhi_info sdhi0_info = {
663 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
664 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
Magnus Dammda97da72011-01-06 10:55:41 +0000665 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900666};
667
668static struct resource sdhi0_resources[] = {
669 [0] = {
670 .name = "SDHI0",
671 .start = 0xe6850000,
672 .end = 0xe68501ff,
673 .flags = IORESOURCE_MEM,
674 },
675 [1] = {
676 .start = evt2irq(0x0e00) /* SDHI0 */,
677 .flags = IORESOURCE_IRQ,
678 },
679};
680
681static struct platform_device sdhi0_device = {
682 .name = "sh_mobile_sdhi",
683 .num_resources = ARRAY_SIZE(sdhi0_resources),
684 .resource = sdhi0_resources,
685 .id = 0,
686 .dev = {
687 .platform_data = &sdhi0_info,
688 },
689};
690
Yusuke Goda41491b92010-12-15 08:31:04 +0000691#if !defined(CONFIG_MMC_SH_MMCIF)
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900692/* SDHI1 */
693static struct sh_mobile_sdhi_info sdhi1_info = {
694 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
695 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
696 .tmio_ocr_mask = MMC_VDD_165_195,
697 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
Magnus Dammda97da72011-01-06 10:55:41 +0000698 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900699 MMC_CAP_NEEDS_POLL,
700 .get_cd = slot_cn7_get_cd,
701};
702
703static struct resource sdhi1_resources[] = {
704 [0] = {
705 .name = "SDHI1",
706 .start = 0xe6860000,
707 .end = 0xe68601ff,
708 .flags = IORESOURCE_MEM,
709 },
710 [1] = {
711 .start = evt2irq(0x0e80),
712 .flags = IORESOURCE_IRQ,
713 },
714};
715
716static struct platform_device sdhi1_device = {
717 .name = "sh_mobile_sdhi",
718 .num_resources = ARRAY_SIZE(sdhi1_resources),
719 .resource = sdhi1_resources,
720 .id = 1,
721 .dev = {
722 .platform_data = &sdhi1_info,
723 },
724};
Yusuke Goda41491b92010-12-15 08:31:04 +0000725#endif
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900726
Yusuke Godada5d1f42011-01-07 09:48:36 +0000727/*
728 * The card detect pin of the top SD/MMC slot (CN23) is active low and is
729 * connected to GPIO SCIFB_SCK of SH7372 (GPIO_PORT162).
730 */
731static int slot_cn23_get_cd(struct platform_device *pdev)
732{
733 return !gpio_get_value(GPIO_PORT162);
734}
735
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900736/* SDHI2 */
737static struct sh_mobile_sdhi_info sdhi2_info = {
738 .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX,
739 .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX,
740 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
Magnus Dammda97da72011-01-06 10:55:41 +0000741 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900742 MMC_CAP_NEEDS_POLL,
Yusuke Godada5d1f42011-01-07 09:48:36 +0000743 .get_cd = slot_cn23_get_cd,
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900744};
745
746static struct resource sdhi2_resources[] = {
747 [0] = {
748 .name = "SDHI2",
749 .start = 0xe6870000,
750 .end = 0xe68701ff,
751 .flags = IORESOURCE_MEM,
752 },
753 [1] = {
754 .start = evt2irq(0x1200),
755 .flags = IORESOURCE_IRQ,
756 },
757};
758
759static struct platform_device sdhi2_device = {
760 .name = "sh_mobile_sdhi",
761 .num_resources = ARRAY_SIZE(sdhi2_resources),
762 .resource = sdhi2_resources,
763 .id = 2,
764 .dev = {
765 .platform_data = &sdhi2_info,
766 },
767};
768
Yusuke Goda41491b92010-12-15 08:31:04 +0000769/* SH_MMCIF */
770static struct resource sh_mmcif_resources[] = {
771 [0] = {
772 .name = "MMCIF",
773 .start = 0xE6BD0000,
774 .end = 0xE6BD00FF,
775 .flags = IORESOURCE_MEM,
776 },
777 [1] = {
778 /* MMC ERR */
779 .start = evt2irq(0x1ac0),
780 .flags = IORESOURCE_IRQ,
781 },
782 [2] = {
783 /* MMC NOR */
784 .start = evt2irq(0x1ae0),
785 .flags = IORESOURCE_IRQ,
786 },
787};
788
789static struct sh_mmcif_plat_data sh_mmcif_plat = {
790 .sup_pclk = 0,
791 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
792 .caps = MMC_CAP_4_BIT_DATA |
793 MMC_CAP_8_BIT_DATA |
794 MMC_CAP_NEEDS_POLL,
795 .get_cd = slot_cn7_get_cd,
796};
797
798static struct platform_device sh_mmcif_device = {
799 .name = "sh_mmcif",
800 .id = 0,
801 .dev = {
802 .dma_mask = NULL,
803 .coherent_dma_mask = 0xffffffff,
804 .platform_data = &sh_mmcif_plat,
805 },
806 .num_resources = ARRAY_SIZE(sh_mmcif_resources),
807 .resource = sh_mmcif_resources,
808};
809
Magnus Dammae37c8d2010-12-22 14:47:40 +0000810
811static int mackerel_camera_add(struct soc_camera_link *icl, struct device *dev);
812static void mackerel_camera_del(struct soc_camera_link *icl);
813
814static int camera_set_capture(struct soc_camera_platform_info *info,
815 int enable)
816{
817 return 0; /* camera sensor always enabled */
818}
819
820static struct soc_camera_platform_info camera_info = {
821 .format_name = "UYVY",
822 .format_depth = 16,
823 .format = {
824 .code = V4L2_MBUS_FMT_UYVY8_2X8,
825 .colorspace = V4L2_COLORSPACE_SMPTE170M,
826 .field = V4L2_FIELD_NONE,
827 .width = 640,
828 .height = 480,
829 },
830 .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
831 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8 |
832 SOCAM_DATA_ACTIVE_HIGH,
833 .set_capture = camera_set_capture,
834};
835
836static struct soc_camera_link camera_link = {
837 .bus_id = 0,
838 .add_device = mackerel_camera_add,
839 .del_device = mackerel_camera_del,
840 .module_name = "soc_camera_platform",
841 .priv = &camera_info,
842};
843
844static void dummy_release(struct device *dev)
845{
846}
847
848static struct platform_device camera_device = {
849 .name = "soc_camera_platform",
850 .dev = {
851 .platform_data = &camera_info,
852 .release = dummy_release,
853 },
854};
855
856static int mackerel_camera_add(struct soc_camera_link *icl,
857 struct device *dev)
858{
859 if (icl != &camera_link)
860 return -ENODEV;
861
862 camera_info.dev = dev;
863
864 return platform_device_register(&camera_device);
865}
866
867static void mackerel_camera_del(struct soc_camera_link *icl)
868{
869 if (icl != &camera_link)
870 return;
871
872 platform_device_unregister(&camera_device);
873 memset(&camera_device.dev.kobj, 0,
874 sizeof(camera_device.dev.kobj));
875}
876
877static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
878 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
879};
880
881static struct resource ceu_resources[] = {
882 [0] = {
883 .name = "CEU",
884 .start = 0xfe910000,
885 .end = 0xfe91009f,
886 .flags = IORESOURCE_MEM,
887 },
888 [1] = {
889 .start = intcs_evt2irq(0x880),
890 .flags = IORESOURCE_IRQ,
891 },
892 [2] = {
893 /* place holder for contiguous memory */
894 },
895};
896
897static struct platform_device ceu_device = {
898 .name = "sh_mobile_ceu",
899 .id = 0, /* "ceu0" clock */
900 .num_resources = ARRAY_SIZE(ceu_resources),
901 .resource = ceu_resources,
902 .dev = {
903 .platform_data = &sh_mobile_ceu_info,
904 },
905};
906
907static struct platform_device mackerel_camera = {
908 .name = "soc-camera-pdrv",
909 .id = 0,
910 .dev = {
911 .platform_data = &camera_link,
912 },
913};
914
Kuninori Morimoto920adc72010-11-29 02:21:21 +0000915static struct platform_device *mackerel_devices[] __initdata = {
916 &nor_flash_device,
Kuninori Morimoto2264c152010-11-29 02:21:37 +0000917 &smc911x_device,
Kuninori Morimoto11fee462010-11-29 02:21:43 +0000918 &lcdc_device,
Kuninori Morimoto25338f22010-11-30 04:37:33 +0000919 &usb1_host_device,
Kuninori Morimotod44deb32010-11-30 06:52:18 +0000920 &leds_device,
Kuninori Morimoto1a44d722010-12-01 00:31:46 +0000921 &fsi_device,
922 &fsi_ak4643_device,
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900923 &sdhi0_device,
Yusuke Goda41491b92010-12-15 08:31:04 +0000924#if !defined(CONFIG_MMC_SH_MMCIF)
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900925 &sdhi1_device,
Yusuke Goda41491b92010-12-15 08:31:04 +0000926#endif
Yusuke Goda6dff7da2010-12-14 14:18:03 +0900927 &sdhi2_device,
Yusuke Goda41491b92010-12-15 08:31:04 +0000928 &sh_mmcif_device,
Magnus Dammae37c8d2010-12-22 14:47:40 +0000929 &ceu_device,
930 &mackerel_camera,
Kuninori Morimoto12c43092011-01-06 02:44:09 +0000931 &hdmi_lcdc_device,
932 &hdmi_device,
Kuninori Morimoto1a44d722010-12-01 00:31:46 +0000933};
934
Tony SIMcd8ab002010-12-09 01:55:55 +0000935/* Keypad Initialization */
936#define KEYPAD_BUTTON(ev_type, ev_code, act_low) \
937{ \
938 .type = ev_type, \
939 .code = ev_code, \
940 .active_low = act_low, \
941}
942
943#define KEYPAD_BUTTON_LOW(event_code) KEYPAD_BUTTON(EV_KEY, event_code, 1)
944
945static struct tca6416_button mackerel_gpio_keys[] = {
946 KEYPAD_BUTTON_LOW(KEY_HOME),
947 KEYPAD_BUTTON_LOW(KEY_MENU),
948 KEYPAD_BUTTON_LOW(KEY_BACK),
949 KEYPAD_BUTTON_LOW(KEY_POWER),
950};
951
952static struct tca6416_keys_platform_data mackerel_tca6416_keys_info = {
953 .buttons = mackerel_gpio_keys,
954 .nbuttons = ARRAY_SIZE(mackerel_gpio_keys),
955 .rep = 1,
956 .use_polling = 0,
957 .pinmask = 0x000F,
958};
959
Kuninori Morimoto1a44d722010-12-01 00:31:46 +0000960/* I2C */
Tony SIM6ae1e192011-01-11 09:47:59 +0900961#define IRQ7 evt2irq(0x02e0)
Tony SIMcd8ab002010-12-09 01:55:55 +0000962#define IRQ9 evt2irq(0x0320)
963
Kuninori Morimoto1a44d722010-12-01 00:31:46 +0000964static struct i2c_board_info i2c0_devices[] = {
965 {
966 I2C_BOARD_INFO("ak4643", 0x13),
967 },
Tony SIMcd8ab002010-12-09 01:55:55 +0000968 /* Keypad */
969 {
970 I2C_BOARD_INFO("tca6408-keys", 0x20),
971 .platform_data = &mackerel_tca6416_keys_info,
972 .irq = IRQ9,
973 },
Tony SIM6ae1e192011-01-11 09:47:59 +0900974 /* Touchscreen */
975 {
976 I2C_BOARD_INFO("st1232-ts", 0x55),
977 .irq = IRQ7,
978 },
Kuninori Morimoto920adc72010-11-29 02:21:21 +0000979};
980
Tony SIM80f1dc72010-12-07 09:12:14 +0000981#define IRQ21 evt2irq(0x32a0)
982
983static struct i2c_board_info i2c1_devices[] = {
984 /* Accelerometer */
985 {
986 I2C_BOARD_INFO("adxl34x", 0x53),
987 .irq = IRQ21,
988 },
989};
990
Kuninori Morimoto920adc72010-11-29 02:21:21 +0000991static struct map_desc mackerel_io_desc[] __initdata = {
992 /* create a 1:1 entity map for 0xe6xxxxxx
993 * used by CPGA, INTC and PFC.
994 */
995 {
996 .virtual = 0xe6000000,
997 .pfn = __phys_to_pfn(0xe6000000),
998 .length = 256 << 20,
999 .type = MT_DEVICE_NONSHARED
1000 },
1001};
1002
1003static void __init mackerel_map_io(void)
1004{
1005 iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc));
1006
1007 /* setup early devices and console here as well */
1008 sh7372_add_early_devices();
1009 shmobile_setup_console();
1010}
1011
Kuninori Morimoto1a44d722010-12-01 00:31:46 +00001012#define GPIO_PORT9CR 0xE6051009
1013#define GPIO_PORT10CR 0xE605100A
Kuninori Morimoto12c43092011-01-06 02:44:09 +00001014#define SRCR4 0xe61580bc
Kuninori Morimoto98d27b82011-01-06 02:44:15 +00001015#define USCCR1 0xE6058144
Kuninori Morimoto920adc72010-11-29 02:21:21 +00001016static void __init mackerel_init(void)
1017{
Kuninori Morimoto12c43092011-01-06 02:44:09 +00001018 u32 srcr4;
Kuninori Morimoto98d27b82011-01-06 02:44:15 +00001019 struct clk *clk;
Kuninori Morimoto12c43092011-01-06 02:44:09 +00001020
Kuninori Morimoto920adc72010-11-29 02:21:21 +00001021 sh7372_pinmux_init();
1022
1023 /* enable SCIFA0 */
1024 gpio_request(GPIO_FN_SCIFA0_TXD, NULL);
1025 gpio_request(GPIO_FN_SCIFA0_RXD, NULL);
1026
Kuninori Morimoto2264c152010-11-29 02:21:37 +00001027 /* enable SMSC911X */
1028 gpio_request(GPIO_FN_CS5A, NULL);
1029 gpio_request(GPIO_FN_IRQ6_39, NULL);
1030
Kuninori Morimoto11fee462010-11-29 02:21:43 +00001031 /* LCDC */
Kuninori Morimotoeb87e672010-11-29 06:19:52 +00001032 gpio_request(GPIO_FN_LCDD23, NULL);
1033 gpio_request(GPIO_FN_LCDD22, NULL);
1034 gpio_request(GPIO_FN_LCDD21, NULL);
1035 gpio_request(GPIO_FN_LCDD20, NULL);
1036 gpio_request(GPIO_FN_LCDD19, NULL);
1037 gpio_request(GPIO_FN_LCDD18, NULL);
Kuninori Morimoto11fee462010-11-29 02:21:43 +00001038 gpio_request(GPIO_FN_LCDD17, NULL);
1039 gpio_request(GPIO_FN_LCDD16, NULL);
1040 gpio_request(GPIO_FN_LCDD15, NULL);
1041 gpio_request(GPIO_FN_LCDD14, NULL);
1042 gpio_request(GPIO_FN_LCDD13, NULL);
1043 gpio_request(GPIO_FN_LCDD12, NULL);
1044 gpio_request(GPIO_FN_LCDD11, NULL);
1045 gpio_request(GPIO_FN_LCDD10, NULL);
1046 gpio_request(GPIO_FN_LCDD9, NULL);
1047 gpio_request(GPIO_FN_LCDD8, NULL);
1048 gpio_request(GPIO_FN_LCDD7, NULL);
1049 gpio_request(GPIO_FN_LCDD6, NULL);
1050 gpio_request(GPIO_FN_LCDD5, NULL);
1051 gpio_request(GPIO_FN_LCDD4, NULL);
1052 gpio_request(GPIO_FN_LCDD3, NULL);
1053 gpio_request(GPIO_FN_LCDD2, NULL);
1054 gpio_request(GPIO_FN_LCDD1, NULL);
1055 gpio_request(GPIO_FN_LCDD0, NULL);
1056 gpio_request(GPIO_FN_LCDDISP, NULL);
1057 gpio_request(GPIO_FN_LCDDCK, NULL);
1058
1059 gpio_request(GPIO_PORT31, NULL); /* backlight */
1060 gpio_direction_output(GPIO_PORT31, 1);
1061
1062 gpio_request(GPIO_PORT151, NULL); /* LCDDON */
1063 gpio_direction_output(GPIO_PORT151, 1);
1064
Kuninori Morimoto25338f22010-11-30 04:37:33 +00001065 /* USB enable */
1066 gpio_request(GPIO_FN_VBUS0_1, NULL);
1067 gpio_request(GPIO_FN_IDIN_1_18, NULL);
1068 gpio_request(GPIO_FN_PWEN_1_115, NULL);
1069 gpio_request(GPIO_FN_OVCN_1_114, NULL);
1070 gpio_request(GPIO_FN_EXTLP_1, NULL);
1071 gpio_request(GPIO_FN_OVCN2_1, NULL);
1072
1073 /* setup USB phy */
Kuninori Morimotod0fb0c42010-12-28 05:54:53 +00001074 __raw_writew(0x8a0a, 0xE6058130); /* USBCR4 */
Kuninori Morimoto25338f22010-11-30 04:37:33 +00001075
Kuninori Morimoto1a44d722010-12-01 00:31:46 +00001076 /* enable FSI2 port A (ak4643) */
1077 gpio_request(GPIO_FN_FSIAIBT, NULL);
1078 gpio_request(GPIO_FN_FSIAILR, NULL);
1079 gpio_request(GPIO_FN_FSIAISLD, NULL);
1080 gpio_request(GPIO_FN_FSIAOSLD, NULL);
1081 gpio_request(GPIO_PORT161, NULL);
1082 gpio_direction_output(GPIO_PORT161, 0); /* slave */
1083
1084 gpio_request(GPIO_PORT9, NULL);
1085 gpio_request(GPIO_PORT10, NULL);
1086 gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */
1087 gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
1088
1089 intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */
1090
Kuninori Morimoto98d27b82011-01-06 02:44:15 +00001091 /* setup FSI2 port B (HDMI) */
1092 gpio_request(GPIO_FN_FSIBCK, NULL);
1093 __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1); /* use SPDIF */
1094
1095 /* set SPU2 clock to 119.6 MHz */
1096 clk = clk_get(NULL, "spu_clk");
1097 if (!IS_ERR(clk)) {
1098 clk_set_rate(clk, clk_round_rate(clk, 119600000));
1099 clk_put(clk);
1100 }
1101
Tony SIMcd8ab002010-12-09 01:55:55 +00001102 /* enable Keypad */
1103 gpio_request(GPIO_FN_IRQ9_42, NULL);
1104 set_irq_type(IRQ9, IRQ_TYPE_LEVEL_HIGH);
1105
Tony SIM6ae1e192011-01-11 09:47:59 +09001106 /* enable Touchscreen */
1107 gpio_request(GPIO_FN_IRQ7_40, NULL);
1108 set_irq_type(IRQ7, IRQ_TYPE_LEVEL_LOW);
1109
Tony SIM80f1dc72010-12-07 09:12:14 +00001110 /* enable Accelerometer */
1111 gpio_request(GPIO_FN_IRQ21, NULL);
1112 set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);
Kuninori Morimoto1a44d722010-12-01 00:31:46 +00001113
Yusuke Goda6dff7da2010-12-14 14:18:03 +09001114 /* enable SDHI0 */
1115 gpio_request(GPIO_FN_SDHICD0, NULL);
1116 gpio_request(GPIO_FN_SDHIWP0, NULL);
1117 gpio_request(GPIO_FN_SDHICMD0, NULL);
1118 gpio_request(GPIO_FN_SDHICLK0, NULL);
1119 gpio_request(GPIO_FN_SDHID0_3, NULL);
1120 gpio_request(GPIO_FN_SDHID0_2, NULL);
1121 gpio_request(GPIO_FN_SDHID0_1, NULL);
1122 gpio_request(GPIO_FN_SDHID0_0, NULL);
1123
Yusuke Goda41491b92010-12-15 08:31:04 +00001124#if !defined(CONFIG_MMC_SH_MMCIF)
Yusuke Goda6dff7da2010-12-14 14:18:03 +09001125 /* enable SDHI1 */
1126 gpio_request(GPIO_FN_SDHICMD1, NULL);
1127 gpio_request(GPIO_FN_SDHICLK1, NULL);
1128 gpio_request(GPIO_FN_SDHID1_3, NULL);
1129 gpio_request(GPIO_FN_SDHID1_2, NULL);
1130 gpio_request(GPIO_FN_SDHID1_1, NULL);
1131 gpio_request(GPIO_FN_SDHID1_0, NULL);
Yusuke Goda41491b92010-12-15 08:31:04 +00001132#endif
Yusuke Goda6dff7da2010-12-14 14:18:03 +09001133 /* card detect pin for MMC slot (CN7) */
1134 gpio_request(GPIO_PORT41, NULL);
1135 gpio_direction_input(GPIO_PORT41);
1136
1137 /* enable SDHI2 */
1138 gpio_request(GPIO_FN_SDHICMD2, NULL);
1139 gpio_request(GPIO_FN_SDHICLK2, NULL);
1140 gpio_request(GPIO_FN_SDHID2_3, NULL);
1141 gpio_request(GPIO_FN_SDHID2_2, NULL);
1142 gpio_request(GPIO_FN_SDHID2_1, NULL);
1143 gpio_request(GPIO_FN_SDHID2_0, NULL);
1144
Yusuke Godada5d1f42011-01-07 09:48:36 +00001145 /* card detect pin for microSD slot (CN23) */
1146 gpio_request(GPIO_PORT162, NULL);
1147 gpio_direction_input(GPIO_PORT162);
1148
Yusuke Goda41491b92010-12-15 08:31:04 +00001149 /* MMCIF */
1150 gpio_request(GPIO_FN_MMCD0_0, NULL);
1151 gpio_request(GPIO_FN_MMCD0_1, NULL);
1152 gpio_request(GPIO_FN_MMCD0_2, NULL);
1153 gpio_request(GPIO_FN_MMCD0_3, NULL);
1154 gpio_request(GPIO_FN_MMCD0_4, NULL);
1155 gpio_request(GPIO_FN_MMCD0_5, NULL);
1156 gpio_request(GPIO_FN_MMCD0_6, NULL);
1157 gpio_request(GPIO_FN_MMCD0_7, NULL);
1158 gpio_request(GPIO_FN_MMCCMD0, NULL);
1159 gpio_request(GPIO_FN_MMCCLK0, NULL);
1160
Yusuke Goda56e78da2010-12-20 01:06:04 +00001161 /* enable GPS module (GT-720F) */
1162 gpio_request(GPIO_FN_SCIFA2_TXD1, NULL);
1163 gpio_request(GPIO_FN_SCIFA2_RXD1, NULL);
1164
Magnus Dammae37c8d2010-12-22 14:47:40 +00001165 /* CEU */
1166 gpio_request(GPIO_FN_VIO_CLK, NULL);
1167 gpio_request(GPIO_FN_VIO_VD, NULL);
1168 gpio_request(GPIO_FN_VIO_HD, NULL);
1169 gpio_request(GPIO_FN_VIO_FIELD, NULL);
1170 gpio_request(GPIO_FN_VIO_CKO, NULL);
1171 gpio_request(GPIO_FN_VIO_D7, NULL);
1172 gpio_request(GPIO_FN_VIO_D6, NULL);
1173 gpio_request(GPIO_FN_VIO_D5, NULL);
1174 gpio_request(GPIO_FN_VIO_D4, NULL);
1175 gpio_request(GPIO_FN_VIO_D3, NULL);
1176 gpio_request(GPIO_FN_VIO_D2, NULL);
1177 gpio_request(GPIO_FN_VIO_D1, NULL);
1178 gpio_request(GPIO_FN_VIO_D0, NULL);
1179
Kuninori Morimoto12c43092011-01-06 02:44:09 +00001180 /* HDMI */
1181 gpio_request(GPIO_FN_HDMI_HPD, NULL);
1182 gpio_request(GPIO_FN_HDMI_CEC, NULL);
1183
1184 /* Reset HDMI, must be held at least one EXTALR (32768Hz) period */
1185 srcr4 = __raw_readl(SRCR4);
1186 __raw_writel(srcr4 | (1 << 13), SRCR4);
1187 udelay(50);
1188 __raw_writel(srcr4 & ~(1 << 13), SRCR4);
1189
Kuninori Morimoto1a44d722010-12-01 00:31:46 +00001190 i2c_register_board_info(0, i2c0_devices,
1191 ARRAY_SIZE(i2c0_devices));
Tony SIM80f1dc72010-12-07 09:12:14 +00001192 i2c_register_board_info(1, i2c1_devices,
1193 ARRAY_SIZE(i2c1_devices));
Kuninori Morimoto11fee462010-11-29 02:21:43 +00001194
Kuninori Morimoto920adc72010-11-29 02:21:21 +00001195 sh7372_add_standard_devices();
1196
1197 platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
1198}
1199
1200static void __init mackerel_timer_init(void)
1201{
1202 sh7372_clock_init();
1203 shmobile_timer.init();
Kuninori Morimoto12c43092011-01-06 02:44:09 +00001204
1205 /* External clock source */
1206 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
Kuninori Morimoto920adc72010-11-29 02:21:21 +00001207}
1208
1209static struct sys_timer mackerel_timer = {
1210 .init = mackerel_timer_init,
1211};
1212
1213MACHINE_START(MACKEREL, "mackerel")
1214 .map_io = mackerel_map_io,
1215 .init_irq = sh7372_init_irq,
Magnus Damm863b1712010-12-28 08:27:01 +00001216 .handle_irq = shmobile_handle_irq_intc,
Kuninori Morimoto920adc72010-11-29 02:21:21 +00001217 .init_machine = mackerel_init,
1218 .timer = &mackerel_timer,
1219MACHINE_END