1 /* linux/arch/arm/mach-s5pv210/mach-aquila.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/init.h>
14 #include <linux/serial_core.h>
16 #include <linux/i2c.h>
17 #include <linux/i2c-gpio.h>
18 #include <linux/mfd/max8998.h>
19 #include <linux/mfd/wm8994/pdata.h>
20 #include <linux/regulator/fixed.h>
21 #include <linux/gpio_keys.h>
22 #include <linux/input.h>
23 #include <linux/gpio.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach/map.h>
27 #include <asm/setup.h>
28 #include <asm/mach-types.h>
31 #include <mach/regs-clock.h>
32 #include <mach/regs-fb.h>
34 #include <plat/gpio-cfg.h>
35 #include <plat/regs-serial.h>
36 #include <plat/s5pv210.h>
37 #include <plat/devs.h>
40 #include <plat/fimc-core.h>
41 #include <plat/sdhci.h>
43 /* Following are default values for UCON, ULCON and UFCON UART registers */
44 #define AQUILA_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
45 S3C2410_UCON_RXILEVEL | \
46 S3C2410_UCON_TXIRQMODE | \
47 S3C2410_UCON_RXIRQMODE | \
48 S3C2410_UCON_RXFIFO_TOI | \
49 S3C2443_UCON_RXERR_IRQEN)
51 #define AQUILA_ULCON_DEFAULT S3C2410_LCON_CS8
53 #define AQUILA_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
55 static struct s3c2410_uartcfg aquila_uartcfgs
[] __initdata
= {
59 .ucon
= AQUILA_UCON_DEFAULT
,
60 .ulcon
= AQUILA_ULCON_DEFAULT
,
62 * Actually UART0 can support 256 bytes fifo, but aquila board
63 * supports 128 bytes fifo because of initial chip bug
65 .ufcon
= AQUILA_UFCON_DEFAULT
|
66 S5PV210_UFCON_TXTRIG128
| S5PV210_UFCON_RXTRIG128
,
71 .ucon
= AQUILA_UCON_DEFAULT
,
72 .ulcon
= AQUILA_ULCON_DEFAULT
,
73 .ufcon
= AQUILA_UFCON_DEFAULT
|
74 S5PV210_UFCON_TXTRIG64
| S5PV210_UFCON_RXTRIG64
,
79 .ucon
= AQUILA_UCON_DEFAULT
,
80 .ulcon
= AQUILA_ULCON_DEFAULT
,
81 .ufcon
= AQUILA_UFCON_DEFAULT
|
82 S5PV210_UFCON_TXTRIG16
| S5PV210_UFCON_RXTRIG16
,
87 .ucon
= AQUILA_UCON_DEFAULT
,
88 .ulcon
= AQUILA_ULCON_DEFAULT
,
89 .ufcon
= AQUILA_UFCON_DEFAULT
|
90 S5PV210_UFCON_TXTRIG16
| S5PV210_UFCON_RXTRIG16
,
95 static struct s3c_fb_pd_win aquila_fb_win0
= {
110 static struct s3c_fb_pd_win aquila_fb_win1
= {
125 static struct s3c_fb_platdata aquila_lcd_pdata __initdata
= {
126 .win
[0] = &aquila_fb_win0
,
127 .win
[1] = &aquila_fb_win1
,
128 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
,
129 .vidcon1
= VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
|
130 VIDCON1_INV_VCLK
| VIDCON1_INV_VDEN
,
131 .setup_gpio
= s5pv210_fb_gpio_setup_24bpp
,
134 /* MAX8998 regulators */
135 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
137 static struct regulator_init_data aquila_ldo2_data
= {
139 .name
= "VALIVE_1.1V",
150 static struct regulator_init_data aquila_ldo3_data
= {
152 .name
= "VUSB/MIPI_1.1V",
160 static struct regulator_init_data aquila_ldo4_data
= {
169 static struct regulator_init_data aquila_ldo5_data
= {
178 static struct regulator_init_data aquila_ldo6_data
= {
187 static struct regulator_init_data aquila_ldo7_data
= {
198 static struct regulator_init_data aquila_ldo8_data
= {
200 .name
= "VUSB/VADC_3.3V",
208 static struct regulator_init_data aquila_ldo9_data
= {
210 .name
= "VCC/VCAM_2.8V",
218 static struct regulator_init_data aquila_ldo10_data
= {
228 static struct regulator_init_data aquila_ldo11_data
= {
230 .name
= "CAM_IO_2.8V",
238 static struct regulator_init_data aquila_ldo12_data
= {
240 .name
= "CAM_ISP_1.2V",
248 static struct regulator_init_data aquila_ldo13_data
= {
250 .name
= "CAM_A_2.8V",
258 static struct regulator_init_data aquila_ldo14_data
= {
260 .name
= "CAM_CIF_1.8V",
268 static struct regulator_init_data aquila_ldo15_data
= {
270 .name
= "CAM_AF_3.3V",
278 static struct regulator_init_data aquila_ldo16_data
= {
280 .name
= "VMIPI_1.8V",
288 static struct regulator_init_data aquila_ldo17_data
= {
290 .name
= "CAM_8M_1.8V",
299 static struct regulator_consumer_supply buck1_consumer
[] = {
300 { .supply
= "vddarm", },
303 static struct regulator_consumer_supply buck2_consumer
[] = {
304 { .supply
= "vddint", },
307 static struct regulator_init_data aquila_buck1_data
= {
313 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
314 REGULATOR_CHANGE_STATUS
,
316 .num_consumer_supplies
= ARRAY_SIZE(buck1_consumer
),
317 .consumer_supplies
= buck1_consumer
,
320 static struct regulator_init_data aquila_buck2_data
= {
326 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
327 REGULATOR_CHANGE_STATUS
,
329 .num_consumer_supplies
= ARRAY_SIZE(buck2_consumer
),
330 .consumer_supplies
= buck2_consumer
,
333 static struct regulator_init_data aquila_buck3_data
= {
345 static struct regulator_init_data aquila_buck4_data
= {
347 .name
= "CAM_CORE_1.2V",
355 static struct max8998_regulator_data aquila_regulators
[] = {
356 { MAX8998_LDO2
, &aquila_ldo2_data
},
357 { MAX8998_LDO3
, &aquila_ldo3_data
},
358 { MAX8998_LDO4
, &aquila_ldo4_data
},
359 { MAX8998_LDO5
, &aquila_ldo5_data
},
360 { MAX8998_LDO6
, &aquila_ldo6_data
},
361 { MAX8998_LDO7
, &aquila_ldo7_data
},
362 { MAX8998_LDO8
, &aquila_ldo8_data
},
363 { MAX8998_LDO9
, &aquila_ldo9_data
},
364 { MAX8998_LDO10
, &aquila_ldo10_data
},
365 { MAX8998_LDO11
, &aquila_ldo11_data
},
366 { MAX8998_LDO12
, &aquila_ldo12_data
},
367 { MAX8998_LDO13
, &aquila_ldo13_data
},
368 { MAX8998_LDO14
, &aquila_ldo14_data
},
369 { MAX8998_LDO15
, &aquila_ldo15_data
},
370 { MAX8998_LDO16
, &aquila_ldo16_data
},
371 { MAX8998_LDO17
, &aquila_ldo17_data
},
372 { MAX8998_BUCK1
, &aquila_buck1_data
},
373 { MAX8998_BUCK2
, &aquila_buck2_data
},
374 { MAX8998_BUCK3
, &aquila_buck3_data
},
375 { MAX8998_BUCK4
, &aquila_buck4_data
},
378 static struct max8998_platform_data aquila_max8998_pdata
= {
379 .num_regulators
= ARRAY_SIZE(aquila_regulators
),
380 .regulators
= aquila_regulators
,
381 .buck1_set1
= S5PV210_GPH0(3),
382 .buck1_set2
= S5PV210_GPH0(4),
383 .buck2_set3
= S5PV210_GPH0(5),
384 .buck1_max_voltage1
= 1200000,
385 .buck1_max_voltage2
= 1200000,
386 .buck2_max_voltage
= 1200000,
390 static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies
[] = {
392 .dev_name
= "5-001a",
395 .dev_name
= "5-001a",
398 .dev_name
= "5-001a",
403 static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies
[] = {
405 .dev_name
= "5-001a",
408 .dev_name
= "5-001a",
413 static struct regulator_init_data wm8994_fixed_voltage0_init_data
= {
417 .num_consumer_supplies
= ARRAY_SIZE(wm8994_fixed_voltage0_supplies
),
418 .consumer_supplies
= wm8994_fixed_voltage0_supplies
,
421 static struct regulator_init_data wm8994_fixed_voltage1_init_data
= {
425 .num_consumer_supplies
= ARRAY_SIZE(wm8994_fixed_voltage1_supplies
),
426 .consumer_supplies
= wm8994_fixed_voltage1_supplies
,
429 static struct fixed_voltage_config wm8994_fixed_voltage0_config
= {
430 .supply_name
= "VCC_1.8V_PDA",
431 .microvolts
= 1800000,
433 .init_data
= &wm8994_fixed_voltage0_init_data
,
436 static struct fixed_voltage_config wm8994_fixed_voltage1_config
= {
437 .supply_name
= "V_BAT",
438 .microvolts
= 3700000,
440 .init_data
= &wm8994_fixed_voltage1_init_data
,
443 static struct platform_device wm8994_fixed_voltage0
= {
444 .name
= "reg-fixed-voltage",
447 .platform_data
= &wm8994_fixed_voltage0_config
,
451 static struct platform_device wm8994_fixed_voltage1
= {
452 .name
= "reg-fixed-voltage",
455 .platform_data
= &wm8994_fixed_voltage1_config
,
459 static struct regulator_consumer_supply wm8994_avdd1_supply
= {
460 .dev_name
= "5-001a",
464 static struct regulator_consumer_supply wm8994_dcvdd_supply
= {
465 .dev_name
= "5-001a",
469 static struct regulator_init_data wm8994_ldo1_data
= {
471 .name
= "AVDD1_3.0V",
472 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
474 .num_consumer_supplies
= 1,
475 .consumer_supplies
= &wm8994_avdd1_supply
,
478 static struct regulator_init_data wm8994_ldo2_data
= {
480 .name
= "DCVDD_1.0V",
482 .num_consumer_supplies
= 1,
483 .consumer_supplies
= &wm8994_dcvdd_supply
,
486 static struct wm8994_pdata wm8994_platform_data
= {
487 /* configure gpio1 function: 0x0001(Logic level input/output) */
488 .gpio_defaults
[0] = 0x0001,
489 /* configure gpio3/4/5/7 function for AIF2 voice */
490 .gpio_defaults
[2] = 0x8100,
491 .gpio_defaults
[3] = 0x8100,
492 .gpio_defaults
[4] = 0x8100,
493 .gpio_defaults
[6] = 0x0100,
494 /* configure gpio8/9/10/11 function for AIF3 BT */
495 .gpio_defaults
[7] = 0x8100,
496 .gpio_defaults
[8] = 0x0100,
497 .gpio_defaults
[9] = 0x0100,
498 .gpio_defaults
[10] = 0x0100,
499 .ldo
[0] = { S5PV210_MP03(6), NULL
, &wm8994_ldo1_data
}, /* XM0FRNB_2 */
500 .ldo
[1] = { 0, NULL
, &wm8994_ldo2_data
},
504 #define AP_I2C_GPIO_PMIC_BUS_4 4
505 static struct i2c_gpio_platform_data aquila_i2c_gpio_pmic_data
= {
506 .sda_pin
= S5PV210_GPJ4(0), /* XMSMCSN */
507 .scl_pin
= S5PV210_GPJ4(3), /* XMSMIRQN */
510 static struct platform_device aquila_i2c_gpio_pmic
= {
512 .id
= AP_I2C_GPIO_PMIC_BUS_4
,
514 .platform_data
= &aquila_i2c_gpio_pmic_data
,
518 static struct i2c_board_info i2c_gpio_pmic_devs
[] __initdata
= {
519 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
521 /* 0xCC when SRAD = 0 */
522 I2C_BOARD_INFO("max8998", 0xCC >> 1),
523 .platform_data
= &aquila_max8998_pdata
,
528 /* GPIO I2C AP 1.8V */
529 #define AP_I2C_GPIO_BUS_5 5
530 static struct i2c_gpio_platform_data aquila_i2c_gpio5_data
= {
531 .sda_pin
= S5PV210_MP05(3), /* XM0ADDR_11 */
532 .scl_pin
= S5PV210_MP05(2), /* XM0ADDR_10 */
535 static struct platform_device aquila_i2c_gpio5
= {
537 .id
= AP_I2C_GPIO_BUS_5
,
539 .platform_data
= &aquila_i2c_gpio5_data
,
543 static struct i2c_board_info i2c_gpio5_devs
[] __initdata
= {
545 /* CS/ADDR = low 0x34 (FYI: high = 0x36) */
546 I2C_BOARD_INFO("wm8994", 0x1a),
547 .platform_data
= &wm8994_platform_data
,
551 /* PMIC Power button */
552 static struct gpio_keys_button aquila_gpio_keys_table
[] = {
555 .gpio
= S5PV210_GPH2(6),
556 .desc
= "gpio-keys: KEY_POWER",
560 .debounce_interval
= 1,
564 static struct gpio_keys_platform_data aquila_gpio_keys_data
= {
565 .buttons
= aquila_gpio_keys_table
,
566 .nbuttons
= ARRAY_SIZE(aquila_gpio_keys_table
),
569 static struct platform_device aquila_device_gpiokeys
= {
572 .platform_data
= &aquila_gpio_keys_data
,
576 static void __init
aquila_pmic_init(void)
578 /* AP_PMIC_IRQ: EINT7 */
579 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
580 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP
);
583 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
584 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP
);
588 static struct s3c_sdhci_platdata aquila_hsmmc0_data __initdata
= {
590 .cd_type
= S3C_SDHCI_CD_PERMANENT
,
594 static struct s3c_sdhci_platdata aquila_hsmmc1_data __initdata
= {
596 .cd_type
= S3C_SDHCI_CD_EXTERNAL
,
597 /* ext_cd_{init,cleanup} callbacks will be added later */
601 #define AQUILA_EXT_FLASH_EN S5PV210_MP05(4)
602 #define AQUILA_EXT_FLASH_CD S5PV210_GPH3(4)
603 static struct s3c_sdhci_platdata aquila_hsmmc2_data __initdata
= {
605 .cd_type
= S3C_SDHCI_CD_GPIO
,
606 .ext_cd_gpio
= AQUILA_EXT_FLASH_CD
,
607 .ext_cd_gpio_invert
= 1,
610 static void aquila_setup_sdhci(void)
612 gpio_request(AQUILA_EXT_FLASH_EN
, "FLASH_EN");
613 gpio_direction_output(AQUILA_EXT_FLASH_EN
, 1);
615 s3c_sdhci0_set_platdata(&aquila_hsmmc0_data
);
616 s3c_sdhci1_set_platdata(&aquila_hsmmc1_data
);
617 s3c_sdhci2_set_platdata(&aquila_hsmmc2_data
);
620 static struct platform_device
*aquila_devices
[] __initdata
= {
621 &aquila_i2c_gpio_pmic
,
623 &aquila_device_gpiokeys
,
632 &s5pv210_device_iis0
,
633 &wm8994_fixed_voltage0
,
634 &wm8994_fixed_voltage1
,
637 static void __init
aquila_sound_init(void)
643 * The Aquila board have a oscillator which provide main clock
644 * to WM8994 codec. The oscillator provide 24MHz clock to WM8994
645 * clock. Set gpio setting of "CODEC_XTAL_EN" to enable a oscillator.
647 gpio
= S5PV210_GPH3(2); /* XEINT_26 */
648 gpio_request(gpio
, "CODEC_XTAL_EN");
649 s3c_gpio_cfgpin(gpio
, S3C_GPIO_OUTPUT
);
650 s3c_gpio_setpull(gpio
, S3C_GPIO_PULL_NONE
);
652 /* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
653 * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
654 * because it needs 24MHz clock to operate WM8994 codec.
656 __raw_writel(__raw_readl(S5P_OTHERS
) | (0x3 << 8), S5P_OTHERS
);
659 static void __init
aquila_map_io(void)
661 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
662 s3c24xx_init_clocks(24000000);
663 s3c24xx_init_uarts(aquila_uartcfgs
, ARRAY_SIZE(aquila_uartcfgs
));
666 static void __init
aquila_machine_init(void)
670 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4
, i2c_gpio_pmic_devs
,
671 ARRAY_SIZE(i2c_gpio_pmic_devs
));
673 aquila_setup_sdhci();
675 s3c_fimc_setname(0, "s5p-fimc");
676 s3c_fimc_setname(1, "s5p-fimc");
677 s3c_fimc_setname(2, "s5p-fimc");
681 i2c_register_board_info(AP_I2C_GPIO_BUS_5
, i2c_gpio5_devs
,
682 ARRAY_SIZE(i2c_gpio5_devs
));
685 s3c_fb_set_platdata(&aquila_lcd_pdata
);
687 platform_add_devices(aquila_devices
, ARRAY_SIZE(aquila_devices
));
690 MACHINE_START(AQUILA
, "Aquila")
692 Marek Szyprowski <m.szyprowski@samsung.com>
693 Kyungmin Park <kyungmin.park@samsung.com> */
694 .boot_params
= S5P_PA_SDRAM
+ 0x100,
695 .init_irq
= s5pv210_init_irq
,
696 .map_io
= aquila_map_io
,
697 .init_machine
= aquila_machine_init
,
698 .timer
= &s3c24xx_timer
,