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>
15 #include <linux/serial_s3c.h>
17 #include <linux/i2c.h>
18 #include <linux/i2c-gpio.h>
19 #include <linux/mfd/max8998.h>
20 #include <linux/mfd/wm8994/pdata.h>
21 #include <linux/regulator/fixed.h>
22 #include <linux/gpio_keys.h>
23 #include <linux/input.h>
24 #include <linux/gpio.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
28 #include <asm/setup.h>
29 #include <asm/mach-types.h>
31 #include <video/samsung_fimd.h>
33 #include <mach/regs-clock.h>
35 #include <plat/gpio-cfg.h>
36 #include <plat/devs.h>
39 #include <plat/fimc-core.h>
40 #include <plat/sdhci.h>
41 #include <plat/samsung-time.h>
45 /* Following are default values for UCON, ULCON and UFCON UART registers */
46 #define AQUILA_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
47 S3C2410_UCON_RXILEVEL | \
48 S3C2410_UCON_TXIRQMODE | \
49 S3C2410_UCON_RXIRQMODE | \
50 S3C2410_UCON_RXFIFO_TOI | \
51 S3C2443_UCON_RXERR_IRQEN)
53 #define AQUILA_ULCON_DEFAULT S3C2410_LCON_CS8
55 #define AQUILA_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
57 static struct s3c2410_uartcfg aquila_uartcfgs
[] __initdata
= {
61 .ucon
= AQUILA_UCON_DEFAULT
,
62 .ulcon
= AQUILA_ULCON_DEFAULT
,
64 * Actually UART0 can support 256 bytes fifo, but aquila board
65 * supports 128 bytes fifo because of initial chip bug
67 .ufcon
= AQUILA_UFCON_DEFAULT
|
68 S5PV210_UFCON_TXTRIG128
| S5PV210_UFCON_RXTRIG128
,
73 .ucon
= AQUILA_UCON_DEFAULT
,
74 .ulcon
= AQUILA_ULCON_DEFAULT
,
75 .ufcon
= AQUILA_UFCON_DEFAULT
|
76 S5PV210_UFCON_TXTRIG64
| S5PV210_UFCON_RXTRIG64
,
81 .ucon
= AQUILA_UCON_DEFAULT
,
82 .ulcon
= AQUILA_ULCON_DEFAULT
,
83 .ufcon
= AQUILA_UFCON_DEFAULT
|
84 S5PV210_UFCON_TXTRIG16
| S5PV210_UFCON_RXTRIG16
,
89 .ucon
= AQUILA_UCON_DEFAULT
,
90 .ulcon
= AQUILA_ULCON_DEFAULT
,
91 .ufcon
= AQUILA_UFCON_DEFAULT
|
92 S5PV210_UFCON_TXTRIG16
| S5PV210_UFCON_RXTRIG16
,
97 static struct s3c_fb_pd_win aquila_fb_win0
= {
104 static struct s3c_fb_pd_win aquila_fb_win1
= {
111 static struct fb_videomode aquila_lcd_timing
= {
122 static struct s3c_fb_platdata aquila_lcd_pdata __initdata
= {
123 .win
[0] = &aquila_fb_win0
,
124 .win
[1] = &aquila_fb_win1
,
125 .vtiming
= &aquila_lcd_timing
,
126 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
,
127 .vidcon1
= VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
|
128 VIDCON1_INV_VCLK
| VIDCON1_INV_VDEN
,
129 .setup_gpio
= s5pv210_fb_gpio_setup_24bpp
,
132 /* MAX8998 regulators */
133 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
135 static struct regulator_init_data aquila_ldo2_data
= {
137 .name
= "VALIVE_1.1V",
148 static struct regulator_init_data aquila_ldo3_data
= {
150 .name
= "VUSB+MIPI_1.1V",
158 static struct regulator_init_data aquila_ldo4_data
= {
167 static struct regulator_init_data aquila_ldo5_data
= {
176 static struct regulator_init_data aquila_ldo6_data
= {
185 static struct regulator_init_data aquila_ldo7_data
= {
196 static struct regulator_init_data aquila_ldo8_data
= {
198 .name
= "VUSB+VADC_3.3V",
206 static struct regulator_init_data aquila_ldo9_data
= {
208 .name
= "VCC+VCAM_2.8V",
216 static struct regulator_init_data aquila_ldo10_data
= {
226 static struct regulator_init_data aquila_ldo11_data
= {
228 .name
= "CAM_IO_2.8V",
236 static struct regulator_init_data aquila_ldo12_data
= {
238 .name
= "CAM_ISP_1.2V",
246 static struct regulator_init_data aquila_ldo13_data
= {
248 .name
= "CAM_A_2.8V",
256 static struct regulator_init_data aquila_ldo14_data
= {
258 .name
= "CAM_CIF_1.8V",
266 static struct regulator_init_data aquila_ldo15_data
= {
268 .name
= "CAM_AF_3.3V",
276 static struct regulator_init_data aquila_ldo16_data
= {
278 .name
= "VMIPI_1.8V",
286 static struct regulator_init_data aquila_ldo17_data
= {
288 .name
= "CAM_8M_1.8V",
297 static struct regulator_consumer_supply buck1_consumer
=
298 REGULATOR_SUPPLY("vddarm", NULL
);
300 static struct regulator_consumer_supply buck2_consumer
=
301 REGULATOR_SUPPLY("vddint", NULL
);
303 static struct regulator_init_data aquila_buck1_data
= {
309 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
310 REGULATOR_CHANGE_STATUS
,
312 .num_consumer_supplies
= 1,
313 .consumer_supplies
= &buck1_consumer
,
316 static struct regulator_init_data aquila_buck2_data
= {
322 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
323 REGULATOR_CHANGE_STATUS
,
325 .num_consumer_supplies
= 1,
326 .consumer_supplies
= &buck2_consumer
,
329 static struct regulator_init_data aquila_buck3_data
= {
341 static struct regulator_init_data aquila_buck4_data
= {
343 .name
= "CAM_CORE_1.2V",
351 static struct max8998_regulator_data aquila_regulators
[] = {
352 { MAX8998_LDO2
, &aquila_ldo2_data
},
353 { MAX8998_LDO3
, &aquila_ldo3_data
},
354 { MAX8998_LDO4
, &aquila_ldo4_data
},
355 { MAX8998_LDO5
, &aquila_ldo5_data
},
356 { MAX8998_LDO6
, &aquila_ldo6_data
},
357 { MAX8998_LDO7
, &aquila_ldo7_data
},
358 { MAX8998_LDO8
, &aquila_ldo8_data
},
359 { MAX8998_LDO9
, &aquila_ldo9_data
},
360 { MAX8998_LDO10
, &aquila_ldo10_data
},
361 { MAX8998_LDO11
, &aquila_ldo11_data
},
362 { MAX8998_LDO12
, &aquila_ldo12_data
},
363 { MAX8998_LDO13
, &aquila_ldo13_data
},
364 { MAX8998_LDO14
, &aquila_ldo14_data
},
365 { MAX8998_LDO15
, &aquila_ldo15_data
},
366 { MAX8998_LDO16
, &aquila_ldo16_data
},
367 { MAX8998_LDO17
, &aquila_ldo17_data
},
368 { MAX8998_BUCK1
, &aquila_buck1_data
},
369 { MAX8998_BUCK2
, &aquila_buck2_data
},
370 { MAX8998_BUCK3
, &aquila_buck3_data
},
371 { MAX8998_BUCK4
, &aquila_buck4_data
},
374 static struct max8998_platform_data aquila_max8998_pdata
= {
375 .num_regulators
= ARRAY_SIZE(aquila_regulators
),
376 .regulators
= aquila_regulators
,
377 .buck1_set1
= S5PV210_GPH0(3),
378 .buck1_set2
= S5PV210_GPH0(4),
379 .buck2_set3
= S5PV210_GPH0(5),
380 .buck1_voltage
= { 1200000, 1200000, 1200000, 1200000 },
381 .buck2_voltage
= { 1200000, 1200000 },
385 static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies
[] = {
386 REGULATOR_SUPPLY("DBVDD", "5-001a"),
387 REGULATOR_SUPPLY("AVDD2", "5-001a"),
388 REGULATOR_SUPPLY("CPVDD", "5-001a"),
391 static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies
[] = {
392 REGULATOR_SUPPLY("SPKVDD1", "5-001a"),
393 REGULATOR_SUPPLY("SPKVDD2", "5-001a"),
396 static struct regulator_init_data wm8994_fixed_voltage0_init_data
= {
400 .num_consumer_supplies
= ARRAY_SIZE(wm8994_fixed_voltage0_supplies
),
401 .consumer_supplies
= wm8994_fixed_voltage0_supplies
,
404 static struct regulator_init_data wm8994_fixed_voltage1_init_data
= {
408 .num_consumer_supplies
= ARRAY_SIZE(wm8994_fixed_voltage1_supplies
),
409 .consumer_supplies
= wm8994_fixed_voltage1_supplies
,
412 static struct fixed_voltage_config wm8994_fixed_voltage0_config
= {
413 .supply_name
= "VCC_1.8V_PDA",
414 .microvolts
= 1800000,
416 .init_data
= &wm8994_fixed_voltage0_init_data
,
419 static struct fixed_voltage_config wm8994_fixed_voltage1_config
= {
420 .supply_name
= "V_BAT",
421 .microvolts
= 3700000,
423 .init_data
= &wm8994_fixed_voltage1_init_data
,
426 static struct platform_device wm8994_fixed_voltage0
= {
427 .name
= "reg-fixed-voltage",
430 .platform_data
= &wm8994_fixed_voltage0_config
,
434 static struct platform_device wm8994_fixed_voltage1
= {
435 .name
= "reg-fixed-voltage",
438 .platform_data
= &wm8994_fixed_voltage1_config
,
442 static struct regulator_consumer_supply wm8994_avdd1_supply
=
443 REGULATOR_SUPPLY("AVDD1", "5-001a");
445 static struct regulator_consumer_supply wm8994_dcvdd_supply
=
446 REGULATOR_SUPPLY("DCVDD", "5-001a");
448 static struct regulator_init_data wm8994_ldo1_data
= {
450 .name
= "AVDD1_3.0V",
451 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
453 .num_consumer_supplies
= 1,
454 .consumer_supplies
= &wm8994_avdd1_supply
,
457 static struct regulator_init_data wm8994_ldo2_data
= {
459 .name
= "DCVDD_1.0V",
461 .num_consumer_supplies
= 1,
462 .consumer_supplies
= &wm8994_dcvdd_supply
,
465 static struct wm8994_pdata wm8994_platform_data
= {
466 /* configure gpio1 function: 0x0001(Logic level input/output) */
467 .gpio_defaults
[0] = 0x0001,
468 /* configure gpio3/4/5/7 function for AIF2 voice */
469 .gpio_defaults
[2] = 0x8100,
470 .gpio_defaults
[3] = 0x8100,
471 .gpio_defaults
[4] = 0x8100,
472 .gpio_defaults
[6] = 0x0100,
473 /* configure gpio8/9/10/11 function for AIF3 BT */
474 .gpio_defaults
[7] = 0x8100,
475 .gpio_defaults
[8] = 0x0100,
476 .gpio_defaults
[9] = 0x0100,
477 .gpio_defaults
[10] = 0x0100,
478 .ldo
[0] = { S5PV210_MP03(6), &wm8994_ldo1_data
}, /* XM0FRNB_2 */
479 .ldo
[1] = { 0, &wm8994_ldo2_data
},
483 #define AP_I2C_GPIO_PMIC_BUS_4 4
484 static struct i2c_gpio_platform_data aquila_i2c_gpio_pmic_data
= {
485 .sda_pin
= S5PV210_GPJ4(0), /* XMSMCSN */
486 .scl_pin
= S5PV210_GPJ4(3), /* XMSMIRQN */
489 static struct platform_device aquila_i2c_gpio_pmic
= {
491 .id
= AP_I2C_GPIO_PMIC_BUS_4
,
493 .platform_data
= &aquila_i2c_gpio_pmic_data
,
497 static struct i2c_board_info i2c_gpio_pmic_devs
[] __initdata
= {
498 #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
500 /* 0xCC when SRAD = 0 */
501 I2C_BOARD_INFO("max8998", 0xCC >> 1),
502 .platform_data
= &aquila_max8998_pdata
,
507 /* GPIO I2C AP 1.8V */
508 #define AP_I2C_GPIO_BUS_5 5
509 static struct i2c_gpio_platform_data aquila_i2c_gpio5_data
= {
510 .sda_pin
= S5PV210_MP05(3), /* XM0ADDR_11 */
511 .scl_pin
= S5PV210_MP05(2), /* XM0ADDR_10 */
514 static struct platform_device aquila_i2c_gpio5
= {
516 .id
= AP_I2C_GPIO_BUS_5
,
518 .platform_data
= &aquila_i2c_gpio5_data
,
522 static struct i2c_board_info i2c_gpio5_devs
[] __initdata
= {
524 /* CS/ADDR = low 0x34 (FYI: high = 0x36) */
525 I2C_BOARD_INFO("wm8994", 0x1a),
526 .platform_data
= &wm8994_platform_data
,
530 /* PMIC Power button */
531 static struct gpio_keys_button aquila_gpio_keys_table
[] = {
534 .gpio
= S5PV210_GPH2(6),
535 .desc
= "gpio-keys: KEY_POWER",
539 .debounce_interval
= 1,
543 static struct gpio_keys_platform_data aquila_gpio_keys_data
= {
544 .buttons
= aquila_gpio_keys_table
,
545 .nbuttons
= ARRAY_SIZE(aquila_gpio_keys_table
),
548 static struct platform_device aquila_device_gpiokeys
= {
551 .platform_data
= &aquila_gpio_keys_data
,
555 static void __init
aquila_pmic_init(void)
557 /* AP_PMIC_IRQ: EINT7 */
558 s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
559 s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP
);
562 s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
563 s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP
);
567 static struct s3c_sdhci_platdata aquila_hsmmc0_data __initdata
= {
569 .cd_type
= S3C_SDHCI_CD_PERMANENT
,
573 static struct s3c_sdhci_platdata aquila_hsmmc1_data __initdata
= {
575 .cd_type
= S3C_SDHCI_CD_EXTERNAL
,
576 /* ext_cd_{init,cleanup} callbacks will be added later */
580 #define AQUILA_EXT_FLASH_EN S5PV210_MP05(4)
581 #define AQUILA_EXT_FLASH_CD S5PV210_GPH3(4)
582 static struct s3c_sdhci_platdata aquila_hsmmc2_data __initdata
= {
584 .cd_type
= S3C_SDHCI_CD_GPIO
,
585 .ext_cd_gpio
= AQUILA_EXT_FLASH_CD
,
586 .ext_cd_gpio_invert
= 1,
589 static void aquila_setup_sdhci(void)
591 gpio_request_one(AQUILA_EXT_FLASH_EN
, GPIOF_OUT_INIT_HIGH
, "FLASH_EN");
593 s3c_sdhci0_set_platdata(&aquila_hsmmc0_data
);
594 s3c_sdhci1_set_platdata(&aquila_hsmmc1_data
);
595 s3c_sdhci2_set_platdata(&aquila_hsmmc2_data
);
599 static struct platform_device aquila_device_audio
= {
600 .name
= "smdk-audio",
604 static struct platform_device
*aquila_devices
[] __initdata
= {
605 &aquila_i2c_gpio_pmic
,
607 &aquila_device_gpiokeys
,
608 &aquila_device_audio
,
618 &s5pv210_device_iis0
,
619 &wm8994_fixed_voltage0
,
620 &wm8994_fixed_voltage1
,
623 static void __init
aquila_sound_init(void)
629 * The Aquila board have a oscillator which provide main clock
630 * to WM8994 codec. The oscillator provide 24MHz clock to WM8994
631 * clock. Set gpio setting of "CODEC_XTAL_EN" to enable a oscillator.
633 gpio
= S5PV210_GPH3(2); /* XEINT_26 */
634 gpio_request(gpio
, "CODEC_XTAL_EN");
635 s3c_gpio_cfgpin(gpio
, S3C_GPIO_OUTPUT
);
636 s3c_gpio_setpull(gpio
, S3C_GPIO_PULL_NONE
);
638 /* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
639 * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
640 * because it needs 24MHz clock to operate WM8994 codec.
642 __raw_writel(__raw_readl(S5P_OTHERS
) | (0x3 << 8), S5P_OTHERS
);
645 static void __init
aquila_map_io(void)
647 s5pv210_init_io(NULL
, 0);
648 s3c24xx_init_clocks(24000000);
649 s3c24xx_init_uarts(aquila_uartcfgs
, ARRAY_SIZE(aquila_uartcfgs
));
650 samsung_set_timer_source(SAMSUNG_PWM3
, SAMSUNG_PWM4
);
653 static void __init
aquila_machine_init(void)
657 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4
, i2c_gpio_pmic_devs
,
658 ARRAY_SIZE(i2c_gpio_pmic_devs
));
660 aquila_setup_sdhci();
662 s3c_fimc_setname(0, "s5p-fimc");
663 s3c_fimc_setname(1, "s5p-fimc");
664 s3c_fimc_setname(2, "s5p-fimc");
668 i2c_register_board_info(AP_I2C_GPIO_BUS_5
, i2c_gpio5_devs
,
669 ARRAY_SIZE(i2c_gpio5_devs
));
672 s3c_fb_set_platdata(&aquila_lcd_pdata
);
674 platform_add_devices(aquila_devices
, ARRAY_SIZE(aquila_devices
));
677 MACHINE_START(AQUILA
, "Aquila")
679 Marek Szyprowski <m.szyprowski@samsung.com>
680 Kyungmin Park <kyungmin.park@samsung.com> */
681 .atag_offset
= 0x100,
682 .init_irq
= s5pv210_init_irq
,
683 .map_io
= aquila_map_io
,
684 .init_machine
= aquila_machine_init
,
685 .init_time
= samsung_timer_init
,
686 .restart
= s5pv210_restart
,