2 * linux/arch/arm/mach-s5pv310/mach-universal_c210.c
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
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/platform_device.h>
12 #include <linux/serial_core.h>
13 #include <linux/input.h>
14 #include <linux/gpio.h>
15 #include <linux/gpio_keys.h>
16 #include <linux/delay.h>
17 #include <linux/cma.h>
18 #include <linux/lcd.h>
19 #include <linux/spi/spi.h>
20 #include <linux/spi/spi_gpio.h>
21 #include <linux/i2c.h>
22 #include <linux/i2c-gpio.h>
23 #include <linux/i2c/mcs.h>
24 #include <linux/i2c/atmel_mxt_ts.h>
25 #include <linux/clk.h>
26 #include <linux/ntc.h>
27 #include <linux/regulator/machine.h>
28 #include <linux/regulator/fixed.h>
29 #include <linux/regulator/max8952.h>
30 #include <linux/mfd/max8998.h>
31 #include <linux/mfd/max8998-private.h>
32 #include <linux/mmc/host.h>
33 #include <linux/ak8975.h>
34 #include <linux/tmd27711.h>
35 #include <linux/pn544.h>
36 #include <linux/jack.h>
37 #include <linux/fsa9480.h>
38 #include <linux/kr3dh.h>
39 #include <linux/k3g.h>
40 #include <linux/max17040_battery.h>
41 #include <linux/ramoops.h>
42 #include <linux/mmcoops.h>
43 #include <linux/micro_usb_switch.h>
44 #include <linux/uart_select.h>
45 #include <linux/memblock.h>
46 #include <linux/rtc/rtc-s3c.h>
48 #include <asm/mach-types.h>
49 #include <asm/mach/arch.h>
50 #include <asm/setup.h>
53 #include <mach/gpio.h>
54 #include <mach/regs-clock.h>
55 #include <mach/regs-pmu.h>
58 #include <plat/devs.h>
59 #include <plat/gpio-cfg.h>
60 #include <plat/gpio-core.h>
62 #include <plat/fimc-core.h>
63 #include <plat/mipi_csis.h>
64 #include <plat/fimg2d.h>
65 #include <plat/mali.h>
68 #include <plat/regs-otg.h>
69 #include <plat/regs-serial.h>
70 #include <plat/s5pv310.h>
71 #include <plat/sdhci.h>
73 #include <plat/fimd_drm.h>
74 #include <plat/s5p-charger.h>
75 #include <plat/s5p-charger-breaker.h>
76 #include <plat/tvout.h>
79 #include <media/s5p_fimc.h>
80 #include <media/m5mols.h>
81 #include <media/s5k6aafx.h>
83 #include <sound/a1026.h>
87 #include "gpio-mobile.h"
88 #include "gpio-universal.h"
90 /* Following are default values for UCON, ULCON and UFCON UART registers */
91 #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
92 S3C2410_UCON_RXILEVEL | \
93 S3C2410_UCON_TXIRQMODE | \
94 S3C2410_UCON_RXIRQMODE | \
95 S3C2410_UCON_RXFIFO_TOI | \
96 S3C2443_UCON_RXERR_IRQEN)
98 #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
100 #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
101 S5PV210_UFCON_TXTRIG256 | \
102 S5PV210_UFCON_RXTRIG256)
104 static int hwrevision(int hwrev)
106 return ((system_rev & 0xFF) == hwrev);
109 static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
112 .ucon = UNIVERSAL_UCON_DEFAULT,
113 .ulcon = UNIVERSAL_ULCON_DEFAULT,
114 .ufcon = UNIVERSAL_UFCON_DEFAULT,
118 .ucon = UNIVERSAL_UCON_DEFAULT,
119 .ulcon = UNIVERSAL_ULCON_DEFAULT,
120 .ufcon = UNIVERSAL_UFCON_DEFAULT,
122 #ifndef CONFIG_FIQ_DEBUGGER
125 .ucon = UNIVERSAL_UCON_DEFAULT,
126 .ulcon = UNIVERSAL_ULCON_DEFAULT,
127 .ufcon = UNIVERSAL_UFCON_DEFAULT,
132 .ucon = UNIVERSAL_UCON_DEFAULT,
133 .ulcon = UNIVERSAL_ULCON_DEFAULT,
134 .ufcon = UNIVERSAL_UFCON_DEFAULT,
138 static struct s3c2410_platform_i2c universal_i2c0_platdata __initdata = {
139 .frequency = 300 * 1000,
143 static struct k3g_platform_data universal_k3g_data = {
145 .powerdown = K3G_POWERDOWN_NORMAL,
149 .block_data_update = K3G_BLOCK_DATA_UPDATE,
150 .fullscale = K3G_FULL_SCALE_2000DPS,
151 .fifo_mode = K3G_FIFO_FIFO_MODE,
152 .int2_src = K3G_INT2_OVERRUN,
153 .fifo_threshold = 16,
154 .int1_enable = K3G_INT1_EN,
155 .int1_z_high_enable = K3G_Z_HIGH_INT_EN,
156 .int1_y_high_enable = K3G_Y_HIGH_INT_EN,
157 .int1_x_high_enable = K3G_X_HIGH_INT_EN,
158 .int1_latch = K3G_INTERRUPT_LATCHED,
159 .int1_z_threshold = 0x12,
160 .int1_y_threshold = 0x25,
161 .int1_x_threshold = 0x25,
162 .int1_wait_enable = K3G_INT1_WAIT_EN,
163 .int1_wait_duration = 0x10,
167 static struct i2c_board_info i2c1_devs[] __initdata = {
170 I2C_BOARD_INFO("K3G", 0x69),
171 .platform_data = &universal_k3g_data,
174 #ifdef CONFIG_VIDEO_TVOUT
176 I2C_BOARD_INFO("s5p_ddc", (0x74 >> 1)),
182 static struct mxt_platform_data mxt_platform_data = {
189 .voltage = 2800000, /* 2.8V */
190 .orient = MXT_DIAGONAL,
191 .irqflags = IRQF_TRIGGER_FALLING,
194 static struct i2c_board_info i2c3_devs[] __initdata = {
196 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
197 .platform_data = &mxt_platform_data,
201 static void __init universal_tsp_init(void)
205 /* TSP_LDO_ON: XMDMADDR_11 */
206 gpio = S5PV310_GPE2(3);
207 gpio_request(gpio, "TSP_LDO_ON");
208 gpio_direction_output(gpio, 1);
209 gpio_export(gpio, 0);
211 /* TSP_INT: XMDMADDR_7 */
212 gpio = S5PV310_GPE1(7);
213 gpio_request(gpio, "TSP_INT");
214 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
216 * Note that because TSP_LDO provides an external pull-up to TSP_INT,
217 * the pull-up setting at GPE1(7) is useless and may be omitted in
218 * order to reduce idle current. However, it probably needs some
219 * sleep/delay from TSP_LDO_ON = true event because there could be
220 * "ramp-up" delay. Before knowing this, let's just use PULL_UP here.
222 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
223 i2c3_devs[0].irq = gpio_to_irq(gpio);
226 static struct kr3dh_platform_data universal_kr3dh_data = {
227 .power_mode = KR3DH_NORMAL_MODE,
228 .data_rate = KR3DH_ODR_50HZ,
233 .int1_cfg = KR3DH_INT_SOURCE,
234 .block_data_update = 1,
235 .fullscale = KR3DH_RANGE_2G,
236 .int1_combination = KR3DH_OR_COMBINATION,
238 .int1_z_high_enable = 1,
239 .int1_z_low_enable = 1,
240 .int1_y_high_enable = 1,
241 .int1_y_low_enable = 1,
242 .int1_x_high_enable = 1,
243 .int1_x_low_enable = 1,
244 .int1_threshold = 0x25,
245 .int1_duration = 0x01,
252 static struct i2c_board_info i2c4_devs[] __initdata = {
254 I2C_BOARD_INFO("si470x", 0x10),
256 I2C_BOARD_INFO("KR3DH", 0x19),
257 .platform_data = &universal_kr3dh_data,
262 static void __init universal_fmradio_init(void)
266 gpio = S5PV310_GPE3(4); /* XMDMDATA_4 */
267 gpio_request(gpio, "FM_INT");
268 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
269 i2c4_devs[0].irq = gpio_to_irq(gpio);
272 gpio = S5PV310_GPE3(5); /* XMDMDATA_5 */
273 gpio_request(gpio, "FM_nRST");
274 gpio_direction_output(gpio, 1);
278 /* I2C5: PMICs LP3974, MAX8952 */
279 static struct regulator_consumer_supply max8952_consumer[] = {
281 .supply = "varm_1.2v_c210", /* obsolete */
287 static struct max8952_platform_data universal_max8952_pdata = {
288 .gpio_vid0 = S5PV310_GPX0(3),
289 .gpio_vid1 = S5PV310_GPX0(4),
290 .gpio_en = -1, /* Not controllable, set "Always High" */
291 .default_mode = 3, /* vid0 = 1, vid1 = 1 */
292 .dvs_mode = { 13, 23, 43, 33 },
294 * 0.90 1.00 1.20 1.10V (Defaule: 1.10V)
295 * 1.10V is 0x3 so that we can reduce current at sleep
296 * because there are pull-up's at vid0 and vid1 and 1.10V is
297 * the default voltage (cpufreq is supposed to set at the
298 * default voltage/frequency during suspend).
300 .sync_freq = 0, /* default: fastest */
301 .ramp_speed = 0, /* default: fastest */
308 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
314 * MAX8952's EN is connected to an
315 * uncontrollable pin. Assume it is
320 .num_consumer_supplies = ARRAY_SIZE(max8952_consumer),
321 .consumer_supplies = max8952_consumer,
325 static struct regulator_consumer_supply lp3974_buck1_consumer[] = {
327 .supply = "vint_1.1v_c210", /* obsolete */
333 static struct regulator_consumer_supply lp3974_buck2_consumer[] = {
335 .supply = "vg3d_1.2v_c210", /* obsolete */
341 static struct regulator_consumer_supply lp3974_buck3_consumer[] = {
343 .supply = "vcc_1.8v_pda",
347 static struct regulator_consumer_supply lp3974_buck4_consumer[] = {
349 .supply = "vmem_1.2v_c210",
353 static struct regulator_consumer_supply lp3974_ldo2_consumer[] = {
354 REGULATOR_SUPPLY("valive", NULL),
357 static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
358 REGULATOR_SUPPLY("vusb_a", NULL),
359 REGULATOR_SUPPLY("vmipi_1.1v", NULL),
362 static struct regulator_consumer_supply lp3974_ldo4_consumer[] = {
363 REGULATOR_SUPPLY("vadc", NULL),
364 REGULATOR_SUPPLY("vadc", "s5p-charger"),
367 static struct regulator_consumer_supply lp3974_ldo5_consumer[] = {
368 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
371 static struct regulator_consumer_supply lp3974_ldo7_consumer[] = {
372 REGULATOR_SUPPLY("vmipi_1.8v", NULL),
373 REGULATOR_SUPPLY("vlcd_1.8v", NULL),
376 static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
377 REGULATOR_SUPPLY("vusb_d", NULL),
378 REGULATOR_SUPPLY("vdac", NULL),
381 static struct regulator_consumer_supply lp3974_ldo9_consumer[] = {
382 REGULATOR_SUPPLY("vcc_2.8v_pda", NULL),
383 REGULATOR_SUPPLY("vddio", "0-003c"),
386 static struct regulator_consumer_supply lp3974_ldo10_consumer[] = {
387 REGULATOR_SUPPLY("vpll", NULL),
390 static struct regulator_consumer_supply lp3974_ldo11_consumer[] = {
392 .supply = "cam_af_3.3v",
394 REGULATOR_SUPPLY("dig_28", "0-001f"), /* CAM_AF_3.3V */
397 static struct regulator_consumer_supply lp3974_ldo12_consumer[] = {
403 static struct regulator_consumer_supply lp3974_ldo13_consumer[] = {
404 REGULATOR_SUPPLY("vhsic", NULL),
407 static struct regulator_consumer_supply lp3974_ldo14_consumer[] = {
409 .supply = "cam_i_host_1.8v",
411 REGULATOR_SUPPLY("dig_18", "0-001f"), /* CAM_I_HOST_1.8V */
414 static struct regulator_consumer_supply lp3974_ldo15_consumer[] = {
415 REGULATOR_SUPPLY("dig_12", "0-001f"), /* CAM_S_DIG_1.2V */
416 REGULATOR_SUPPLY("fm33_core_1.2v", NULL),
419 static struct regulator_consumer_supply lp3974_ldo16_consumer[] = {
420 REGULATOR_SUPPLY("a_sensor", "0-001f"),
421 REGULATOR_SUPPLY("vdda", "0-003c"),
424 static struct regulator_consumer_supply lp3974_ldo17_consumer[] = {
425 REGULATOR_SUPPLY("vlcd_3.0v", NULL),
426 REGULATOR_SUPPLY("mipi_csi", "s5p-mipi-csis.0"),
429 static struct regulator_consumer_supply lp3974_esafeout1_consumer[] = {
431 .supply = "usb_vbus_ap_5v",
435 static struct regulator_consumer_supply lp3974_esafeout2_consumer[] = {
437 .supply = "usb_vbus_cp_5v",
441 static struct regulator_consumer_supply lp3974_charger_consumer[] = {
442 REGULATOR_SUPPLY("vinchg", "s5p-charger"),
443 REGULATOR_SUPPLY("vinchg", "s5p-charger-breaker"),
446 static struct regulator_init_data lp3974_buck1_data = {
451 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
452 REGULATOR_CHANGE_STATUS,
459 .num_consumer_supplies = ARRAY_SIZE(lp3974_buck1_consumer),
460 .consumer_supplies = lp3974_buck1_consumer,
463 static struct regulator_init_data lp3974_buck2_data = {
466 .min_uV = 1100000, /* Default after boot */
467 .max_uV = 1200000, /* For max performance */
468 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
469 REGULATOR_CHANGE_VOLTAGE,
476 .num_consumer_supplies = ARRAY_SIZE(lp3974_buck2_consumer),
477 .consumer_supplies = lp3974_buck2_consumer,
480 static struct regulator_init_data lp3974_buck3_data = {
492 .num_consumer_supplies = ARRAY_SIZE(lp3974_buck3_consumer),
493 .consumer_supplies = lp3974_buck3_consumer,
496 static struct regulator_init_data lp3974_buck4_data = {
501 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
509 .num_consumer_supplies = ARRAY_SIZE(lp3974_buck4_consumer),
510 .consumer_supplies = lp3974_buck4_consumer,
513 static struct regulator_init_data lp3974_ldo2_data = {
515 .name = "VALIVE_1.2V",
525 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo2_consumer),
526 .consumer_supplies = lp3974_ldo2_consumer,
529 static struct regulator_init_data lp3974_ldo3_data = {
531 .name = "VUSB/MIPI_1.1V",
535 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
541 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo3_consumer),
542 .consumer_supplies = lp3974_ldo3_consumer,
545 static struct regulator_init_data lp3974_ldo4_data = {
551 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
558 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo4_consumer),
559 .consumer_supplies = lp3974_ldo4_consumer,
562 static struct regulator_init_data lp3974_ldo5_data = {
568 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
574 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo5_consumer),
575 .consumer_supplies = lp3974_ldo5_consumer,
578 static struct regulator_init_data lp3974_ldo6_data = {
584 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
592 static struct regulator_init_data lp3974_ldo7_data = {
594 .name = "VLCD/VMIPI_1.8V",
598 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
604 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo7_consumer),
605 .consumer_supplies = lp3974_ldo7_consumer,
608 static struct regulator_init_data lp3974_ldo8_data = {
610 .name = "VUSB/VDAC_3.3V",
614 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
620 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo8_consumer),
621 .consumer_supplies = lp3974_ldo8_consumer,
624 static struct regulator_init_data lp3974_ldo9_data = {
636 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo9_consumer),
637 .consumer_supplies = lp3974_ldo9_consumer,
640 static struct regulator_init_data lp3974_ldo10_data = {
646 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
652 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo10_consumer),
653 .consumer_supplies = lp3974_ldo10_consumer,
656 static struct regulator_init_data lp3974_ldo11_data = {
658 .name = "CAM_AF_3.3V",
662 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
668 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo11_consumer),
669 .consumer_supplies = lp3974_ldo11_consumer,
672 static struct regulator_init_data lp3974_ldo12_data = {
678 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
684 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo12_consumer),
685 .consumer_supplies = lp3974_ldo12_consumer,
688 static struct regulator_init_data lp3974_ldo13_data = {
690 .name = "VHSIC_1.2V",
694 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
700 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo13_consumer),
701 .consumer_supplies = lp3974_ldo13_consumer,
704 static struct regulator_init_data lp3974_ldo14_data = {
706 .name = "CAM_I_HOST_1.8V",
710 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
716 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo14_consumer),
717 .consumer_supplies = lp3974_ldo14_consumer,
720 static struct regulator_init_data lp3974_ldo15_data = {
722 .name = "CAM_S_DIG/FM33_CORE_1.2V",
726 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
732 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo15_consumer),
733 .consumer_supplies = lp3974_ldo15_consumer,
736 static struct regulator_init_data lp3974_ldo16_data = {
738 .name = "CAM_S_ANA_2.8V",
742 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
748 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo16_consumer),
749 .consumer_supplies = lp3974_ldo16_consumer,
752 static struct regulator_init_data lp3974_ldo17_data = {
754 .name = "VCC_3.0V_LCD",
758 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
764 .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo17_consumer),
765 .consumer_supplies = lp3974_ldo17_consumer,
768 static struct regulator_init_data lp3974_32khz_ap_data = {
779 static struct regulator_init_data lp3974_32khz_cp_data = {
789 static struct regulator_init_data lp3974_vichg_data = {
799 static struct regulator_init_data lp3974_esafeout1_data = {
805 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
811 .num_consumer_supplies = ARRAY_SIZE(lp3974_esafeout1_consumer),
812 .consumer_supplies = lp3974_esafeout1_consumer,
815 static struct regulator_init_data lp3974_esafeout2_data = {
821 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
827 .num_consumer_supplies = ARRAY_SIZE(lp3974_esafeout2_consumer),
828 .consumer_supplies = lp3974_esafeout2_consumer,
831 static struct regulator_init_data lp3974_charger_data = {
837 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
838 REGULATOR_CHANGE_CURRENT,
840 .num_consumer_supplies = ARRAY_SIZE(lp3974_charger_consumer),
841 .consumer_supplies = lp3974_charger_consumer,
844 static struct max8998_regulator_data lp3974_regulators[] = {
845 { MAX8998_LDO2, &lp3974_ldo2_data },
846 { MAX8998_LDO3, &lp3974_ldo3_data },
847 { MAX8998_LDO4, &lp3974_ldo4_data },
848 { MAX8998_LDO5, &lp3974_ldo5_data },
849 { MAX8998_LDO6, &lp3974_ldo6_data },
850 { MAX8998_LDO7, &lp3974_ldo7_data },
851 { MAX8998_LDO8, &lp3974_ldo8_data },
852 { MAX8998_LDO9, &lp3974_ldo9_data },
853 { MAX8998_LDO10, &lp3974_ldo10_data },
854 { MAX8998_LDO11, &lp3974_ldo11_data },
855 { MAX8998_LDO12, &lp3974_ldo12_data },
856 { MAX8998_LDO13, &lp3974_ldo13_data },
857 { MAX8998_LDO14, &lp3974_ldo14_data },
858 { MAX8998_LDO15, &lp3974_ldo15_data },
859 { MAX8998_LDO16, &lp3974_ldo16_data },
860 { MAX8998_LDO17, &lp3974_ldo17_data },
861 { MAX8998_BUCK1, &lp3974_buck1_data },
862 { MAX8998_BUCK2, &lp3974_buck2_data },
863 { MAX8998_BUCK3, &lp3974_buck3_data },
864 { MAX8998_BUCK4, &lp3974_buck4_data },
865 { MAX8998_EN32KHZ_AP, &lp3974_32khz_ap_data },
866 { MAX8998_EN32KHZ_CP, &lp3974_32khz_cp_data },
867 { MAX8998_ENVICHG, &lp3974_vichg_data },
868 { MAX8998_ESAFEOUT1, &lp3974_esafeout1_data },
869 { MAX8998_ESAFEOUT2, &lp3974_esafeout2_data },
870 { MAX8998_CHARGER, &lp3974_charger_data },
873 static struct max8998_platform_data universal_lp3974_pdata = {
874 .irq_base = IRQ_PMIC_BASE,
875 .num_regulators = ARRAY_SIZE(lp3974_regulators),
876 .regulators = lp3974_regulators,
877 .buck1_voltage1 = 1100000, /* INT */
878 .buck1_voltage2 = 1000000,
879 .buck1_voltage3 = 1100000,
880 .buck1_voltage4 = 1000000,
881 .buck1_set1 = S5PV310_GPX0(5),
882 .buck1_set2 = S5PV310_GPX0(6),
883 .buck2_voltage1 = 1200000, /* G3D */
884 .buck2_voltage2 = 1100000,
885 .buck1_default_idx = 0,
886 .buck2_set3 = S5PV310_GPE2(0),
887 .buck2_default_idx = 0,
894 static void __init universal_pmic_init(void)
898 gpio = S5PV310_GPE2(0);
899 gpio_request(gpio, "BUCK2_EN");
900 gpio_direction_output(gpio, universal_lp3974_pdata.buck2_default_idx);
901 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
903 gpio = S5PV310_GPX0(5);
904 gpio_request(gpio, "BUCK1_EN_A");
905 gpio_direction_output(gpio,
906 universal_lp3974_pdata.buck1_default_idx % 2);
907 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
909 gpio = S5PV310_GPX0(6);
910 gpio_request(gpio, "BUCK1_EN_B");
911 gpio_direction_output(gpio,
912 (universal_lp3974_pdata.buck1_default_idx / 2) % 2);
913 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
915 gpio = S5PV310_GPX0(7);
916 gpio_request(gpio, "AP_PMIC_IRQ");
917 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
918 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
920 /* TO BE ENABLED LATER
921 regulator_has_full_constraints();
925 /* GPIO I2C 5 (PMIC) */
926 enum { I2C5_MAX8952, I2C5_LP3974 };
927 static struct i2c_board_info i2c5_devs[] __initdata = {
929 I2C_BOARD_INFO("max8952", 0xC0 >> 1),
930 .platform_data = &universal_max8952_pdata,
933 I2C_BOARD_INFO("lp3974-regerr", 0xCC >> 1),
934 .platform_data = &universal_lp3974_pdata,
938 static void __init universal_sound_init(void)
942 /* Set PMU register to set CLK_OUT to use XUSBXTI
943 * as codec source clock */
945 __raw_writel(val, S5P_PMREG(0xA00));
949 static struct i2c_board_info i2c6_devs_rev00[] __initdata = {
952 I2C_BOARD_INFO("mc1n2", 0x3a),
956 static struct a1026_platform_data universal_a1026_pdata = {
957 .reset = S5PV310_GPL2(4), /* XGNSS_GPIO_3 */
958 .wake_up = S5PV310_GPL2(3), /* XGNSS_GPIO_4 */
959 .i2c_clk = S5PV310_GPC1(3), /* XI2S2SDO - CODEC_SDA_1.8V */
960 .i2c_data = S5PV310_GPC1(4), /* XI2S2SDI - CODEC_SCL_1.8V */
963 static struct i2c_board_info i2c6_devs_rev02[] __initdata = {
966 I2C_BOARD_INFO("mc1n2", 0x3a),
969 I2C_BOARD_INFO("a1026", 0x3e),
970 .platform_data = &universal_a1026_pdata,
974 static struct ak8975_platform_data universal_ak8975_data = {
975 .poll_interval = 100,
979 static struct i2c_board_info i2c7_devs[] __initdata = {
982 I2C_BOARD_INFO("ak8975", 0x0c),
983 .platform_data = &universal_ak8975_data,
987 static void __init universal_sensor_init(void)
991 gpio = S5PV310_GPE1(5); /* XMDMADDR_5 */
992 gpio_request(gpio, "MSENSE_INT");
993 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
994 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
995 i2c7_devs[0].irq = gpio_to_irq(gpio);
997 gpio = S5PV310_GPX0(0); /* XEINT_0 */
998 gpio_request(gpio, "GYRO_INT");
999 gpio_direction_input(gpio);
1000 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
1002 gpio = S5PV310_GPX0(1); /* XEINT_1 */
1003 gpio_request(gpio, "GYRO_INT1");
1004 gpio_direction_input(gpio);
1005 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
1007 gpio = S5PV310_GPX0(2); /* XEINT_2 */
1008 gpio_request(gpio, "PS/ALS_INT");
1009 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1010 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1012 gpio = S5PV310_GPX2(4); /* XEINT_20 */
1013 gpio_request(gpio, "ACC_INT");
1014 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1015 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
1021 static struct i2c_gpio_platform_data i2c9_gpio_data = {
1022 .sda_pin = S5PV310_GPY4(0), /* XM0ADDR_8 */
1023 .scl_pin = S5PV310_GPY4(1), /* XM0ADDR_9 */
1026 static struct platform_device i2c9_gpio = {
1030 .platform_data = &i2c9_gpio_data,
1034 static struct max17040_platform_data universal_battery_platform_data = {
1035 .rcomp = 0x9700, /* 1500mAh */
1038 static struct i2c_board_info i2c9_devs[] __initdata = {
1040 I2C_BOARD_INFO("max17040", 0x36),
1041 .platform_data = &universal_battery_platform_data,
1045 /* GPIO I2C 10 (Micro USB Switch) */
1046 static void fsa9480_cfg_gpio(void)
1048 /* EINT24: JACK_nINT */
1049 s3c_gpio_cfgpin(S5PV310_GPX3(0), S3C_GPIO_SFN(0x0));
1050 gpio_request(S5PV310_GPX3(0), "JACK_nINT");
1051 s3c_gpio_setpull(S5PV310_GPX3(0), S3C_GPIO_PULL_NONE);
1053 /* GPE2_4: TA_CURRENT_SEL */
1054 s3c_gpio_cfgpin(S5PV310_GPE2(4), S3C_GPIO_INPUT);
1055 gpio_request(S5PV310_GPE2(4), "TA_CURRENT_SEL");
1056 s3c_gpio_setpull(S5PV310_GPE2(4), S3C_GPIO_PULL_UP);
1059 static void universal_usb_cb(u8 attached);
1060 static void universal_charger_cb(u8 attached);
1061 static void universal_jig_cb(u8 attached);
1062 static void universal_fsa9480_reset_cb(void);
1063 static void universal_usb_power(u8 on);
1065 static struct fsa9480_platform_data universal_fsa9480_platform_data = {
1066 .cfg_gpio = fsa9480_cfg_gpio,
1067 .usb_cb = universal_usb_cb,
1069 .charger_cb = universal_charger_cb,
1070 .jig_cb = universal_jig_cb,
1071 .reset_cb = universal_fsa9480_reset_cb,
1072 .usb_power = universal_usb_power,
1076 static struct i2c_gpio_platform_data i2c10_gpio_data = {
1077 .sda_pin = S5PV310_GPE1(0), /* XMDMADDR_0 */
1078 .scl_pin = S5PV310_GPE1(1), /* XMDMADDR_1 */
1081 static struct platform_device i2c10_gpio = {
1085 .platform_data = &i2c10_gpio_data,
1089 static struct i2c_board_info i2c10_devs[] __initdata = {
1091 I2C_BOARD_INFO("fsa9480", 0x25),
1092 .platform_data = &universal_fsa9480_platform_data,
1093 .irq = IRQ_EINT(24),
1097 /* GPIO I2C 12 (3 Touchkey) */
1098 #define TOUCHKEY_EN S5PV310_GPE3(3) /* XMDMDATA_3 */
1099 #define TOUCHKEY_INTR S5PV310_GPE3(7)
1100 #define TOUCHKEY_SDA S5PV310_GPE4(0)
1101 #define TOUCHKEY_SCL S5PV310_GPE4(1)
1103 static uint32_t touchkey_keymap[] = {
1104 /* MCS_KEY_MAP(value, keycode) */
1105 #ifdef ANDROID_KEYMAP
1106 MCS_KEY_MAP(0, KEY_MENU), /* KEY_SEND */
1107 MCS_KEY_MAP(1, KEY_BACK), /* KEY_END */
1109 MCS_KEY_MAP(0, KEY_PHONE), /* KEY_SEND */
1110 /* KEY_BACK will be used */
1111 MCS_KEY_MAP(1, KEY_EXIT), /* KEY_END */
1115 static void touchkey_poweron(bool enable)
1117 gpio_set_value(TOUCHKEY_EN, enable);
1120 static void touchkey_cfg_pin_fw(int use)
1123 s3c_gpio_cfgpin(TOUCHKEY_SDA, S3C_GPIO_OUTPUT);
1124 s3c_gpio_cfgpin(TOUCHKEY_SCL, S3C_GPIO_OUTPUT);
1125 s3c_gpio_cfgpin(TOUCHKEY_INTR, S3C_GPIO_OUTPUT);
1127 s3c_gpio_setpull(TOUCHKEY_SDA, S3C_GPIO_PULL_NONE);
1128 s3c_gpio_setpull(TOUCHKEY_SCL, S3C_GPIO_PULL_NONE);
1129 s3c_gpio_setpull(TOUCHKEY_INTR, S3C_GPIO_PULL_NONE);
1131 gpio_direction_output(TOUCHKEY_SDA, 0);
1132 gpio_direction_output(TOUCHKEY_SCL, 0);
1133 gpio_direction_output(TOUCHKEY_INTR, 0);
1135 s3c_gpio_setpull(TOUCHKEY_SDA, S3C_GPIO_PULL_UP);
1136 s3c_gpio_setpull(TOUCHKEY_SCL, S3C_GPIO_PULL_UP);
1137 s3c_gpio_setpull(TOUCHKEY_INTR, S3C_GPIO_PULL_UP);
1139 s3c_gpio_cfgpin(TOUCHKEY_SDA, S3C_GPIO_SFN(2));
1140 s3c_gpio_cfgpin(TOUCHKEY_SCL, S3C_GPIO_SFN(2));
1141 s3c_gpio_cfgpin(TOUCHKEY_INTR, S3C_GPIO_SFN(0xf));
1145 static struct mcs_platform_data touchkey_data = {
1146 .poweron = touchkey_poweron,
1147 .cfg_pin_fw = touchkey_cfg_pin_fw,
1148 .fw_ver = 0x02, /* MCS5080 Firnware Version */
1149 .md_ver = 0x01, /* MCS5080 Module Version */
1150 .keymap = touchkey_keymap,
1151 .keymap_size = ARRAY_SIZE(touchkey_keymap),
1155 static struct i2c_gpio_platform_data i2c12_gpio_data = {
1156 .sda_pin = S5PV310_GPE4(0), /* XMDMDATA_8 */
1157 .scl_pin = S5PV310_GPE4(1), /* XMDMDATA_9 */
1160 static struct platform_device i2c12_gpio = {
1164 .platform_data = &i2c12_gpio_data,
1168 static struct i2c_board_info i2c12_devs[] __initdata = {
1170 I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
1171 .platform_data = &touchkey_data,
1175 static void __init universal_touchkey_init(void)
1180 gpio = S5PV310_GPE3(7); /* XMDMDATA_7 */
1181 gpio_request(gpio, "3_TOUCH_INT");
1182 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1183 irq = gpio_to_irq(gpio);
1184 i2c12_devs[0].irq = irq;
1186 gpio = S5PV310_GPE3(3); /* XMDMDATA_3 */
1187 gpio_request(gpio, "3_TOUCH_EN");
1188 gpio_direction_output(gpio, 1);
1189 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1192 static void tmd27711_control_power_source(int enable)
1194 struct regulator *regulator = regulator_get(NULL, "ps_2.8v");
1195 static int disabled = 1;
1197 if (IS_ERR_OR_NULL(regulator))
1202 regulator_disable(regulator);
1205 regulator_enable(regulator);
1208 regulator_disable(regulator);
1212 regulator_put(regulator);
1215 static struct tmd27711_platform_data universal_tmd27711_data = {
1216 .control_power_source = tmd27711_control_power_source,
1217 .power_on = TMD27711_PON,
1218 .wait_enable = TMD27711_WEN,
1219 .wait_time = 0xf2, /* 35.36 ms */
1222 .ps_enable = TMD27711_PEN,
1223 .ps_interrupt_h_thres = 700,
1224 .ps_interrupt_l_thres = 600,
1225 .ps_interrupt_enable = TMD27711_PIEN,
1227 .ps_interrupt_persistence = 0x30,
1228 .ps_pulse_count = 0x08,
1229 .ps_drive_strength = TMD27711_PDRIVE_12MA,
1230 .ps_diode = TMD27711_PDIODE_CH1_DIODE,
1233 .als_enable = TMD27711_AEN,
1234 .als_time = 200, /* 152.32 ms */
1235 .als_interrupt_persistence = 1,
1236 .als_gain = TMD27711_AGAIN_16X,
1240 static struct i2c_gpio_platform_data i2c14_gpio_data = {
1241 .sda_pin = S5PV310_GPK2(2), /* XMMC2CDn */
1242 .scl_pin = S5PV310_GPK3(2), /* XMMC3CDn */
1243 .udelay = 1, /* 500kHz */
1246 static struct platform_device i2c14_gpio = {
1250 .platform_data = &i2c14_gpio_data,
1254 static struct i2c_board_info i2c14_devs[] __initdata = {
1256 I2C_BOARD_INFO("TMD27711", 0x39),
1257 .platform_data = &universal_tmd27711_data,
1263 #define GPIO_NFC_SCL_1_8V S5PV310_GPY3(0)
1264 #define GPIO_NFC_SDA_1_8V S5PV310_GPY3(2)
1265 #define GPIO_NFC_IRQ S5PV310_GPX1(7)
1266 #define GPIO_NFC_EN S5PV310_GPY3(7)
1267 #define GPIO_NFC_FIRMWARE S5PV310_GPY4(4)
1269 /* GPIO_LEVEL_NONE = 2, GPIO_LEVEL_LOW = 0 */
1270 static unsigned int nfc_gpio_table[][4] = {
1271 {GPIO_NFC_IRQ, S3C_GPIO_INPUT, 2, S3C_GPIO_PULL_DOWN},
1272 {GPIO_NFC_EN, S3C_GPIO_OUTPUT, 0, S3C_GPIO_PULL_NONE},
1273 {GPIO_NFC_FIRMWARE, S3C_GPIO_OUTPUT, 0, S3C_GPIO_PULL_NONE},
1274 {GPIO_NFC_SCL_1_8V, S3C_GPIO_INPUT, 2, S3C_GPIO_PULL_NONE},
1275 {GPIO_NFC_SDA_1_8V, S3C_GPIO_INPUT, 2, S3C_GPIO_PULL_NONE},
1278 void nfc_setup_gpio(void)
1280 int array_size = ARRAY_SIZE(nfc_gpio_table);
1282 for (i = 0; i < array_size; i++) {
1283 gpio = nfc_gpio_table[i][0];
1284 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(nfc_gpio_table[i][1]));
1285 s3c_gpio_setpull(gpio, nfc_gpio_table[i][3]);
1286 if (nfc_gpio_table[i][2] != 2)
1287 gpio_set_value(gpio, nfc_gpio_table[i][2]);
1291 static struct i2c_gpio_platform_data i2c15_gpio_data = {
1292 .sda_pin = S5PV310_GPY3(2), /* XM0ADDR_2 */
1293 .scl_pin = S5PV310_GPY3(0), /* XM0ADDR_0 */
1297 static struct platform_device i2c15_gpio = {
1301 .platform_data = &i2c15_gpio_data,
1306 static struct pn544_i2c_platform_data pn544_pdata = {
1307 .irq_gpio = GPIO_NFC_IRQ,
1308 .ven_gpio = GPIO_NFC_EN,
1309 .firm_gpio = GPIO_NFC_FIRMWARE,
1312 static struct i2c_board_info i2c15_devs[] __initdata = {
1314 I2C_BOARD_INFO("pn544", 0x2b),
1315 .platform_data = &pn544_pdata,
1316 .irq = IRQ_EINT(15), /* NFC_IRQ */
1321 static struct gpio_keys_button universal_gpio_keys_tables[] = {
1323 .code = KEY_VOLUMEUP,
1324 .gpio = S5PV310_GPX2(0), /* XEINT16 */
1325 .desc = "gpio-keys: KEY_VOLUMEUP",
1328 .debounce_interval = 1,
1330 .code = KEY_VOLUMEDOWN,
1331 .gpio = S5PV310_GPX2(1), /* XEINT17 */
1332 .desc = "gpio-keys: KEY_VOLUMEDOWN",
1335 .debounce_interval = 1,
1338 .gpio = S5PV310_GPX2(2), /* XEINT18 */
1339 .desc = "gpio-keys: KEY_CONFIG",
1342 .debounce_interval = 1,
1345 .gpio = S5PV310_GPX2(3), /* XEINT19 */
1346 .desc = "gpio-keys: KEY_CAMERA",
1349 .debounce_interval = 1,
1352 .gpio = S5PV310_GPX2(7), /* XEINT23 */
1353 .desc = "gpio-keys: KEY_POWER",
1357 .debounce_interval = 1,
1359 /* KEY_MENU will be used */
1360 .code = KEY_FRONT, /* KEY_OK */
1361 .gpio = S5PV310_GPX3(5), /* XEINT29 */
1362 .desc = "gpio-keys: KEY_MENU",
1365 .debounce_interval = 1,
1369 static struct gpio_keys_platform_data universal_gpio_keys_data = {
1370 .buttons = universal_gpio_keys_tables,
1371 .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables),
1374 static struct platform_device universal_gpio_keys = {
1375 .name = "gpio-keys",
1377 .platform_data = &universal_gpio_keys_data,
1381 static unsigned int ld9040_lcd_enabled;
1383 static struct s3cfb_lcd ld9040 = {
1409 static int lcd_cfg_gpio(void)
1414 for (i = 0; i < 8; i++) {
1415 /* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
1416 s3c_gpio_cfgpin(S5PV310_GPF0(i), S3C_GPIO_SFN(2));
1417 s3c_gpio_setpull(S5PV310_GPF0(i), S3C_GPIO_PULL_NONE);
1420 for (i = 0; i < 8; i++) {
1421 s3c_gpio_cfgpin(S5PV310_GPF1(i), S3C_GPIO_SFN(2));
1422 s3c_gpio_setpull(S5PV310_GPF1(i), S3C_GPIO_PULL_NONE);
1425 for (i = 0; i < 8; i++) {
1426 s3c_gpio_cfgpin(S5PV310_GPF2(i), S3C_GPIO_SFN(2));
1427 s3c_gpio_setpull(S5PV310_GPF2(i), S3C_GPIO_PULL_NONE);
1430 for (i = 0; i < f3_end; i++) {
1431 s3c_gpio_cfgpin(S5PV310_GPF3(i), S3C_GPIO_SFN(2));
1432 s3c_gpio_setpull(S5PV310_GPF3(i), S3C_GPIO_PULL_NONE);
1435 /* Set FIMD0 bypass */
1436 reg = __raw_readl(S3C_VA_SYS + 0x0210);
1438 __raw_writel(reg, S3C_VA_SYS + 0x0210);
1443 static int lcd_power_on(struct lcd_device *ld, int enable)
1445 struct regulator *regulator;
1448 printk(KERN_ERR "lcd device object is NULL.\n");
1453 regulator = regulator_get(NULL, "vlcd_3.0v");
1454 if (IS_ERR(regulator))
1456 regulator_enable(regulator);
1457 regulator_put(regulator);
1458 regulator = regulator_get(NULL, "vlcd_1.8v");
1459 if (IS_ERR(regulator))
1461 regulator_enable(regulator);
1462 regulator_put(regulator);
1464 regulator = regulator_get(NULL, "vlcd_1.8v");
1465 if (IS_ERR(regulator))
1467 if (regulator_is_enabled(regulator))
1468 regulator_force_disable(regulator);
1469 regulator_put(regulator);
1470 regulator = regulator_get(NULL, "vlcd_3.0v");
1471 if (IS_ERR(regulator))
1473 if (regulator_is_enabled(regulator))
1474 regulator_force_disable(regulator);
1475 regulator_put(regulator);
1481 static int reset_lcd(struct lcd_device *ld)
1483 static unsigned int first = 1;
1484 int reset_gpio = -1;
1486 reset_gpio = S5PV310_GPY4(5);
1489 gpio_request(reset_gpio, "MLCD_RST");
1494 gpio_direction_output(reset_gpio, 0);
1496 gpio_direction_output(reset_gpio, 1);
1501 static void __init early_lcd(char **param)
1505 if (strncmp(*param, "ld9040", 6) == 0)
1506 ld9040_lcd_enabled = 1;
1508 __early_param("lcd", early_lcd);
1510 static struct lcd_platform_data ld9040_platform_data = {
1512 .power_on = lcd_power_on,
1513 /* it indicates whether lcd panel is enabled from u-boot. */
1515 .reset_delay = 10, /* 10ms */
1516 .power_on_delay = 10, /* 10ms */
1517 .power_off_delay = 120, /* 120ms */
1520 #define LCD_BUS_NUM 3
1521 #define DISPLAY_CS S5PV310_GPY4(3)
1522 static struct spi_board_info spi_board_info[] __initdata = {
1524 .max_speed_hz = 1200000,
1525 .bus_num = LCD_BUS_NUM,
1528 .controller_data = (void *)DISPLAY_CS,
1532 #define DISPLAY_CLK S5PV310_GPY3(1)
1533 #define DISPLAY_SI S5PV310_GPY3(3)
1534 static struct spi_gpio_platform_data lcd_spi_gpio_data = {
1537 .miso = SPI_GPIO_NO_MISO,
1538 .num_chipselect = 1,
1541 static struct platform_device universal_spi_gpio = {
1545 .parent = &s3c_device_fb.dev,
1546 .platform_data = &lcd_spi_gpio_data,
1550 #ifdef CONFIG_VIDEO_FIMG2D
1551 static struct fimg2d_platdata fimg2d_data __initdata = {
1553 .parent_clkname = "mout_g2d0",
1554 .clkname = "sclk_fimg2d",
1555 .gate_clkname = "fimg2d",
1556 .smmu_gate_clkname = "smmu_fimg2d",
1557 .clkrate = 250 * 1000000,
1561 static struct s3c_platform_fb fb_platform_data __initdata = {
1565 #ifdef CONFIG_FB_S3C_DEFAULT_WINDOW
1566 .default_win = CONFIG_FB_S3C_DEFAULT_WINDOW,
1570 .swap = FB_SWAP_HWORD | FB_SWAP_WORD,
1573 #ifdef CONFIG_FB_S3C
1574 static void __init universal_fb_init(void)
1576 strcpy(spi_board_info[0].modalias, "ld9040");
1578 /* workaround: because of early_lcd not working */
1579 ld9040_platform_data.lcd_enabled = 1;
1580 spi_board_info[0].platform_data =
1581 (void *)&ld9040_platform_data;
1583 spi_register_board_info(spi_board_info,
1584 ARRAY_SIZE(spi_board_info));
1586 fb_platform_data.lcd_data = (struct s3cfb_lcd *)&ld9040;
1589 s3cfb_set_platdata(&fb_platform_data);
1594 * CAMERA Fixed voltage regulators
1595 * The Source of regulators is V_BAT. And, the consumer name only specified in
1596 * the driver, was registered Fixed regulator.
1599 /* CIF(or VGA) attached at the front: S5K6AAFX */
1600 static struct regulator_consumer_supply supplies_cam_pwr_en2[] = {
1601 REGULATOR_SUPPLY("core", "0-003c"),
1604 /* MEGA attached at the back: M5MOLS */
1605 static struct regulator_consumer_supply supplies_8m_core_en[] = {
1606 REGULATOR_SUPPLY("core", "0-001f"),
1608 static struct regulator_consumer_supply supplies_cam_pwr_en1[] = {
1609 REGULATOR_SUPPLY("d_sensor", "0-001f"),
1612 static struct regulator_init_data cam_fixreg_init_data[] = {
1614 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1615 .num_consumer_supplies = ARRAY_SIZE(supplies_cam_pwr_en2),
1616 .consumer_supplies = supplies_cam_pwr_en2,
1619 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1620 .num_consumer_supplies = ARRAY_SIZE(supplies_8m_core_en),
1621 .consumer_supplies = supplies_8m_core_en,
1624 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1625 .num_consumer_supplies = ARRAY_SIZE(supplies_cam_pwr_en1),
1626 .consumer_supplies = supplies_cam_pwr_en1,
1630 static struct fixed_voltage_config cam_fixreg_cfg[] = {
1632 .supply_name = "CAM_PWR_EN2",
1633 .microvolts = 2800000,
1634 .gpio = S5PV310_GPE2(1),
1636 .init_data = &cam_fixreg_init_data[0],
1639 .supply_name = "CAM_8M_CORE_EN",
1640 .microvolts = 1200000,
1641 .gpio = S5PV310_GPE2(2),
1643 .init_data = &cam_fixreg_init_data[1],
1646 .supply_name = "CAM_PWR_EN1",
1647 .microvolts = 1800000,
1648 .gpio = S5PV310_GPE3(0),
1650 .init_data = &cam_fixreg_init_data[2],
1654 static struct platform_device camera_fixed_reg_dev[] = {
1656 .name = "reg-fixed-voltage", .id = 1,
1657 .dev = { .platform_data = &cam_fixreg_cfg[0] },
1659 .name = "reg-fixed-voltage", .id = 2,
1660 .dev = { .platform_data = &cam_fixreg_cfg[1] },
1662 .name = "reg-fixed-voltage", .id = 3,
1663 .dev = { .platform_data = &cam_fixreg_cfg[2] },
1667 static struct s5p_platform_mipi_csis mipi_csis0_pldata = {
1668 .clk_rate = 166000000UL,
1672 .phy_enable = s5p_csis_phy_enable,
1675 static int s5k6aafx_additional_set_power(struct device *dev, int on)
1679 gpio_i2c = MOBILE_GPIO(CAM_LEVEL_EN2);
1682 gpio_set_value(gpio_i2c, 1);
1684 gpio_set_value(gpio_i2c, 0);
1689 static struct s5k6aafx_platform_data s5k6aafx_pldata = {
1690 .set_power = s5k6aafx_additional_set_power,
1691 .clk_rate = 16000000UL,
1692 .gpio_nreset = -EINVAL,
1693 .gpio_nstby = -EINVAL,
1696 static struct i2c_board_info s5k6aafx_board_info = {
1697 I2C_BOARD_INFO("S5K6AAFX", 0x3C),
1698 .platform_data = &s5k6aafx_pldata,
1701 static int m5mols_additional_set_power(struct device *dev, int on)
1704 * The M5MOLS's main power on/off are controlled inside the driver.
1705 * But, the pin setting I2C level-shiftter on/off, and additional pins
1706 * (n-reset, mclk for M5MOLS) is a board specific side. So, in this
1707 * function, the 2 kinds of pins are controlled.
1709 int gpio_i2c, gpio_opt;
1711 gpio_opt = MOBILE_GPIO(CAM_LEVEL_EN1); /* Negative Enable */
1712 gpio_i2c = MOBILE_GPIO(CAM_LEVEL_EN2);
1715 gpio_set_value(gpio_opt, 0);
1716 gpio_set_value(gpio_i2c, 1);
1718 gpio_set_value(gpio_opt, 1);
1719 gpio_set_value(gpio_i2c, 0);
1725 static struct m5mols_platform_data m5mols_platdata = {
1726 .set_power = m5mols_additional_set_power,
1727 .gpio_rst = -EINVAL,
1728 .rst_polarity = true, /* positive reset */
1731 static struct i2c_board_info m5mols_board_info = {
1732 I2C_BOARD_INFO("M5MOLS", 0x1F),
1733 .platform_data = &m5mols_platdata,
1736 static struct s5p_fimc_isp_info universal_vga_cam_sensor = {
1738 .flags = FIMC_CLK_INV_PCLK | FIMC_CLK_INV_VSYNC,
1739 .bus_type = FIMC_ITU_601,
1740 .board_info = &s5k6aafx_board_info,
1741 .clk_frequency = 24000000UL,
1745 static struct s5p_fimc_isp_info universal_8m_cam_sensor = {
1747 .flags = FIMC_CLK_INV_PCLK | FIMC_CLK_INV_VSYNC,
1748 .bus_type = FIMC_MIPI_CSI2,
1749 .board_info = &m5mols_board_info,
1750 .clk_frequency = 24000000UL,
1752 .csi_data_align = 32,
1755 static struct s5p_fimc_isp_info *universal_camera_sensors[] = {
1756 &universal_vga_cam_sensor,
1757 &universal_8m_cam_sensor,
1760 static struct s5p_platform_fimc universal_fimc_plat_data[] = {
1762 .isp_info = universal_camera_sensors,
1763 .num_clients = ARRAY_SIZE(universal_camera_sensors),
1767 int __init s5pv310_fimc_setup_clks(void)
1771 struct clk *clock, *parent;
1773 struct device *fimc_devs[] = {
1774 &s5p_device_fimc0.dev,
1775 &s5p_device_fimc1.dev,
1776 &s5p_device_fimc2.dev,
1777 &s5p_device_fimc3.dev
1780 parent = clk_get(NULL, "mout_epll");
1782 return PTR_ERR(parent);
1784 for (i = 0; err == 0 && i < ARRAY_SIZE(fimc_devs); i++) {
1786 clock = clk_get(fimc_devs[i], "sclk_fimc");
1787 if (IS_ERR(clock)) {
1788 err = PTR_ERR(clock);
1789 printk(KERN_ERR"couldn't get sclk_fimc.%d\n", i);
1792 clk_set_parent(clock, parent);
1801 /* Set parent clock of the MIPI-CSIS interfaces */
1802 parent = clk_get(NULL, "mout_mpll");
1803 if (IS_ERR(parent)) {
1804 err = PTR_ERR(parent);
1805 printk(KERN_ERR "failed to get clock mout_mpll\n");
1809 clock = clk_get(&s5p_device_mipi_csis0.dev, "sclk_csis");
1811 err = PTR_ERR(clock);
1813 clk_set_parent(clock, parent);
1817 printk(KERN_ERR "failed to get clock sclk_csis.0\n");
1821 /* Set parent clock of FIMC external clock for image processors */
1822 parent = clk_get(NULL, "sclk_vpll");
1823 if (IS_ERR(parent)) {
1824 printk(KERN_ERR "failed to get clock sclk_vpll\n");
1825 err = PTR_ERR(parent);
1829 clock = clk_get(fimc_devs[0], "sclk_cam");
1830 if (IS_ERR(clock)) {
1831 printk(KERN_ERR "failed to get clock sclk_cam.0\n");
1833 err = PTR_ERR(clock);
1837 clk_set_parent(clock, parent);
1844 printk("%s%s: %s\n", err ? "WARNING! " : "", __func__,
1845 err ? "failed!" : "succedded.");
1850 #define cfg_camif_pin(pin) do { \
1851 s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(2)); \
1852 s3c_gpio_setpull(pin, S3C_GPIO_PULL_UP); \
1855 static void universal_camera_init(void)
1860 /* Configuration Camera0(camA) pin for unviersal */
1861 for (i = 0; i < 8; i++)
1862 cfg_camif_pin(S5PV310_GPJ0(i));
1863 for (i = 0; i < 5; i++)
1864 cfg_camif_pin(S5PV310_GPJ1(i));
1866 /* Assign gpios for the sensor drivers */
1867 s5k6aafx_pldata.gpio_nreset = MOBILE_GPIO(CAM_VGA_NRST);
1868 s5k6aafx_pldata.gpio_nstby = MOBILE_GPIO(CAM_VGA_NSTBY);
1870 m5mols_platdata.gpio_rst = MOBILE_GPIO(CAM_MEGA_NRST);
1872 /* Camera fixed voltage regulators */
1873 for (i = 0; i < ARRAY_SIZE(camera_fixed_reg_dev); i++)
1874 platform_device_register(&camera_fixed_reg_dev[i]);
1876 /* set pin to default state, for dual camera issue */
1877 gpio = MOBILE_GPIO(CAM_MEGA_NRST);
1878 gpio_set_value(gpio, 0);
1879 gpio = MOBILE_GPIO(CAM_VGA_NRST);
1880 gpio_set_value(gpio, 0);
1881 gpio = MOBILE_GPIO(CAM_VGA_NSTBY);
1882 gpio_set_value(gpio, 0);
1886 static struct modemctl_platform_data universal_modemctl_data __initdata = {
1891 static struct platform_device universal_modemctl __initdata = {
1895 .platform_data = &universal_modemctl_data,
1900 static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
1902 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
1903 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
1905 .cd_type = S3C_SDHCI_CD_PERMANENT,
1906 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
1909 static struct regulator_consumer_supply mmc0_supplies[] = {
1910 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
1913 static struct regulator_init_data mmc0_fixed_voltage_init_data = {
1915 .name = "VMEM_VDD_2.8V",
1916 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
1918 .num_consumer_supplies = ARRAY_SIZE(mmc0_supplies),
1919 .consumer_supplies = mmc0_supplies,
1922 static struct fixed_voltage_config mmc0_fixed_voltage_config = {
1923 .supply_name = "MASSMEMORY_EN",
1924 .microvolts = 2800000,
1925 .gpio = S5PV310_GPE1(3),
1926 .enable_high = true,
1927 .init_data = &mmc0_fixed_voltage_init_data,
1930 static struct platform_device mmc0_fixed_voltage = {
1931 .name = "reg-fixed-voltage",
1934 .platform_data = &mmc0_fixed_voltage_config,
1939 static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
1941 .host_caps = MMC_CAP_4_BIT_DATA |
1942 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
1944 .ext_cd_gpio = S5PV310_GPX3(4), /* XEINT_28 */
1945 .ext_cd_gpio_invert = 1,
1946 .cd_type = S3C_SDHCI_CD_GPIO,
1947 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
1951 static void (*wlan_notify_change_cb)(struct platform_device *dev, int state);
1953 static int wlan_ext_cd_init(void (*cb)(struct platform_device *dev, int state))
1955 wlan_notify_change_cb = cb;
1959 static int wlan_ext_cd_cleanup(void (*cb)(struct platform_device *dev, int state))
1961 wlan_notify_change_cb = NULL;
1965 static int universal_wlan_host_enable(int on)
1967 if (wlan_notify_change_cb)
1968 (*wlan_notify_change_cb)(&s3c_device_hsmmc3, on);
1972 static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = {
1974 .host_caps = (MMC_CAP_4_BIT_DATA |
1975 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
1977 .cd_type = S3C_SDHCI_CD_EXTERNAL,
1978 .ext_cd_init = &wlan_ext_cd_init,
1979 .ext_cd_cleanup = &wlan_ext_cd_cleanup,
1980 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
1983 static void __init universal_sdhci_init(void)
1987 gpio = S5PV310_GPX3(4); /* T-Flash Detect */
1988 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1989 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1991 s3c_sdhci0_set_platdata(&universal_hsmmc0_data);
1992 s3c_sdhci2_set_platdata(&universal_hsmmc2_data);
1993 s3c_sdhci3_set_platdata(&universal_hsmmc3_data);
1997 static struct bcm4330_platform_data bcm4330_data = {
1998 .wlan_en = S5PV310_GPE3(1),
1999 .wlan_host_wake = S5PV310_GPX2(5),
2000 .bt_en = S5PV310_GPE1(2),
2001 .bt_nrst = S5PV310_GPE1(4),
2002 .bt_host_wake = S5PV310_GPX2(6),
2003 .bt_wake = S5PV310_GPX3(1),
2004 .bt_uart[0] = S5PV310_GPA0(0), /* XuRXD[0] */
2005 .bt_uart[1] = S5PV310_GPA0(1), /* XuTXD[0] */
2006 .bt_uart[2] = S5PV310_GPA0(2), /* XuCTSn[0] */
2007 .bt_uart[3] = S5PV310_GPA0(3), /* XuRTSn[0] */
2008 .wlan_host_enable = &universal_wlan_host_enable,
2011 static struct platform_device universal_bcm4330 = {
2015 .platform_data = &bcm4330_data,
2020 static struct jack_platform_data universal_jack_data = {
2022 .charger_online = 0,
2024 .earjack_online = 0,
2025 .earkey_online = -1,
2031 static void universal_vbus_enable(int on, char *name)
2033 struct regulator *regulator;
2035 regulator = regulator_get(NULL, name);
2036 if (IS_ERR(regulator))
2040 regulator_enable(regulator);
2042 regulator_force_disable(regulator);
2044 regulator_put(regulator);
2047 static void universal_usb_path_power(int on, int path)
2049 if (path == USB_PATH_AP)
2050 universal_vbus_enable(on, "usb_vbus_ap_5v");
2051 else if (path == USB_PATH_CP)
2052 universal_vbus_enable(on, "usb_vbus_cp_5v");
2054 universal_vbus_enable(0, "usb_vbus_ap_5v");
2055 universal_vbus_enable(0, "usb_vbus_cp_5v");
2059 static int universal_get_usb_switch(void);
2061 static void universal_usb_power(u8 on)
2063 universal_usb_path_power(on, universal_get_usb_switch());
2066 #ifdef CONFIG_REGULATOR
2067 static struct regulator *reg_charger;
2069 static void universal_usb_cb(u8 attached)
2071 #ifdef CONFIG_JACK_MON
2072 jack_event_handler("usb", attached);
2074 universal_usb_power(attached);
2075 #ifdef CONFIG_REGULATOR
2076 if (reg_charger == NULL) {
2077 reg_charger = regulator_get(NULL, "vinchg");
2078 if (IS_ERR_OR_NULL(reg_charger)) {
2079 pr_err("Cannot get regulator: vinchg (%ld)\n",
2080 PTR_ERR(reg_charger));
2086 if (reg_charger && attached)
2087 regulator_set_current_limit(reg_charger, 200000, 475000);
2091 static void universal_charger_cb(u8 attached)
2093 #ifdef CONFIG_JACK_MON
2094 jack_event_handler("charger", attached);
2096 #ifdef CONFIG_REGULATOR
2097 if (reg_charger == NULL) {
2098 reg_charger = regulator_get(NULL, "vinchg");
2099 if (IS_ERR_OR_NULL(reg_charger)) {
2100 pr_err("Cannot get regulator: vinchg (%ld)\n",
2101 PTR_ERR(reg_charger));
2107 if (reg_charger && attached)
2108 regulator_set_current_limit(reg_charger, 200000, 600000);
2112 static void universal_jig_cb(u8 attached)
2114 #ifdef CONFIG_JACK_MON
2115 jack_event_handler("jig", attached);
2119 static void universal_fsa9480_reset_cb(void)
2121 #ifdef CONFIG_JACK_MON
2122 jack_event_handler("", 0);
2126 static struct platform_device universal_jack = {
2130 .platform_data = &universal_jack_data,
2134 static void universal_set_usb_switch(int path)
2136 if (path == USB_PATH_AP)
2137 fsa9480_set_switch("DHOST");
2138 else if (path == USB_PATH_CP)
2139 fsa9480_set_switch("AUDIO");
2142 static int universal_get_usb_switch(void)
2146 fsa9480_get_switch(buf);
2148 if (!strncmp(buf, "AUDIO", 5))
2150 else if (!strncmp(buf, "DHOST", 5))
2152 else if (!strncmp(buf, "AUTO", 4))
2158 /* Micro USB Switch */
2159 static struct micro_usb_switch_platform_data universal_usb_switch_data = {
2160 .usb_power = universal_usb_path_power,
2161 .set_usb_switch = universal_set_usb_switch,
2162 .get_usb_switch = universal_get_usb_switch,
2165 static struct platform_device universal_micro_usb_switch = {
2166 .name = "usb-switch",
2169 .platform_data = &universal_usb_switch_data,
2174 static struct uart_select_platform_data universal_uart_select_data = {
2175 .gpio = S5PV310_GPY4(7),
2177 .cpu_by_default = AP,
2180 static struct platform_device universal_uart_select = {
2181 .name = "uart-select",
2184 .platform_data = &universal_uart_select_data,
2189 static struct bcm4751_platform_data universal_bcm4751_data = {
2190 .regpu = S5PV310_GPE0(3), /* XMDMIRQn */
2191 .nrst = S5PV310_GPE0(4), /* XMDMADVN */
2192 .uart_rxd = S5PV310_GPA0(4), /* XURXD[1] */
2195 static struct platform_device universal_bcm4751 = {
2199 .platform_data = &universal_bcm4751_data,
2204 #ifdef CONFIG_DRM_MALI
2205 static struct platform_device s5p_device_mali_drm = {
2212 #ifdef CONFIG_DRM_FIMD
2213 static struct resource fimd_drm_resource[] = {
2215 .start = S5P_PA_LCD0,
2216 .end = S5P_PA_LCD0 + S5P_SZ_LCD0 - 1,
2217 .flags = IORESOURCE_MEM,
2220 .start = S5P_PA_LCD1,
2221 .end = S5P_PA_LCD1 + S5P_SZ_LCD1 - 1,
2222 .flags = IORESOURCE_MEM,
2227 .flags = IORESOURCE_IRQ,
2232 .flags = IORESOURCE_IRQ,
2236 static struct fimd_drm_platform_data fimd_drm_pd = {
2240 static struct platform_device s5p_device_fimd_drm = {
2243 .num_resources = ARRAY_SIZE(fimd_drm_resource),
2244 .resource = fimd_drm_resource,
2246 .platform_data = &fimd_drm_pd,
2252 static struct s3c_adc_platform_data s3c_adc_pdata __initdata = {
2256 .max_adc_voltage_uV = 3300000,
2259 static void __init universal_adc_init(void)
2261 s3c_adc_set_platdata(&s3c_adc_pdata);
2264 static void ramoops_enable(int enable)
2268 clk = clk_get(NULL, "modem");
2276 static struct ramoops_platform_data universal_ramoops_data = {
2277 .mem_address = 0x13A00000, /* MODEM I/F */
2279 .enable = ramoops_enable,
2282 static struct platform_device universal_ramoops = {
2285 .platform_data = &universal_ramoops_data,
2289 static struct mmcoops_platform_data universal_mmcoops_data = {
2290 .pdev = &s3c_device_hsmmc0,
2291 .start = 64, /* 32KiB offset */
2292 .size = 16, /* 8KiB */
2295 static struct platform_device universal_mmcoops = {
2298 .platform_data = &universal_mmcoops_data,
2302 #ifdef CONFIG_LCD_OOPS
2304 static struct platform_device universal_lcdoops = {
2307 .platform_data = NULL,
2312 #ifdef CONFIG_ANDROID_RAM_CONSOLE
2313 static struct resource ram_console_resource[] = {
2315 .flags = IORESOURCE_MEM,
2319 static struct platform_device ram_console_device = {
2320 .name = "ram_console",
2322 .num_resources = ARRAY_SIZE(ram_console_resource),
2323 .resource = ram_console_resource,
2327 #ifdef CONFIG_SENSORS_NTC_THERMISTOR
2328 static unsigned int read_thermistor_uV(void)
2330 struct s3c_adc_request req = {
2334 .channel = 6, /* XADCAIN_6 */
2337 return s3c_adc_convert_uV(s3c_adc_get(&req));
2340 static struct ntc_thermistor_platform_data ncp15wb473_pdata = {
2341 .read_uV = read_thermistor_uV,
2342 .pullup_uV = 3300000, /* VADC_3.3V_C210 */
2343 .pullup_ohm = 100000, /* R817 in Aquila Rev 1.9 */
2344 .pulldown_ohm = 100000, /* R818 in Aquila Rev 1.9 */
2345 .connect = NTC_CONNECTED_GROUND,
2348 static struct platform_device universal_ncp15wb473_thermistor = {
2349 .name = "ncp15wb473",
2351 .platform_data = &ncp15wb473_pdata,
2355 #ifdef CONFIG_S5P_CHARGER_BREAKER
2356 static const char *s5p_charger_supplies[] = {"vinchg"};
2358 static struct s5p_charger_breaker_pdata charger_breaker_pdata = {
2359 .supplies = s5p_charger_supplies,
2360 .num_supplies = ARRAY_SIZE(s5p_charger_supplies),
2362 .thermistor = &universal_ncp15wb473_thermistor.dev,
2363 .thermistor_sensor_id = 1,
2365 .setup_for_pm_loop = true,
2367 .interval_ms = 30000,
2372 .number_of_measure = 7,
2373 .discard_extreme = true,
2376 static struct platform_device universal_charger_breaker = {
2377 .name = "s5p-charger-breaker",
2380 .platform_data = &charger_breaker_pdata,
2384 #ifdef CONFIG_S5P_CHARGER
2385 static bool universal_config_s5p_charger;
2386 extern bool ntc_monitor_pm_loop(bool*);
2388 static char *regulators4charger[] = {
2392 static char *s5p_charger_controls[] = {
2393 "max8997_pmic", "max8903_charger" };
2395 static struct s5p_charger_pdata s5p_charger_pdata = {
2396 .wakeup_interval_charging = 30000,
2397 .fullbatt_voltage_ck_delay = 30000,
2398 .fullbatt_voltage_ck_uV = 100000,
2399 .fuel_gauge = "max17040_battery",
2400 .th_cap = {1, 3, 5},
2401 .th_uV = {3700000, 3800000, 3900000},
2402 .battery_control = s5p_charger_controls,
2403 .num_battery_control = ARRAY_SIZE(s5p_charger_controls),
2404 .battery_charger = s5p_charger_supplies,
2405 .num_battery_charger = ARRAY_SIZE(s5p_charger_supplies),
2406 .rtc_name = "rtc1", /* s3c-rtc with tick */
2407 .pm_loop_func = ntc_monitor_pm_loop,
2408 .num_regulators_for_charger = ARRAY_SIZE(regulators4charger),
2409 .regulators_for_charger = regulators4charger,
2410 .irq_battery_full = IRQ_PMIC_BASE + MAX8998_IRQ_DONER,
2411 .irq_battery_out = IRQ_PMIC_BASE + MAX8998_STATUS_DETBAT,
2413 /* Ignore capacity if it's below 10% and the voltage is over 4.2V */
2414 .full_battery_voltage_uV = 4200000,
2415 .override_capacity_ovp = 10,
2418 static struct platform_device s5p_charger = {
2419 .name = "s5p-charger",
2422 .platform_data = &s5p_charger_pdata,
2426 static int __init s5p_charger_init(void)
2428 if (universal_config_s5p_charger) {
2429 platform_device_register(&s5p_charger);
2430 platform_device_register(&universal_charger_breaker);
2434 /* s5p charger depends on other devices. register later */
2435 late_initcall(s5p_charger_init);
2437 #endif /* CONFIG_S5P_CHARGER_BREAKER */
2438 #endif /* CONFIG_SENSORS_NTC_THERMISTOR */
2440 static struct platform_device *universal_devices[] __initdata = {
2441 #ifdef CONFIG_FIQ_DEBUGGER
2442 &s5pv310_device_fiqdbg_uart2,
2444 /* Samsung Platform Devices */
2445 #ifdef CONFIG_S5PV310_DEV_PD
2446 &s5pv310_device_pd[PD_MFC],
2447 &s5pv310_device_pd[PD_G3D],
2448 &s5pv310_device_pd[PD_LCD0],
2449 &s5pv310_device_pd[PD_LCD1],
2450 &s5pv310_device_pd[PD_TV],
2451 &s5pv310_device_pd[PD_CAM],
2452 &s5pv310_device_pd[PD_GPS],
2454 #ifdef CONFIG_DRM_MALI
2455 &s5p_device_mali_drm,
2457 #ifdef CONFIG_DRM_FIMD
2458 &s5p_device_fimd_drm,
2460 &universal_gpio_keys,
2461 &s5p_device_onenand,
2474 /* Universal Devices */
2479 #ifdef CONFIG_S5P_SYSMMU
2482 #ifdef CONFIG_FB_S3C
2484 &universal_spi_gpio,
2486 #ifdef CONFIG_VIDEO_FIMG2D
2489 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
2493 #if defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC) || \
2494 defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC_MODULE)
2500 #if defined(CONFIG_VIDEO_S5P_MIPI_CSIS) || \
2501 defined(CONFIG_VIDEO_S5P_MIPI_CSIS_MODULE)
2502 &s5p_device_mipi_csis0,
2504 &s5p_device_usb_ehci,
2505 &universal_modemctl,
2506 #ifdef CONFIG_S3C_DEV_RTC
2509 #ifdef CONFIG_USB_GADGET
2510 &s3c_device_usbgadget,
2513 &mmc0_fixed_voltage,
2516 #ifdef CONFIG_SND_SOC
2517 &s5pv310_device_i2s0,
2519 #ifdef CONFIG_VIDEO_TVOUT
2524 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_TV
2529 &universal_micro_usb_switch,
2530 &universal_uart_select,
2532 #ifdef CONFIG_ANDROID_RAM_CONSOLE
2533 &ram_console_device,
2535 #ifdef CONFIG_SENSORS_NTC_THERMISTOR
2536 &universal_ncp15wb473_thermistor,
2540 #if defined(CONFIG_VIDEO_TVOUT)
2541 static struct s5p_platform_hpd hdmi_hpd_data __initdata = {
2544 static struct s5p_platform_cec hdmi_cec_data __initdata = {
2549 extern void s5p_reserve_bootmem(void);
2551 static void __init universal_map_io(void)
2553 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
2554 s3c24xx_init_clocks(24000000);
2555 s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
2558 static void __init s5pv310_reserve(void)
2560 static struct cma_region regions[] = {
2561 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD0
2564 .size = (CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD0
2565 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD1
2566 + CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD1
2571 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0
2574 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC0 * SZ_1K,
2577 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1
2580 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC1 * SZ_1K,
2583 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2
2586 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC2 * SZ_1K,
2589 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3
2592 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMC3 * SZ_1K,
2595 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MALI
2596 #if !defined(CONFIG_MALI_OSMEM_ONLY)
2599 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MALI * SZ_1K,
2603 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC
2606 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC * SZ_1K,
2609 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0
2612 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0 * SZ_1K,
2614 .alignment = 1 << 17,
2618 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1
2621 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1 * SZ_1K,
2623 .alignment = 1 << 17,
2627 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
2631 { .alignment = 128 << 10 },
2632 .start = 0x42000000,
2637 .start = 0x43000000,
2642 .start = 0x51000000,
2652 static const char map[] __initconst =
2654 "s5p-fimc.0=fimc0;s5p-fimc.1=fimc1;s5p-fimc.2=fimc2;"
2656 "mfc=mfc,mfc0,mfc1;s5p-mfc/f=fw;s5p-mfc/a=b1;s5p-mfc/b=b2;"
2657 "mali_dev/dedicated_mem=mali;"
2663 #ifdef CONFIG_ANDROID_RAM_CONSOLE
2666 /* FIXME: ram console MUST be reserved at first time */
2667 addr = memblock_alloc(SZ_1M, SZ_4K);
2668 ram_console_resource[0].start = addr;
2669 ram_console_resource[0].end = addr + SZ_1M - 1;
2670 pr_info("ram_console: 0x%08x ~ 0x%08x (1MB)\n",
2671 addr, addr + SZ_1M);
2674 cma_set_defaults(regions, map);
2675 cma_early_regions_reserve(NULL);
2677 for (; i < ARRAY_SIZE(regions) - 1 /* terminator */; ++i) {
2678 pr_info("cma: region: %-8s: 0x%08x ~ 0x%08x (%dMB)\n",
2679 regions[i].name, regions[i].start,
2680 regions[i].start + regions[i].size,
2681 regions[i].size / SZ_1M);
2686 * universal_gpio_init()
2688 * There are GPIOs that are NOT handled by device drivers becuase;
2689 * a) No devices are connected to the specific GPIOs, or
2690 * b) No device drivers are loaded for the corresponding devices.
2692 * Such GPIOs may incur unnecessary current according to the board
2693 * schematics. Therefore, we may need to configure such GPIOs.
2695 static void __init universal_gpio_init(void)
2699 gpio = S5PV310_GPX3(3); /* GLNA_ON */
2700 gpio_request(gpio, "GLNA_ON");
2701 gpio_direction_output(gpio, 0);
2702 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2704 /* FIXME check the HDMI_5V */
2705 gpio = S5PV310_GPE0(1); /* HDMI_EN1 */
2706 gpio_request(gpio, "HDMI_EN1");
2707 gpio_direction_output(gpio, 0);
2708 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2711 static void __init universal_modem_init(void)
2713 struct modemctl_platform_data *pdata = &universal_modemctl_data;
2716 gpio = MOBILE_GPIO(CP_ON);
2717 gpio_request(gpio, "CP_ON");
2718 gpio_direction_output(gpio, 0);
2719 pdata->gpio_phone_on = gpio;
2721 gpio = MOBILE_GPIO(PHONE_ACTIVE);
2722 gpio_request(gpio, "PHONE_ACTIVE");
2723 pdata->gpio_phone_active = gpio;
2725 gpio = MOBILE_GPIO(PDA_ACTIVE);
2726 gpio_request(gpio, "PDA_ACTIVE");
2727 gpio_direction_output(gpio, 0);
2728 pdata->gpio_pda_active = gpio;
2730 gpio = MOBILE_GPIO(CP_PMU_RST);
2731 gpio_request(gpio, "CP_PMU_RST");
2732 gpio_direction_output(gpio, 0);
2733 pdata->gpio_cp_reset = gpio;
2735 gpio = MOBILE_GPIO(RESET_REQ_N);
2736 gpio_request(gpio, "RESET_REQ_N");
2737 gpio_direction_output(gpio, 0);
2738 pdata->gpio_cp_req_reset = gpio;
2740 gpio = MOBILE_GPIO(IPC_SLAVE_WAKEUP);
2741 gpio_request(gpio, "IPC_SLAVE_WAKEUP");
2742 gpio_direction_output(gpio, 0);
2743 pdata->gpio_ipc_slave_wakeup = gpio;
2745 gpio = MOBILE_GPIO(IPC_HOST_WAKEUP);
2746 gpio_request(gpio, "IPC_HOST_WAKEUP");
2747 pdata->gpio_ipc_host_wakeup = gpio;
2749 gpio = MOBILE_GPIO(SUSPEND_REQUEST_HSIC);
2750 gpio_request(gpio, "SUSPEND_REQUEST_HSIC");
2751 pdata->gpio_suspend_request = gpio;
2753 gpio = MOBILE_GPIO(ACTIVE_STATE_HSIC);
2754 gpio_request(gpio, "ACTIVE_STATE_HSIC");
2755 gpio_direction_output(gpio, 0);
2756 pdata->gpio_active_state = gpio;
2760 * GPX are saved and restored at plat-samsung/pm.c:s5c_pm_enter.
2761 * However, they are inside of pm_prepare and pm_finish, so it
2762 * does not save ours against universal_pm_prepare:2.
2764 static struct sleep_save s5pc210_gpx[] = {
2765 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C00),
2766 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C04),
2767 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C08),
2768 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C0C),
2769 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C20),
2770 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C24),
2771 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C28),
2772 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C2C),
2773 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C40),
2774 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C44),
2775 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C48),
2776 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C4C),
2777 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C60),
2778 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C64),
2779 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C68),
2780 SAVE_ITEM(S5P_VA_GPIO2 + 0x0C6C),
2783 #ifdef CONFIG_UNIVERSAL_C210_POWEROFF_WORKAROUND
2784 static void universal_power_off(void)
2786 struct regulator *reg;
2788 pr_emerg("POWEROFF: WORKAOUND\n");
2790 /* Turn LDO9 Off (LP3974 ONLY. MAX8998 CANNOT DO THIS) */
2791 reg = regulator_get(NULL, "vcc_2.8v_pda");
2792 if (IS_ERR_OR_NULL(reg))
2793 pr_emerg("LDO9 cannot be found.\n");
2795 regulator_force_disable(reg);
2797 panic("The power should be already turned off.\n");
2801 static void universal_pm_finish(void)
2803 /* Restore GPX conf */
2804 s3c_pm_do_restore(s5pc210_gpx, ARRAY_SIZE(s5pc210_gpx));
2807 static void universal_pm_prepare(void)
2811 /* 1. Save GPX conf */
2812 s3c_pm_do_save(s5pc210_gpx, ARRAY_SIZE(s5pc210_gpx));
2814 /* 2. Set GPX as Power Save Mode */
2816 gpio = S5PV310_GPX0(3); /* PULL_UP is connected at board */
2817 gpio_direction_output(gpio, 1);
2818 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2819 gpio = S5PV310_GPX0(4); /* PULL_UP is connected at board */
2820 gpio_direction_output(gpio, 1);
2821 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2822 gpio = S5PV310_GPX0(5);
2823 gpio_direction_output(gpio, 0);
2824 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2825 gpio = S5PV310_GPX0(6);
2826 gpio_direction_output(gpio, 0);
2827 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2828 gpio = S5PV310_GPX0(7);
2829 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2830 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2832 /* 2-b. Gyro sensor */
2833 gpio = S5PV310_GPX0(0);
2834 gpio_direction_input(gpio);
2835 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
2836 gpio = S5PV310_GPX0(1);
2837 gpio_direction_input(gpio);
2838 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
2840 /* 2-c. Proximity sensor */
2841 gpio = S5PV310_GPX0(2);
2842 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2843 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
2845 /* 2-d. Accelerometer */
2846 gpio = S5PV310_GPX2(4);
2847 gpio_direction_input(gpio);
2848 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
2851 gpio = S5PV310_GPX1(6);
2852 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
2854 /* 3. Debug: Look at the diff */
2855 mobile_gpios_groupx_difference();
2859 static void __init universal_rev00_fixup(void)
2861 /* Rev 0.0 connected with inverter so active low */
2862 mmc0_fixed_voltage_config.gpio = S5PV310_GPE3(6);
2863 mmc0_fixed_voltage_config.enable_high = false;
2865 universal_bcm4751_data.regpu = S5PV310_GPK1(0);
2866 universal_bcm4751_data.nrst =S5PV310_GPK1(2);
2871 int universal_mfc_setup_clock(const char *sclk_name, const char *pclk_name,
2872 unsigned long rate, unsigned int rate_set)
2874 struct clk *sclk = NULL;
2875 struct clk *pclk = NULL;
2877 sclk = clk_get(NULL, sclk_name);
2879 printk(KERN_ERR "failed to get %s clock.\n", sclk_name);
2883 pclk = clk_get(NULL, pclk_name);
2885 printk(KERN_ERR "failed to get %s clock.\n", pclk_name);
2889 clk_set_parent(sclk, pclk);
2891 printk(KERN_INFO "set parent clock of %s to %s\n", sclk_name,
2899 clk_set_rate(sclk, rate);
2900 printk(KERN_INFO "set mfc sclk rate to %lu\n", rate);
2916 #ifdef CONFIG_S5PV310_DEV_PD
2917 static void inline powerdomain_boot_on(int pd)
2919 struct samsung_pd_info *pdinfo = (struct samsung_pd_info *)
2920 s5pv310_device_pd[pd].dev.platform_data;
2921 pdinfo->boot_on = true;
2925 static void __init universal_machine_init(void)
2927 mobile_gpios_init_universal();
2930 universal_rev00_fixup();
2932 s3c_i2c0_set_platdata(&universal_i2c0_platdata);
2934 s3c_i2c1_set_platdata(NULL);
2935 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
2937 universal_tsp_init();
2938 s3c_i2c3_set_platdata(NULL);
2939 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
2941 universal_sensor_init();
2942 universal_fmradio_init();
2943 s3c_i2c4_set_platdata(NULL);
2944 i2c_register_board_info(4, i2c4_devs, ARRAY_SIZE(i2c4_devs));
2946 universal_pmic_init();
2947 s3c_i2c5_set_platdata(NULL);
2948 i2c5_devs[I2C5_LP3974].irq = gpio_to_irq(S5PV310_GPX0(7)),
2949 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
2951 universal_sound_init();
2952 s3c_i2c6_set_platdata(NULL);
2953 if (hwrevision(0) || hwrevision(1))
2954 i2c_register_board_info(6, i2c6_devs_rev00,
2955 ARRAY_SIZE(i2c6_devs_rev00));
2957 i2c_register_board_info(6, i2c6_devs_rev02,
2958 ARRAY_SIZE(i2c6_devs_rev02));
2960 s3c_i2c7_set_platdata(NULL);
2961 i2c_register_board_info(7, i2c7_devs, ARRAY_SIZE(i2c7_devs));
2963 s3c_i2c8_set_platdata(NULL);
2965 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
2967 i2c_register_board_info(10, i2c10_devs, ARRAY_SIZE(i2c10_devs));
2969 universal_touchkey_init();
2970 i2c_register_board_info(12, i2c12_devs, ARRAY_SIZE(i2c12_devs));
2972 i2c_register_board_info(14, i2c14_devs, ARRAY_SIZE(i2c14_devs));
2978 i2c_register_board_info(15, i2c15_devs, ARRAY_SIZE(i2c15_devs));
2981 universal_modem_init();
2983 #ifdef CONFIG_FB_S3C
2984 universal_fb_init();
2986 #ifdef CONFIG_S5PV310_DEV_PD
2987 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
2988 s5p_device_mfc.dev.parent = &s5pv310_device_pd[PD_MFC].dev;
2989 universal_mfc_setup_clock("mout_mfc0", "mout_mpll", 0, 0);
2990 universal_mfc_setup_clock("sclk_mfc", "mout_mfc0", 200 * MHZ, 1);
2993 #ifdef CONFIG_VIDEO_FIMG2D
2994 s5p_fimg2d_set_platdata(&fimg2d_data);
2995 #ifdef CONFIG_S5PV310_DEV_PD
2996 s5p_device_fimg2d.dev.parent = &s5pv310_device_pd[PD_LCD0].dev;
3000 pm_cpu_prepare = universal_pm_prepare;
3001 pm_cpu_finish = universal_pm_finish;
3004 s3c_irq_wake(IRQ_RTC_ALARM, 1);
3005 universal_gpio_init();
3008 #if defined(CONFIG_S5PV310_DEV_PD) && !defined(CONFIG_PM_RUNTIME)
3010 * These power domains should be always on
3011 * without runtime pm support.
3013 s5pv310_pd_enable(&s5pv310_device_pd[PD_MFC]);
3014 s5pv310_pd_enable(&s5pv310_device_pd[PD_G3D]);
3015 s5pv310_pd_enable(&s5pv310_device_pd[PD_LCD0]);
3016 s5pv310_pd_enable(&s5pv310_device_pd[PD_LCD1]);
3017 s5pv310_pd_enable(&s5pv310_device_pd[PD_CAM]);
3018 s5pv310_pd_enable(&s5pv310_device_pd[PD_TV]);
3019 s5pv310_pd_enable(&s5pv310_device_pd[PD_GPS]);
3022 #ifdef CONFIG_VIDEO_FIMG2D
3023 /* setup fimg2d parent clock. */
3024 universal_fimg2d_setup_clock("mout_g2d0", "mout_mpll");
3026 universal_sdhci_init();
3027 #ifdef CONFIG_S5P_ADC
3028 universal_adc_init();
3031 #ifdef CONFIG_UNIVERSAL_C210_POWEROFF_WORKAROUND
3033 * Registered at pm_power_off_prepare because system often halts
3034 * at kernel_power_off() before calling pm_power_off because of
3035 * an issue of disable_cpu called at power_off.
3037 pm_power_off_prepare = universal_power_off;
3040 #ifdef CONFIG_S5PV310_DEV_PD
3041 #ifdef CONFIG_FB_S3C
3042 s3c_device_fb.dev.parent = &s5pv310_device_pd[PD_LCD0].dev;
3043 powerdomain_boot_on(PD_LCD0);
3047 #if defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC) || \
3048 defined(CONFIG_VIDEO_SAMSUNG_S5P_FIMC_MODULE)
3049 s3c_fimc_setname(0, "s5pv310-fimc");
3050 s3c_fimc_setname(1, "s5pv310-fimc");
3051 s3c_fimc_setname(2, "s5pv310-fimc");
3052 s3c_fimc_setname(3, "s5pv310-fimc");
3053 #ifdef CONFIG_S5PV310_DEV_PD
3054 s5p_device_fimc0.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
3055 s5p_device_fimc1.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
3056 s5p_device_fimc2.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
3057 s5p_device_fimc3.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
3059 s3c_set_platdata(&universal_fimc_plat_data[0],
3060 sizeof(universal_fimc_plat_data[0]),
3062 #endif /* CONFIG_VIDEO_SAMSUNG_S5P_FIMC */
3064 #if defined(CONFIG_VIDEO_S5P_MIPI_CSIS) || \
3065 defined(CONFIG_VIDEO_S5P_MIPI_CSIS_MODULE)
3066 s3c_set_platdata(&mipi_csis0_pldata, sizeof(mipi_csis0_pldata),
3067 &s5p_device_mipi_csis0);
3068 #ifdef CONFIG_S5PV310_DEV_PD
3069 s5p_device_mipi_csis0.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
3072 universal_camera_init();
3073 #if defined(CONFIG_VIDEO_TVOUT)
3074 s5p_hdmi_hpd_set_platdata(&hdmi_hpd_data);
3075 s5p_hdmi_cec_set_platdata(&hdmi_cec_data);
3076 #ifdef CONFIG_S5PV310_DEV_PD
3077 s5p_device_tvout.dev.parent = &s5pv310_device_pd[PD_TV].dev;
3081 /* Add 15th i2c device for pn544 nfc chip*/
3083 platform_device_register(&i2c15_gpio);
3086 platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
3089 * setup parent clk for fimc, camera, mipi clks. It must be called after
3090 * platform_add_device() for enable enumerating the name of struct clk.
3092 s5pv310_fimc_setup_clks();
3093 #ifdef CONFIG_S5P_CHARGER
3094 universal_config_s5p_charger = true;
3098 MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
3099 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
3100 .phys_io = S3C_PA_UART & 0xfff00000,
3101 .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
3102 .boot_params = S5P_PA_SDRAM + 0x100,
3103 .init_irq = s5pv310_init_irq,
3104 .map_io = universal_map_io,
3105 .init_machine = universal_machine_init,
3106 .timer = &s5pv310_evt0_timer,
3107 .reserve = &s5pv310_reserve,