ARM: shmobile: r8a73a4: Remove init_irq declaration in machine description
[linux-2.6.git] / arch / arm / mach-shmobile / board-kota2.c
blobef5ca0ef0cb5179b666ce4dc2f298fcda6ed1bf6
1 /*
2 * kota2 board support
4 * Copyright (C) 2011 Renesas Solutions Corp.
5 * Copyright (C) 2011 Magnus Damm
6 * Copyright (C) 2010 Takashi Yoshii <yoshii.takashi.zj@renesas.com>
7 * Copyright (C) 2009 Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <linux/kernel.h>
24 #include <linux/init.h>
25 #include <linux/interrupt.h>
26 #include <linux/irq.h>
27 #include <linux/pinctrl/machine.h>
28 #include <linux/pinctrl/pinconf-generic.h>
29 #include <linux/platform_device.h>
30 #include <linux/delay.h>
31 #include <linux/io.h>
32 #include <linux/regulator/fixed.h>
33 #include <linux/regulator/machine.h>
34 #include <linux/smsc911x.h>
35 #include <linux/gpio.h>
36 #include <linux/input.h>
37 #include <linux/input/sh_keysc.h>
38 #include <linux/gpio_keys.h>
39 #include <linux/leds.h>
40 #include <linux/irqchip/arm-gic.h>
41 #include <linux/platform_data/leds-renesas-tpu.h>
42 #include <linux/mmc/host.h>
43 #include <linux/mmc/sh_mmcif.h>
44 #include <linux/mfd/tmio.h>
45 #include <linux/mmc/sh_mobile_sdhi.h>
46 #include <mach/hardware.h>
47 #include <mach/irqs.h>
48 #include <mach/sh73a0.h>
49 #include <mach/common.h>
50 #include <asm/mach-types.h>
51 #include <asm/mach/arch.h>
52 #include <asm/mach/time.h>
53 #include <asm/hardware/cache-l2x0.h>
54 #include <asm/traps.h>
56 /* Dummy supplies, where voltage doesn't matter */
57 static struct regulator_consumer_supply dummy_supplies[] = {
58 REGULATOR_SUPPLY("vddvario", "smsc911x"),
59 REGULATOR_SUPPLY("vdd33a", "smsc911x"),
62 /* SMSC 9220 */
63 static struct resource smsc9220_resources[] = {
64 [0] = {
65 .start = 0x14000000, /* CS5A */
66 .end = 0x140000ff, /* A1->A7 */
67 .flags = IORESOURCE_MEM,
69 [1] = {
70 .start = SH73A0_PINT0_IRQ(2), /* PINTA2 */
71 .flags = IORESOURCE_IRQ,
75 static struct smsc911x_platform_config smsc9220_platdata = {
76 .flags = SMSC911X_USE_32BIT, /* 32-bit SW on 16-bit HW bus */
77 .phy_interface = PHY_INTERFACE_MODE_MII,
78 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
79 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
82 static struct platform_device eth_device = {
83 .name = "smsc911x",
84 .id = 0,
85 .dev = {
86 .platform_data = &smsc9220_platdata,
88 .resource = smsc9220_resources,
89 .num_resources = ARRAY_SIZE(smsc9220_resources),
92 /* KEYSC */
93 static struct sh_keysc_info keysc_platdata = {
94 .mode = SH_KEYSC_MODE_6,
95 .scan_timing = 3,
96 .delay = 100,
97 .keycodes = {
98 KEY_NUMERIC_STAR, KEY_NUMERIC_0, KEY_NUMERIC_POUND,
99 0, 0, 0, 0, 0,
100 KEY_NUMERIC_7, KEY_NUMERIC_8, KEY_NUMERIC_9,
101 0, KEY_DOWN, 0, 0, 0,
102 KEY_NUMERIC_4, KEY_NUMERIC_5, KEY_NUMERIC_6,
103 KEY_LEFT, KEY_ENTER, KEY_RIGHT, 0, 0,
104 KEY_NUMERIC_1, KEY_NUMERIC_2, KEY_NUMERIC_3,
105 0, KEY_UP, 0, 0, 0,
106 0, 0, 0, 0, 0, 0, 0, 0,
107 0, 0, 0, 0, 0, 0, 0, 0,
108 0, 0, 0, 0, 0, 0, 0, 0,
109 0, 0, 0, 0, 0, 0, 0, 0,
113 static struct resource keysc_resources[] = {
114 [0] = {
115 .name = "KEYSC",
116 .start = 0xe61b0000,
117 .end = 0xe61b0098 - 1,
118 .flags = IORESOURCE_MEM,
120 [1] = {
121 .start = gic_spi(71),
122 .flags = IORESOURCE_IRQ,
126 static struct platform_device keysc_device = {
127 .name = "sh_keysc",
128 .id = 0,
129 .num_resources = ARRAY_SIZE(keysc_resources),
130 .resource = keysc_resources,
131 .dev = {
132 .platform_data = &keysc_platdata,
136 /* GPIO KEY */
137 #define GPIO_KEY(c, g, d) { .code = c, .gpio = g, .desc = d, .active_low = 1 }
139 static struct gpio_keys_button gpio_buttons[] = {
140 GPIO_KEY(KEY_VOLUMEUP, 56, "+"), /* S2: VOL+ [IRQ9] */
141 GPIO_KEY(KEY_VOLUMEDOWN, 54, "-"), /* S3: VOL- [IRQ10] */
142 GPIO_KEY(KEY_MENU, 27, "Menu"), /* S4: MENU [IRQ30] */
143 GPIO_KEY(KEY_HOMEPAGE, 26, "Home"), /* S5: HOME [IRQ31] */
144 GPIO_KEY(KEY_BACK, 11, "Back"), /* S6: BACK [IRQ0] */
145 GPIO_KEY(KEY_PHONE, 238, "Tel"), /* S7: TEL [IRQ11] */
146 GPIO_KEY(KEY_POWER, 239, "C1"), /* S8: CAM [IRQ13] */
147 GPIO_KEY(KEY_MAIL, 224, "Mail"), /* S9: MAIL [IRQ3] */
148 /* Omitted button "C3?": 223 - S10: CUST [IRQ8] */
149 GPIO_KEY(KEY_CAMERA, 164, "C2"), /* S11: CAM_HALF [IRQ25] */
150 /* Omitted button "?": 152 - S12: CAM_FULL [No IRQ] */
153 static struct gpio_keys_platform_data gpio_key_info = {
154 .buttons = gpio_buttons,
155 .nbuttons = ARRAY_SIZE(gpio_buttons),
158 static struct platform_device gpio_keys_device = {
159 .name = "gpio-keys",
160 .id = -1,
161 .dev = {
162 .platform_data = &gpio_key_info,
166 /* GPIO LED */
167 #define GPIO_LED(n, g) { .name = n, .gpio = g }
169 static struct gpio_led gpio_leds[] = {
170 GPIO_LED("G", 20), /* PORT20 [GPO0] -> LED7 -> "G" */
171 GPIO_LED("H", 21), /* PORT21 [GPO1] -> LED8 -> "H" */
172 GPIO_LED("J", 22), /* PORT22 [GPO2] -> LED9 -> "J" */
175 static struct gpio_led_platform_data gpio_leds_info = {
176 .leds = gpio_leds,
177 .num_leds = ARRAY_SIZE(gpio_leds),
180 static struct platform_device gpio_leds_device = {
181 .name = "leds-gpio",
182 .id = -1,
183 .dev = {
184 .platform_data = &gpio_leds_info,
188 /* TPU LED */
189 static struct led_renesas_tpu_config led_renesas_tpu12_pdata = {
190 .name = "V2513",
191 .pin_gpio_fn = GPIO_FN_TPU1TO2,
192 .pin_gpio = 153,
193 .channel_offset = 0x90,
194 .timer_bit = 2,
195 .max_brightness = 1000,
198 static struct resource tpu12_resources[] = {
199 [0] = {
200 .name = "TPU12",
201 .start = 0xe6610090,
202 .end = 0xe66100b5,
203 .flags = IORESOURCE_MEM,
207 static struct platform_device leds_tpu12_device = {
208 .name = "leds-renesas-tpu",
209 .id = 12,
210 .dev = {
211 .platform_data = &led_renesas_tpu12_pdata,
213 .num_resources = ARRAY_SIZE(tpu12_resources),
214 .resource = tpu12_resources,
217 static struct led_renesas_tpu_config led_renesas_tpu41_pdata = {
218 .name = "V2514",
219 .pin_gpio_fn = GPIO_FN_TPU4TO1,
220 .pin_gpio = 199,
221 .channel_offset = 0x50,
222 .timer_bit = 1,
223 .max_brightness = 1000,
226 static struct resource tpu41_resources[] = {
227 [0] = {
228 .name = "TPU41",
229 .start = 0xe6640050,
230 .end = 0xe6640075,
231 .flags = IORESOURCE_MEM,
235 static struct platform_device leds_tpu41_device = {
236 .name = "leds-renesas-tpu",
237 .id = 41,
238 .dev = {
239 .platform_data = &led_renesas_tpu41_pdata,
241 .num_resources = ARRAY_SIZE(tpu41_resources),
242 .resource = tpu41_resources,
245 static struct led_renesas_tpu_config led_renesas_tpu21_pdata = {
246 .name = "V2515",
247 .pin_gpio_fn = GPIO_FN_TPU2TO1,
248 .pin_gpio = 197,
249 .channel_offset = 0x50,
250 .timer_bit = 1,
251 .max_brightness = 1000,
254 static struct resource tpu21_resources[] = {
255 [0] = {
256 .name = "TPU21",
257 .start = 0xe6620050,
258 .end = 0xe6620075,
259 .flags = IORESOURCE_MEM,
263 static struct platform_device leds_tpu21_device = {
264 .name = "leds-renesas-tpu",
265 .id = 21,
266 .dev = {
267 .platform_data = &led_renesas_tpu21_pdata,
269 .num_resources = ARRAY_SIZE(tpu21_resources),
270 .resource = tpu21_resources,
273 static struct led_renesas_tpu_config led_renesas_tpu30_pdata = {
274 .name = "KEYLED",
275 .pin_gpio_fn = GPIO_FN_TPU3TO0,
276 .pin_gpio = 163,
277 .channel_offset = 0x10,
278 .timer_bit = 0,
279 .max_brightness = 1000,
282 static struct resource tpu30_resources[] = {
283 [0] = {
284 .name = "TPU30",
285 .start = 0xe6630010,
286 .end = 0xe6630035,
287 .flags = IORESOURCE_MEM,
291 static struct platform_device leds_tpu30_device = {
292 .name = "leds-renesas-tpu",
293 .id = 30,
294 .dev = {
295 .platform_data = &led_renesas_tpu30_pdata,
297 .num_resources = ARRAY_SIZE(tpu30_resources),
298 .resource = tpu30_resources,
301 /* Fixed 1.8V regulator to be used by MMCIF */
302 static struct regulator_consumer_supply fixed1v8_power_consumers[] =
304 REGULATOR_SUPPLY("vmmc", "sh_mmcif.0"),
305 REGULATOR_SUPPLY("vqmmc", "sh_mmcif.0"),
308 /* MMCIF */
309 static struct resource mmcif_resources[] = {
310 [0] = {
311 .name = "MMCIF",
312 .start = 0xe6bd0000,
313 .end = 0xe6bd00ff,
314 .flags = IORESOURCE_MEM,
316 [1] = {
317 .start = gic_spi(140),
318 .flags = IORESOURCE_IRQ,
320 [2] = {
321 .start = gic_spi(141),
322 .flags = IORESOURCE_IRQ,
326 static struct sh_mmcif_plat_data mmcif_info = {
327 .ocr = MMC_VDD_165_195,
328 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
331 static struct platform_device mmcif_device = {
332 .name = "sh_mmcif",
333 .id = 0,
334 .dev = {
335 .platform_data = &mmcif_info,
337 .num_resources = ARRAY_SIZE(mmcif_resources),
338 .resource = mmcif_resources,
341 /* Fixed 3.3V regulator to be used by SDHI0 and SDHI1 */
342 static struct regulator_consumer_supply fixed3v3_power_consumers[] =
344 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
345 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
346 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
347 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
350 /* SDHI0 */
351 static struct sh_mobile_sdhi_info sdhi0_info = {
352 .tmio_caps = MMC_CAP_SD_HIGHSPEED,
353 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
356 static struct resource sdhi0_resources[] = {
357 [0] = {
358 .name = "SDHI0",
359 .start = 0xee100000,
360 .end = 0xee1000ff,
361 .flags = IORESOURCE_MEM,
363 [1] = {
364 .start = gic_spi(83),
365 .flags = IORESOURCE_IRQ,
367 [2] = {
368 .start = gic_spi(84),
369 .flags = IORESOURCE_IRQ,
371 [3] = {
372 .start = gic_spi(85),
373 .flags = IORESOURCE_IRQ,
377 static struct platform_device sdhi0_device = {
378 .name = "sh_mobile_sdhi",
379 .id = 0,
380 .num_resources = ARRAY_SIZE(sdhi0_resources),
381 .resource = sdhi0_resources,
382 .dev = {
383 .platform_data = &sdhi0_info,
387 /* SDHI1 */
388 static struct sh_mobile_sdhi_info sdhi1_info = {
389 .tmio_caps = MMC_CAP_NONREMOVABLE | MMC_CAP_SDIO_IRQ,
390 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_HAS_IDLE_WAIT,
393 static struct resource sdhi1_resources[] = {
394 [0] = {
395 .name = "SDHI1",
396 .start = 0xee120000,
397 .end = 0xee1200ff,
398 .flags = IORESOURCE_MEM,
400 [1] = {
401 .start = gic_spi(87),
402 .flags = IORESOURCE_IRQ,
404 [2] = {
405 .start = gic_spi(88),
406 .flags = IORESOURCE_IRQ,
408 [3] = {
409 .start = gic_spi(89),
410 .flags = IORESOURCE_IRQ,
414 static struct platform_device sdhi1_device = {
415 .name = "sh_mobile_sdhi",
416 .id = 1,
417 .num_resources = ARRAY_SIZE(sdhi1_resources),
418 .resource = sdhi1_resources,
419 .dev = {
420 .platform_data = &sdhi1_info,
424 static struct platform_device *kota2_devices[] __initdata = {
425 &eth_device,
426 &keysc_device,
427 &gpio_keys_device,
428 &gpio_leds_device,
429 &leds_tpu12_device,
430 &leds_tpu41_device,
431 &leds_tpu21_device,
432 &leds_tpu30_device,
433 &mmcif_device,
434 &sdhi0_device,
435 &sdhi1_device,
438 static unsigned long pin_pullup_conf[] = {
439 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 0),
442 static const struct pinctrl_map kota2_pinctrl_map[] = {
443 /* KEYSC */
444 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
445 "keysc_in8", "keysc"),
446 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
447 "keysc_out04", "keysc"),
448 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
449 "keysc_out5", "keysc"),
450 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
451 "keysc_out6_0", "keysc"),
452 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
453 "keysc_out7_0", "keysc"),
454 PIN_MAP_MUX_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
455 "keysc_out8_0", "keysc"),
456 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_keysc.0", "pfc-sh73a0",
457 "keysc_in8", pin_pullup_conf),
458 /* MMCIF */
459 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
460 "mmc0_data8_0", "mmc0"),
461 PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
462 "mmc0_ctrl_0", "mmc0"),
463 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
464 "PORT279", pin_pullup_conf),
465 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mmcif.0", "pfc-sh73a0",
466 "mmc0_data8_0", pin_pullup_conf),
467 /* SCIFA2 (UART2) */
468 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0",
469 "scifa2_data_0", "scifa2"),
470 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.2", "pfc-sh73a0",
471 "scifa2_ctrl_0", "scifa2"),
472 /* SCIFA4 (UART1) */
473 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
474 "scifa4_data", "scifa4"),
475 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.4", "pfc-sh73a0",
476 "scifa4_ctrl", "scifa4"),
477 /* SCIFB (BT) */
478 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0",
479 "scifb_data_0", "scifb"),
480 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0",
481 "scifb_clk_0", "scifb"),
482 PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.8", "pfc-sh73a0",
483 "scifb_ctrl_0", "scifb"),
484 /* SDHI0 (microSD) */
485 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
486 "sdhi0_data4", "sdhi0"),
487 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
488 "sdhi0_ctrl", "sdhi0"),
489 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
490 "sdhi0_cd", "sdhi0"),
491 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
492 "sdhi0_data4", pin_pullup_conf),
493 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
494 "PORT256", pin_pullup_conf),
495 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.0", "pfc-sh73a0",
496 "PORT251", pin_pullup_conf),
497 /* SDHI1 (BCM4330) */
498 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
499 "sdhi1_data4", "sdhi1"),
500 PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
501 "sdhi1_ctrl", "sdhi1"),
502 PIN_MAP_CONFIGS_GROUP_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
503 "sdhi1_data4", pin_pullup_conf),
504 PIN_MAP_CONFIGS_PIN_DEFAULT("sh_mobile_sdhi.1", "pfc-sh73a0",
505 "PORT263", pin_pullup_conf),
506 /* SMSC911X */
507 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
508 "bsc_data_0_7", "bsc"),
509 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
510 "bsc_data_8_15", "bsc"),
511 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
512 "bsc_cs5_a", "bsc"),
513 PIN_MAP_MUX_GROUP_DEFAULT("smsc911x.0", "pfc-sh73a0",
514 "bsc_we0", "bsc"),
517 static void __init kota2_init(void)
519 regulator_register_always_on(0, "fixed-1.8V", fixed1v8_power_consumers,
520 ARRAY_SIZE(fixed1v8_power_consumers), 1800000);
521 regulator_register_always_on(1, "fixed-3.3V", fixed3v3_power_consumers,
522 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
523 regulator_register_fixed(2, dummy_supplies, ARRAY_SIZE(dummy_supplies));
525 pinctrl_register_mappings(kota2_pinctrl_map,
526 ARRAY_SIZE(kota2_pinctrl_map));
527 sh73a0_pinmux_init();
529 /* SMSC911X */
530 gpio_request_one(144, GPIOF_IN, NULL); /* PINTA2 */
531 gpio_request_one(145, GPIOF_OUT_INIT_HIGH, NULL); /* RESET */
533 /* MMCIF */
534 gpio_request_one(208, GPIOF_OUT_INIT_HIGH, NULL); /* Reset */
536 #ifdef CONFIG_CACHE_L2X0
537 /* Early BRESP enable, Shared attribute override enable, 64K*8way */
538 l2x0_init(IOMEM(0xf0100000), 0x40460000, 0x82000fff);
539 #endif
540 sh73a0_add_standard_devices();
541 platform_add_devices(kota2_devices, ARRAY_SIZE(kota2_devices));
544 MACHINE_START(KOTA2, "kota2")
545 .smp = smp_ops(sh73a0_smp_ops),
546 .map_io = sh73a0_map_io,
547 .init_early = sh73a0_add_early_devices,
548 .nr_irqs = NR_IRQS_LEGACY,
549 .init_irq = sh73a0_init_irq,
550 .init_machine = kota2_init,
551 .init_late = shmobile_init_late,
552 .init_time = sh73a0_earlytimer_init,
553 MACHINE_END