1 /* linux/arch/arm/mach-exynos4/mach-universal_c210.c
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
10 #include <linux/platform_device.h>
11 #include <linux/serial_core.h>
12 #include <linux/input.h>
13 #include <linux/i2c.h>
14 #include <linux/gpio_keys.h>
15 #include <linux/gpio.h>
16 #include <linux/mfd/max8998.h>
17 #include <linux/regulator/machine.h>
18 #include <linux/regulator/fixed.h>
19 #include <linux/regulator/max8952.h>
20 #include <linux/mmc/host.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach-types.h>
25 #include <plat/regs-serial.h>
26 #include <plat/exynos4.h>
28 #include <plat/devs.h>
30 #include <plat/sdhci.h>
34 /* Following are default values for UCON, ULCON and UFCON UART registers */
35 #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
36 S3C2410_UCON_RXILEVEL | \
37 S3C2410_UCON_TXIRQMODE | \
38 S3C2410_UCON_RXIRQMODE | \
39 S3C2410_UCON_RXFIFO_TOI | \
40 S3C2443_UCON_RXERR_IRQEN)
42 #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
44 #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
45 S5PV210_UFCON_TXTRIG256 | \
46 S5PV210_UFCON_RXTRIG256)
48 static struct s3c2410_uartcfg universal_uartcfgs
[] __initdata
= {
51 .ucon
= UNIVERSAL_UCON_DEFAULT
,
52 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
53 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
57 .ucon
= UNIVERSAL_UCON_DEFAULT
,
58 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
59 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
63 .ucon
= UNIVERSAL_UCON_DEFAULT
,
64 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
65 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
69 .ucon
= UNIVERSAL_UCON_DEFAULT
,
70 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
71 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
75 static struct regulator_consumer_supply max8952_consumer
=
76 REGULATOR_SUPPLY("vddarm", NULL
);
78 static struct max8952_platform_data universal_max8952_pdata __initdata
= {
79 .gpio_vid0
= EXYNOS4_GPX0(3),
80 .gpio_vid1
= EXYNOS4_GPX0(4),
81 .gpio_en
= -1, /* Not controllable, set "Always High" */
82 .default_mode
= 0, /* vid0 = 0, vid1 = 0 */
83 .dvs_mode
= { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */
84 .sync_freq
= 0, /* default: fastest */
85 .ramp_speed
= 0, /* default: fastest */
92 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
,
96 .num_consumer_supplies
= 1,
97 .consumer_supplies
= &max8952_consumer
,
101 static struct regulator_consumer_supply lp3974_buck1_consumer
=
102 REGULATOR_SUPPLY("vddint", NULL
);
104 static struct regulator_consumer_supply lp3974_buck2_consumer
=
105 REGULATOR_SUPPLY("vddg3d", NULL
);
107 static struct regulator_init_data lp3974_buck1_data
= {
112 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
113 REGULATOR_CHANGE_STATUS
,
119 .num_consumer_supplies
= 1,
120 .consumer_supplies
= &lp3974_buck1_consumer
,
123 static struct regulator_init_data lp3974_buck2_data
= {
128 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
129 REGULATOR_CHANGE_STATUS
,
135 .num_consumer_supplies
= 1,
136 .consumer_supplies
= &lp3974_buck2_consumer
,
139 static struct regulator_init_data lp3974_buck3_data
= {
152 static struct regulator_init_data lp3974_buck4_data
= {
157 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
165 static struct regulator_init_data lp3974_ldo2_data
= {
167 .name
= "VALIVE_1.2V",
178 static struct regulator_init_data lp3974_ldo3_data
= {
180 .name
= "VUSB+MIPI_1.1V",
184 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
191 static struct regulator_init_data lp3974_ldo4_data
= {
197 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
204 static struct regulator_init_data lp3974_ldo5_data
= {
210 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
217 static struct regulator_init_data lp3974_ldo6_data
= {
223 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
230 static struct regulator_init_data lp3974_ldo7_data
= {
232 .name
= "VLCD+VMIPI_1.8V",
236 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
243 static struct regulator_init_data lp3974_ldo8_data
= {
245 .name
= "VUSB+VDAC_3.3V",
249 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
256 static struct regulator_init_data lp3974_ldo9_data
= {
269 static struct regulator_init_data lp3974_ldo10_data
= {
276 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
283 static struct regulator_init_data lp3974_ldo11_data
= {
285 .name
= "CAM_AF_3.3V",
289 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
296 static struct regulator_init_data lp3974_ldo12_data
= {
302 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
309 static struct regulator_init_data lp3974_ldo13_data
= {
315 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
322 static struct regulator_init_data lp3974_ldo14_data
= {
324 .name
= "CAM_I_HOST_1.8V",
328 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
335 static struct regulator_init_data lp3974_ldo15_data
= {
337 .name
= "CAM_S_DIG+FM33_CORE_1.2V",
341 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
348 static struct regulator_init_data lp3974_ldo16_data
= {
350 .name
= "CAM_S_ANA_2.8V",
354 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
361 static struct regulator_init_data lp3974_ldo17_data
= {
363 .name
= "VCC_3.0V_LCD",
367 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
375 static struct regulator_init_data lp3974_32khz_ap_data
= {
385 static struct regulator_init_data lp3974_32khz_cp_data
= {
394 static struct regulator_init_data lp3974_vichg_data
= {
403 static struct regulator_init_data lp3974_esafeout1_data
= {
406 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
413 static struct regulator_init_data lp3974_esafeout2_data
= {
417 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
424 static struct max8998_regulator_data lp3974_regulators
[] = {
425 { MAX8998_LDO2
, &lp3974_ldo2_data
},
426 { MAX8998_LDO3
, &lp3974_ldo3_data
},
427 { MAX8998_LDO4
, &lp3974_ldo4_data
},
428 { MAX8998_LDO5
, &lp3974_ldo5_data
},
429 { MAX8998_LDO6
, &lp3974_ldo6_data
},
430 { MAX8998_LDO7
, &lp3974_ldo7_data
},
431 { MAX8998_LDO8
, &lp3974_ldo8_data
},
432 { MAX8998_LDO9
, &lp3974_ldo9_data
},
433 { MAX8998_LDO10
, &lp3974_ldo10_data
},
434 { MAX8998_LDO11
, &lp3974_ldo11_data
},
435 { MAX8998_LDO12
, &lp3974_ldo12_data
},
436 { MAX8998_LDO13
, &lp3974_ldo13_data
},
437 { MAX8998_LDO14
, &lp3974_ldo14_data
},
438 { MAX8998_LDO15
, &lp3974_ldo15_data
},
439 { MAX8998_LDO16
, &lp3974_ldo16_data
},
440 { MAX8998_LDO17
, &lp3974_ldo17_data
},
441 { MAX8998_BUCK1
, &lp3974_buck1_data
},
442 { MAX8998_BUCK2
, &lp3974_buck2_data
},
443 { MAX8998_BUCK3
, &lp3974_buck3_data
},
444 { MAX8998_BUCK4
, &lp3974_buck4_data
},
445 { MAX8998_EN32KHZ_AP
, &lp3974_32khz_ap_data
},
446 { MAX8998_EN32KHZ_CP
, &lp3974_32khz_cp_data
},
447 { MAX8998_ENVICHG
, &lp3974_vichg_data
},
448 { MAX8998_ESAFEOUT1
, &lp3974_esafeout1_data
},
449 { MAX8998_ESAFEOUT2
, &lp3974_esafeout2_data
},
452 static struct max8998_platform_data universal_lp3974_pdata
= {
453 .num_regulators
= ARRAY_SIZE(lp3974_regulators
),
454 .regulators
= lp3974_regulators
,
455 .buck1_voltage1
= 1100000, /* INT */
456 .buck1_voltage2
= 1000000,
457 .buck1_voltage3
= 1100000,
458 .buck1_voltage4
= 1000000,
459 .buck1_set1
= EXYNOS4_GPX0(5),
460 .buck1_set2
= EXYNOS4_GPX0(6),
461 .buck2_voltage1
= 1200000, /* G3D */
462 .buck2_voltage2
= 1100000,
463 .buck1_default_idx
= 0,
464 .buck2_set3
= EXYNOS4_GPE2(0),
465 .buck2_default_idx
= 0,
469 /* GPIO I2C 5 (PMIC) */
470 static struct i2c_board_info i2c5_devs
[] __initdata
= {
472 I2C_BOARD_INFO("max8952", 0xC0 >> 1),
473 .platform_data
= &universal_max8952_pdata
,
475 I2C_BOARD_INFO("lp3974", 0xCC >> 1),
476 .platform_data
= &universal_lp3974_pdata
,
481 static struct gpio_keys_button universal_gpio_keys_tables
[] = {
483 .code
= KEY_VOLUMEUP
,
484 .gpio
= EXYNOS4_GPX2(0), /* XEINT16 */
485 .desc
= "gpio-keys: KEY_VOLUMEUP",
488 .debounce_interval
= 1,
490 .code
= KEY_VOLUMEDOWN
,
491 .gpio
= EXYNOS4_GPX2(1), /* XEINT17 */
492 .desc
= "gpio-keys: KEY_VOLUMEDOWN",
495 .debounce_interval
= 1,
498 .gpio
= EXYNOS4_GPX2(2), /* XEINT18 */
499 .desc
= "gpio-keys: KEY_CONFIG",
502 .debounce_interval
= 1,
505 .gpio
= EXYNOS4_GPX2(3), /* XEINT19 */
506 .desc
= "gpio-keys: KEY_CAMERA",
509 .debounce_interval
= 1,
512 .gpio
= EXYNOS4_GPX3(5), /* XEINT29 */
513 .desc
= "gpio-keys: KEY_OK",
516 .debounce_interval
= 1,
520 static struct gpio_keys_platform_data universal_gpio_keys_data
= {
521 .buttons
= universal_gpio_keys_tables
,
522 .nbuttons
= ARRAY_SIZE(universal_gpio_keys_tables
),
525 static struct platform_device universal_gpio_keys
= {
528 .platform_data
= &universal_gpio_keys_data
,
533 static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata
= {
535 .host_caps
= (MMC_CAP_8_BIT_DATA
| MMC_CAP_4_BIT_DATA
|
536 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
538 .cd_type
= S3C_SDHCI_CD_PERMANENT
,
539 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
542 static struct regulator_consumer_supply mmc0_supplies
[] = {
543 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
546 static struct regulator_init_data mmc0_fixed_voltage_init_data
= {
548 .name
= "VMEM_VDD_2.8V",
549 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
551 .num_consumer_supplies
= ARRAY_SIZE(mmc0_supplies
),
552 .consumer_supplies
= mmc0_supplies
,
555 static struct fixed_voltage_config mmc0_fixed_voltage_config
= {
556 .supply_name
= "MASSMEMORY_EN",
557 .microvolts
= 2800000,
558 .gpio
= EXYNOS4_GPE1(3),
560 .init_data
= &mmc0_fixed_voltage_init_data
,
563 static struct platform_device mmc0_fixed_voltage
= {
564 .name
= "reg-fixed-voltage",
567 .platform_data
= &mmc0_fixed_voltage_config
,
572 static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata
= {
574 .host_caps
= MMC_CAP_4_BIT_DATA
|
575 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
577 .ext_cd_gpio
= EXYNOS4_GPX3(4), /* XEINT_28 */
578 .ext_cd_gpio_invert
= 1,
579 .cd_type
= S3C_SDHCI_CD_GPIO
,
580 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
584 static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata
= {
586 .host_caps
= MMC_CAP_4_BIT_DATA
|
587 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
589 .cd_type
= S3C_SDHCI_CD_EXTERNAL
,
592 static void __init
universal_sdhci_init(void)
594 s3c_sdhci0_set_platdata(&universal_hsmmc0_data
);
595 s3c_sdhci2_set_platdata(&universal_hsmmc2_data
);
596 s3c_sdhci3_set_platdata(&universal_hsmmc3_data
);
600 static struct i2c_board_info i2c0_devs
[] __initdata
= {
601 /* Camera, To be updated */
605 static struct i2c_board_info i2c1_devs
[] __initdata
= {
606 /* Gyro, To be updated */
609 static struct platform_device
*universal_devices
[] __initdata
= {
610 /* Samsung Platform Devices */
617 /* Universal Devices */
618 &universal_gpio_keys
,
622 static void __init
universal_map_io(void)
624 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
625 s3c24xx_init_clocks(24000000);
626 s3c24xx_init_uarts(universal_uartcfgs
, ARRAY_SIZE(universal_uartcfgs
));
629 static void __init
universal_machine_init(void)
631 universal_sdhci_init();
633 i2c_register_board_info(0, i2c0_devs
, ARRAY_SIZE(i2c0_devs
));
634 i2c_register_board_info(1, i2c1_devs
, ARRAY_SIZE(i2c1_devs
));
636 s3c_i2c5_set_platdata(NULL
);
637 i2c_register_board_info(5, i2c5_devs
, ARRAY_SIZE(i2c5_devs
));
640 platform_add_devices(universal_devices
, ARRAY_SIZE(universal_devices
));
643 MACHINE_START(UNIVERSAL_C210
, "UNIVERSAL_C210")
644 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
645 .boot_params
= S5P_PA_SDRAM
+ 0x100,
646 .init_irq
= exynos4_init_irq
,
647 .map_io
= universal_map_io
,
648 .init_machine
= universal_machine_init
,
649 .timer
= &exynos4_timer
,