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/interrupt.h>
18 #include <linux/mfd/max8998.h>
19 #include <linux/regulator/machine.h>
20 #include <linux/regulator/fixed.h>
21 #include <linux/regulator/max8952.h>
22 #include <linux/mmc/host.h>
23 #include <linux/i2c-gpio.h>
24 #include <linux/i2c/mcs.h>
25 #include <linux/i2c/atmel_mxt_ts.h>
27 #include <asm/mach/arch.h>
28 #include <asm/hardware/gic.h>
29 #include <asm/mach-types.h>
31 #include <plat/regs-serial.h>
32 #include <plat/clock.h>
34 #include <plat/devs.h>
36 #include <plat/gpio-cfg.h>
39 #include <plat/sdhci.h>
41 #include <plat/regs-fb-v4.h>
42 #include <plat/fimc-core.h>
43 #include <plat/s5p-time.h>
44 #include <plat/camport.h>
45 #include <plat/mipi_csis.h>
49 #include <media/v4l2-mediabus.h>
50 #include <media/s5p_fimc.h>
51 #include <media/m5mols.h>
52 #include <media/s5k6aa.h>
56 /* Following are default values for UCON, ULCON and UFCON UART registers */
57 #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
58 S3C2410_UCON_RXILEVEL | \
59 S3C2410_UCON_TXIRQMODE | \
60 S3C2410_UCON_RXIRQMODE | \
61 S3C2410_UCON_RXFIFO_TOI | \
62 S3C2443_UCON_RXERR_IRQEN)
64 #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
66 #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
67 S5PV210_UFCON_TXTRIG256 | \
68 S5PV210_UFCON_RXTRIG256)
70 static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
73 .ucon = UNIVERSAL_UCON_DEFAULT,
74 .ulcon = UNIVERSAL_ULCON_DEFAULT,
75 .ufcon = UNIVERSAL_UFCON_DEFAULT,
79 .ucon = UNIVERSAL_UCON_DEFAULT,
80 .ulcon = UNIVERSAL_ULCON_DEFAULT,
81 .ufcon = UNIVERSAL_UFCON_DEFAULT,
85 .ucon = UNIVERSAL_UCON_DEFAULT,
86 .ulcon = UNIVERSAL_ULCON_DEFAULT,
87 .ufcon = UNIVERSAL_UFCON_DEFAULT,
91 .ucon = UNIVERSAL_UCON_DEFAULT,
92 .ulcon = UNIVERSAL_ULCON_DEFAULT,
93 .ufcon = UNIVERSAL_UFCON_DEFAULT,
97 static struct regulator_consumer_supply max8952_consumer =
98 REGULATOR_SUPPLY("vdd_arm", NULL);
100 static struct max8952_platform_data universal_max8952_pdata __initdata = {
101 .gpio_vid0 = EXYNOS4_GPX0(3),
102 .gpio_vid1 = EXYNOS4_GPX0(4),
103 .gpio_en = -1, /* Not controllable, set "Always High" */
104 .default_mode = 0, /* vid0 = 0, vid1 = 0 */
105 .dvs_mode = { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */
106 .sync_freq = 0, /* default: fastest */
107 .ramp_speed = 0, /* default: fastest */
114 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
118 .num_consumer_supplies = 1,
119 .consumer_supplies = &max8952_consumer,
123 static struct regulator_consumer_supply lp3974_buck1_consumer =
124 REGULATOR_SUPPLY("vdd_int", NULL);
126 static struct regulator_consumer_supply lp3974_buck2_consumer =
127 REGULATOR_SUPPLY("vddg3d", NULL);
129 static struct regulator_consumer_supply lp3974_buck3_consumer[] = {
130 REGULATOR_SUPPLY("vdet", "s5p-sdo"),
131 REGULATOR_SUPPLY("vdd_reg", "0-003c"),
134 static struct regulator_init_data lp3974_buck1_data = {
139 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
140 REGULATOR_CHANGE_STATUS,
146 .num_consumer_supplies = 1,
147 .consumer_supplies = &lp3974_buck1_consumer,
150 static struct regulator_init_data lp3974_buck2_data = {
155 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
156 REGULATOR_CHANGE_STATUS,
162 .num_consumer_supplies = 1,
163 .consumer_supplies = &lp3974_buck2_consumer,
166 static struct regulator_init_data lp3974_buck3_data = {
177 .num_consumer_supplies = ARRAY_SIZE(lp3974_buck3_consumer),
178 .consumer_supplies = lp3974_buck3_consumer,
181 static struct regulator_init_data lp3974_buck4_data = {
186 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
194 static struct regulator_init_data lp3974_ldo2_data = {
196 .name = "VALIVE_1.2V",
207 static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
208 REGULATOR_SUPPLY("vdd", "exynos4-hdmi"),
209 REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"),
210 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"),
213 static struct regulator_init_data lp3974_ldo3_data = {
215 .name = "VUSB+MIPI_1.1V",
219 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
224 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo3_consumer),
225 .consumer_supplies = lp3974_ldo3_consumer,
228 static struct regulator_consumer_supply lp3974_ldo4_consumer[] = {
229 REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"),
232 static struct regulator_init_data lp3974_ldo4_data = {
238 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
243 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo4_consumer),
244 .consumer_supplies = lp3974_ldo4_consumer,
247 static struct regulator_init_data lp3974_ldo5_data = {
253 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
260 static struct regulator_init_data lp3974_ldo6_data = {
266 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
273 static struct regulator_consumer_supply lp3974_ldo7_consumer[] = {
274 REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"),
277 static struct regulator_init_data lp3974_ldo7_data = {
279 .name = "VLCD+VMIPI_1.8V",
283 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
288 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo7_consumer),
289 .consumer_supplies = lp3974_ldo7_consumer,
292 static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
293 REGULATOR_SUPPLY("vdd33a_dac", "s5p-sdo"),
296 static struct regulator_init_data lp3974_ldo8_data = {
298 .name = "VUSB+VDAC_3.3V",
302 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
307 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo8_consumer),
308 .consumer_supplies = lp3974_ldo8_consumer,
311 static struct regulator_consumer_supply lp3974_ldo9_consumer =
312 REGULATOR_SUPPLY("vddio", "0-003c");
314 static struct regulator_init_data lp3974_ldo9_data = {
325 .num_consumer_supplies = 1,
326 .consumer_supplies = &lp3974_ldo9_consumer,
329 static struct regulator_init_data lp3974_ldo10_data = {
336 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
343 static struct regulator_consumer_supply lp3974_ldo11_consumer =
344 REGULATOR_SUPPLY("dig_28", "0-001f");
346 static struct regulator_init_data lp3974_ldo11_data = {
348 .name = "CAM_AF_3.3V",
352 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
357 .num_consumer_supplies = 1,
358 .consumer_supplies = &lp3974_ldo11_consumer,
361 static struct regulator_init_data lp3974_ldo12_data = {
367 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
374 static struct regulator_init_data lp3974_ldo13_data = {
380 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
387 static struct regulator_consumer_supply lp3974_ldo14_consumer =
388 REGULATOR_SUPPLY("dig_18", "0-001f");
390 static struct regulator_init_data lp3974_ldo14_data = {
392 .name = "CAM_I_HOST_1.8V",
396 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
401 .num_consumer_supplies = 1,
402 .consumer_supplies = &lp3974_ldo14_consumer,
406 static struct regulator_consumer_supply lp3974_ldo15_consumer =
407 REGULATOR_SUPPLY("dig_12", "0-001f");
409 static struct regulator_init_data lp3974_ldo15_data = {
411 .name = "CAM_S_DIG+FM33_CORE_1.2V",
415 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
420 .num_consumer_supplies = 1,
421 .consumer_supplies = &lp3974_ldo15_consumer,
424 static struct regulator_consumer_supply lp3974_ldo16_consumer[] = {
425 REGULATOR_SUPPLY("vdda", "0-003c"),
426 REGULATOR_SUPPLY("a_sensor", "0-001f"),
429 static struct regulator_init_data lp3974_ldo16_data = {
431 .name = "CAM_S_ANA_2.8V",
435 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
440 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo16_consumer),
441 .consumer_supplies = lp3974_ldo16_consumer,
444 static struct regulator_init_data lp3974_ldo17_data = {
446 .name = "VCC_3.0V_LCD",
450 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
458 static struct regulator_init_data lp3974_32khz_ap_data = {
468 static struct regulator_init_data lp3974_32khz_cp_data = {
477 static struct regulator_init_data lp3974_vichg_data = {
486 static struct regulator_init_data lp3974_esafeout1_data = {
489 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
496 static struct regulator_init_data lp3974_esafeout2_data = {
500 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
507 static struct max8998_regulator_data lp3974_regulators[] = {
508 { MAX8998_LDO2, &lp3974_ldo2_data },
509 { MAX8998_LDO3, &lp3974_ldo3_data },
510 { MAX8998_LDO4, &lp3974_ldo4_data },
511 { MAX8998_LDO5, &lp3974_ldo5_data },
512 { MAX8998_LDO6, &lp3974_ldo6_data },
513 { MAX8998_LDO7, &lp3974_ldo7_data },
514 { MAX8998_LDO8, &lp3974_ldo8_data },
515 { MAX8998_LDO9, &lp3974_ldo9_data },
516 { MAX8998_LDO10, &lp3974_ldo10_data },
517 { MAX8998_LDO11, &lp3974_ldo11_data },
518 { MAX8998_LDO12, &lp3974_ldo12_data },
519 { MAX8998_LDO13, &lp3974_ldo13_data },
520 { MAX8998_LDO14, &lp3974_ldo14_data },
521 { MAX8998_LDO15, &lp3974_ldo15_data },
522 { MAX8998_LDO16, &lp3974_ldo16_data },
523 { MAX8998_LDO17, &lp3974_ldo17_data },
524 { MAX8998_BUCK1, &lp3974_buck1_data },
525 { MAX8998_BUCK2, &lp3974_buck2_data },
526 { MAX8998_BUCK3, &lp3974_buck3_data },
527 { MAX8998_BUCK4, &lp3974_buck4_data },
528 { MAX8998_EN32KHZ_AP, &lp3974_32khz_ap_data },
529 { MAX8998_EN32KHZ_CP, &lp3974_32khz_cp_data },
530 { MAX8998_ENVICHG, &lp3974_vichg_data },
531 { MAX8998_ESAFEOUT1, &lp3974_esafeout1_data },
532 { MAX8998_ESAFEOUT2, &lp3974_esafeout2_data },
535 static struct max8998_platform_data universal_lp3974_pdata = {
536 .num_regulators = ARRAY_SIZE(lp3974_regulators),
537 .regulators = lp3974_regulators,
538 .buck1_voltage1 = 1100000, /* INT */
539 .buck1_voltage2 = 1000000,
540 .buck1_voltage3 = 1100000,
541 .buck1_voltage4 = 1000000,
542 .buck1_set1 = EXYNOS4_GPX0(5),
543 .buck1_set2 = EXYNOS4_GPX0(6),
544 .buck2_voltage1 = 1200000, /* G3D */
545 .buck2_voltage2 = 1100000,
546 .buck1_default_idx = 0,
547 .buck2_set3 = EXYNOS4_GPE2(0),
548 .buck2_default_idx = 0,
553 enum fixed_regulator_id {
555 FIXED_REG_ID_HDMI_5V,
556 FIXED_REG_ID_CAM_S_IF,
557 FIXED_REG_ID_CAM_I_CORE,
558 FIXED_REG_ID_CAM_VT_DIO,
561 static struct regulator_consumer_supply hdmi_fixed_consumer =
562 REGULATOR_SUPPLY("hdmi-en", "exynos4-hdmi");
564 static struct regulator_init_data hdmi_fixed_voltage_init_data = {
567 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
569 .num_consumer_supplies = 1,
570 .consumer_supplies = &hdmi_fixed_consumer,
573 static struct fixed_voltage_config hdmi_fixed_voltage_config = {
574 .supply_name = "HDMI_EN1",
575 .microvolts = 5000000,
576 .gpio = EXYNOS4_GPE0(1),
578 .init_data = &hdmi_fixed_voltage_init_data,
581 static struct platform_device hdmi_fixed_voltage = {
582 .name = "reg-fixed-voltage",
583 .id = FIXED_REG_ID_HDMI_5V,
585 .platform_data = &hdmi_fixed_voltage_config,
589 /* GPIO I2C 5 (PMIC) */
590 static struct i2c_board_info i2c5_devs[] __initdata = {
592 I2C_BOARD_INFO("max8952", 0xC0 >> 1),
593 .platform_data = &universal_max8952_pdata,
595 I2C_BOARD_INFO("lp3974", 0xCC >> 1),
596 .platform_data = &universal_lp3974_pdata,
601 static struct mxt_platform_data qt602240_platform_data = {
608 .voltage = 2800000, /* 2.8V */
609 .orient = MXT_DIAGONAL,
610 .irqflags = IRQF_TRIGGER_FALLING,
613 static struct i2c_board_info i2c3_devs[] __initdata = {
615 I2C_BOARD_INFO("qt602240_ts", 0x4a),
616 .platform_data = &qt602240_platform_data,
620 static void __init universal_tsp_init(void)
624 /* TSP_LDO_ON: XMDMADDR_11 */
625 gpio = EXYNOS4_GPE2(3);
626 gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "TSP_LDO_ON");
627 gpio_export(gpio, 0);
629 /* TSP_INT: XMDMADDR_7 */
630 gpio = EXYNOS4_GPE1(7);
631 gpio_request(gpio, "TSP_INT");
633 s5p_register_gpio_interrupt(gpio);
634 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
635 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
636 i2c3_devs[0].irq = gpio_to_irq(gpio);
640 /* GPIO I2C 12 (3 Touchkey) */
641 static uint32_t touchkey_keymap[] = {
642 /* MCS_KEY_MAP(value, keycode) */
643 MCS_KEY_MAP(0, KEY_MENU), /* KEY_SEND */
644 MCS_KEY_MAP(1, KEY_BACK), /* KEY_END */
647 static struct mcs_platform_data touchkey_data = {
648 .keymap = touchkey_keymap,
649 .keymap_size = ARRAY_SIZE(touchkey_keymap),
653 /* GPIO I2C 3_TOUCH 2.8V */
654 #define I2C_GPIO_BUS_12 12
655 static struct i2c_gpio_platform_data i2c_gpio12_data = {
656 .sda_pin = EXYNOS4_GPE4(0), /* XMDMDATA_8 */
657 .scl_pin = EXYNOS4_GPE4(1), /* XMDMDATA_9 */
660 static struct platform_device i2c_gpio12 = {
662 .id = I2C_GPIO_BUS_12,
664 .platform_data = &i2c_gpio12_data,
668 static struct i2c_board_info i2c_gpio12_devs[] __initdata = {
670 I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
671 .platform_data = &touchkey_data,
675 static void __init universal_touchkey_init(void)
679 gpio = EXYNOS4_GPE3(7); /* XMDMDATA_7 */
680 gpio_request(gpio, "3_TOUCH_INT");
681 s5p_register_gpio_interrupt(gpio);
682 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
683 i2c_gpio12_devs[0].irq = gpio_to_irq(gpio);
685 gpio = EXYNOS4_GPE3(3); /* XMDMDATA_3 */
686 gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "3_TOUCH_EN");
689 static struct s3c2410_platform_i2c universal_i2c0_platdata __initdata = {
690 .frequency = 300 * 1000,
695 static struct gpio_keys_button universal_gpio_keys_tables[] = {
697 .code = KEY_VOLUMEUP,
698 .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
699 .desc = "gpio-keys: KEY_VOLUMEUP",
702 .debounce_interval = 1,
704 .code = KEY_VOLUMEDOWN,
705 .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
706 .desc = "gpio-keys: KEY_VOLUMEDOWN",
709 .debounce_interval = 1,
712 .gpio = EXYNOS4_GPX2(2), /* XEINT18 */
713 .desc = "gpio-keys: KEY_CONFIG",
716 .debounce_interval = 1,
719 .gpio = EXYNOS4_GPX2(3), /* XEINT19 */
720 .desc = "gpio-keys: KEY_CAMERA",
723 .debounce_interval = 1,
726 .gpio = EXYNOS4_GPX3(5), /* XEINT29 */
727 .desc = "gpio-keys: KEY_OK",
730 .debounce_interval = 1,
734 static struct gpio_keys_platform_data universal_gpio_keys_data = {
735 .buttons = universal_gpio_keys_tables,
736 .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables),
739 static struct platform_device universal_gpio_keys = {
742 .platform_data = &universal_gpio_keys_data,
747 static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
749 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
750 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
751 .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE,
752 .cd_type = S3C_SDHCI_CD_PERMANENT,
753 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
756 static struct regulator_consumer_supply mmc0_supplies[] = {
757 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"),
760 static struct regulator_init_data mmc0_fixed_voltage_init_data = {
762 .name = "VMEM_VDD_2.8V",
763 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
765 .num_consumer_supplies = ARRAY_SIZE(mmc0_supplies),
766 .consumer_supplies = mmc0_supplies,
769 static struct fixed_voltage_config mmc0_fixed_voltage_config = {
770 .supply_name = "MASSMEMORY_EN",
771 .microvolts = 2800000,
772 .gpio = EXYNOS4_GPE1(3),
774 .init_data = &mmc0_fixed_voltage_init_data,
777 static struct platform_device mmc0_fixed_voltage = {
778 .name = "reg-fixed-voltage",
779 .id = FIXED_REG_ID_MMC0,
781 .platform_data = &mmc0_fixed_voltage_config,
786 static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
788 .host_caps = MMC_CAP_4_BIT_DATA |
789 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
790 .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */
791 .ext_cd_gpio_invert = 1,
792 .cd_type = S3C_SDHCI_CD_GPIO,
793 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
797 static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = {
799 .host_caps = MMC_CAP_4_BIT_DATA |
800 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
801 .cd_type = S3C_SDHCI_CD_EXTERNAL,
804 static void __init universal_sdhci_init(void)
806 s3c_sdhci0_set_platdata(&universal_hsmmc0_data);
807 s3c_sdhci2_set_platdata(&universal_hsmmc2_data);
808 s3c_sdhci3_set_platdata(&universal_hsmmc3_data);
812 static struct i2c_board_info i2c1_devs[] __initdata = {
813 /* Gyro, To be updated */
817 static struct s3c_fb_pd_win universal_fb_win0 = {
832 .virtual_y = 2 * 800,
835 static struct s3c_fb_platdata universal_lcd_pdata __initdata = {
836 .win[0] = &universal_fb_win0,
837 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
839 .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
840 | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
841 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
844 static struct regulator_consumer_supply cam_vt_dio_supply =
845 REGULATOR_SUPPLY("vdd_core", "0-003c");
847 static struct regulator_init_data cam_vt_dio_reg_init_data = {
848 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
849 .num_consumer_supplies = 1,
850 .consumer_supplies = &cam_vt_dio_supply,
853 static struct fixed_voltage_config cam_vt_dio_fixed_voltage_cfg = {
854 .supply_name = "CAM_VT_D_IO",
855 .microvolts = 2800000,
856 .gpio = EXYNOS4_GPE2(1), /* CAM_PWR_EN2 */
858 .init_data = &cam_vt_dio_reg_init_data,
861 static struct platform_device cam_vt_dio_fixed_reg_dev = {
862 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_DIO,
863 .dev = { .platform_data = &cam_vt_dio_fixed_voltage_cfg },
866 static struct regulator_consumer_supply cam_i_core_supply =
867 REGULATOR_SUPPLY("core", "0-001f");
869 static struct regulator_init_data cam_i_core_reg_init_data = {
870 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
871 .num_consumer_supplies = 1,
872 .consumer_supplies = &cam_i_core_supply,
875 static struct fixed_voltage_config cam_i_core_fixed_voltage_cfg = {
876 .supply_name = "CAM_I_CORE_1.2V",
877 .microvolts = 1200000,
878 .gpio = EXYNOS4_GPE2(2), /* CAM_8M_CORE_EN */
880 .init_data = &cam_i_core_reg_init_data,
883 static struct platform_device cam_i_core_fixed_reg_dev = {
884 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_I_CORE,
885 .dev = { .platform_data = &cam_i_core_fixed_voltage_cfg },
888 static struct regulator_consumer_supply cam_s_if_supply =
889 REGULATOR_SUPPLY("d_sensor", "0-001f");
891 static struct regulator_init_data cam_s_if_reg_init_data = {
892 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
893 .num_consumer_supplies = 1,
894 .consumer_supplies = &cam_s_if_supply,
897 static struct fixed_voltage_config cam_s_if_fixed_voltage_cfg = {
898 .supply_name = "CAM_S_IF_1.8V",
899 .microvolts = 1800000,
900 .gpio = EXYNOS4_GPE3(0), /* CAM_PWR_EN1 */
902 .init_data = &cam_s_if_reg_init_data,
905 static struct platform_device cam_s_if_fixed_reg_dev = {
906 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_S_IF,
907 .dev = { .platform_data = &cam_s_if_fixed_voltage_cfg },
910 static struct s5p_platform_mipi_csis mipi_csis_platdata = {
911 .clk_rate = 166000000UL,
915 .phy_enable = s5p_csis_phy_enable,
918 #define GPIO_CAM_LEVEL_EN(n) EXYNOS4_GPE4(n + 3)
919 #define GPIO_CAM_8M_ISP_INT EXYNOS4_GPX1(5) /* XEINT_13 */
920 #define GPIO_CAM_MEGA_nRST EXYNOS4_GPE2(5)
921 #define GPIO_CAM_VGA_NRST EXYNOS4_GPE4(7)
922 #define GPIO_CAM_VGA_NSTBY EXYNOS4_GPE4(6)
924 static int s5k6aa_set_power(int on)
926 gpio_set_value(GPIO_CAM_LEVEL_EN(2), !!on);
930 static struct s5k6aa_platform_data s5k6aa_platdata = {
931 .mclk_frequency = 21600000UL,
932 .gpio_reset = { GPIO_CAM_VGA_NRST, 0 },
933 .gpio_stby = { GPIO_CAM_VGA_NSTBY, 0 },
934 .bus_type = V4L2_MBUS_PARALLEL,
936 .set_power = s5k6aa_set_power,
939 static struct i2c_board_info s5k6aa_board_info = {
940 I2C_BOARD_INFO("S5K6AA", 0x3C),
941 .platform_data = &s5k6aa_platdata,
944 static int m5mols_set_power(struct device *dev, int on)
946 gpio_set_value(GPIO_CAM_LEVEL_EN(1), !on);
947 gpio_set_value(GPIO_CAM_LEVEL_EN(2), !!on);
951 static struct m5mols_platform_data m5mols_platdata = {
952 .gpio_reset = GPIO_CAM_MEGA_nRST,
954 .set_power = m5mols_set_power,
957 static struct i2c_board_info m5mols_board_info = {
958 I2C_BOARD_INFO("M5MOLS", 0x1F),
959 .platform_data = &m5mols_platdata,
962 static struct s5p_fimc_isp_info universal_camera_sensors[] = {
965 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
966 V4L2_MBUS_VSYNC_ACTIVE_LOW,
967 .bus_type = FIMC_ITU_601,
968 .board_info = &s5k6aa_board_info,
970 .clk_frequency = 24000000UL,
973 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
974 V4L2_MBUS_VSYNC_ACTIVE_LOW,
975 .bus_type = FIMC_MIPI_CSI2,
976 .board_info = &m5mols_board_info,
978 .clk_frequency = 24000000UL,
979 .csi_data_align = 32,
983 static struct s5p_platform_fimc fimc_md_platdata = {
984 .isp_info = universal_camera_sensors,
985 .num_clients = ARRAY_SIZE(universal_camera_sensors),
988 static struct gpio universal_camera_gpios[] = {
989 { GPIO_CAM_LEVEL_EN(1), GPIOF_OUT_INIT_HIGH, "CAM_LVL_EN1" },
990 { GPIO_CAM_LEVEL_EN(2), GPIOF_OUT_INIT_LOW, "CAM_LVL_EN2" },
991 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
992 { GPIO_CAM_MEGA_nRST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
993 { GPIO_CAM_VGA_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" },
994 { GPIO_CAM_VGA_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
997 static void __init universal_camera_init(void)
999 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
1000 &s5p_device_mipi_csis0);
1001 s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
1002 &s5p_device_fimc_md);
1004 if (gpio_request_array(universal_camera_gpios,
1005 ARRAY_SIZE(universal_camera_gpios))) {
1006 pr_err("%s: GPIO request failed\n", __func__);
1010 if (!s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xf)))
1011 m5mols_board_info.irq = gpio_to_irq(GPIO_CAM_8M_ISP_INT);
1013 pr_err("Failed to configure 8M_ISP_INT GPIO\n");
1015 /* Free GPIOs controlled directly by the sensor drivers. */
1016 gpio_free(GPIO_CAM_MEGA_nRST);
1017 gpio_free(GPIO_CAM_8M_ISP_INT);
1018 gpio_free(GPIO_CAM_VGA_NRST);
1019 gpio_free(GPIO_CAM_VGA_NSTBY);
1021 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A))
1022 pr_err("Camera port A setup failed\n");
1025 static struct platform_device *universal_devices[] __initdata = {
1026 /* Samsung Platform Devices */
1027 &s5p_device_mipi_csis0,
1033 &mmc0_fixed_voltage,
1040 &s5p_device_i2c_hdmiphy,
1041 &hdmi_fixed_voltage,
1046 /* Universal Devices */
1048 &universal_gpio_keys,
1049 &s5p_device_onenand,
1055 &cam_vt_dio_fixed_reg_dev,
1056 &cam_i_core_fixed_reg_dev,
1057 &cam_s_if_fixed_reg_dev,
1058 &s5p_device_fimc_md,
1061 static void __init universal_map_io(void)
1063 clk_xusbxti.rate = 24000000;
1064 exynos_init_io(NULL, 0);
1065 s3c24xx_init_clocks(24000000);
1066 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
1067 s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
1070 static void s5p_tv_setup(void)
1072 /* direct HPD to HDMI chip */
1073 gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
1074 s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
1075 s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
1078 static void __init universal_reserve(void)
1080 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
1083 static void __init universal_machine_init(void)
1085 universal_sdhci_init();
1088 s3c_i2c0_set_platdata(&universal_i2c0_platdata);
1089 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
1091 universal_tsp_init();
1092 s3c_i2c3_set_platdata(NULL);
1093 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
1095 s3c_i2c5_set_platdata(NULL);
1096 s5p_i2c_hdmiphy_set_platdata(NULL);
1097 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
1099 s5p_fimd0_set_platdata(&universal_lcd_pdata);
1101 universal_touchkey_init();
1102 i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
1103 ARRAY_SIZE(i2c_gpio12_devs));
1105 universal_camera_init();
1108 platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
1111 MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
1112 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
1113 .atag_offset = 0x100,
1114 .init_irq = exynos4_init_irq,
1115 .map_io = universal_map_io,
1116 .handle_irq = gic_handle_irq,
1117 .init_machine = universal_machine_init,
1118 .timer = &s5p_timer,
1119 .reserve = &universal_reserve,
1120 .restart = exynos4_restart,