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>
17 #include <linux/mfd/max8998.h>
18 #include <linux/regulator/machine.h>
19 #include <linux/regulator/fixed.h>
20 #include <linux/regulator/max8952.h>
21 #include <linux/mmc/host.h>
22 #include <linux/i2c-gpio.h>
23 #include <linux/i2c/mcs.h>
24 #include <linux/i2c/atmel_mxt_ts.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach-types.h>
29 #include <plat/regs-serial.h>
30 #include <plat/exynos4.h>
32 #include <plat/devs.h>
34 #include <plat/gpio-cfg.h>
37 #include <plat/sdhci.h>
39 #include <plat/regs-fb-v4.h>
43 /* Following are default values for UCON, ULCON and UFCON UART registers */
44 #define UNIVERSAL_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 UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
53 #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
54 S5PV210_UFCON_TXTRIG256 | \
55 S5PV210_UFCON_RXTRIG256)
57 static struct s3c2410_uartcfg universal_uartcfgs
[] __initdata
= {
60 .ucon
= UNIVERSAL_UCON_DEFAULT
,
61 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
62 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
66 .ucon
= UNIVERSAL_UCON_DEFAULT
,
67 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
68 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
72 .ucon
= UNIVERSAL_UCON_DEFAULT
,
73 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
74 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
78 .ucon
= UNIVERSAL_UCON_DEFAULT
,
79 .ulcon
= UNIVERSAL_ULCON_DEFAULT
,
80 .ufcon
= UNIVERSAL_UFCON_DEFAULT
,
84 static struct regulator_consumer_supply max8952_consumer
=
85 REGULATOR_SUPPLY("vdd_arm", NULL
);
87 static struct max8952_platform_data universal_max8952_pdata __initdata
= {
88 .gpio_vid0
= EXYNOS4_GPX0(3),
89 .gpio_vid1
= EXYNOS4_GPX0(4),
90 .gpio_en
= -1, /* Not controllable, set "Always High" */
91 .default_mode
= 0, /* vid0 = 0, vid1 = 0 */
92 .dvs_mode
= { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */
93 .sync_freq
= 0, /* default: fastest */
94 .ramp_speed
= 0, /* default: fastest */
101 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
,
105 .num_consumer_supplies
= 1,
106 .consumer_supplies
= &max8952_consumer
,
110 static struct regulator_consumer_supply lp3974_buck1_consumer
=
111 REGULATOR_SUPPLY("vdd_int", NULL
);
113 static struct regulator_consumer_supply lp3974_buck2_consumer
=
114 REGULATOR_SUPPLY("vddg3d", NULL
);
116 static struct regulator_init_data lp3974_buck1_data
= {
121 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
122 REGULATOR_CHANGE_STATUS
,
128 .num_consumer_supplies
= 1,
129 .consumer_supplies
= &lp3974_buck1_consumer
,
132 static struct regulator_init_data lp3974_buck2_data
= {
137 .valid_ops_mask
= REGULATOR_CHANGE_VOLTAGE
|
138 REGULATOR_CHANGE_STATUS
,
144 .num_consumer_supplies
= 1,
145 .consumer_supplies
= &lp3974_buck2_consumer
,
148 static struct regulator_init_data lp3974_buck3_data
= {
161 static struct regulator_init_data lp3974_buck4_data
= {
166 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
174 static struct regulator_init_data lp3974_ldo2_data
= {
176 .name
= "VALIVE_1.2V",
187 static struct regulator_init_data lp3974_ldo3_data
= {
189 .name
= "VUSB+MIPI_1.1V",
193 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
200 static struct regulator_init_data lp3974_ldo4_data
= {
206 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
213 static struct regulator_init_data lp3974_ldo5_data
= {
219 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
226 static struct regulator_init_data lp3974_ldo6_data
= {
232 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
239 static struct regulator_init_data lp3974_ldo7_data
= {
241 .name
= "VLCD+VMIPI_1.8V",
245 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
252 static struct regulator_init_data lp3974_ldo8_data
= {
254 .name
= "VUSB+VDAC_3.3V",
258 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
265 static struct regulator_init_data lp3974_ldo9_data
= {
278 static struct regulator_init_data lp3974_ldo10_data
= {
285 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
292 static struct regulator_init_data lp3974_ldo11_data
= {
294 .name
= "CAM_AF_3.3V",
298 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
305 static struct regulator_init_data lp3974_ldo12_data
= {
311 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
318 static struct regulator_init_data lp3974_ldo13_data
= {
324 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
331 static struct regulator_init_data lp3974_ldo14_data
= {
333 .name
= "CAM_I_HOST_1.8V",
337 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
344 static struct regulator_init_data lp3974_ldo15_data
= {
346 .name
= "CAM_S_DIG+FM33_CORE_1.2V",
350 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
357 static struct regulator_init_data lp3974_ldo16_data
= {
359 .name
= "CAM_S_ANA_2.8V",
363 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
370 static struct regulator_init_data lp3974_ldo17_data
= {
372 .name
= "VCC_3.0V_LCD",
376 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
384 static struct regulator_init_data lp3974_32khz_ap_data
= {
394 static struct regulator_init_data lp3974_32khz_cp_data
= {
403 static struct regulator_init_data lp3974_vichg_data
= {
412 static struct regulator_init_data lp3974_esafeout1_data
= {
415 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
422 static struct regulator_init_data lp3974_esafeout2_data
= {
426 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
433 static struct max8998_regulator_data lp3974_regulators
[] = {
434 { MAX8998_LDO2
, &lp3974_ldo2_data
},
435 { MAX8998_LDO3
, &lp3974_ldo3_data
},
436 { MAX8998_LDO4
, &lp3974_ldo4_data
},
437 { MAX8998_LDO5
, &lp3974_ldo5_data
},
438 { MAX8998_LDO6
, &lp3974_ldo6_data
},
439 { MAX8998_LDO7
, &lp3974_ldo7_data
},
440 { MAX8998_LDO8
, &lp3974_ldo8_data
},
441 { MAX8998_LDO9
, &lp3974_ldo9_data
},
442 { MAX8998_LDO10
, &lp3974_ldo10_data
},
443 { MAX8998_LDO11
, &lp3974_ldo11_data
},
444 { MAX8998_LDO12
, &lp3974_ldo12_data
},
445 { MAX8998_LDO13
, &lp3974_ldo13_data
},
446 { MAX8998_LDO14
, &lp3974_ldo14_data
},
447 { MAX8998_LDO15
, &lp3974_ldo15_data
},
448 { MAX8998_LDO16
, &lp3974_ldo16_data
},
449 { MAX8998_LDO17
, &lp3974_ldo17_data
},
450 { MAX8998_BUCK1
, &lp3974_buck1_data
},
451 { MAX8998_BUCK2
, &lp3974_buck2_data
},
452 { MAX8998_BUCK3
, &lp3974_buck3_data
},
453 { MAX8998_BUCK4
, &lp3974_buck4_data
},
454 { MAX8998_EN32KHZ_AP
, &lp3974_32khz_ap_data
},
455 { MAX8998_EN32KHZ_CP
, &lp3974_32khz_cp_data
},
456 { MAX8998_ENVICHG
, &lp3974_vichg_data
},
457 { MAX8998_ESAFEOUT1
, &lp3974_esafeout1_data
},
458 { MAX8998_ESAFEOUT2
, &lp3974_esafeout2_data
},
461 static struct max8998_platform_data universal_lp3974_pdata
= {
462 .num_regulators
= ARRAY_SIZE(lp3974_regulators
),
463 .regulators
= lp3974_regulators
,
464 .buck1_voltage1
= 1100000, /* INT */
465 .buck1_voltage2
= 1000000,
466 .buck1_voltage3
= 1100000,
467 .buck1_voltage4
= 1000000,
468 .buck1_set1
= EXYNOS4_GPX0(5),
469 .buck1_set2
= EXYNOS4_GPX0(6),
470 .buck2_voltage1
= 1200000, /* G3D */
471 .buck2_voltage2
= 1100000,
472 .buck1_default_idx
= 0,
473 .buck2_set3
= EXYNOS4_GPE2(0),
474 .buck2_default_idx
= 0,
478 /* GPIO I2C 5 (PMIC) */
479 static struct i2c_board_info i2c5_devs
[] __initdata
= {
481 I2C_BOARD_INFO("max8952", 0xC0 >> 1),
482 .platform_data
= &universal_max8952_pdata
,
484 I2C_BOARD_INFO("lp3974", 0xCC >> 1),
485 .platform_data
= &universal_lp3974_pdata
,
490 static struct mxt_platform_data qt602240_platform_data
= {
497 .voltage
= 2800000, /* 2.8V */
498 .orient
= MXT_DIAGONAL
,
501 static struct i2c_board_info i2c3_devs
[] __initdata
= {
503 I2C_BOARD_INFO("qt602240_ts", 0x4a),
504 .platform_data
= &qt602240_platform_data
,
508 static void __init
universal_tsp_init(void)
512 /* TSP_LDO_ON: XMDMADDR_11 */
513 gpio
= EXYNOS4_GPE2(3);
514 gpio_request(gpio
, "TSP_LDO_ON");
515 gpio_direction_output(gpio
, 1);
516 gpio_export(gpio
, 0);
518 /* TSP_INT: XMDMADDR_7 */
519 gpio
= EXYNOS4_GPE1(7);
520 gpio_request(gpio
, "TSP_INT");
522 s5p_register_gpio_interrupt(gpio
);
523 s3c_gpio_cfgpin(gpio
, S3C_GPIO_SFN(0xf));
524 s3c_gpio_setpull(gpio
, S3C_GPIO_PULL_UP
);
525 i2c3_devs
[0].irq
= gpio_to_irq(gpio
);
529 /* GPIO I2C 12 (3 Touchkey) */
530 static uint32_t touchkey_keymap
[] = {
531 /* MCS_KEY_MAP(value, keycode) */
532 MCS_KEY_MAP(0, KEY_MENU
), /* KEY_SEND */
533 MCS_KEY_MAP(1, KEY_BACK
), /* KEY_END */
536 static struct mcs_platform_data touchkey_data
= {
537 .keymap
= touchkey_keymap
,
538 .keymap_size
= ARRAY_SIZE(touchkey_keymap
),
542 /* GPIO I2C 3_TOUCH 2.8V */
543 #define I2C_GPIO_BUS_12 12
544 static struct i2c_gpio_platform_data i2c_gpio12_data
= {
545 .sda_pin
= EXYNOS4_GPE4(0), /* XMDMDATA_8 */
546 .scl_pin
= EXYNOS4_GPE4(1), /* XMDMDATA_9 */
549 static struct platform_device i2c_gpio12
= {
551 .id
= I2C_GPIO_BUS_12
,
553 .platform_data
= &i2c_gpio12_data
,
557 static struct i2c_board_info i2c_gpio12_devs
[] __initdata
= {
559 I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
560 .platform_data
= &touchkey_data
,
564 static void __init
universal_touchkey_init(void)
568 gpio
= EXYNOS4_GPE3(7); /* XMDMDATA_7 */
569 gpio_request(gpio
, "3_TOUCH_INT");
570 s5p_register_gpio_interrupt(gpio
);
571 s3c_gpio_cfgpin(gpio
, S3C_GPIO_SFN(0xf));
572 i2c_gpio12_devs
[0].irq
= gpio_to_irq(gpio
);
574 gpio
= EXYNOS4_GPE3(3); /* XMDMDATA_3 */
575 gpio_request(gpio
, "3_TOUCH_EN");
576 gpio_direction_output(gpio
, 1);
580 static struct gpio_keys_button universal_gpio_keys_tables
[] = {
582 .code
= KEY_VOLUMEUP
,
583 .gpio
= EXYNOS4_GPX2(0), /* XEINT16 */
584 .desc
= "gpio-keys: KEY_VOLUMEUP",
587 .debounce_interval
= 1,
589 .code
= KEY_VOLUMEDOWN
,
590 .gpio
= EXYNOS4_GPX2(1), /* XEINT17 */
591 .desc
= "gpio-keys: KEY_VOLUMEDOWN",
594 .debounce_interval
= 1,
597 .gpio
= EXYNOS4_GPX2(2), /* XEINT18 */
598 .desc
= "gpio-keys: KEY_CONFIG",
601 .debounce_interval
= 1,
604 .gpio
= EXYNOS4_GPX2(3), /* XEINT19 */
605 .desc
= "gpio-keys: KEY_CAMERA",
608 .debounce_interval
= 1,
611 .gpio
= EXYNOS4_GPX3(5), /* XEINT29 */
612 .desc
= "gpio-keys: KEY_OK",
615 .debounce_interval
= 1,
619 static struct gpio_keys_platform_data universal_gpio_keys_data
= {
620 .buttons
= universal_gpio_keys_tables
,
621 .nbuttons
= ARRAY_SIZE(universal_gpio_keys_tables
),
624 static struct platform_device universal_gpio_keys
= {
627 .platform_data
= &universal_gpio_keys_data
,
632 static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata
= {
634 .host_caps
= (MMC_CAP_8_BIT_DATA
| MMC_CAP_4_BIT_DATA
|
635 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
637 .cd_type
= S3C_SDHCI_CD_PERMANENT
,
638 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
641 static struct regulator_consumer_supply mmc0_supplies
[] = {
642 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
645 static struct regulator_init_data mmc0_fixed_voltage_init_data
= {
647 .name
= "VMEM_VDD_2.8V",
648 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
650 .num_consumer_supplies
= ARRAY_SIZE(mmc0_supplies
),
651 .consumer_supplies
= mmc0_supplies
,
654 static struct fixed_voltage_config mmc0_fixed_voltage_config
= {
655 .supply_name
= "MASSMEMORY_EN",
656 .microvolts
= 2800000,
657 .gpio
= EXYNOS4_GPE1(3),
659 .init_data
= &mmc0_fixed_voltage_init_data
,
662 static struct platform_device mmc0_fixed_voltage
= {
663 .name
= "reg-fixed-voltage",
666 .platform_data
= &mmc0_fixed_voltage_config
,
671 static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata
= {
673 .host_caps
= MMC_CAP_4_BIT_DATA
|
674 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
676 .ext_cd_gpio
= EXYNOS4_GPX3(4), /* XEINT_28 */
677 .ext_cd_gpio_invert
= 1,
678 .cd_type
= S3C_SDHCI_CD_GPIO
,
679 .clk_type
= S3C_SDHCI_CLK_DIV_EXTERNAL
,
683 static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata
= {
685 .host_caps
= MMC_CAP_4_BIT_DATA
|
686 MMC_CAP_MMC_HIGHSPEED
| MMC_CAP_SD_HIGHSPEED
|
688 .cd_type
= S3C_SDHCI_CD_EXTERNAL
,
691 static void __init
universal_sdhci_init(void)
693 s3c_sdhci0_set_platdata(&universal_hsmmc0_data
);
694 s3c_sdhci2_set_platdata(&universal_hsmmc2_data
);
695 s3c_sdhci3_set_platdata(&universal_hsmmc3_data
);
699 static struct i2c_board_info i2c0_devs
[] __initdata
= {
700 /* Camera, To be updated */
704 static struct i2c_board_info i2c1_devs
[] __initdata
= {
705 /* Gyro, To be updated */
709 static struct s3c_fb_pd_win universal_fb_win0
= {
725 static struct s3c_fb_platdata universal_lcd_pdata __initdata
= {
726 .win
[0] = &universal_fb_win0
,
727 .vidcon0
= VIDCON0_VIDOUT_RGB
| VIDCON0_PNRMODE_RGB
|
729 .vidcon1
= VIDCON1_INV_VCLK
| VIDCON1_INV_VDEN
730 | VIDCON1_INV_HSYNC
| VIDCON1_INV_VSYNC
,
731 .setup_gpio
= exynos4_fimd0_gpio_setup_24bpp
,
734 static struct platform_device
*universal_devices
[] __initdata
= {
735 /* Samsung Platform Devices */
747 /* Universal Devices */
749 &universal_gpio_keys
,
755 &exynos4_device_pd
[PD_MFC
],
756 &exynos4_device_pd
[PD_LCD0
],
759 static void __init
universal_map_io(void)
761 s5p_init_io(NULL
, 0, S5P_VA_CHIPID
);
762 s3c24xx_init_clocks(24000000);
763 s3c24xx_init_uarts(universal_uartcfgs
, ARRAY_SIZE(universal_uartcfgs
));
766 static void __init
universal_reserve(void)
768 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
771 static void __init
universal_machine_init(void)
773 universal_sdhci_init();
775 i2c_register_board_info(0, i2c0_devs
, ARRAY_SIZE(i2c0_devs
));
776 i2c_register_board_info(1, i2c1_devs
, ARRAY_SIZE(i2c1_devs
));
778 universal_tsp_init();
779 s3c_i2c3_set_platdata(NULL
);
780 i2c_register_board_info(3, i2c3_devs
, ARRAY_SIZE(i2c3_devs
));
782 s3c_i2c5_set_platdata(NULL
);
783 i2c_register_board_info(5, i2c5_devs
, ARRAY_SIZE(i2c5_devs
));
785 s5p_fimd0_set_platdata(&universal_lcd_pdata
);
787 universal_touchkey_init();
788 i2c_register_board_info(I2C_GPIO_BUS_12
, i2c_gpio12_devs
,
789 ARRAY_SIZE(i2c_gpio12_devs
));
792 platform_add_devices(universal_devices
, ARRAY_SIZE(universal_devices
));
793 s5p_device_mfc
.dev
.parent
= &exynos4_device_pd
[PD_MFC
].dev
;
794 s5p_device_fimd0
.dev
.parent
= &exynos4_device_pd
[PD_LCD0
].dev
;
797 MACHINE_START(UNIVERSAL_C210
, "UNIVERSAL_C210")
798 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
799 .boot_params
= S5P_PA_SDRAM
+ 0x100,
800 .init_irq
= exynos4_init_irq
,
801 .map_io
= universal_map_io
,
802 .init_machine
= universal_machine_init
,
803 .timer
= &exynos4_timer
,
804 .reserve
= &universal_reserve
,