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>
21 #include <linux/i2c-gpio.h>
22 #include <linux/i2c/mcs.h>
23 #include <linux/i2c/atmel_mxt_ts.h>
25 #include <asm/mach/arch.h>
26 #include <asm/mach-types.h>
28 #include <plat/regs-serial.h>
29 #include <plat/exynos4.h>
31 #include <plat/devs.h>
33 #include <plat/gpio-cfg.h>
35 #include <plat/sdhci.h>
40 /* Following are default values for UCON, ULCON and UFCON UART registers */
41 #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
42 S3C2410_UCON_RXILEVEL | \
43 S3C2410_UCON_TXIRQMODE | \
44 S3C2410_UCON_RXIRQMODE | \
45 S3C2410_UCON_RXFIFO_TOI | \
46 S3C2443_UCON_RXERR_IRQEN)
48 #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
50 #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
51 S5PV210_UFCON_TXTRIG256 | \
52 S5PV210_UFCON_RXTRIG256)
54 static struct s3c2410_uartcfg universal_uartcfgs
[] __initdata
= {
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 .ucon
= UNIVERSAL_UCON_DEFAULT
,
76 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
77 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
81 static struct regulator_consumer_supply max8952_consumer
=
82 REGULATOR_SUPPLY("vddarm", NULL
);
84 static struct max8952_platform_data universal_max8952_pdata __initdata
= {
85 .gpio_vid0
= EXYNOS4_GPX0(3),
86 .gpio_vid1
= EXYNOS4_GPX0(4),
87 .gpio_en
= -1, /* Not controllable, set "Always High" */
88 .default_mode
= 0, /* vid0 = 0, vid1 = 0 */
89 .dvs_mode
= { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */
90 .sync_freq
= 0, /* default: fastest */
91 .ramp_speed
= 0, /* default: fastest */
98 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
,
102 .num_consumer_supplies
= 1,
103 .consumer_supplies
= &max8952_consumer
,
107 static struct regulator_consumer_supply lp3974_buck1_consumer
=
108 REGULATOR_SUPPLY("vddint", NULL
);
110 static struct regulator_consumer_supply lp3974_buck2_consumer
=
111 REGULATOR_SUPPLY("vddg3d", NULL
);
113 static struct regulator_init_data lp3974_buck1_data
= {
118 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
119 REGULATOR_CHANGE_STATUS
,
125 .num_consumer_supplies
= 1,
126 .consumer_supplies
= &lp3974_buck1_consumer
,
129 static struct regulator_init_data lp3974_buck2_data
= {
134 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
135 REGULATOR_CHANGE_STATUS
,
141 .num_consumer_supplies
= 1,
142 .consumer_supplies
= &lp3974_buck2_consumer
,
145 static struct regulator_init_data lp3974_buck3_data
= {
158 static struct regulator_init_data lp3974_buck4_data
= {
163 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
171 static struct regulator_init_data lp3974_ldo2_data
= {
173 .name
= "VALIVE_1.2V",
184 static struct regulator_init_data lp3974_ldo3_data
= {
186 .name
= "VUSB+MIPI_1.1V",
190 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
197 static struct regulator_init_data lp3974_ldo4_data
= {
203 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
210 static struct regulator_init_data lp3974_ldo5_data
= {
216 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
223 static struct regulator_init_data lp3974_ldo6_data
= {
229 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
236 static struct regulator_init_data lp3974_ldo7_data
= {
238 .name
= "VLCD+VMIPI_1.8V",
242 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
249 static struct regulator_init_data lp3974_ldo8_data
= {
251 .name
= "VUSB+VDAC_3.3V",
255 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
262 static struct regulator_init_data lp3974_ldo9_data
= {
275 static struct regulator_init_data lp3974_ldo10_data
= {
282 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
289 static struct regulator_init_data lp3974_ldo11_data
= {
291 .name
= "CAM_AF_3.3V",
295 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
302 static struct regulator_init_data lp3974_ldo12_data
= {
308 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
315 static struct regulator_init_data lp3974_ldo13_data
= {
321 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
328 static struct regulator_init_data lp3974_ldo14_data
= {
330 .name
= "CAM_I_HOST_1.8V",
334 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
341 static struct regulator_init_data lp3974_ldo15_data
= {
343 .name
= "CAM_S_DIG+FM33_CORE_1.2V",
347 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
354 static struct regulator_init_data lp3974_ldo16_data
= {
356 .name
= "CAM_S_ANA_2.8V",
360 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
367 static struct regulator_init_data lp3974_ldo17_data
= {
369 .name
= "VCC_3.0V_LCD",
373 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
381 static struct regulator_init_data lp3974_32khz_ap_data
= {
391 static struct regulator_init_data lp3974_32khz_cp_data
= {
400 static struct regulator_init_data lp3974_vichg_data
= {
409 static struct regulator_init_data lp3974_esafeout1_data
= {
412 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
419 static struct regulator_init_data lp3974_esafeout2_data
= {
423 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
430 static struct max8998_regulator_data lp3974_regulators
[] = {
431 { MAX8998_LDO2
, &lp3974_ldo2_data
},
432 { MAX8998_LDO3
, &lp3974_ldo3_data
},
433 { MAX8998_LDO4
, &lp3974_ldo4_data
},
434 { MAX8998_LDO5
, &lp3974_ldo5_data
},
435 { MAX8998_LDO6
, &lp3974_ldo6_data
},
436 { MAX8998_LDO7
, &lp3974_ldo7_data
},
437 { MAX8998_LDO8
, &lp3974_ldo8_data
},
438 { MAX8998_LDO9
, &lp3974_ldo9_data
},
439 { MAX8998_LDO10
, &lp3974_ldo10_data
},
440 { MAX8998_LDO11
, &lp3974_ldo11_data
},
441 { MAX8998_LDO12
, &lp3974_ldo12_data
},
442 { MAX8998_LDO13
, &lp3974_ldo13_data
},
443 { MAX8998_LDO14
, &lp3974_ldo14_data
},
444 { MAX8998_LDO15
, &lp3974_ldo15_data
},
445 { MAX8998_LDO16
, &lp3974_ldo16_data
},
446 { MAX8998_LDO17
, &lp3974_ldo17_data
},
447 { MAX8998_BUCK1
, &lp3974_buck1_data
},
448 { MAX8998_BUCK2
, &lp3974_buck2_data
},
449 { MAX8998_BUCK3
, &lp3974_buck3_data
},
450 { MAX8998_BUCK4
, &lp3974_buck4_data
},
451 { MAX8998_EN32KHZ_AP
, &lp3974_32khz_ap_data
},
452 { MAX8998_EN32KHZ_CP
, &lp3974_32khz_cp_data
},
453 { MAX8998_ENVICHG
, &lp3974_vichg_data
},
454 { MAX8998_ESAFEOUT1
, &lp3974_esafeout1_data
},
455 { MAX8998_ESAFEOUT2
, &lp3974_esafeout2_data
},
458 static struct max8998_platform_data universal_lp3974_pdata
= {
459 .num_regulators
= ARRAY_SIZE(lp3974_regulators
),
460 .regulators
= lp3974_regulators
,
461 .buck1_voltage1
= 1100000, /* INT */
462 .buck1_voltage2
= 1000000,
463 .buck1_voltage3
= 1100000,
464 .buck1_voltage4
= 1000000,
465 .buck1_set1
= EXYNOS4_GPX0(5),
466 .buck1_set2
= EXYNOS4_GPX0(6),
467 .buck2_voltage1
= 1200000, /* G3D */
468 .buck2_voltage2
= 1100000,
469 .buck1_default_idx
= 0,
470 .buck2_set3
= EXYNOS4_GPE2(0),
471 .buck2_default_idx
= 0,
475 /* GPIO I2C 5 (PMIC) */
476 static struct i2c_board_info i2c5_devs
[] __initdata
= {
478 I2C_BOARD_INFO("max8952", 0xC0 >> 1),
479 .platform_data
= &universal_max8952_pdata
,
481 I2C_BOARD_INFO("lp3974", 0xCC >> 1),
482 .platform_data
= &universal_lp3974_pdata
,
487 static struct mxt_platform_data qt602240_platform_data
= {
494 .voltage
= 2800000, /* 2.8V */
495 .orient
= MXT_DIAGONAL
,
498 static struct i2c_board_info i2c3_devs
[] __initdata
= {
500 I2C_BOARD_INFO("qt602240_ts", 0x4a),
501 .platform_data
= &qt602240_platform_data
,
505 static void __init
universal_tsp_init(void)
509 /* TSP_LDO_ON: XMDMADDR_11 */
510 gpio
= EXYNOS4_GPE2(3);
511 gpio_request(gpio
, "TSP_LDO_ON");
512 gpio_direction_output(gpio
, 1);
513 gpio_export(gpio
, 0);
515 /* TSP_INT: XMDMADDR_7 */
516 gpio
= EXYNOS4_GPE1(7);
517 gpio_request(gpio
, "TSP_INT");
519 s5p_register_gpio_interrupt(gpio
);
520 s3c_gpio_cfgpin(gpio
, S3C_GPIO_SFN(0xf));
521 s3c_gpio_setpull(gpio
, S3C_GPIO_PULL_UP
);
522 i2c3_devs
[0].irq
= gpio_to_irq(gpio
);
526 /* GPIO I2C 12 (3 Touchkey) */
527 static uint32_t touchkey_keymap
[] = {
528 /* MCS_KEY_MAP(value, keycode) */
529 MCS_KEY_MAP(0, KEY_MENU
), /* KEY_SEND */
530 MCS_KEY_MAP(1, KEY_BACK
), /* KEY_END */
533 static struct mcs_platform_data touchkey_data
= {
534 .keymap
= touchkey_keymap
,
535 .keymap_size
= ARRAY_SIZE(touchkey_keymap
),
539 /* GPIO I2C 3_TOUCH 2.8V */
540 #define I2C_GPIO_BUS_12 12
541 static struct i2c_gpio_platform_data i2c_gpio12_data
= {
542 .sda_pin
= EXYNOS4_GPE4(0), /* XMDMDATA_8 */
543 .scl_pin
= EXYNOS4_GPE4(1), /* XMDMDATA_9 */
546 static struct platform_device i2c_gpio12
= {
548 .id
= I2C_GPIO_BUS_12
,
550 .platform_data
= &i2c_gpio12_data
,
554 static struct i2c_board_info i2c_gpio12_devs
[] __initdata
= {
556 I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
557 .platform_data
= &touchkey_data
,
561 static void __init
universal_touchkey_init(void)
565 gpio
= EXYNOS4_GPE3(7); /* XMDMDATA_7 */
566 gpio_request(gpio
, "3_TOUCH_INT");
567 s5p_register_gpio_interrupt(gpio
);
568 s3c_gpio_cfgpin(gpio
, S3C_GPIO_SFN(0xf));
569 i2c_gpio12_devs
[0].irq
= gpio_to_irq(gpio
);
571 gpio
= EXYNOS4_GPE3(3); /* XMDMDATA_3 */
572 gpio_request(gpio
, "3_TOUCH_EN");
573 gpio_direction_output(gpio
, 1);
577 static struct gpio_keys_button universal_gpio_keys_tables
[] = {
579 .code
= KEY_VOLUMEUP
,
580 .gpio
= EXYNOS4_GPX2(0), /* XEINT16 */
581 .desc
= "gpio-keys: KEY_VOLUMEUP",
584 .debounce_interval
= 1,
586 .code
= KEY_VOLUMEDOWN
,
587 .gpio
= EXYNOS4_GPX2(1), /* XEINT17 */
588 .desc
= "gpio-keys: KEY_VOLUMEDOWN",
591 .debounce_interval
= 1,
594 .gpio
= EXYNOS4_GPX2(2), /* XEINT18 */
595 .desc
= "gpio-keys: KEY_CONFIG",
598 .debounce_interval
= 1,
601 .gpio
= EXYNOS4_GPX2(3), /* XEINT19 */
602 .desc
= "gpio-keys: KEY_CAMERA",
605 .debounce_interval
= 1,
608 .gpio
= EXYNOS4_GPX3(5), /* XEINT29 */
609 .desc
= "gpio-keys: KEY_OK",
612 .debounce_interval
= 1,
616 static struct gpio_keys_platform_data universal_gpio_keys_data
= {
617 .buttons
= universal_gpio_keys_tables
,
618 .nbuttons
= ARRAY_SIZE(universal_gpio_keys_tables
),
621 static struct platform_device universal_gpio_keys
= {
624 .platform_data
= &universal_gpio_keys_data
,
629 static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata
= {
631 .host_caps
= (MMC_CAP_8_BIT_DATA
| MMC_CAP_4_BIT_DATA
|
632 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
634 .cd_type
= S3C_SDHCI_CD_PERMANENT
,
635 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
638 static struct regulator_consumer_supply mmc0_supplies
[] = {
639 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
642 static struct regulator_init_data mmc0_fixed_voltage_init_data
= {
644 .name
= "VMEM_VDD_2.8V",
645 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
647 .num_consumer_supplies
= ARRAY_SIZE(mmc0_supplies
),
648 .consumer_supplies
= mmc0_supplies
,
651 static struct fixed_voltage_config mmc0_fixed_voltage_config
= {
652 .supply_name
= "MASSMEMORY_EN",
653 .microvolts
= 2800000,
654 .gpio
= EXYNOS4_GPE1(3),
656 .init_data
= &mmc0_fixed_voltage_init_data
,
659 static struct platform_device mmc0_fixed_voltage
= {
660 .name
= "reg-fixed-voltage",
663 .platform_data
= &mmc0_fixed_voltage_config
,
668 static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata
= {
670 .host_caps
= MMC_CAP_4_BIT_DATA
|
671 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
673 .ext_cd_gpio
= EXYNOS4_GPX3(4), /* XEINT_28 */
674 .ext_cd_gpio_invert
= 1,
675 .cd_type
= S3C_SDHCI_CD_GPIO
,
676 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
680 static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata
= {
682 .host_caps
= MMC_CAP_4_BIT_DATA
|
683 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
685 .cd_type
= S3C_SDHCI_CD_EXTERNAL
,
688 static void __init
universal_sdhci_init(void)
690 s3c_sdhci0_set_platdata(&universal_hsmmc0_data
);
691 s3c_sdhci2_set_platdata(&universal_hsmmc2_data
);
692 s3c_sdhci3_set_platdata(&universal_hsmmc3_data
);
696 static struct i2c_board_info i2c0_devs
[] __initdata
= {
697 /* Camera, To be updated */
701 static struct i2c_board_info i2c1_devs
[] __initdata
= {
702 /* Gyro, To be updated */
705 static struct platform_device
*universal_devices
[] __initdata
= {
706 /* Samsung Platform Devices */
718 /* Universal Devices */
720 &universal_gpio_keys
,
725 &exynos4_device_pd
[PD_MFC
],
728 static void __init
universal_map_io(void)
730 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
731 s3c24xx_init_clocks(24000000);
732 s3c24xx_init_uarts(universal_uartcfgs
, ARRAY_SIZE(universal_uartcfgs
));
735 static void __init
universal_reserve(void)
737 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
740 static void __init
universal_machine_init(void)
742 universal_sdhci_init();
744 i2c_register_board_info(0, i2c0_devs
, ARRAY_SIZE(i2c0_devs
));
745 i2c_register_board_info(1, i2c1_devs
, ARRAY_SIZE(i2c1_devs
));
747 universal_tsp_init();
748 s3c_i2c3_set_platdata(NULL
);
749 i2c_register_board_info(3, i2c3_devs
, ARRAY_SIZE(i2c3_devs
));
751 s3c_i2c5_set_platdata(NULL
);
752 i2c_register_board_info(5, i2c5_devs
, ARRAY_SIZE(i2c5_devs
));
754 universal_touchkey_init();
755 i2c_register_board_info(I2C_GPIO_BUS_12
, i2c_gpio12_devs
,
756 ARRAY_SIZE(i2c_gpio12_devs
));
759 platform_add_devices(universal_devices
, ARRAY_SIZE(universal_devices
));
760 s5p_device_mfc
.dev
.parent
= &exynos4_device_pd
[PD_MFC
].dev
;
763 MACHINE_START(UNIVERSAL_C210
, "UNIVERSAL_C210")
764 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
765 .boot_params
= S5P_PA_SDRAM
+ 0x100,
766 .init_irq
= exynos4_init_irq
,
767 .map_io
= universal_map_io
,
768 .init_machine
= universal_machine_init
,
769 .timer
= &exynos4_timer
,
770 .reserve
= &universal_reserve
,