upload tizen1.0 source
[kernel/linux-2.6.36.git] / arch / arm / mach-s5pv310 / mach-c1_c210.c
1 /*
2  * linux/arch/arm/mach-s5pv310/mach-c1_c210.c
3  *
4  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5  *
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.
9  */
10
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/cypress_touchkey.h>
25 #include <linux/i2c/atmel_mxt_ts.h>
26 #include <linux/clk.h>
27 #include <linux/ntc.h>
28 #include <linux/regulator/machine.h>
29 #include <linux/regulator/fixed.h>
30 #include <linux/mfd/max8997.h>
31 #include <linux/mfd/max8997-private.h>
32 #include <linux/mmc/host.h>
33 #include <linux/power/max17042_battery.h>
34 #include <linux/ramoops.h>
35 #include <linux/mmcoops.h>
36 #include <linux/uart_select.h>
37 #include <linux/memblock.h>
38 #include <linux/rtc/rtc-s3c.h>
39 #include <linux/swi.h>
40 #include <linux/jack.h>
41 #include <linux/k3g.h>
42 #include <linux/kr3dh.h>
43 #include <linux/pn544.h>
44 #include <linux/tmd27711.h>
45 #include <linux/ak8975.h>
46 #include <linux/micro_usb_switch.h>
47
48 #include <linux/cpufreq.h>
49 #include <linux/modem/xmm6260.h>
50 #include <linux/power/charger-manager.h>
51 #include <video/platform_lcd.h>
52
53 #include <asm/mach-types.h>
54 #include <asm/mach/arch.h>
55 #include <asm/setup.h>
56
57 #include <mach/map.h>
58 #include <mach/gpio.h>
59 #include <mach/regs-clock.h>
60 #include <mach/regs-pmu.h>
61 #include <mach/pm-core.h>
62 #include <mach/nt39411.h>
63
64 #include <plat/cpu.h>
65 #include <plat/clock.h>
66 #include <plat/devs.h>
67 #include <plat/gpio-cfg.h>
68 #include <plat/gpio-core.h>
69 #include <plat/fb.h>
70 #include <plat/fimc-core.h>
71 #include <plat/mipi_csis.h>
72 #include <plat/fimg2d.h>
73 #include <plat/mali.h>
74 #include <plat/iic.h>
75 #include <plat/pm.h>
76 #include <plat/regs-otg.h>
77 #include <plat/regs-serial.h>
78 #include <plat/s5pv310.h>
79 #include <plat/sdhci.h>
80 #include <plat/adc.h>
81 #include <plat/fimd_drm.h>
82 #include <plat/tvout.h>
83 #include <plat/pd.h>
84 #include <plat/s5p_fimd_lite.h>
85 #include <plat/usb_ehci.h>
86 #include <plat/sysmmu.h>
87
88 #include <media/s5p_fimc.h>
89 #include <media/m5mols.h>
90 #include <media/s5k6aafx.h>
91
92 #include "bcm4330.h"
93 #include "gpio-mobile.h"
94 #include "gpio-c1.h"
95
96 /* Following are default values for UCON, ULCON and UFCON UART registers */
97 #define UNIVERSAL_UCON_DEFAULT  (S3C2410_UCON_TXILEVEL |        \
98                                  S3C2410_UCON_RXILEVEL |        \
99                                  S3C2410_UCON_TXIRQMODE |       \
100                                  S3C2410_UCON_RXIRQMODE |       \
101                                  S3C2410_UCON_RXFIFO_TOI |      \
102                                  S3C2443_UCON_RXERR_IRQEN)
103
104 #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
105
106 #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE |       \
107                                  S5PV210_UFCON_TXTRIG256 |      \
108                                  S5PV210_UFCON_RXTRIG256)
109
110 enum fixed_regulator_id {
111         FIXED_REG_ID_MMC = 0,
112         FIXED_REG_ID_CAM0,
113         FIXED_REG_ID_CAM1,
114         FIXED_REG_ID_CAM2,
115 };
116
117 static struct s3c2410_uartcfg c1_uartcfgs[] __initdata = {
118         {
119                 .hwport         = 0,
120                 .ucon           = UNIVERSAL_UCON_DEFAULT,
121                 .ulcon          = UNIVERSAL_ULCON_DEFAULT,
122                 .ufcon          = UNIVERSAL_UFCON_DEFAULT,
123         },
124         {
125                 .hwport         = 1,
126                 .ucon           = UNIVERSAL_UCON_DEFAULT,
127                 .ulcon          = UNIVERSAL_ULCON_DEFAULT,
128                 .ufcon          = UNIVERSAL_UFCON_DEFAULT,
129         },
130         {
131                 .hwport         = 2,
132                 .ucon           = UNIVERSAL_UCON_DEFAULT,
133                 .ulcon          = UNIVERSAL_ULCON_DEFAULT,
134                 .ufcon          = UNIVERSAL_UFCON_DEFAULT,
135         },
136         {
137                 .hwport         = 3,
138                 .ucon           = UNIVERSAL_UCON_DEFAULT,
139                 .ulcon          = UNIVERSAL_ULCON_DEFAULT,
140                 .ufcon          = UNIVERSAL_UFCON_DEFAULT,
141         },
142 };
143
144 static struct s3c2410_platform_i2c c1_i2c0_platdata __initdata = {
145         .frequency      = 300 * 1000,
146         .sda_delay      = 200,
147 };
148
149 static struct k3g_platform_data c1_k3g_data = {
150         .irq2                   = IRQ_EINT(1),
151         .powerdown              = K3G_POWERDOWN_NORMAL,
152         .zen                    = K3G_Z_EN,
153         .yen                    = K3G_Y_EN,
154         .xen                    = K3G_X_EN,
155         .block_data_update      = K3G_BLOCK_DATA_UPDATE,
156         .fullscale              = K3G_FULL_SCALE_2000DPS,
157         .fifo_mode              = K3G_FIFO_FIFO_MODE,
158         .int2_src               = K3G_INT2_OVERRUN,
159         .fifo_threshold         = 16,
160         .int1_enable            = K3G_INT1_EN,
161         .int1_z_high_enable     = K3G_Z_HIGH_INT_EN,
162         .int1_y_high_enable     = K3G_Y_HIGH_INT_EN,
163         .int1_x_high_enable     = K3G_X_HIGH_INT_EN,
164         .int1_latch             = K3G_INTERRUPT_LATCHED,
165         .int1_z_threshold       = 0x12,
166         .int1_y_threshold       = 0x25,
167         .int1_x_threshold       = 0x25,
168         .int1_wait_enable       = K3G_INT1_WAIT_EN,
169         .int1_wait_duration     = 0x10,
170 };
171
172 static struct kr3dh_platform_data c1_kr3dh_data_rev03 = {
173         .power_mode             = KR3DH_NORMAL_MODE,
174         .data_rate              = KR3DH_ODR_50HZ,
175         .zen                    = 1,
176         .yen                    = 1,
177         .xen                    = 1,
178         .int1_latch             = 1,
179         .int1_cfg               = KR3DH_INT_SOURCE,
180         .block_data_update      = 1,
181         .fullscale              = KR3DH_RANGE_2G,
182         .int1_combination       = KR3DH_OR_COMBINATION,
183         .int1_6d_enable         = 1,
184         .int1_z_high_enable     = 1,
185         .int1_z_low_enable      = 1,
186         .int1_y_high_enable     = 1,
187         .int1_y_low_enable      = 1,
188         .int1_x_high_enable     = 1,
189         .int1_x_low_enable      = 1,
190         .int1_threshold         = 0x25,
191         .int1_duration          = 0x01,
192         .negate_x               = 0,
193         .negate_y               = 0,
194         .negate_z               = 0,
195         .change_xy              = 0,
196 };
197
198 static struct kr3dh_platform_data c1_kr3dh_data_rev04 = {
199         .power_mode             = KR3DH_NORMAL_MODE,
200         .data_rate              = KR3DH_ODR_50HZ,
201         .zen                    = 1,
202         .yen                    = 1,
203         .xen                    = 1,
204         .int1_latch             = 1,
205         .int1_cfg               = KR3DH_INT_SOURCE,
206         .block_data_update      = 1,
207         .fullscale              = KR3DH_RANGE_2G,
208         .int1_combination       = KR3DH_OR_COMBINATION,
209         .int1_6d_enable         = 1,
210         .int1_z_high_enable     = 1,
211         .int1_z_low_enable      = 1,
212         .int1_y_high_enable     = 1,
213         .int1_y_low_enable      = 1,
214         .int1_x_high_enable     = 1,
215         .int1_x_low_enable      = 1,
216         .int1_threshold         = 0x25,
217         .int1_duration          = 0x01,
218         .negate_x               = 0,
219         .negate_y               = 1,
220         .negate_z               = 1,
221         .change_xy              = 0,
222 };
223
224 #ifdef CONFIG_CPU_FREQ_TICKLE
225 static void user_input_response_work(struct work_struct *work)
226 {
227         /* core 0's cpufreq controls both cores */
228         cpufreq_tickle_cpu(100, 0);
229
230         /* turn the core 1 on */
231         s5pv310_pm_hotplug_tickle();
232 }
233
234 static DECLARE_WORK(uir_work, user_input_response_work);
235
236 static void user_input_response(void *data)
237 {
238         if (!work_pending(&uir_work))
239                 schedule_work_on(0, &uir_work);
240 }
241 #endif
242
243 /* I2C1 */
244 static struct i2c_board_info i2c1_devs_rev03[] __initdata = {
245         {
246                 /* Gyro sensor */
247                 I2C_BOARD_INFO("K3G", 0x69),
248                 .platform_data  = &c1_k3g_data,
249                 .irq            = IRQ_EINT(0),
250         }, {
251                 /* Accelerometer */
252                 I2C_BOARD_INFO("KR3DH", 0x19),
253                 .platform_data  = &c1_kr3dh_data_rev03,
254                 .irq            = IRQ_EINT(24),
255         }
256 };
257
258 static struct i2c_board_info i2c1_devs_rev04[] __initdata = {
259         {
260                 /* Gyro sensor */
261                 I2C_BOARD_INFO("K3G", 0x69),
262                 .platform_data  = &c1_k3g_data,
263                 .irq            = IRQ_EINT(0),
264         }, {
265                 /* Accelerometer */
266                 I2C_BOARD_INFO("KR3DH", 0x19),
267                 .platform_data  = &c1_kr3dh_data_rev04,
268                 .irq            = IRQ_EINT(24),
269         }
270 };
271
272 /* I2C3: TSP */
273
274 /* FIXME: Only use for tuning */
275 static u8 mxt_init_vals_ver_22[] __initdata = {
276         /* MXT_GEN_COMMAND(6) */
277         0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
278         /* MXT_GEN_POWER(7) */
279         0x20, 0xff, 0x32,
280         /* MXT_GEN_ACQUIRE(8) */
281         0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23,
282         /* MXT_TOUCH_MULTI(9) */
283         0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00,
284         0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00,
285         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
286         0x00,
287         /* MXT_TOUCH_KEYARRAY(15) */
288         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
289         0x00,
290         /* MXT_SPT_GPIOPWM(19) */
291         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
292         0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
293         /* MXT_PROCI_GRIPFACE(20) */
294         0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04,
295         0x0f, 0x0a,
296         /* MXT_PROCG_NOISE(22) */
297         0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00,
298         0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03,
299         /* MXT_TOUCH_PROXIMITY(23) */
300         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
301         0x00, 0x00, 0x00, 0x00, 0x00,
302         /* MXT_PROCI_ONETOUCH(24) */
303         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
304         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
305         /* MXT_SPT_SELFTEST(25) */
306         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
307         0x00, 0x00, 0x00, 0x00,
308         /* MXT_PROCI_TWOTOUCH(27) */
309         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
310         /* MXT_SPT_CTECONFIG(28) */
311         0x00, 0x00, 0x03, 0x08, 0x10, 0x00,
312 };
313
314 static struct mxt_platform_data mxt_platform_data __refconst = {
315         .config                 = mxt_init_vals_ver_22,
316         .config_length          = ARRAY_SIZE(mxt_init_vals_ver_22),
317
318         .x_line                 = 19,
319         .y_line                 = 11,
320         .x_size                 = 800,
321         .y_size                 = 480,
322         .blen                   = 0x11,
323         .threshold              = 0x28,
324         .voltage                = 2800000,              /* 2.8V */
325         .orient                 = MXT_DIAGONAL,
326         .irqflags               = IRQF_TRIGGER_FALLING,
327
328 #ifdef CONFIG_CPU_FREQ_TICKLE
329         /* For the faster user response */
330         .input_event            = user_input_response,
331 #endif
332 };
333
334 static struct i2c_board_info i2c3_devs[] __initdata = {
335         {
336                 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
337                 .platform_data  = &mxt_platform_data,
338         },
339 };
340
341 static void __init c1_tsp_init(void)
342 {
343         int gpio;
344
345 #if 1
346         /* TSP_LDO_ON: XGNSS_QSIGN */
347         gpio = S5PV310_GPL0(3);
348         gpio_request(gpio, "TSP_LDO_ON");
349         gpio_direction_output(gpio, 1);
350         gpio_export(gpio, 0);
351
352         /* TSP_INT: XEINT[4] */
353         gpio = S5PV310_GPX0(4);
354         gpio_request(gpio, "TSP_INT");
355         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
356
357 #endif
358         /*
359          * Note that because TSP_LDO provides an external pull-up to TSP_INT,
360          * the pull-up setting at GPE1(7) is useless and may be omitted in
361          * order to reduce idle current. However, it probably needs some
362          * sleep/delay from TSP_LDO_ON = true event because there could be
363          * "ramp-up" delay. Before knowing this, let's just use PULL_UP here.
364          */
365         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
366         i2c3_devs[0].irq = gpio_to_irq(gpio);
367
368 }
369
370 /* TODO: should be modify for C1 */
371 extern struct max8997_platform_data c1_max8997_pdata;
372 extern void __init c1_pmic_init(void);
373
374 static void haptic_control_power(struct device *dev, int on)
375 {
376         struct regulator *regulator;
377
378         if (on) {
379                 regulator = regulator_get(dev, "inmotor");
380                 if (IS_ERR_OR_NULL(regulator))
381                         return;
382                 regulator_enable(regulator);
383                 regulator_put(regulator);
384         } else {
385                 regulator = regulator_get(dev, "inmotor");
386                 if (IS_ERR_OR_NULL(regulator))
387                         return;
388
389                 if (regulator_is_enabled(regulator))
390                         regulator_disable(regulator);
391                 regulator_put(regulator);
392         }
393 }
394
395 struct max8997_haptic_platform_data c1_haptic_pdata = {
396         .name           = "vibtone",
397         .pwm_timer      = 1,
398         .control_power  = haptic_control_power,
399 };
400
401 /* GPIO I2C 5 (PMIC) */
402 enum { I2C5_MAX8997 };
403 static struct i2c_board_info i2c5_devs[] __initdata = {
404         [I2C5_MAX8997] = {
405                 I2C_BOARD_INFO("max8997", 0xCC >> 1),
406                 .platform_data  = &c1_max8997_pdata,
407         },
408 };
409
410 /* GPIO I2C 6 */
411 static struct i2c_board_info i2c6_devs[] __initdata = {
412         {
413                 /* Audio Codec */
414                 I2C_BOARD_INFO("mc1n2", 0x3a),
415         },
416 };
417
418 static void __init c1_sound_init(void)
419 {
420         int val;
421
422         /* Set PMU register to set CLK_OUT to use XUSBXTI
423          * as codec source clock */
424         val = 0x900;
425         __raw_writel(val, S5P_PMREG(0xA00));
426 }
427
428 static struct ak8975_platform_data universal_ak8975_data = {
429         .poll_interval = 100,
430 };
431
432 /* I2C7 */
433 static struct i2c_board_info i2c7_devs[] __initdata = {
434         {
435                 /* Compass */
436                 I2C_BOARD_INFO("ak8975", 0x0c),
437                 .platform_data  = &universal_ak8975_data,
438         },
439 };
440
441 static void __init c1_sensor_init(void)
442 {
443         int gpio;
444
445         gpio = S5PV310_GPX2(2); /* XEINT_18 */
446         gpio_request(gpio, "MSENSE_INT");
447         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
448         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
449         i2c7_devs[0].irq = gpio_to_irq(gpio);
450
451         gpio = S5PV310_GPX0(0); /* XEINT_0 */
452         gpio_request(gpio, "GYRO_INT");
453         gpio_direction_input(gpio);
454         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
455
456         gpio = S5PV310_GPX0(1); /* XEINT_1 */
457         gpio_request(gpio, "GYRO_INT1");
458         gpio_direction_input(gpio);
459         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
460
461         gpio = S5PV310_GPX0(2); /* XEINT_2 */
462         gpio_request(gpio, "PS/ALS_INT");
463         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
464         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
465
466         gpio = S5PV310_GPX3(0); /* XEINT_24 */
467         gpio_request(gpio, "ACC_INT");
468         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
469         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_DOWN);
470 }
471
472 /* I2C8: HDMI */
473
474 /* I2C9 */
475 static struct i2c_gpio_platform_data i2c9_gpio_data = {
476         .sda_pin                = S5PV310_GPY4(0),      /* XM0ADDR_8 */
477         .scl_pin                = S5PV310_GPY4(1),      /* XM0ADDR_9 */
478 };
479
480 static struct platform_device i2c9_gpio = {
481         .name                   = "i2c-gpio",
482         .id                     = 9,
483         .dev                    = {
484                 .platform_data  = &i2c9_gpio_data,
485         },
486 };
487
488 static struct max17042_reg_data max17042_init_data[] = {
489         { MAX17042_CGAIN,               0x0000 },
490         { MAX17042_MiscCFG,             0x0003 },
491         { MAX17042_LearnCFG,            0x0007 },
492         /* RCOMP: 0x0050 2011.02.29 from MAXIM */
493         { MAX17042_RCOMP0,              0x0050 },
494 };
495 /* Alert only when the battery is removed or inserted */
496 static struct max17042_reg_data max17042_alert_init_data[] = {
497         /* SALRT Threshold setting (disable) unsigned MAX/MIN */
498         { MAX17042_SALRT_Th,    0xFF00 },
499         /* VALRT Threshold setting (disable) unsigned MAX/MIN */
500         { MAX17042_VALRT_Th,    0xFF00 },
501         /* TALRT Threshold setting (disable) signed MAX/MIN */
502         { MAX17042_TALRT_Th,    0x7F80 },
503 };
504 static struct max17042_platform_data c1_battery_platform_data = {
505         .init_data = max17042_init_data,
506         .num_init_data = ARRAY_SIZE(max17042_init_data),
507         .alrt_data = max17042_alert_init_data,
508         .num_alrt_data = ARRAY_SIZE(max17042_alert_init_data),
509         .irq_base = IRQ_FUEL_BASE,
510         .enable_alert = true,
511         .wakeup = true,
512         .r_sns = 10000, /* 10m Ohm */
513 };
514
515 enum { I2C9_MAX17042};
516 static struct i2c_board_info i2c9_devs[] __initdata = {
517         [I2C9_MAX17042] = {
518                 I2C_BOARD_INFO("max17042", 0x36),
519                 .platform_data = &c1_battery_platform_data,
520         },
521 };
522
523
524 /* GPIO I2C 12 (3 Touchkey) */
525 #define TOUCHKEY_EN     S5PV310_GPE3(3)         /* XMDMDATA_3 */
526 #define TOUCHKEY_INTR   S5PV310_GPL0(5)
527 #define TOUCHKEY_SDA    S5PV310_GPK1(2)
528 #define TOUCHKEY_SCL    S5PV310_GPK1(0)
529
530 static uint32_t touchkey_keymap[] = {
531         /* MCS_KEY_MAP(value, keycode) */
532         MCS_KEY_MAP(0, KEY_PHONE),              /* KEY_SEND */
533         MCS_KEY_MAP(1, KEY_BACK),               /* KEY_END */
534 };
535
536 static void touchkey_poweron(bool enable)
537 {
538         struct regulator *regulator;
539
540         if (enable) {
541                 regulator = regulator_get(NULL, "touch_2.8v");
542                 if (IS_ERR(regulator))
543                         return;
544                 regulator_enable(regulator);
545                 regulator_put(regulator);
546         } else {
547                 regulator = regulator_get(NULL, "touch_2.8v");
548                 if (IS_ERR(regulator))
549                         return;
550                 regulator_disable(regulator);
551                 regulator_put(regulator);
552         }
553 }
554
555 static void touchkey_cfg_pin_fw(int use)
556 {
557         if (use == 1) {
558                 s3c_gpio_cfgpin(TOUCHKEY_SDA, S3C_GPIO_OUTPUT);
559                 s3c_gpio_cfgpin(TOUCHKEY_SCL, S3C_GPIO_OUTPUT);
560                 s3c_gpio_cfgpin(TOUCHKEY_INTR, S3C_GPIO_OUTPUT);
561
562                 s3c_gpio_setpull(TOUCHKEY_SDA, S3C_GPIO_PULL_NONE);
563                 s3c_gpio_setpull(TOUCHKEY_SCL, S3C_GPIO_PULL_NONE);
564                 s3c_gpio_setpull(TOUCHKEY_INTR, S3C_GPIO_PULL_NONE);
565
566                 gpio_direction_output(TOUCHKEY_SDA, 0);
567                 gpio_direction_output(TOUCHKEY_SCL, 0);
568                 gpio_direction_output(TOUCHKEY_INTR, 0);
569         } else {
570                 s3c_gpio_setpull(TOUCHKEY_SDA, S3C_GPIO_PULL_UP);
571                 s3c_gpio_setpull(TOUCHKEY_SCL, S3C_GPIO_PULL_UP);
572                 s3c_gpio_setpull(TOUCHKEY_INTR, S3C_GPIO_PULL_UP);
573
574                 s3c_gpio_cfgpin(TOUCHKEY_SDA, S3C_GPIO_SFN(2));
575                 s3c_gpio_cfgpin(TOUCHKEY_SCL, S3C_GPIO_SFN(2));
576                 s3c_gpio_cfgpin(TOUCHKEY_INTR, S3C_GPIO_SFN(0xf));
577         }
578 }
579
580 static struct mcs_platform_data touchkey_data = {
581         .poweron                = touchkey_poweron,
582         .cfg_pin_fw             = touchkey_cfg_pin_fw,
583         .fw_ver                 = 0x02,         /* MCS5080 Firnware Version */
584         .md_ver                 = 0x01,         /* MCS5080 Module Version */
585         .keymap                 = touchkey_keymap,
586         .keymap_size            = ARRAY_SIZE(touchkey_keymap),
587         .key_maxval             = 2,
588 };
589
590 static struct i2c_gpio_platform_data i2c12_gpio_data = {
591         .sda_pin                = S5PV310_GPK1(2),      /* XMDMDATA_8 */
592         .scl_pin                = S5PV310_GPK1(0),      /* XMDMDATA_9 */
593 };
594
595 static struct platform_device i2c12_gpio = {
596         .name                   = "i2c-gpio",
597         .id                     = 12,
598         .dev                    = {
599                 .platform_data  = &i2c12_gpio_data,
600         },
601 };
602
603 static struct i2c_board_info i2c12_devs_mcs[] __initdata = {
604         {
605                 I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
606                 .platform_data  = &touchkey_data,
607         },
608 };
609
610 /*===============================*/
611 /*=     CYPRESS TOUCH KEY       =*/
612 /*===============================*/
613 static struct cypress_pin cypress_tk_pin = {
614         .gpio_en        = 0,
615         .gpio_int       = TOUCHKEY_INTR,
616         .gpio_sda       = TOUCHKEY_SDA,
617         .gpio_scl       = TOUCHKEY_SCL,
618 };
619
620 static void cypress_tk_cfg_pin(void)
621 {
622         s3c_gpio_setpull(cypress_tk_pin.gpio_sda, S3C_GPIO_PULL_NONE);
623         s3c_gpio_setpull(cypress_tk_pin.gpio_scl, S3C_GPIO_PULL_NONE);
624
625         s3c_gpio_cfgpin(cypress_tk_pin.gpio_sda, S3C_GPIO_SFN(2));
626         s3c_gpio_cfgpin(cypress_tk_pin.gpio_scl, S3C_GPIO_SFN(2));
627
628         s3c_gpio_cfgpin(cypress_tk_pin.gpio_int, S3C_GPIO_SFN(0xf));
629         s3c_gpio_cfgpin(cypress_tk_pin.gpio_en, S3C_GPIO_OUTPUT);
630 };
631
632 static int cypress_touchkey_power(int onoff)
633 {
634         struct regulator *regulator;
635
636         regulator = regulator_get(NULL, "touch_2.8v");
637         if (IS_ERR(regulator)) {
638                 printk(KERN_ERR "[TK][ERROR] regulator_get fail\n");
639                 return -1;
640         }
641
642         if (onoff) {
643                 regulator_enable(regulator);
644         } else {
645                 if (regulator_is_enabled(regulator))
646                         regulator_force_disable(regulator);
647         }
648         regulator_put(regulator);
649
650         msleep(100);
651         return 0;
652 }
653
654 static int cypress_touchled_power(int onoff)
655 {
656         struct regulator *regulator;
657
658         regulator = regulator_get(NULL, "touch_led_3.3v");
659         if (IS_ERR(regulator)) {
660                 printk(KERN_ERR "[TK][ERROR] regulator_get fail\n");
661                 return -1;
662         }
663
664         if (onoff) {
665                 regulator_enable(regulator);
666         } else {
667                 if (regulator_is_enabled(regulator))
668                         regulator_force_disable(regulator);
669         }
670         regulator_put(regulator);
671
672         msleep(100);
673         return 0;
674 }
675
676 static unsigned int c1_cypress_touch_keycode[] = {
677         KEY_PHONE,      /* not use this value 0x00 */
678         KEY_PHONE,      /* KEY_SEND 0x01 */
679         KEY_BACK,       /* KEY_END 0x02 */
680 };
681
682 static unsigned char c1_cypress_keycode_setbit[] = {
683         0,
684         1,
685         1,
686 };
687
688 static struct cypress_platform_data cypress_tk_data = {
689         .cfg_pin                = cypress_tk_cfg_pin,
690         .power_pin              = cypress_touchkey_power,
691         .led_pin                = cypress_touchled_power,
692         .pin                    = &cypress_tk_pin,
693         .keycode                = c1_cypress_touch_keycode,
694         .keycode_size   = ARRAY_SIZE(c1_cypress_touch_keycode),
695         .keycode_setbit = c1_cypress_keycode_setbit,
696         .gpio_control   = 0,
697 };
698
699 static struct i2c_board_info i2c12_devs_cypress[] __initdata = {
700         {
701                 I2C_BOARD_INFO("cypress_tk", 0x20),
702                 .platform_data  = &cypress_tk_data,
703         },
704 };
705
706 static void __init universal_touchkey_init(void)
707 {
708         int gpio;
709         int irq;
710
711         gpio = S5PV310_GPL0(5);                 /* XMDMDATA_7 */
712         gpio_request(gpio, "3_TOUCH_INT");
713         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
714         irq = gpio_to_irq(gpio);
715
716         if (system_rev == SLP_C1_REV03)
717                 i2c12_devs_mcs[0].irq = irq;
718         else
719                 i2c12_devs_cypress[0].irq = irq;
720 }
721
722 /* I2C14: Light */
723 static struct i2c_gpio_platform_data i2c14_gpio_data = {
724         .sda_pin                = S5PV310_GPK2(2),      /* XMMC2CDn */
725         .scl_pin                = S5PV310_GPK3(2),      /* XMMC3CDn */
726         .udelay                 = 1,                    /* 500kHz   */
727 };
728
729 static struct platform_device i2c14_gpio = {
730         .name                   = "i2c-gpio",
731         .id                     = 14,
732         .dev                    = {
733                 .platform_data  = &i2c14_gpio_data,
734         },
735 };
736
737 static void tmd27711_control_power_source(int enable)
738 {
739         struct regulator *regulator = regulator_get(NULL, "led_a_2.8v");
740         static int disabled = 1;
741
742         if (IS_ERR_OR_NULL(regulator))
743                 return;
744
745         if (enable) {
746                 if (!disabled) {
747                         regulator_disable(regulator);
748                         disabled = 1;
749                 }
750                 regulator_enable(regulator);
751                 disabled = 0;
752         } else {
753                 regulator_disable(regulator);
754                 disabled = 1;
755         }
756
757         regulator_put(regulator);
758 }
759
760 static struct tmd27711_platform_data universal_tmd27711_data = {
761         .control_power_source           = tmd27711_control_power_source,
762         .power_on                       = TMD27711_PON,
763         .wait_enable                    = TMD27711_WEN,
764         .wait_time                      = 0xf2, /* 35.36 ms */
765
766         /* Proximity */
767         .ps_enable                      = TMD27711_PEN,
768         .ps_interrupt_h_thres           = 700,
769         .ps_interrupt_l_thres           = 600,
770         .ps_interrupt_enable            = TMD27711_PIEN,
771         .ps_time                        = 0xff,
772         .ps_interrupt_persistence       = 0x30,
773         .ps_pulse_count                 = 0x08,
774         .ps_drive_strength              = TMD27711_PDRIVE_12MA,
775         .ps_diode                       = TMD27711_PDIODE_CH1_DIODE,
776
777         /* Ambient Light */
778         .als_enable                     = TMD27711_AEN,
779         .als_time                       = 200, /* 152.32 ms */
780         .als_interrupt_persistence      = 1,
781         .als_gain                       = TMD27711_AGAIN_16X,
782 };
783
784 static struct i2c_board_info i2c14_devs[] __initdata = {
785         {
786                 I2C_BOARD_INFO("TMD27711", 0x39),
787                 .platform_data  = &universal_tmd27711_data,
788                 .irq            = IRQ_EINT(2),
789         },
790 };
791
792 /* I2C15: MHL */
793 static struct i2c_gpio_platform_data i2c15_gpio_data = {
794         .sda_pin                = S5PV310_GPY3(0),      /* XM0ADDR_0 */
795         .scl_pin                = S5PV310_GPY3(2),      /* XM0ADDR_2 */
796         .udelay                 = 1,
797 };
798
799 static struct platform_device i2c15_gpio = {
800         .name                   = "i2c-gpio",
801         .id                     = 15,
802         .dev                    = {
803                 .platform_data  = &i2c15_gpio_data,
804         },
805 };
806
807 static struct i2c_board_info i2c15_devs[] __initdata = {
808         /*
809          * TODO SII9234
810          */
811 };
812
813 /* I2C16: NFC */
814 #define GPIO_NFC_SCL_1_8V               S5PV310_GPY0(0)
815 #define GPIO_NFC_SDA_1_8V               S5PV310_GPY0(1)
816 #define GPIO_NFC_IRQ                    S5PV310_GPX1(7)
817 #define GPIO_NFC_EN                             S5PV310_GPL2(6)
818 #define GPIO_NFC_FIRMWARE               S5PV310_GPL2(7)
819
820 /* GPIO_LEVEL_NONE = 2, GPIO_LEVEL_LOW = 0 */
821 static unsigned int nfc_gpio_table[][4] = {
822         {GPIO_NFC_IRQ, S3C_GPIO_INPUT, 2, S3C_GPIO_PULL_DOWN},
823         {GPIO_NFC_EN, S3C_GPIO_OUTPUT, 0, S3C_GPIO_PULL_NONE},
824         {GPIO_NFC_FIRMWARE, S3C_GPIO_OUTPUT, 0, S3C_GPIO_PULL_NONE},
825         {GPIO_NFC_SCL_1_8V, S3C_GPIO_INPUT, 2, S3C_GPIO_PULL_NONE},
826         {GPIO_NFC_SDA_1_8V, S3C_GPIO_INPUT, 2, S3C_GPIO_PULL_NONE},
827 };
828
829 void nfc_setup_gpio(void)
830 {
831         int array_size = ARRAY_SIZE(nfc_gpio_table);
832         u32 i, gpio;
833         for (i = 0; i < array_size; i++) {
834                 gpio = nfc_gpio_table[i][0];
835                 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(nfc_gpio_table[i][1]));
836                 s3c_gpio_setpull(gpio, nfc_gpio_table[i][3]);
837                 if (nfc_gpio_table[i][2] != 2)
838                         gpio_set_value(gpio, nfc_gpio_table[i][2]);
839         }
840 }
841
842 static struct i2c_gpio_platform_data i2c16_gpio_data = {
843         .sda_pin                = GPIO_NFC_SDA_1_8V,
844         .scl_pin                = GPIO_NFC_SCL_1_8V,
845         .udelay                 = 1,
846 };
847
848 static struct platform_device i2c16_gpio = {
849         .name                   = "i2c-gpio",
850         .id                     = 16,
851         .dev                    = {
852                 .platform_data  = &i2c16_gpio_data,
853         },
854 };
855
856 /* I2C17: VGA CAM */
857 #define GPIO_S5K6AAFX_SCL_1_8V          S5PV310_GPC1(2)
858 #define GPIO_S5K6AAFX_SDA_1_8V          S5PV310_GPC1(0)
859
860 static struct i2c_gpio_platform_data i2c17_gpio_data = {
861         .sda_pin                = GPIO_S5K6AAFX_SDA_1_8V,
862         .scl_pin                = GPIO_S5K6AAFX_SCL_1_8V,
863         .udelay                 = 1,
864 };
865
866 static struct platform_device i2c17_gpio = {
867         .name                   = "i2c-gpio",
868         .id                     = 17,
869         .dev                    = {
870                 .platform_data  = &i2c17_gpio_data,
871         },
872 };
873
874 /* I2C16 */
875 static struct pn544_i2c_platform_data pn544_pdata = {
876         .irq_gpio = GPIO_NFC_IRQ,
877         .ven_gpio = GPIO_NFC_EN,
878         .firm_gpio = GPIO_NFC_FIRMWARE,
879 };
880
881 /* PN65NET1 NFC */
882 static struct i2c_board_info i2c16_devs[] __initdata = {
883         {
884                 I2C_BOARD_INFO("pn544", 0x2b),
885                 .platform_data  = &pn544_pdata,
886                 .irq            = IRQ_EINT(15),
887         },
888 };
889
890 /* USB EHCI */
891 static struct s5p_usb_ehci_platdata c1_usb_ehci_pdata;
892
893 static void __init c1_usb_ehci_init(void)
894 {
895         struct s5p_usb_ehci_platdata *pdata = &c1_usb_ehci_pdata;
896
897         /* The gpios is initialized from modem_init */
898         pdata->gpio_active = MOBILE_GPIO(ACTIVE_STATE_HSIC);
899
900         s5p_usb_ehci_set_platdata(pdata);
901 }
902
903 /* MODEM Net */
904 static struct platform_device c1_modem_net = {
905         .name                   = "modem_net",
906         .id                     = -1,
907 };
908
909 /* XMM6260 control */
910 static struct xmm6260_gpios c1_xmm6260_gpios;
911
912 static struct xmm6260_platform_data c1_xmm6260_pdata = {
913         .gpios                  = &c1_xmm6260_gpios,
914         .wakeup                 = 1,
915 };
916
917 static struct platform_device c1_xmm6260 = {
918         /* FIXME: Use modemctl name because of platform dependency */
919         .name                   = "modemctl",
920         .id                     = -1,
921         .dev                    = {
922                 .platform_data  = &c1_xmm6260_pdata,
923         },
924 };
925
926 static void __init c1_modem_init(void)
927 {
928         struct xmm6260_gpios *gpios = &c1_xmm6260_gpios;
929         int gpio;
930
931         gpio = MOBILE_GPIO(CP_ON);
932         gpio_request(gpio, "CP_ON");
933         gpio_direction_output(gpio, 0);
934         gpios->cp_on = gpio;
935
936         gpio = MOBILE_GPIO(PHONE_ACTIVE);
937         gpio_request(gpio, "PHONE_ACTIVE");
938         gpios->phone_active = gpio;
939
940         gpio = MOBILE_GPIO(PDA_ACTIVE);
941         gpio_request(gpio, "PDA_ACTIVE");
942         gpio_direction_output(gpio, 0);
943         gpios->pda_active = gpio;
944
945         gpio = MOBILE_GPIO(CP_PMU_RST);
946         gpio_request(gpio, "CP_PMU_RST");
947         gpio_direction_output(gpio, 0);
948         gpios->cp_pmu_rst = gpio;
949
950         gpio = MOBILE_GPIO(RESET_REQ_N);
951         gpio_request(gpio, "RESET_REQ_N");
952         gpio_direction_output(gpio, 0);
953         gpios->reset_req_n = gpio;
954
955         gpio = MOBILE_GPIO(IPC_SLAVE_WAKEUP);
956         gpio_request(gpio, "IPC_SLAVE_WAKEUP");
957         gpio_direction_output(gpio, 0);
958         gpios->ipc_slave_wakeup = gpio;
959
960         gpio = MOBILE_GPIO(IPC_HOST_WAKEUP);
961         gpio_request(gpio, "IPC_HOST_WAKEUP");
962         gpios->ipc_host_wakeup = gpio;
963
964         gpio = MOBILE_GPIO(SUSPEND_REQUEST_HSIC);
965         gpio_request(gpio, "SUSPEND_REQUEST_HSIC");
966         gpios->suspend_request_hsic = gpio;
967
968         gpio = MOBILE_GPIO(ACTIVE_STATE_HSIC);
969         gpio_request(gpio, "ACTIVE_STATE_HSIC");
970         gpio_direction_output(gpio, 0);
971         gpios->active_state_hsic = gpio;
972 }
973
974 /* Uart Select */
975 static void c1_set_uart_switch(int path)
976 {
977         int gpio;
978
979         gpio = MOBILE_GPIO(UART_SEL);
980         gpio_request(gpio, "UART_SEL");
981
982         /* c1 target is gpio_high == AP */
983         if (path == UART_SW_PATH_AP)
984                 gpio_set_value(gpio, GPIO_LEVEL_HIGH);
985         else if (path == UART_SW_PATH_CP)
986                 gpio_set_value(gpio, GPIO_LEVEL_LOW);
987
988         gpio_free(gpio);
989         return;
990 }
991
992 static int c1_get_uart_switch(void)
993 {
994         int val;
995         int gpio;
996
997         gpio = MOBILE_GPIO(UART_SEL);
998         gpio_request(gpio, "UART_SEL");
999         val = gpio_get_value(gpio);
1000         gpio_free(gpio);
1001
1002         /* c1 target is gpio_high == AP */
1003         if (val == GPIO_LEVEL_HIGH)
1004                 return UART_SW_PATH_AP;
1005         else if (val == GPIO_LEVEL_LOW)
1006                 return UART_SW_PATH_CP;
1007         else
1008                 return UART_SW_PATH_NA;
1009 }
1010 static struct uart_select_platform_data c1_uart_select_data = {
1011         .set_uart_switch        = c1_set_uart_switch,
1012         .get_uart_switch        = c1_get_uart_switch,
1013 };
1014
1015 static struct platform_device c1_uart_select = {
1016         .name                   = "uart-select",
1017         .id                     = -1,
1018         .dev                    = {
1019                 .platform_data  = &c1_uart_select_data,
1020         },
1021 };
1022
1023 /* eMMC */
1024 #ifndef CONFIG_S3C_DEV_HSMMC4
1025 static struct s3c_sdhci_platdata c1_hsmmc0_data __initdata = {
1026         .max_width              = 8,
1027         .host_caps              = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
1028                            MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
1029                            MMC_CAP_DISABLE | MMC_CAP_ERASE),
1030         .cd_type                = S3C_SDHCI_CD_PERMANENT,
1031         .clk_type               = S3C_SDHCI_CLK_DIV_EXTERNAL,
1032 };
1033 #endif
1034
1035 static struct regulator_consumer_supply emmc_supplies[] = {
1036         REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
1037         REGULATOR_SUPPLY("vmmc", "dw_mmc"),
1038 };
1039
1040 static struct regulator_init_data emmc_fixed_voltage_init_data = {
1041         .constraints            = {
1042                 .name           = "VMEM_VDD_2.8V",
1043                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
1044         },
1045         .num_consumer_supplies  = ARRAY_SIZE(emmc_supplies),
1046         .consumer_supplies      = emmc_supplies,
1047 };
1048
1049 static struct fixed_voltage_config emmc_fixed_voltage_config = {
1050         .supply_name            = "MASSMEMORY_EN",
1051         .microvolts             = 2800000,
1052         .gpio                   = S5PV310_GPL1(1),
1053         .enable_high            = false,
1054         .init_data              = &emmc_fixed_voltage_init_data,
1055 };
1056
1057 static struct platform_device emmc_fixed_voltage = {
1058         .name                   = "reg-fixed-voltage",
1059         .id                     = FIXED_REG_ID_MMC,
1060         .dev                    = {
1061                 .platform_data  = &emmc_fixed_voltage_config,
1062         },
1063 };
1064
1065 /* SD */
1066 static struct s3c_sdhci_platdata c1_hsmmc2_data __initdata = {
1067         .max_width              = 4,
1068         .host_caps              = MMC_CAP_4_BIT_DATA |
1069                                 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
1070                                 MMC_CAP_DISABLE,
1071         .ext_cd_gpio            = S5PV310_GPX3(4),      /* XEINT_27 */
1072         .ext_cd_gpio_invert     = 1,
1073         .cd_type                = S3C_SDHCI_CD_GPIO,
1074         .clk_type               = S3C_SDHCI_CLK_DIV_EXTERNAL,
1075 };
1076
1077 /* WLAN */
1078 static void (*wlan_notify_change_cb)(struct platform_device *dev, int state);
1079
1080 static int wlan_ext_cd_init(void (*cb)(struct platform_device *dev, int state))
1081 {
1082         wlan_notify_change_cb = cb;
1083         return 0;
1084 }
1085
1086 static int wlan_ext_cd_cleanup(void (*cb)(struct platform_device *dev, int state))
1087 {
1088         wlan_notify_change_cb = NULL;
1089         return 0;
1090 }
1091
1092 static int c1_wlan_host_enable(int on)
1093 {
1094         if (wlan_notify_change_cb)
1095                 (*wlan_notify_change_cb)(&s3c_device_hsmmc3, on);
1096         return 0;
1097 }
1098
1099 static struct s3c_sdhci_platdata c1_hsmmc3_data __initdata = {
1100         .max_width              = 4,
1101         .host_caps              = (MMC_CAP_4_BIT_DATA |
1102                            MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
1103         .pm_caps                = MMC_PM_KEEP_POWER,
1104         .cd_type                = S3C_SDHCI_CD_EXTERNAL,
1105         .ext_cd_init            = &wlan_ext_cd_init,
1106         .ext_cd_cleanup         = &wlan_ext_cd_cleanup,
1107         .clk_type               = S3C_SDHCI_CLK_DIV_EXTERNAL,
1108 };
1109
1110 static void __init c1_sdhci_init(void)
1111 {
1112         unsigned int gpio;
1113
1114 #ifndef CONFIG_S3C_DEV_HSMMC4
1115         s3c_sdhci0_set_platdata(&c1_hsmmc0_data);
1116 #endif
1117         s3c_sdhci3_set_platdata(&c1_hsmmc3_data);
1118
1119         if (system_rev == SLP_C1_REV03) {
1120                 gpio = S5PV310_GPX3(4); /* T-Flash Detect */
1121                 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1122                 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1123
1124                 s3c_sdhci2_set_platdata(&c1_hsmmc2_data);
1125         }
1126 }
1127
1128 /* BCM4330 */
1129 static struct bcm4330_platform_data bcm4330_data = {
1130         .wlan_en                = S5PV310_GPL1(2),      /* XGNSS_EPOCH  */
1131         .wlan_host_wake         = S5PV310_GPX2(5),      /* XEINT[21]    */
1132         .bt_en                  = S5PV310_GPL0(4),      /* XGNSS_QMAG   */
1133         .bt_nrst                = S5PV310_GPL1(0),      /* XGNSS_SCL    */
1134         .bt_host_wake           = S5PV310_GPX2(6),      /* XEINT[22]    */
1135         .bt_wake                = S5PV310_GPX3(1),      /* XEINT[25]    */
1136         .wlan_host_enable       = &c1_wlan_host_enable,
1137 };
1138
1139 static struct platform_device c1_bcm4330 = {
1140         .name                   = "bcm4330-b1",
1141         .id                     = -1,
1142         .dev                    = {
1143                 .platform_data  = &bcm4330_data,
1144         },
1145 };
1146
1147 /* MALI DRM. */
1148 #ifdef CONFIG_DRM_MALI
1149 static struct platform_device s5p_device_mali_drm = {
1150         .name                   = "mali_drm",
1151         .id                     = -1,
1152 };
1153 #endif
1154
1155 /* FIMD DRM. */
1156 #ifdef CONFIG_DRM_FIMD
1157 static struct resource fimd_drm_resource[] = {
1158         [0] = {
1159                 .start          = S5P_PA_LCD0,
1160                 .end            = S5P_PA_LCD0 + S5P_SZ_LCD0 - 1,
1161                 .flags          = IORESOURCE_MEM,
1162         },
1163         [1] = {
1164                 .start          = S5P_PA_LCD1,
1165                 .end            = S5P_PA_LCD1 + S5P_SZ_LCD1 - 1,
1166                 .flags          = IORESOURCE_MEM,
1167         },
1168         [2] = {
1169                 .start          = IRQ_LCD1,
1170                 .end            = IRQ_LCD1,
1171                 .flags          = IORESOURCE_IRQ,
1172         },
1173         [3] = {
1174                 .start          = IRQ_LCD0,
1175                 .end            = IRQ_LCD0,
1176                 .flags          = IORESOURCE_IRQ,
1177         },
1178 };
1179
1180 static struct fimd_drm_platform_data fimd_drm_pd = {
1181         .hw_ver = 0x70,
1182 };
1183
1184 static struct platform_device s5p_device_fimd_drm = {
1185         .name                   = "fimd_drm",
1186         .id                     = -1,
1187         .num_resources          = ARRAY_SIZE(fimd_drm_resource),
1188         .resource               = fimd_drm_resource,
1189         .dev                    = {
1190                 .platform_data = &fimd_drm_pd,
1191         },
1192 };
1193 #endif
1194
1195 /* ADC */
1196 static struct s3c_adc_platform_data s3c_adc_pdata __initdata = {
1197         .delay                  = 1000,
1198         .presc                  = 49,
1199         .resolution             = 12,
1200         .max_adc_voltage_uV     = 3300000,
1201 };
1202
1203 static void __init c1_adc_init(void)
1204 {
1205         s3c_adc_set_platdata(&s3c_adc_pdata);
1206 }
1207
1208 static void ramoops_enable(int enable)
1209 {
1210         struct clk *clk;
1211
1212         clk = clk_get(NULL, "modem");
1213         if (enable)
1214                 clk_enable(clk);
1215         else
1216                 clk_disable(clk);
1217         clk_put(clk);
1218 }
1219
1220 static struct ramoops_platform_data c1_ramoops_data = {
1221         .mem_address            = 0x13A00000,           /* MODEM I/F */
1222         .mem_size               = SZ_16K,
1223         .enable                 = ramoops_enable,
1224 };
1225
1226 static struct platform_device c1_ramoops = {
1227         .name                   = "ramoops",
1228         .dev                    = {
1229                 .platform_data  = &c1_ramoops_data,
1230         },
1231 };
1232
1233 /* TZPC */
1234 static struct platform_device c1_tzpc = {
1235         .name                   = "tzpc",
1236         .id                     = -1,
1237 };
1238
1239 #ifdef CONFIG_ANDROID_RAM_CONSOLE
1240 static struct resource ram_console_resource[] = {
1241         [0] = {
1242                 .flags = IORESOURCE_MEM,
1243         },
1244 };
1245
1246 static struct platform_device ram_console_device = {
1247         .name                   = "ram_console",
1248         .id                     = -1,
1249         .num_resources          = ARRAY_SIZE(ram_console_resource),
1250         .resource               = ram_console_resource,
1251 };
1252 #endif
1253
1254 static void __init c1_map_io(void)
1255 {
1256         s5p_init_io(NULL, 0, S5P_VA_CHIPID);
1257         s5p_xtal_set_parent(CLK_XUSBXTI);
1258         s3c24xx_init_clocks(24000000);
1259         s3c24xx_init_uarts(c1_uartcfgs, ARRAY_SIZE(c1_uartcfgs));
1260 }
1261
1262 static void __init s5pv310_reserve(void)
1263 {
1264         static struct cma_region regions[] = {
1265 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD0
1266                 {
1267                         .name = "fimd",
1268                         .size = (CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD0
1269 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD1
1270                                 + CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD1
1271 #endif
1272                                 ) * SZ_1K,
1273                 },
1274 #endif
1275 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
1276                 {
1277                         .name           = "fimc1",
1278                         .size           = 5 << 20,
1279                 },
1280                 {
1281                         .name           = "fimc2",
1282                         .size           = 5 << 20,
1283                 },
1284                 {
1285                         .name           = "fimc3",
1286                         .size           = 5 << 20,
1287                 },
1288 #endif
1289 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG
1290                 {
1291                         .name           = "jpeg",
1292                         .size           = CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG *  SZ_1K,
1293                 },
1294 #endif
1295 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC
1296                 {
1297                         .name = "mfc",
1298                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC *  SZ_1K,
1299                 },
1300 #endif
1301 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0
1302                 {
1303                         .name = "mfc0",
1304                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0 * SZ_1K,
1305                         {
1306                                 .alignment = 1 << 17,
1307                         },
1308                 },
1309 #endif
1310 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1
1311                 {
1312                         .name = "mfc1",
1313                         .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1 * SZ_1K,
1314                         {
1315                                 .alignment = 1 << 17,
1316                         },
1317                 },
1318 #endif
1319 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
1320                 {
1321                         .name           = "fw",
1322                         .size           = 1 << 20,
1323                         { .alignment    = 128 << 10 },
1324                         .start          = 0x42000000,
1325                 },
1326                 {
1327                         .name           = "b1",
1328                         .size           = 32 << 20,
1329                         .start          = 0x43000000,
1330                 },
1331                 {
1332                         .name           = "b2",
1333                         .size           = 32 << 20,
1334                         .start          = 0x51000000,
1335                 },
1336 #endif
1337                 { }
1338         };
1339
1340         static const char map[] __initconst =
1341                 "s3cfb=fimd;"
1342                 "s5pv310-fimc.0/for-mfc=b2;"
1343                 "s5pv310-fimc.1/for-fimc1=fimc1;"
1344                 "s5pv310-fimc.2/for-fimc2=fimc2;"
1345                 "s5pv310-fimc.3/for-fimc3=fimc3;"
1346                 "s5p-jpeg=jpeg;"
1347                 "mfc=mfc,mfc0,mfc1;s5p-mfc/f=fw;s5p-mfc/a=b1;s5p-mfc/b=b2;"
1348                 "*=b1,b2";
1349
1350         unsigned int i = 0;
1351
1352 #ifdef CONFIG_ANDROID_RAM_CONSOLE
1353         unsigned int addr;
1354
1355         /* FIXME: ram console MUST be reserved at first time */
1356         addr = memblock_alloc_base(SZ_1M, SZ_4K, 0x60000000);
1357         ram_console_resource[0].start = addr;
1358         ram_console_resource[0].end = addr + SZ_1M - 1;
1359         pr_info("ram_console: 0x%08x ~ 0x%08x (1MB)\n",
1360                         addr, addr + SZ_1M);
1361 #endif
1362
1363         cma_set_defaults(regions, map);
1364         cma_early_regions_reserve(NULL);
1365
1366         for (; i < ARRAY_SIZE(regions) - 1 /* terminator */; ++i) {
1367                 pr_info("cma: region: %-8s: 0x%08x ~ 0x%08x (%dMB)\n",
1368                         regions[i].name, regions[i].start,
1369                         regions[i].start + regions[i].size,
1370                         regions[i].size / SZ_1M);
1371         }
1372 }
1373
1374 /*
1375  * GPX are saved and restored at plat-samsung/pm.c:s5c_pm_enter.
1376  * However, they are inside of pm_prepare and pm_finish, so it
1377  * does not save ours against universal_pm_prepare:2.
1378  */
1379 static struct sleep_save s5pc210_gpx[] = {
1380         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C00),
1381         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C04),
1382         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C08),
1383         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C0C),
1384         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C20),
1385         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C24),
1386         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C28),
1387         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C2C),
1388         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C40),
1389         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C44),
1390         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C48),
1391         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C4C),
1392         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C60),
1393         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C64),
1394         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C68),
1395         SAVE_ITEM(S5P_VA_GPIO2 + 0x0C6C),
1396 };
1397
1398 /* GPIO KEYS */
1399 static struct gpio_keys_button c1_gpio_keys_tables[] = {
1400         {
1401                 .code                   = KEY_VOLUMEUP,
1402                 .gpio                   = S5PV310_GPX2(0),      /* XEINT16 */
1403                 .desc                   = "gpio-keys: KEY_VOLUMEUP",
1404                 .type                   = EV_KEY,
1405                 .active_low             = 1,
1406                 .debounce_interval      = 1,
1407         }, {
1408                 .code                   = KEY_VOLUMEDOWN,
1409                 .gpio                   = S5PV310_GPX2(1),      /* XEINT17 */
1410                 .desc                   = "gpio-keys: KEY_VOLUMEDOWN",
1411                 .type                   = EV_KEY,
1412                 .active_low             = 1,
1413                 .debounce_interval      = 1,
1414         }, {
1415                 .code                   = KEY_POWER,
1416                 .gpio                   = S5PV310_GPX2(7),      /* XEINT23 */
1417                 .desc                   = "gpio-keys: KEY_POWER",
1418                 .type                   = EV_KEY,
1419                 .active_low             = 1,
1420                 .wakeup                 = 1,
1421                 .debounce_interval      = 1,
1422         }, {
1423                                         /* KEY_MENU will be used */
1424                 .code                   = KEY_MENU,             /* KEY_OK */
1425                 .gpio                   = S5PV310_GPX3(5),      /* XEINT29 */
1426                 .desc                   = "gpio-keys: KEY_MENU",
1427                 .type                   = EV_KEY,
1428                 .active_low             = 1,
1429                 .debounce_interval      = 1,
1430         },
1431 };
1432
1433 static struct gpio_keys_platform_data c1_gpio_keys_data = {
1434         .buttons                = c1_gpio_keys_tables,
1435         .nbuttons               = ARRAY_SIZE(c1_gpio_keys_tables),
1436 };
1437
1438 static struct platform_device c1_gpio_keys = {
1439         .name                   = "gpio-keys",
1440         .dev                    = {
1441                 .platform_data  = &c1_gpio_keys_data,
1442         },
1443 };
1444
1445
1446
1447 static unsigned int ld9040_lcd_enabled;
1448
1449 static struct s3cfb_lcd ld9040 = {
1450         .width = 480,
1451         .height = 800,
1452         .width_mm = 59,
1453         .height_mm = 98,
1454         .bpp = 24,
1455
1456         .freq = 60,
1457         .timing = {
1458                 .h_fp = 16,
1459                 .h_bp = 16,
1460                 .h_sw = 2,
1461                 .v_fp = 4,
1462                 .v_fpe = 1,
1463                 .v_bp = 6,
1464                 .v_bpe = 1,
1465                 .v_sw = 2,
1466         },
1467         .polarity = {
1468                 .rise_vclk = 1,
1469                 .inv_hsync = 1,
1470                 .inv_vsync = 1,
1471                 .inv_vden = 1,
1472         },
1473 };
1474
1475 static int lcd_cfg_gpio(void)
1476 {
1477         int i, f3_end = 4;
1478         u32 reg;
1479
1480         for (i = 0; i < 8; i++) {
1481                 /* set GPF0,1,2[0:7] for RGB Interface and Data lines (32bit) */
1482                 s3c_gpio_cfgpin(S5PV310_GPF0(i), S3C_GPIO_SFN(2));
1483                 s3c_gpio_setpull(S5PV310_GPF0(i), S3C_GPIO_PULL_NONE);
1484
1485         }
1486         for (i = 0; i < 8; i++) {
1487                 s3c_gpio_cfgpin(S5PV310_GPF1(i), S3C_GPIO_SFN(2));
1488                 s3c_gpio_setpull(S5PV310_GPF1(i), S3C_GPIO_PULL_NONE);
1489         }
1490
1491         for (i = 0; i < 8; i++) {
1492                 s3c_gpio_cfgpin(S5PV310_GPF2(i), S3C_GPIO_SFN(2));
1493                 s3c_gpio_setpull(S5PV310_GPF2(i), S3C_GPIO_PULL_NONE);
1494         }
1495
1496         for (i = 0; i < f3_end; i++) {
1497                 s3c_gpio_cfgpin(S5PV310_GPF3(i), S3C_GPIO_SFN(2));
1498                 s3c_gpio_setpull(S5PV310_GPF3(i), S3C_GPIO_PULL_NONE);
1499         }
1500
1501         /* Set FIMD0 bypass */
1502         reg = __raw_readl(S3C_VA_SYS + 0x0210);
1503         reg |= (1<<1);
1504         __raw_writel(reg, S3C_VA_SYS + 0x0210);
1505
1506         return 0;
1507 }
1508
1509 static int lcd_power_on(struct lcd_device *ld, int enable)
1510 {
1511         struct regulator *regulator;
1512
1513         if (ld == NULL) {
1514                 printk(KERN_ERR "lcd device object is NULL.\n");
1515                 return 0;
1516         }
1517
1518         if (enable) {
1519                 regulator = regulator_get(&ld->dev, "vcc_1.8v");
1520                 if (IS_ERR(regulator))
1521                         return -1;
1522                 regulator_enable(regulator);
1523                 regulator_put(regulator);
1524
1525                 regulator = regulator_get(&ld->dev, "vcc_3.0v_lcd");
1526                 if (IS_ERR(regulator))
1527                         return -1;
1528                 regulator_enable(regulator);
1529                 regulator_put(regulator);
1530         } else {
1531                 regulator = regulator_get(&ld->dev, "vcc_1.8v");
1532                 if (IS_ERR(regulator))
1533                         return -1;
1534                 if (regulator_is_enabled(regulator))
1535                         regulator_disable(regulator);
1536                 regulator_put(regulator);
1537
1538                 regulator = regulator_get(&ld->dev, "vcc_3.0v_lcd");
1539                 if (IS_ERR(regulator))
1540                         return -1;
1541                 if (regulator_is_enabled(regulator))
1542                         regulator_disable(regulator);
1543                 regulator_put(regulator);
1544         }
1545
1546         return 0;
1547 }
1548 static int reset_lcd(struct lcd_device *ld)
1549 {
1550         static unsigned int first = 1;
1551         int reset_gpio = -1;
1552
1553         reset_gpio = S5PV310_GPY4(5);
1554
1555         if (first) {
1556                 gpio_request(reset_gpio, "MLCD_RST");
1557                 first = 0;
1558         }
1559
1560         mdelay(10);
1561         gpio_direction_output(reset_gpio, 0);
1562         mdelay(10);
1563         gpio_direction_output(reset_gpio, 1);
1564
1565         return 1;
1566 }
1567
1568 static void __init early_lcd(char **param)
1569 {
1570         (*param)++;
1571
1572         if (strncmp(*param, "ld9040", 6) == 0)
1573                 ld9040_lcd_enabled = 1;
1574 }
1575 __early_param("lcd", early_lcd);
1576
1577 static struct lcd_platform_data ld9040_platform_data = {
1578         .reset                  = reset_lcd,
1579         .power_on               = lcd_power_on,
1580         /* it indicates whether lcd panel is enabled from u-boot. */
1581         .lcd_enabled            = 1,
1582         .reset_delay            = 10,   /* 10ms */
1583         .power_on_delay         = 10,   /* 10ms */
1584         .power_off_delay        = 120,  /* 120ms */
1585 };
1586
1587 #define LCD_BUS_NUM     3
1588 #define DISPLAY_CS      S5PV310_GPY4(3)
1589 static struct spi_board_info spi_board_info[] __initdata = {
1590         {
1591                 .max_speed_hz   = 1200000,
1592                 .bus_num        = LCD_BUS_NUM,
1593                 .chip_select    = 0,
1594                 .mode           = SPI_MODE_3,
1595                 .controller_data = (void *)DISPLAY_CS,
1596         },
1597 };
1598
1599 #define DISPLAY_CLK     S5PV310_GPY3(1)
1600 #define DISPLAY_SI      S5PV310_GPY3(3)
1601 static struct spi_gpio_platform_data lcd_spi_gpio_data = {
1602         .sck                    = DISPLAY_CLK,
1603         .mosi                   = DISPLAY_SI,
1604         .miso                   = SPI_GPIO_NO_MISO,
1605         .num_chipselect         = 1,
1606 };
1607
1608 static struct platform_device c1_spi_gpio = {
1609         .name                   = "spi_gpio",
1610         .id                     = LCD_BUS_NUM,
1611         .dev                    = {
1612                 .parent         = &s3c_device_fb.dev,
1613                 .platform_data  = &lcd_spi_gpio_data,
1614         },
1615 };
1616
1617 #ifdef CONFIG_VIDEO_FIMG2D
1618 static struct fimg2d_platdata fimg2d_data __initdata = {
1619         .hw_ver                 = 30,
1620         .parent_clkname         = "mout_g2d0",
1621         .clkname                = "sclk_fimg2d",
1622         .gate_clkname           = "fimg2d",
1623         .smmu_gate_clkname      = "smmu_fimg2d",
1624         .clkrate                = 250 * 1000000,
1625 };
1626 #endif
1627
1628 static struct s3c_platform_fb fb_platform_data __initdata = {
1629         .hw_ver                 = 0x70,
1630         .nr_wins                = 5,
1631 #ifdef CONFIG_FB_S3C_DEFAULT_WINDOW
1632         .default_win            = CONFIG_FB_S3C_DEFAULT_WINDOW,
1633 #else
1634         .default_win            = 0,
1635 #endif
1636         .swap                   = FB_SWAP_HWORD | FB_SWAP_WORD,
1637 };
1638
1639 static void __init c1_fb_init(void)
1640 {
1641         struct device *dev = s3c_device_fb.dev.parent;
1642         struct samsung_pd_info *pdinfo;
1643
1644         if (dev) {
1645                 pdinfo = (struct samsung_pd_info *)dev->platform_data;
1646                 /* fimd driver have to know LCD domain power status. */
1647                 if (pdinfo)
1648                         fb_platform_data.boot_on = pdinfo->boot_on;
1649         }
1650
1651         strcpy(spi_board_info[0].modalias, "ld9040");
1652
1653         /* workaround: because of early_lcd not working */
1654         ld9040_platform_data.lcd_enabled = 1;
1655         spi_board_info[0].platform_data =
1656         (void *)&ld9040_platform_data;
1657
1658         spi_register_board_info(spi_board_info,
1659         ARRAY_SIZE(spi_board_info));
1660
1661         fb_platform_data.lcd_data = (struct s3cfb_lcd *)&ld9040;
1662
1663         lcd_cfg_gpio();
1664         s3cfb_set_platdata(&fb_platform_data);
1665 }
1666
1667 /* VT cam attached at the front: S5K6AAFX */
1668
1669 static struct regulator_consumer_supply supplies_cam_io_en[] = {
1670         REGULATOR_SUPPLY("vdda", "17-003c"),
1671         REGULATOR_SUPPLY("a_sensor", "0-001f"),
1672 };
1673
1674 static struct regulator_consumer_supply supplies_vt_cam_15v_en[] = {
1675         REGULATOR_SUPPLY("core", "17-003c"),
1676 };
1677
1678 /* MEGA attached at the back: M5MOLS */
1679 static struct regulator_consumer_supply supplies_cam_sensor_core_12v_en[] = {
1680         REGULATOR_SUPPLY("dig_12", "0-001f"),
1681 };
1682
1683 #if 0
1684 /* MEGA attached at the back: M5MOLS */
1685 static struct regulator_consumer_supply supplies_8m_core_en[] = {
1686         REGULATOR_SUPPLY("core", "0-001f"),
1687 };
1688 static struct regulator_consumer_supply supplies_cam_pwr_en1[] = {
1689         REGULATOR_SUPPLY("d_sensor", "0-001f"),
1690 };
1691 #endif
1692
1693 static struct regulator_init_data cam_fixreg_init_data[] = {
1694         [0] = {
1695                 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1696                 .num_consumer_supplies  = ARRAY_SIZE(supplies_cam_io_en),
1697                 .consumer_supplies      = supplies_cam_io_en,
1698         },
1699         [1] = {
1700                 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1701                 .num_consumer_supplies  = ARRAY_SIZE(supplies_vt_cam_15v_en),
1702                 .consumer_supplies      = supplies_vt_cam_15v_en,
1703         },
1704         [2] = {
1705                 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1706                 .num_consumer_supplies  = ARRAY_SIZE(supplies_cam_sensor_core_12v_en),
1707                 .consumer_supplies      = supplies_cam_sensor_core_12v_en,
1708         },
1709 };
1710
1711 static struct fixed_voltage_config cam_fixreg_cfg[] = {
1712         [0] = {
1713                 .supply_name    = "CAM_IO_EN",
1714                 .microvolts     = 2800000,
1715                 .gpio           = S5PV310_GPE2(1),
1716                 .enable_high    = 1,
1717                 .init_data      = &cam_fixreg_init_data[0],
1718         },
1719         [1] = {
1720                 .supply_name    = "VT_CAM_1.5V_EN",
1721                 .microvolts     = 1500000,
1722                 .gpio           = S5PV310_GPE2(2),
1723                 .enable_high    = 1,
1724                 .init_data      = &cam_fixreg_init_data[1],
1725         },
1726         [2] = {
1727                 .supply_name    = "CAM_SENSOR_CORE_1.2V_EN",
1728                 .microvolts     = 1200000,
1729                 .gpio           = S5PV310_GPE2(5),
1730                 .enable_high    = 1,
1731                 .init_data      = &cam_fixreg_init_data[2],
1732         },
1733 };
1734
1735 static struct platform_device camera_fixed_reg_dev[] = {
1736         {
1737                 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM0,
1738                 .dev = { .platform_data = &cam_fixreg_cfg[0] },
1739         }, {
1740                 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM1,
1741                 .dev = { .platform_data = &cam_fixreg_cfg[1] },
1742         }, {
1743                 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM2,
1744                 .dev = { .platform_data = &cam_fixreg_cfg[2] },
1745         },
1746 };
1747
1748 static struct s5p_platform_mipi_csis mipi_csis0_pldata = {
1749         .clk_rate       = 166000000UL,
1750         .lanes          = 2,
1751         .alignment      = 32,
1752         .hs_settle      = 12,
1753         .phy_enable             = s5p_csis_phy_enable,
1754 };
1755
1756 static struct s5k6aafx_platform_data s5k6aafx_pldata = {
1757         .clk_rate               = 16000000UL,
1758         .gpio_nreset            = S5PV310_GPL2(1), /* CAM_VGA_NRST */
1759         .gpio_nstby             = S5PV310_GPL2(0), /* CAM_VGA_NSTBY */
1760 };
1761
1762 static struct i2c_board_info s5k6aafx_board_info = {
1763         I2C_BOARD_INFO("S5K6AAFX", 0x3C),
1764         .platform_data = &s5k6aafx_pldata,
1765 };
1766
1767 static struct m5mols_platform_data m5mols_platdata = {
1768         .gpio_reset             = S5PV310_GPY3(7),      /* ISP_RESET */
1769         .reset_polarity         = 0,
1770 };
1771
1772 static struct i2c_board_info m5mols_board_info = {
1773         I2C_BOARD_INFO("M5MOLS", 0x1F),
1774         .platform_data = &m5mols_platdata,
1775 };
1776
1777
1778 static struct s5p_fimc_isp_info c1_front_cam_sensor = {
1779         .mux_id         = 0,
1780         .flags          = FIMC_CLK_INV_PCLK | FIMC_CLK_INV_VSYNC,
1781         .bus_type       = FIMC_ITU_601,
1782         .board_info     = &s5k6aafx_board_info,
1783         .clk_frequency  = 24000000UL,
1784         .i2c_bus_num    = 17,
1785 };
1786
1787 static struct s5p_fimc_isp_info c1_rear_cam_sensor = {
1788         .mux_id         = 0,
1789         .flags          = FIMC_CLK_INV_PCLK | FIMC_CLK_INV_VSYNC,
1790         .bus_type       = FIMC_MIPI_CSI2,
1791         .board_info     = &m5mols_board_info,
1792         .clk_frequency  = 24000000UL,
1793         .i2c_bus_num    = 0,
1794         .csi_data_align = 32,
1795 };
1796
1797 static struct s5p_fimc_isp_info *c1_camera_sensors[] = {
1798         &c1_front_cam_sensor,
1799         &c1_rear_cam_sensor,
1800 };
1801
1802 static struct s5p_platform_fimc c1_fimc_platdata[] = {
1803         [0] = {
1804                 .isp_info       = c1_camera_sensors,
1805                 .num_clients    = ARRAY_SIZE(c1_camera_sensors),
1806
1807                 .cma_type = "for-mfc",
1808                 .cma_align = SZ_8K,
1809         },
1810         [1] = {
1811                 .cma_type = "for-fimc1",
1812                 .cma_align = SZ_4K
1813         },
1814         [2] = {
1815                 .cma_type = "for-fimc2",
1816                 .cma_align = SZ_4K
1817         },
1818         [3] = {
1819                 .cma_type = "for-fimc3",
1820                 .cma_align = SZ_4K
1821         },
1822 };
1823
1824 static int __init c1_fimc_setup_clks(void)
1825 {
1826         int err = 0;
1827         int i;
1828         struct clk *clock, *parent;
1829
1830         struct device *fimc_devs[] = {
1831                 &s5p_device_fimc0.dev,
1832                 &s5p_device_fimc1.dev,
1833                 &s5p_device_fimc2.dev,
1834                 &s5p_device_fimc3.dev
1835         };
1836
1837         parent = clk_get(NULL, "mout_epll");
1838         if (IS_ERR(parent))
1839                 return PTR_ERR(parent);
1840
1841         for (i = 0; err == 0 && i < ARRAY_SIZE(fimc_devs); i++) {
1842                 if (fimc_devs[i]) {
1843                         clock = clk_get(fimc_devs[i], "sclk_fimc");
1844                         if (IS_ERR(clock)) {
1845                                 err = PTR_ERR(clock);
1846                                 printk(KERN_ERR "couldn't get sclk_fimc.%d\n",
1847                                         i);
1848                                 break;
1849                         }
1850                         clk_set_parent(clock, parent);
1851                         clk_put(clock);
1852                 }
1853         }
1854         clk_put(parent);
1855
1856         if (err)
1857                 goto clk_err;
1858
1859         /* Set parent clock of the MIPI-CSIS interfaces */
1860         parent = clk_get(NULL, "mout_mpll");
1861         if (IS_ERR(parent)) {
1862                 err = PTR_ERR(parent);
1863                 printk(KERN_ERR "failed to get clock mout_mpll\n");
1864                 goto clk_err;
1865         }
1866
1867         clock = clk_get(&s5p_device_mipi_csis0.dev, "sclk_csis");
1868         if (IS_ERR(clock))
1869                 err = PTR_ERR(clock);
1870         else
1871                 clk_set_parent(clock, parent);
1872         clk_put(parent);
1873
1874         if (err) {
1875                 printk(KERN_ERR "failed to get clock sclk_csis.0\n");
1876                 goto clk_err;
1877         }
1878
1879         /* Set parent clock of FIMC external clock for image processors */
1880         parent = clk_get(NULL, "sclk_vpll");
1881         if (IS_ERR(parent)) {
1882                 printk(KERN_ERR "failed to get clock sclk_vpll\n");
1883                 err = PTR_ERR(parent);
1884                 goto clk_err;
1885         }
1886
1887         clock = clk_get(fimc_devs[0], "sclk_cam");
1888         if (IS_ERR(clock)) {
1889                 printk(KERN_ERR "failed to get clock sclk_cam.0\n");
1890                 clk_put(parent);
1891                 err = PTR_ERR(clock);
1892                 goto clk_err;
1893         }
1894
1895         clk_set_parent(clock, parent);
1896         clk_put(parent);
1897
1898         /* WORKAROUND */
1899         /*      clk_disable(clock);     */
1900         clk_put(clock);
1901
1902 clk_err:
1903         printk(KERN_ERR "%s%s: %s\n", err ? "WARNING! " : "", __func__,
1904                err ? "failed!" : "succedded.");
1905
1906         return err;
1907 }
1908
1909 #define cfg_camif_pin(pin) do {                         \
1910         s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(2));  \
1911         s3c_gpio_setpull(pin, S3C_GPIO_PULL_UP);        \
1912 } while (0)
1913
1914 static void c1_camera_init(void)
1915 {
1916         int gpio;
1917         int i;
1918
1919         /* Configuration Camera0(camA) pin */
1920         for (i = 0; i < 8; i++)
1921                 cfg_camif_pin(S5PV310_GPJ0(i));
1922         for (i = 0; i < 5; i++)
1923                 cfg_camif_pin(S5PV310_GPJ1(i));
1924
1925         /* Camera fixed voltage regulators */
1926         for (i = 0; i < ARRAY_SIZE(camera_fixed_reg_dev); i++)
1927                 platform_device_register(&camera_fixed_reg_dev[i]);
1928
1929         /* set pin to default state, for dual camera issue */
1930         gpio = S5PV310_GPY3(7);         /* ISP_RESET */
1931         gpio_set_value(gpio, 0);
1932         gpio = S5PV310_GPL2(1);         /* CAM_VT_NRST */
1933         gpio_set_value(gpio, 0);
1934         gpio = S5PV310_GPL2(0);         /* CAM_VT_NSTBY */
1935         gpio_set_value(gpio, 0);
1936
1937         gpio = S5PV310_GPX1(5);         /* ISP_INT: XEINT[13] */
1938         gpio_request(gpio, "M5MOLS_INT");
1939         m5mols_platdata.irq = gpio_to_irq(gpio);
1940
1941         gpio_free(gpio);
1942 }
1943
1944 /* Jack */
1945 static struct jack_platform_data c1_jack_data = {
1946         .usb_online             = 0,
1947         .charger_online         = 0,
1948         .hdmi_online            = -1,
1949         .earjack_online         = 0,
1950         .earkey_online          = 0,
1951         .ums_online             = -1,
1952         .cdrom_online           = -1,
1953         .jig_online             = 0,
1954 };
1955
1956 static struct platform_device c1_jack = {
1957         .name                   = "jack",
1958         .id                     = -1,
1959         .dev                    = {
1960                 .platform_data  = &c1_jack_data,
1961         },
1962 };
1963
1964 static void c1_vbus_enable(int on, char *name)
1965 {
1966         struct regulator *regulator;
1967
1968         regulator = regulator_get(NULL, name);
1969         if (IS_ERR(regulator))
1970                 return;
1971
1972         if (on)
1973                 regulator_enable(regulator);
1974         else {
1975                 if (regulator_is_enabled(regulator))
1976                         regulator_disable(regulator);
1977         }
1978
1979         regulator_put(regulator);
1980 }
1981
1982 static void c1_usb_path_power(int on, int path)
1983 {
1984         if (path == USB_PATH_AP) {
1985                 if (on) {
1986                         /* Enable USB_D first */
1987                         c1_vbus_enable(on, "vusb_d");
1988                         c1_vbus_enable(on, "vusb_a");
1989                 } else {
1990                         /* Disable USB_A first */
1991                         c1_vbus_enable(on, "vusb_a");
1992                         c1_vbus_enable(on, "vusb_d");
1993                 }
1994                 c1_vbus_enable(on, "usb_vbus_ap_5v");
1995         } else if (path == USB_PATH_CP) {
1996                 c1_vbus_enable(on, "usb_vbus_cp_5v");
1997         } else {
1998                 c1_vbus_enable(0, "vusb_a");
1999                 c1_vbus_enable(0, "vusb_d");
2000                 c1_vbus_enable(0, "usb_vbus_ap_5v");
2001                 c1_vbus_enable(0, "usb_vbus_cp_5v");
2002         }
2003 }
2004
2005 static void c1_usb_switch_power(int on, int path)
2006 {
2007         if (jack_get_data("usb") == 0)
2008                 return;
2009
2010         c1_usb_path_power(on, path);
2011 }
2012
2013 static void c1_set_usb_switch(int path)
2014 {
2015         if (path == USB_PATH_AP)
2016                 max8997_muic_set_switch("USB");
2017         else if (path == USB_PATH_CP)
2018                 max8997_muic_set_switch("UART");
2019 }
2020
2021 static int c1_get_usb_switch(void)
2022 {
2023         char buf[16];
2024
2025         max8997_muic_get_switch(buf);
2026
2027         if (!strncmp(buf, "USB", 3))
2028                 return USB_PATH_AP;
2029         else if (!strncmp(buf, "UART", 4))
2030                 return USB_PATH_CP;
2031
2032         return USB_PATH_NA;
2033 }
2034
2035 /* Micro USB Switch */
2036 static struct micro_usb_switch_platform_data c1_usb_switch_data = {
2037         .usb_power              = c1_usb_switch_power,
2038         .set_usb_switch         = c1_set_usb_switch,
2039         .get_usb_switch         = c1_get_usb_switch,
2040 };
2041
2042 static struct platform_device c1_micro_usb_switch = {
2043         .name                   = "usb-switch",
2044         .id                     = -1,
2045         .dev                    = {
2046                 .platform_data  = &c1_usb_switch_data,
2047         },
2048 };
2049
2050 static void c1_usb_power(u8 on)
2051 {
2052         c1_usb_path_power(on, c1_get_usb_switch());
2053 }
2054
2055 static void c1_usb_cb(u8 attached)
2056 {
2057 #ifdef CONFIG_JACK_MON
2058         jack_event_handler("usb", attached);
2059 #endif
2060 }
2061
2062 struct max8997_muic_platform_data c1_muic_pdata = {
2063         .usb_power = c1_usb_power,
2064         .usb_cb = c1_usb_cb,
2065 };
2066
2067 static void c1_pm_finish(void)
2068 {
2069         /* Restore GPX conf */
2070         s3c_pm_do_restore(s5pc210_gpx, ARRAY_SIZE(s5pc210_gpx));
2071 }
2072
2073 static void c1_pm_prepare(void)
2074 {
2075         /* 1. Save GPX conf */
2076         s3c_pm_do_save(s5pc210_gpx, ARRAY_SIZE(s5pc210_gpx));
2077
2078         /* 2. Set GPX as Power Save Mode */
2079
2080         /* 3. Debug: Look at the diff */
2081         mobile_gpios_groupx_difference();
2082
2083 }
2084
2085 int c1_common_setup_clock(const char *sclk_name, const char *pclk_name,
2086                 unsigned long rate, unsigned int rate_set)
2087 {
2088         struct clk *sclk = NULL;
2089         struct clk *pclk = NULL;
2090
2091         sclk = clk_get(NULL, sclk_name);
2092         if (IS_ERR(sclk)) {
2093                 printk(KERN_ERR "failed to get %s clock.\n", sclk_name);
2094                 goto err_clk;
2095         }
2096
2097         pclk = clk_get(NULL, pclk_name);
2098         if (IS_ERR(pclk)) {
2099                 printk(KERN_ERR "failed to get %s clock.\n", pclk_name);
2100                 goto err_clk;
2101         }
2102
2103         clk_set_parent(sclk, pclk);
2104
2105         printk(KERN_INFO "set parent clock of %s to %s\n", sclk_name,
2106                         pclk_name);
2107         if (!rate_set)
2108                 goto set_end;
2109
2110         if (!rate)
2111                 rate = 200 * MHZ;
2112
2113         clk_set_rate(sclk, rate);
2114         printk(KERN_INFO "set %s rate to %lu\n", sclk_name, rate);
2115
2116 set_end:
2117         clk_put(sclk);
2118         clk_put(pclk);
2119
2120         return 0;
2121
2122 err_clk:
2123         clk_put(sclk);
2124         clk_put(pclk);
2125
2126         return -EINVAL;
2127
2128 }
2129
2130 #ifdef CONFIG_S5PV310_DEV_PD
2131 static inline void powerdomain_boot_on(int pd)
2132 {
2133         struct samsung_pd_info *pdinfo = (struct samsung_pd_info *)
2134                 s5pv310_device_pd[pd].dev.platform_data;
2135         pdinfo->boot_on = true;
2136 }
2137 #endif
2138
2139
2140 #ifdef CONFIG_CHARGER_MANAGER
2141 extern struct platform_device c1_charger_manager;
2142 extern struct platform_device c1_ncp15wb473_thermistor;
2143 extern struct charger_global_desc c1_charger_g_desc;
2144 #endif
2145 static struct platform_device *c1_devices[] __initdata = {
2146         /* Samsung Platform Devices */
2147 #ifdef CONFIG_S5PV310_DEV_PD
2148         &s5pv310_device_pd[PD_MFC],
2149         &s5pv310_device_pd[PD_G3D],
2150         &s5pv310_device_pd[PD_LCD0],
2151         &s5pv310_device_pd[PD_LCD1],
2152         &s5pv310_device_pd[PD_TV],
2153         &s5pv310_device_pd[PD_CAM],
2154         &s5pv310_device_pd[PD_GPS],
2155 #endif
2156 #ifdef CONFIG_DRM_MALI
2157         &s5p_device_mali_drm,
2158 #endif
2159 #ifdef CONFIG_DRM_FIMD
2160         &s5p_device_fimd_drm,
2161 #endif
2162         &s3c_device_i2c0,
2163         &s3c_device_i2c1,
2164         &s3c_device_i2c3,
2165         &s3c_device_i2c5,
2166         &s3c_device_i2c6,
2167         &s3c_device_i2c7,
2168         &i2c9_gpio,
2169         &i2c12_gpio,
2170         &i2c14_gpio,
2171         &i2c15_gpio,
2172         &i2c16_gpio,
2173         &i2c17_gpio,
2174
2175         &s3c_device_timer[0],
2176         &s3c_device_timer[1],
2177
2178         &s5p_device_usb_ehci,
2179         &c1_xmm6260,
2180         &c1_modem_net,
2181 #ifdef CONFIG_S3C_DEV_RTC
2182         &s3c_device_rtc,
2183 #endif
2184
2185 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
2186         &s5p_device_fimc0,
2187         &s5p_device_fimc1,
2188         &s5p_device_fimc2,
2189         &s5p_device_fimc3,
2190 #endif
2191 #ifdef CONFIG_VIDEO_S5P_MIPI_CSIS
2192         &s5p_device_mipi_csis0,
2193 #endif
2194 #ifdef CONFIG_VIDEO_JPEG
2195         &s5p_device_jpeg,
2196 #endif
2197
2198         &c1_gpio_keys,
2199
2200 #ifdef CONFIG_USB_GADGET
2201         &s3c_device_usbgadget,
2202 #endif
2203 #ifdef CONFIG_S3C_DEV_HSMMC4
2204         &s3c_device_hsmmc4,
2205 #else
2206         &s3c_device_hsmmc0,
2207 #endif
2208         &emmc_fixed_voltage,
2209         &s3c_device_hsmmc2,
2210         &s3c_device_hsmmc3,
2211
2212         &c1_uart_select,
2213         &s3c_device_adc,
2214         &s5pv310_device_i2s0,
2215         &c1_jack,
2216         &c1_bcm4330,
2217         &c1_ramoops,
2218         &c1_micro_usb_switch,
2219
2220 #ifdef CONFIG_S3C2410_WATCHDOG
2221         &s3c_device_wdt,
2222 #endif
2223
2224 #ifdef CONFIG_S5P_SYSMMU
2225         &s5p_device_sysmmu[SYSMMU_G2D],
2226         &s5p_device_sysmmu[SYSMMU_MFC_L],
2227         &s5p_device_sysmmu[SYSMMU_MFC_R],
2228         &s5p_device_sysmmu[SYSMMU_FIMC0],
2229         &s5p_device_sysmmu[SYSMMU_FIMC1],
2230         &s5p_device_sysmmu[SYSMMU_FIMC2],
2231         &s5p_device_sysmmu[SYSMMU_FIMC3],
2232 #endif
2233 #ifdef CONFIG_VIDEO_FIMG2D
2234         &s5p_device_fimg2d,
2235 #endif
2236 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
2237         &s5p_device_mfc,
2238 #endif
2239 #ifdef CONFIG_FB_S3C
2240         &s3c_device_fb,
2241         &c1_spi_gpio,
2242 #endif
2243 #ifdef CONFIG_ANDROID_RAM_CONSOLE
2244         &ram_console_device,
2245 #endif
2246         &c1_tzpc,
2247 #ifdef CONFIG_CHARGER_MANAGER
2248         /* Should be placed after fuel gauge, charger control chips, pmics */
2249         &c1_ncp15wb473_thermistor,
2250         &c1_charger_manager,
2251 #endif
2252 };
2253
2254 static void __init c1_machine_init(void)
2255 {
2256         int gpio;
2257
2258         /* Initialize GPIO default setting */
2259         mobile_gpios_init();
2260
2261         s3c_i2c0_set_platdata(&c1_i2c0_platdata);
2262
2263         c1_sensor_init();
2264         s3c_i2c1_set_platdata(NULL);
2265
2266         if (system_rev == SLP_C1_REV03)
2267                 i2c_register_board_info(1, i2c1_devs_rev03, ARRAY_SIZE(i2c1_devs_rev03));
2268         else
2269                 i2c_register_board_info(1, i2c1_devs_rev04, ARRAY_SIZE(i2c1_devs_rev04));
2270
2271         c1_tsp_init();
2272         s3c_i2c3_set_platdata(NULL);
2273         i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
2274
2275 #ifdef CONFIG_S5PV310_DEV_PD
2276 #ifdef CONFIG_FB_S3C
2277         s3c_device_fb.dev.parent = &s5pv310_device_pd[PD_LCD0].dev;
2278         powerdomain_boot_on(PD_LCD0);
2279 #endif
2280 #endif
2281         c1_fb_init();
2282
2283 #ifdef CONFIG_S5PV310_DEV_PD
2284 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
2285         s5p_device_mfc.dev.parent = &s5pv310_device_pd[PD_MFC].dev;
2286         c1_common_setup_clock("mout_mfc0", "mout_mpll", 0, 0);
2287         c1_common_setup_clock("sclk_mfc", "mout_mfc0", 200 * MHZ, 1);
2288 #endif
2289 #endif
2290
2291         c1_pmic_init(); /* TODO: should be modify for C1 */
2292         s3c_i2c5_set_platdata(NULL);
2293         i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(S5PV310_GPX0(7)),
2294         i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
2295
2296         c1_sound_init();
2297         s3c_i2c6_set_platdata(NULL);
2298         i2c_register_board_info(6, i2c6_devs, ARRAY_SIZE(i2c6_devs));
2299
2300         s3c_i2c7_set_platdata(NULL);
2301         i2c_register_board_info(7, i2c7_devs, ARRAY_SIZE(i2c7_devs));
2302
2303         gpio = S5PV310_GPX2(3);
2304         gpio_request(gpio, "FUEL_ALERT");
2305         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
2306         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
2307         i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(gpio);
2308         i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
2309
2310         universal_touchkey_init();
2311         if (system_rev == SLP_C1_REV03)
2312                 i2c_register_board_info(12, i2c12_devs_mcs, ARRAY_SIZE(i2c12_devs_mcs));
2313         else
2314                 i2c_register_board_info(12, i2c12_devs_cypress, ARRAY_SIZE(i2c12_devs_cypress));
2315
2316         i2c_register_board_info(14, i2c14_devs, ARRAY_SIZE(i2c14_devs));
2317
2318         i2c_register_board_info(15, i2c15_devs, ARRAY_SIZE(i2c15_devs));
2319
2320         /* NFC sensor */
2321         nfc_setup_gpio();
2322         i2c_register_board_info(16, i2c16_devs, ARRAY_SIZE(i2c16_devs));
2323
2324         c1_usb_ehci_init();
2325
2326         c1_modem_init();
2327
2328 #ifdef CONFIG_VIDEO_FIMG2D
2329         s5p_fimg2d_set_platdata(&fimg2d_data);
2330 #ifdef CONFIG_S5PV310_DEV_PD
2331         s5p_device_fimg2d.dev.parent = &s5pv310_device_pd[PD_LCD0].dev;
2332 #endif
2333 #endif
2334
2335 #ifdef CONFIG_PM
2336         pm_cpu_prepare = c1_pm_prepare;
2337         pm_cpu_finish = c1_pm_finish;
2338
2339         s3c_pm_init();
2340         s3c_irq_wake(IRQ_RTC_ALARM, 1);
2341 #endif
2342
2343 #if defined(CONFIG_S5PV310_DEV_PD) && !defined(CONFIG_PM_RUNTIME)
2344         /*
2345          * These power domains should be always on
2346          * without runtime pm support.
2347          */
2348         s5pv310_pd_enable(&s5pv310_device_pd[PD_MFC].dev);
2349         s5pv310_pd_enable(&s5pv310_device_pd[PD_G3D].dev);
2350         s5pv310_pd_enable(&s5pv310_device_pd[PD_LCD0].dev);
2351         s5pv310_pd_enable(&s5pv310_device_pd[PD_LCD1].dev);
2352         s5pv310_pd_enable(&s5pv310_device_pd[PD_CAM].dev);
2353         s5pv310_pd_enable(&s5pv310_device_pd[PD_TV].dev);
2354         s5pv310_pd_enable(&s5pv310_device_pd[PD_GPS].dev);
2355 #endif
2356
2357 #ifdef CONFIG_VIDEO_FIMG2D
2358         /* setup fimg2d parent clock. */
2359         universal_fimg2d_setup_clock("mout_g2d0", "mout_mpll");
2360 #endif
2361
2362         c1_sdhci_init();
2363 #ifdef CONFIG_S5P_ADC
2364         c1_adc_init();
2365 #endif
2366
2367 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
2368         s3c_fimc_setname(0, "s5pv310-fimc");
2369         s3c_fimc_setname(1, "s5pv310-fimc");
2370         s3c_fimc_setname(2, "s5pv310-fimc");
2371         s3c_fimc_setname(3, "s5pv310-fimc");
2372 #ifdef CONFIG_S5PV310_DEV_PD
2373         s5p_device_fimc0.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
2374         s5p_device_fimc1.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
2375         s5p_device_fimc2.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
2376         s5p_device_fimc3.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
2377 #endif
2378         s3c_set_platdata(&c1_fimc_platdata[0], sizeof(c1_fimc_platdata[0]),
2379                          &s5p_device_fimc0);
2380         s3c_set_platdata(&c1_fimc_platdata[1], sizeof(c1_fimc_platdata[1]),
2381                          &s5p_device_fimc1);
2382         s3c_set_platdata(&c1_fimc_platdata[2], sizeof(c1_fimc_platdata[2]),
2383                          &s5p_device_fimc2);
2384         s3c_set_platdata(&c1_fimc_platdata[3], sizeof(c1_fimc_platdata[3]),
2385                          &s5p_device_fimc3);
2386 #endif
2387
2388 #ifdef CONFIG_VIDEO_S5P_MIPI_CSIS
2389         s3c_set_platdata(&mipi_csis0_pldata, sizeof(mipi_csis0_pldata),
2390                          &s5p_device_mipi_csis0);
2391 #ifdef CONFIG_S5PV310_DEV_PD
2392         s5p_device_mipi_csis0.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
2393 #endif
2394 #endif
2395         c1_camera_init();
2396
2397 #ifdef CONFIG_VIDEO_JPEG
2398 #ifdef CONFIG_S5PV310_DEV_PD
2399         s5p_device_jpeg.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
2400 #endif
2401 #endif
2402 #ifdef CONFIG_CHARGER_MANAGER
2403         setup_charger_manager(&c1_charger_g_desc);
2404 #endif
2405
2406         /* Last */
2407         platform_add_devices(c1_devices, ARRAY_SIZE(c1_devices));
2408
2409         /*
2410          * setup parent clk for fimc, camera, mipi clks. It must be called after
2411          * platform_add_device() for enable enumerating the name of struct clk.
2412          */
2413         c1_fimc_setup_clks();
2414         regulator_has_full_constraints();
2415
2416         if (s5pv310_subrev() != 0) {
2417                 pr_emerg("\n\n This kernel does NOT support subrevision %d of S5PC210.\n\n\n",
2418                         s5pv310_subrev());
2419                 panic("Not supported subrevision");
2420         }
2421 }
2422
2423 MACHINE_START(C1_C210, "C1SLP_C210")
2424         /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
2425         .phys_io        = S3C_PA_UART & 0xfff00000,
2426         .io_pg_offst    = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
2427         .boot_params    = S5P_PA_SDRAM + 0x100,
2428         .init_irq       = s5pv310_init_irq,
2429         .map_io         = c1_map_io,
2430         .init_machine   = c1_machine_init,
2431         .timer          = &s5pv310_timer,
2432         .reserve        = &s5pv310_reserve,
2433 MACHINE_END