2 * linux/arch/arm/mach-s5pv310/mach-c1_c210.c
4 * Copyright (c) 2011 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/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>
48 #include <linux/cpufreq.h>
49 #include <linux/modem/xmm6260.h>
50 #include <linux/power/charger-manager.h>
51 #include <video/platform_lcd.h>
53 #include <asm/mach-types.h>
54 #include <asm/mach/arch.h>
55 #include <asm/setup.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>
65 #include <plat/clock.h>
66 #include <plat/devs.h>
67 #include <plat/gpio-cfg.h>
68 #include <plat/gpio-core.h>
70 #include <plat/fimc-core.h>
71 #include <plat/mipi_csis.h>
72 #include <plat/fimg2d.h>
73 #include <plat/mali.h>
76 #include <plat/regs-otg.h>
77 #include <plat/regs-serial.h>
78 #include <plat/s5pv310.h>
79 #include <plat/sdhci.h>
81 #include <plat/fimd_drm.h>
82 #include <plat/tvout.h>
84 #include <plat/s5p_fimd_lite.h>
85 #include <plat/usb_ehci.h>
86 #include <plat/sysmmu.h>
88 #include <media/s5p_fimc.h>
89 #include <media/m5mols.h>
90 #include <media/s5k6aafx.h>
93 #include "gpio-mobile.h"
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)
104 #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
106 #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
107 S5PV210_UFCON_TXTRIG256 | \
108 S5PV210_UFCON_RXTRIG256)
110 enum fixed_regulator_id {
111 FIXED_REG_ID_MMC = 0,
117 static struct s3c2410_uartcfg c1_uartcfgs[] __initdata = {
120 .ucon = UNIVERSAL_UCON_DEFAULT,
121 .ulcon = UNIVERSAL_ULCON_DEFAULT,
122 .ufcon = UNIVERSAL_UFCON_DEFAULT,
126 .ucon = UNIVERSAL_UCON_DEFAULT,
127 .ulcon = UNIVERSAL_ULCON_DEFAULT,
128 .ufcon = UNIVERSAL_UFCON_DEFAULT,
132 .ucon = UNIVERSAL_UCON_DEFAULT,
133 .ulcon = UNIVERSAL_ULCON_DEFAULT,
134 .ufcon = UNIVERSAL_UFCON_DEFAULT,
138 .ucon = UNIVERSAL_UCON_DEFAULT,
139 .ulcon = UNIVERSAL_ULCON_DEFAULT,
140 .ufcon = UNIVERSAL_UFCON_DEFAULT,
144 static struct s3c2410_platform_i2c c1_i2c0_platdata __initdata = {
145 .frequency = 300 * 1000,
149 static struct k3g_platform_data c1_k3g_data = {
151 .powerdown = K3G_POWERDOWN_NORMAL,
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,
172 static struct kr3dh_platform_data c1_kr3dh_data_rev03 = {
173 .power_mode = KR3DH_NORMAL_MODE,
174 .data_rate = KR3DH_ODR_50HZ,
179 .int1_cfg = KR3DH_INT_SOURCE,
180 .block_data_update = 1,
181 .fullscale = KR3DH_RANGE_2G,
182 .int1_combination = KR3DH_OR_COMBINATION,
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,
198 static struct kr3dh_platform_data c1_kr3dh_data_rev04 = {
199 .power_mode = KR3DH_NORMAL_MODE,
200 .data_rate = KR3DH_ODR_50HZ,
205 .int1_cfg = KR3DH_INT_SOURCE,
206 .block_data_update = 1,
207 .fullscale = KR3DH_RANGE_2G,
208 .int1_combination = KR3DH_OR_COMBINATION,
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,
224 #ifdef CONFIG_CPU_FREQ_TICKLE
225 static void user_input_response_work(struct work_struct *work)
227 /* core 0's cpufreq controls both cores */
228 cpufreq_tickle_cpu(100, 0);
230 /* turn the core 1 on */
231 s5pv310_pm_hotplug_tickle();
234 static DECLARE_WORK(uir_work, user_input_response_work);
236 static void user_input_response(void *data)
238 if (!work_pending(&uir_work))
239 schedule_work_on(0, &uir_work);
244 static struct i2c_board_info i2c1_devs_rev03[] __initdata = {
247 I2C_BOARD_INFO("K3G", 0x69),
248 .platform_data = &c1_k3g_data,
252 I2C_BOARD_INFO("KR3DH", 0x19),
253 .platform_data = &c1_kr3dh_data_rev03,
258 static struct i2c_board_info i2c1_devs_rev04[] __initdata = {
261 I2C_BOARD_INFO("K3G", 0x69),
262 .platform_data = &c1_k3g_data,
266 I2C_BOARD_INFO("KR3DH", 0x19),
267 .platform_data = &c1_kr3dh_data_rev04,
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) */
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,
287 /* MXT_TOUCH_KEYARRAY(15) */
288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 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,
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,
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),
324 .voltage = 2800000, /* 2.8V */
325 .orient = MXT_DIAGONAL,
326 .irqflags = IRQF_TRIGGER_FALLING,
328 #ifdef CONFIG_CPU_FREQ_TICKLE
329 /* For the faster user response */
330 .input_event = user_input_response,
334 static struct i2c_board_info i2c3_devs[] __initdata = {
336 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
337 .platform_data = &mxt_platform_data,
341 static void __init c1_tsp_init(void)
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);
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));
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.
365 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
366 i2c3_devs[0].irq = gpio_to_irq(gpio);
370 /* TODO: should be modify for C1 */
371 extern struct max8997_platform_data c1_max8997_pdata;
372 extern void __init c1_pmic_init(void);
374 static void haptic_control_power(struct device *dev, int on)
376 struct regulator *regulator;
379 regulator = regulator_get(dev, "inmotor");
380 if (IS_ERR_OR_NULL(regulator))
382 regulator_enable(regulator);
383 regulator_put(regulator);
385 regulator = regulator_get(dev, "inmotor");
386 if (IS_ERR_OR_NULL(regulator))
389 if (regulator_is_enabled(regulator))
390 regulator_disable(regulator);
391 regulator_put(regulator);
395 struct max8997_haptic_platform_data c1_haptic_pdata = {
398 .control_power = haptic_control_power,
401 /* GPIO I2C 5 (PMIC) */
402 enum { I2C5_MAX8997 };
403 static struct i2c_board_info i2c5_devs[] __initdata = {
405 I2C_BOARD_INFO("max8997", 0xCC >> 1),
406 .platform_data = &c1_max8997_pdata,
411 static struct i2c_board_info i2c6_devs[] __initdata = {
414 I2C_BOARD_INFO("mc1n2", 0x3a),
418 static void __init c1_sound_init(void)
422 /* Set PMU register to set CLK_OUT to use XUSBXTI
423 * as codec source clock */
425 __raw_writel(val, S5P_PMREG(0xA00));
428 static struct ak8975_platform_data universal_ak8975_data = {
429 .poll_interval = 100,
433 static struct i2c_board_info i2c7_devs[] __initdata = {
436 I2C_BOARD_INFO("ak8975", 0x0c),
437 .platform_data = &universal_ak8975_data,
441 static void __init c1_sensor_init(void)
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);
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);
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);
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);
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);
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 */
480 static struct platform_device i2c9_gpio = {
484 .platform_data = &i2c9_gpio_data,
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 },
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 },
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,
512 .r_sns = 10000, /* 10m Ohm */
515 enum { I2C9_MAX17042};
516 static struct i2c_board_info i2c9_devs[] __initdata = {
518 I2C_BOARD_INFO("max17042", 0x36),
519 .platform_data = &c1_battery_platform_data,
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)
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 */
536 static void touchkey_poweron(bool enable)
538 struct regulator *regulator;
541 regulator = regulator_get(NULL, "touch_2.8v");
542 if (IS_ERR(regulator))
544 regulator_enable(regulator);
545 regulator_put(regulator);
547 regulator = regulator_get(NULL, "touch_2.8v");
548 if (IS_ERR(regulator))
550 regulator_disable(regulator);
551 regulator_put(regulator);
555 static void touchkey_cfg_pin_fw(int use)
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);
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);
566 gpio_direction_output(TOUCHKEY_SDA, 0);
567 gpio_direction_output(TOUCHKEY_SCL, 0);
568 gpio_direction_output(TOUCHKEY_INTR, 0);
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);
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));
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),
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 */
595 static struct platform_device i2c12_gpio = {
599 .platform_data = &i2c12_gpio_data,
603 static struct i2c_board_info i2c12_devs_mcs[] __initdata = {
605 I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
606 .platform_data = &touchkey_data,
610 /*===============================*/
611 /*= CYPRESS TOUCH KEY =*/
612 /*===============================*/
613 static struct cypress_pin cypress_tk_pin = {
615 .gpio_int = TOUCHKEY_INTR,
616 .gpio_sda = TOUCHKEY_SDA,
617 .gpio_scl = TOUCHKEY_SCL,
620 static void cypress_tk_cfg_pin(void)
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);
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));
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);
632 static int cypress_touchkey_power(int onoff)
634 struct regulator *regulator;
636 regulator = regulator_get(NULL, "touch_2.8v");
637 if (IS_ERR(regulator)) {
638 printk(KERN_ERR "[TK][ERROR] regulator_get fail\n");
643 regulator_enable(regulator);
645 if (regulator_is_enabled(regulator))
646 regulator_force_disable(regulator);
648 regulator_put(regulator);
654 static int cypress_touchled_power(int onoff)
656 struct regulator *regulator;
658 regulator = regulator_get(NULL, "touch_led_3.3v");
659 if (IS_ERR(regulator)) {
660 printk(KERN_ERR "[TK][ERROR] regulator_get fail\n");
665 regulator_enable(regulator);
667 if (regulator_is_enabled(regulator))
668 regulator_force_disable(regulator);
670 regulator_put(regulator);
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 */
682 static unsigned char c1_cypress_keycode_setbit[] = {
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,
699 static struct i2c_board_info i2c12_devs_cypress[] __initdata = {
701 I2C_BOARD_INFO("cypress_tk", 0x20),
702 .platform_data = &cypress_tk_data,
706 static void __init universal_touchkey_init(void)
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);
716 if (system_rev == SLP_C1_REV03)
717 i2c12_devs_mcs[0].irq = irq;
719 i2c12_devs_cypress[0].irq = irq;
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 */
729 static struct platform_device i2c14_gpio = {
733 .platform_data = &i2c14_gpio_data,
737 static void tmd27711_control_power_source(int enable)
739 struct regulator *regulator = regulator_get(NULL, "led_a_2.8v");
740 static int disabled = 1;
742 if (IS_ERR_OR_NULL(regulator))
747 regulator_disable(regulator);
750 regulator_enable(regulator);
753 regulator_disable(regulator);
757 regulator_put(regulator);
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 */
767 .ps_enable = TMD27711_PEN,
768 .ps_interrupt_h_thres = 700,
769 .ps_interrupt_l_thres = 600,
770 .ps_interrupt_enable = TMD27711_PIEN,
772 .ps_interrupt_persistence = 0x30,
773 .ps_pulse_count = 0x08,
774 .ps_drive_strength = TMD27711_PDRIVE_12MA,
775 .ps_diode = TMD27711_PDIODE_CH1_DIODE,
778 .als_enable = TMD27711_AEN,
779 .als_time = 200, /* 152.32 ms */
780 .als_interrupt_persistence = 1,
781 .als_gain = TMD27711_AGAIN_16X,
784 static struct i2c_board_info i2c14_devs[] __initdata = {
786 I2C_BOARD_INFO("TMD27711", 0x39),
787 .platform_data = &universal_tmd27711_data,
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 */
799 static struct platform_device i2c15_gpio = {
803 .platform_data = &i2c15_gpio_data,
807 static struct i2c_board_info i2c15_devs[] __initdata = {
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)
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},
829 void nfc_setup_gpio(void)
831 int array_size = ARRAY_SIZE(nfc_gpio_table);
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]);
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,
848 static struct platform_device i2c16_gpio = {
852 .platform_data = &i2c16_gpio_data,
857 #define GPIO_S5K6AAFX_SCL_1_8V S5PV310_GPC1(2)
858 #define GPIO_S5K6AAFX_SDA_1_8V S5PV310_GPC1(0)
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,
866 static struct platform_device i2c17_gpio = {
870 .platform_data = &i2c17_gpio_data,
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,
882 static struct i2c_board_info i2c16_devs[] __initdata = {
884 I2C_BOARD_INFO("pn544", 0x2b),
885 .platform_data = &pn544_pdata,
891 static struct s5p_usb_ehci_platdata c1_usb_ehci_pdata;
893 static void __init c1_usb_ehci_init(void)
895 struct s5p_usb_ehci_platdata *pdata = &c1_usb_ehci_pdata;
897 /* The gpios is initialized from modem_init */
898 pdata->gpio_active = MOBILE_GPIO(ACTIVE_STATE_HSIC);
900 s5p_usb_ehci_set_platdata(pdata);
904 static struct platform_device c1_modem_net = {
909 /* XMM6260 control */
910 static struct xmm6260_gpios c1_xmm6260_gpios;
912 static struct xmm6260_platform_data c1_xmm6260_pdata = {
913 .gpios = &c1_xmm6260_gpios,
917 static struct platform_device c1_xmm6260 = {
918 /* FIXME: Use modemctl name because of platform dependency */
922 .platform_data = &c1_xmm6260_pdata,
926 static void __init c1_modem_init(void)
928 struct xmm6260_gpios *gpios = &c1_xmm6260_gpios;
931 gpio = MOBILE_GPIO(CP_ON);
932 gpio_request(gpio, "CP_ON");
933 gpio_direction_output(gpio, 0);
936 gpio = MOBILE_GPIO(PHONE_ACTIVE);
937 gpio_request(gpio, "PHONE_ACTIVE");
938 gpios->phone_active = gpio;
940 gpio = MOBILE_GPIO(PDA_ACTIVE);
941 gpio_request(gpio, "PDA_ACTIVE");
942 gpio_direction_output(gpio, 0);
943 gpios->pda_active = gpio;
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;
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;
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;
960 gpio = MOBILE_GPIO(IPC_HOST_WAKEUP);
961 gpio_request(gpio, "IPC_HOST_WAKEUP");
962 gpios->ipc_host_wakeup = gpio;
964 gpio = MOBILE_GPIO(SUSPEND_REQUEST_HSIC);
965 gpio_request(gpio, "SUSPEND_REQUEST_HSIC");
966 gpios->suspend_request_hsic = gpio;
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;
975 static void c1_set_uart_switch(int path)
979 gpio = MOBILE_GPIO(UART_SEL);
980 gpio_request(gpio, "UART_SEL");
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);
992 static int c1_get_uart_switch(void)
997 gpio = MOBILE_GPIO(UART_SEL);
998 gpio_request(gpio, "UART_SEL");
999 val = gpio_get_value(gpio);
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;
1008 return UART_SW_PATH_NA;
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,
1015 static struct platform_device c1_uart_select = {
1016 .name = "uart-select",
1019 .platform_data = &c1_uart_select_data,
1024 #ifndef CONFIG_S3C_DEV_HSMMC4
1025 static struct s3c_sdhci_platdata c1_hsmmc0_data __initdata = {
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,
1035 static struct regulator_consumer_supply emmc_supplies[] = {
1036 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
1037 REGULATOR_SUPPLY("vmmc", "dw_mmc"),
1040 static struct regulator_init_data emmc_fixed_voltage_init_data = {
1042 .name = "VMEM_VDD_2.8V",
1043 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
1045 .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
1046 .consumer_supplies = emmc_supplies,
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,
1057 static struct platform_device emmc_fixed_voltage = {
1058 .name = "reg-fixed-voltage",
1059 .id = FIXED_REG_ID_MMC,
1061 .platform_data = &emmc_fixed_voltage_config,
1066 static struct s3c_sdhci_platdata c1_hsmmc2_data __initdata = {
1068 .host_caps = MMC_CAP_4_BIT_DATA |
1069 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
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,
1078 static void (*wlan_notify_change_cb)(struct platform_device *dev, int state);
1080 static int wlan_ext_cd_init(void (*cb)(struct platform_device *dev, int state))
1082 wlan_notify_change_cb = cb;
1086 static int wlan_ext_cd_cleanup(void (*cb)(struct platform_device *dev, int state))
1088 wlan_notify_change_cb = NULL;
1092 static int c1_wlan_host_enable(int on)
1094 if (wlan_notify_change_cb)
1095 (*wlan_notify_change_cb)(&s3c_device_hsmmc3, on);
1099 static struct s3c_sdhci_platdata c1_hsmmc3_data __initdata = {
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,
1110 static void __init c1_sdhci_init(void)
1114 #ifndef CONFIG_S3C_DEV_HSMMC4
1115 s3c_sdhci0_set_platdata(&c1_hsmmc0_data);
1117 s3c_sdhci3_set_platdata(&c1_hsmmc3_data);
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);
1124 s3c_sdhci2_set_platdata(&c1_hsmmc2_data);
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,
1139 static struct platform_device c1_bcm4330 = {
1140 .name = "bcm4330-b1",
1143 .platform_data = &bcm4330_data,
1148 #ifdef CONFIG_DRM_MALI
1149 static struct platform_device s5p_device_mali_drm = {
1156 #ifdef CONFIG_DRM_FIMD
1157 static struct resource fimd_drm_resource[] = {
1159 .start = S5P_PA_LCD0,
1160 .end = S5P_PA_LCD0 + S5P_SZ_LCD0 - 1,
1161 .flags = IORESOURCE_MEM,
1164 .start = S5P_PA_LCD1,
1165 .end = S5P_PA_LCD1 + S5P_SZ_LCD1 - 1,
1166 .flags = IORESOURCE_MEM,
1171 .flags = IORESOURCE_IRQ,
1176 .flags = IORESOURCE_IRQ,
1180 static struct fimd_drm_platform_data fimd_drm_pd = {
1184 static struct platform_device s5p_device_fimd_drm = {
1187 .num_resources = ARRAY_SIZE(fimd_drm_resource),
1188 .resource = fimd_drm_resource,
1190 .platform_data = &fimd_drm_pd,
1196 static struct s3c_adc_platform_data s3c_adc_pdata __initdata = {
1200 .max_adc_voltage_uV = 3300000,
1203 static void __init c1_adc_init(void)
1205 s3c_adc_set_platdata(&s3c_adc_pdata);
1208 static void ramoops_enable(int enable)
1212 clk = clk_get(NULL, "modem");
1220 static struct ramoops_platform_data c1_ramoops_data = {
1221 .mem_address = 0x13A00000, /* MODEM I/F */
1223 .enable = ramoops_enable,
1226 static struct platform_device c1_ramoops = {
1229 .platform_data = &c1_ramoops_data,
1234 static struct platform_device c1_tzpc = {
1239 #ifdef CONFIG_ANDROID_RAM_CONSOLE
1240 static struct resource ram_console_resource[] = {
1242 .flags = IORESOURCE_MEM,
1246 static struct platform_device ram_console_device = {
1247 .name = "ram_console",
1249 .num_resources = ARRAY_SIZE(ram_console_resource),
1250 .resource = ram_console_resource,
1254 static void __init c1_map_io(void)
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));
1262 static void __init s5pv310_reserve(void)
1264 static struct cma_region regions[] = {
1265 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD0
1268 .size = (CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD0
1269 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD1
1270 + CONFIG_VIDEO_SAMSUNG_MEMSIZE_FIMD1
1275 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
1289 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG
1292 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_JPEG * SZ_1K,
1295 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC
1298 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC * SZ_1K,
1301 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0
1304 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC0 * SZ_1K,
1306 .alignment = 1 << 17,
1310 #ifdef CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1
1313 .size = CONFIG_VIDEO_SAMSUNG_MEMSIZE_MFC1 * SZ_1K,
1315 .alignment = 1 << 17,
1319 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
1323 { .alignment = 128 << 10 },
1324 .start = 0x42000000,
1329 .start = 0x43000000,
1334 .start = 0x51000000,
1340 static const char map[] __initconst =
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;"
1347 "mfc=mfc,mfc0,mfc1;s5p-mfc/f=fw;s5p-mfc/a=b1;s5p-mfc/b=b2;"
1352 #ifdef CONFIG_ANDROID_RAM_CONSOLE
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);
1363 cma_set_defaults(regions, map);
1364 cma_early_regions_reserve(NULL);
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);
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.
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),
1399 static struct gpio_keys_button c1_gpio_keys_tables[] = {
1401 .code = KEY_VOLUMEUP,
1402 .gpio = S5PV310_GPX2(0), /* XEINT16 */
1403 .desc = "gpio-keys: KEY_VOLUMEUP",
1406 .debounce_interval = 1,
1408 .code = KEY_VOLUMEDOWN,
1409 .gpio = S5PV310_GPX2(1), /* XEINT17 */
1410 .desc = "gpio-keys: KEY_VOLUMEDOWN",
1413 .debounce_interval = 1,
1416 .gpio = S5PV310_GPX2(7), /* XEINT23 */
1417 .desc = "gpio-keys: KEY_POWER",
1421 .debounce_interval = 1,
1423 /* KEY_MENU will be used */
1424 .code = KEY_MENU, /* KEY_OK */
1425 .gpio = S5PV310_GPX3(5), /* XEINT29 */
1426 .desc = "gpio-keys: KEY_MENU",
1429 .debounce_interval = 1,
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),
1438 static struct platform_device c1_gpio_keys = {
1439 .name = "gpio-keys",
1441 .platform_data = &c1_gpio_keys_data,
1447 static unsigned int ld9040_lcd_enabled;
1449 static struct s3cfb_lcd ld9040 = {
1475 static int lcd_cfg_gpio(void)
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);
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);
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);
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);
1501 /* Set FIMD0 bypass */
1502 reg = __raw_readl(S3C_VA_SYS + 0x0210);
1504 __raw_writel(reg, S3C_VA_SYS + 0x0210);
1509 static int lcd_power_on(struct lcd_device *ld, int enable)
1511 struct regulator *regulator;
1514 printk(KERN_ERR "lcd device object is NULL.\n");
1519 regulator = regulator_get(&ld->dev, "vcc_1.8v");
1520 if (IS_ERR(regulator))
1522 regulator_enable(regulator);
1523 regulator_put(regulator);
1525 regulator = regulator_get(&ld->dev, "vcc_3.0v_lcd");
1526 if (IS_ERR(regulator))
1528 regulator_enable(regulator);
1529 regulator_put(regulator);
1531 regulator = regulator_get(&ld->dev, "vcc_1.8v");
1532 if (IS_ERR(regulator))
1534 if (regulator_is_enabled(regulator))
1535 regulator_disable(regulator);
1536 regulator_put(regulator);
1538 regulator = regulator_get(&ld->dev, "vcc_3.0v_lcd");
1539 if (IS_ERR(regulator))
1541 if (regulator_is_enabled(regulator))
1542 regulator_disable(regulator);
1543 regulator_put(regulator);
1548 static int reset_lcd(struct lcd_device *ld)
1550 static unsigned int first = 1;
1551 int reset_gpio = -1;
1553 reset_gpio = S5PV310_GPY4(5);
1556 gpio_request(reset_gpio, "MLCD_RST");
1561 gpio_direction_output(reset_gpio, 0);
1563 gpio_direction_output(reset_gpio, 1);
1568 static void __init early_lcd(char **param)
1572 if (strncmp(*param, "ld9040", 6) == 0)
1573 ld9040_lcd_enabled = 1;
1575 __early_param("lcd", early_lcd);
1577 static struct lcd_platform_data ld9040_platform_data = {
1579 .power_on = lcd_power_on,
1580 /* it indicates whether lcd panel is enabled from u-boot. */
1582 .reset_delay = 10, /* 10ms */
1583 .power_on_delay = 10, /* 10ms */
1584 .power_off_delay = 120, /* 120ms */
1587 #define LCD_BUS_NUM 3
1588 #define DISPLAY_CS S5PV310_GPY4(3)
1589 static struct spi_board_info spi_board_info[] __initdata = {
1591 .max_speed_hz = 1200000,
1592 .bus_num = LCD_BUS_NUM,
1595 .controller_data = (void *)DISPLAY_CS,
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 = {
1604 .miso = SPI_GPIO_NO_MISO,
1605 .num_chipselect = 1,
1608 static struct platform_device c1_spi_gpio = {
1612 .parent = &s3c_device_fb.dev,
1613 .platform_data = &lcd_spi_gpio_data,
1617 #ifdef CONFIG_VIDEO_FIMG2D
1618 static struct fimg2d_platdata fimg2d_data __initdata = {
1620 .parent_clkname = "mout_g2d0",
1621 .clkname = "sclk_fimg2d",
1622 .gate_clkname = "fimg2d",
1623 .smmu_gate_clkname = "smmu_fimg2d",
1624 .clkrate = 250 * 1000000,
1628 static struct s3c_platform_fb fb_platform_data __initdata = {
1631 #ifdef CONFIG_FB_S3C_DEFAULT_WINDOW
1632 .default_win = CONFIG_FB_S3C_DEFAULT_WINDOW,
1636 .swap = FB_SWAP_HWORD | FB_SWAP_WORD,
1639 static void __init c1_fb_init(void)
1641 struct device *dev = s3c_device_fb.dev.parent;
1642 struct samsung_pd_info *pdinfo;
1645 pdinfo = (struct samsung_pd_info *)dev->platform_data;
1646 /* fimd driver have to know LCD domain power status. */
1648 fb_platform_data.boot_on = pdinfo->boot_on;
1651 strcpy(spi_board_info[0].modalias, "ld9040");
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;
1658 spi_register_board_info(spi_board_info,
1659 ARRAY_SIZE(spi_board_info));
1661 fb_platform_data.lcd_data = (struct s3cfb_lcd *)&ld9040;
1664 s3cfb_set_platdata(&fb_platform_data);
1667 /* VT cam attached at the front: S5K6AAFX */
1669 static struct regulator_consumer_supply supplies_cam_io_en[] = {
1670 REGULATOR_SUPPLY("vdda", "17-003c"),
1671 REGULATOR_SUPPLY("a_sensor", "0-001f"),
1674 static struct regulator_consumer_supply supplies_vt_cam_15v_en[] = {
1675 REGULATOR_SUPPLY("core", "17-003c"),
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"),
1684 /* MEGA attached at the back: M5MOLS */
1685 static struct regulator_consumer_supply supplies_8m_core_en[] = {
1686 REGULATOR_SUPPLY("core", "0-001f"),
1688 static struct regulator_consumer_supply supplies_cam_pwr_en1[] = {
1689 REGULATOR_SUPPLY("d_sensor", "0-001f"),
1693 static struct regulator_init_data cam_fixreg_init_data[] = {
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,
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,
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,
1711 static struct fixed_voltage_config cam_fixreg_cfg[] = {
1713 .supply_name = "CAM_IO_EN",
1714 .microvolts = 2800000,
1715 .gpio = S5PV310_GPE2(1),
1717 .init_data = &cam_fixreg_init_data[0],
1720 .supply_name = "VT_CAM_1.5V_EN",
1721 .microvolts = 1500000,
1722 .gpio = S5PV310_GPE2(2),
1724 .init_data = &cam_fixreg_init_data[1],
1727 .supply_name = "CAM_SENSOR_CORE_1.2V_EN",
1728 .microvolts = 1200000,
1729 .gpio = S5PV310_GPE2(5),
1731 .init_data = &cam_fixreg_init_data[2],
1735 static struct platform_device camera_fixed_reg_dev[] = {
1737 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM0,
1738 .dev = { .platform_data = &cam_fixreg_cfg[0] },
1740 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM1,
1741 .dev = { .platform_data = &cam_fixreg_cfg[1] },
1743 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM2,
1744 .dev = { .platform_data = &cam_fixreg_cfg[2] },
1748 static struct s5p_platform_mipi_csis mipi_csis0_pldata = {
1749 .clk_rate = 166000000UL,
1753 .phy_enable = s5p_csis_phy_enable,
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 */
1762 static struct i2c_board_info s5k6aafx_board_info = {
1763 I2C_BOARD_INFO("S5K6AAFX", 0x3C),
1764 .platform_data = &s5k6aafx_pldata,
1767 static struct m5mols_platform_data m5mols_platdata = {
1768 .gpio_reset = S5PV310_GPY3(7), /* ISP_RESET */
1769 .reset_polarity = 0,
1772 static struct i2c_board_info m5mols_board_info = {
1773 I2C_BOARD_INFO("M5MOLS", 0x1F),
1774 .platform_data = &m5mols_platdata,
1778 static struct s5p_fimc_isp_info c1_front_cam_sensor = {
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,
1787 static struct s5p_fimc_isp_info c1_rear_cam_sensor = {
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,
1794 .csi_data_align = 32,
1797 static struct s5p_fimc_isp_info *c1_camera_sensors[] = {
1798 &c1_front_cam_sensor,
1799 &c1_rear_cam_sensor,
1802 static struct s5p_platform_fimc c1_fimc_platdata[] = {
1804 .isp_info = c1_camera_sensors,
1805 .num_clients = ARRAY_SIZE(c1_camera_sensors),
1807 .cma_type = "for-mfc",
1811 .cma_type = "for-fimc1",
1815 .cma_type = "for-fimc2",
1819 .cma_type = "for-fimc3",
1824 static int __init c1_fimc_setup_clks(void)
1828 struct clk *clock, *parent;
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
1837 parent = clk_get(NULL, "mout_epll");
1839 return PTR_ERR(parent);
1841 for (i = 0; err == 0 && i < ARRAY_SIZE(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",
1850 clk_set_parent(clock, parent);
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");
1867 clock = clk_get(&s5p_device_mipi_csis0.dev, "sclk_csis");
1869 err = PTR_ERR(clock);
1871 clk_set_parent(clock, parent);
1875 printk(KERN_ERR "failed to get clock sclk_csis.0\n");
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);
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");
1891 err = PTR_ERR(clock);
1895 clk_set_parent(clock, parent);
1899 /* clk_disable(clock); */
1903 printk(KERN_ERR "%s%s: %s\n", err ? "WARNING! " : "", __func__,
1904 err ? "failed!" : "succedded.");
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); \
1914 static void c1_camera_init(void)
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));
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]);
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);
1937 gpio = S5PV310_GPX1(5); /* ISP_INT: XEINT[13] */
1938 gpio_request(gpio, "M5MOLS_INT");
1939 m5mols_platdata.irq = gpio_to_irq(gpio);
1945 static struct jack_platform_data c1_jack_data = {
1947 .charger_online = 0,
1949 .earjack_online = 0,
1956 static struct platform_device c1_jack = {
1960 .platform_data = &c1_jack_data,
1964 static void c1_vbus_enable(int on, char *name)
1966 struct regulator *regulator;
1968 regulator = regulator_get(NULL, name);
1969 if (IS_ERR(regulator))
1973 regulator_enable(regulator);
1975 if (regulator_is_enabled(regulator))
1976 regulator_disable(regulator);
1979 regulator_put(regulator);
1982 static void c1_usb_path_power(int on, int path)
1984 if (path == USB_PATH_AP) {
1986 /* Enable USB_D first */
1987 c1_vbus_enable(on, "vusb_d");
1988 c1_vbus_enable(on, "vusb_a");
1990 /* Disable USB_A first */
1991 c1_vbus_enable(on, "vusb_a");
1992 c1_vbus_enable(on, "vusb_d");
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");
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");
2005 static void c1_usb_switch_power(int on, int path)
2007 if (jack_get_data("usb") == 0)
2010 c1_usb_path_power(on, path);
2013 static void c1_set_usb_switch(int path)
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");
2021 static int c1_get_usb_switch(void)
2025 max8997_muic_get_switch(buf);
2027 if (!strncmp(buf, "USB", 3))
2029 else if (!strncmp(buf, "UART", 4))
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,
2042 static struct platform_device c1_micro_usb_switch = {
2043 .name = "usb-switch",
2046 .platform_data = &c1_usb_switch_data,
2050 static void c1_usb_power(u8 on)
2052 c1_usb_path_power(on, c1_get_usb_switch());
2055 static void c1_usb_cb(u8 attached)
2057 #ifdef CONFIG_JACK_MON
2058 jack_event_handler("usb", attached);
2062 struct max8997_muic_platform_data c1_muic_pdata = {
2063 .usb_power = c1_usb_power,
2064 .usb_cb = c1_usb_cb,
2067 static void c1_pm_finish(void)
2069 /* Restore GPX conf */
2070 s3c_pm_do_restore(s5pc210_gpx, ARRAY_SIZE(s5pc210_gpx));
2073 static void c1_pm_prepare(void)
2075 /* 1. Save GPX conf */
2076 s3c_pm_do_save(s5pc210_gpx, ARRAY_SIZE(s5pc210_gpx));
2078 /* 2. Set GPX as Power Save Mode */
2080 /* 3. Debug: Look at the diff */
2081 mobile_gpios_groupx_difference();
2085 int c1_common_setup_clock(const char *sclk_name, const char *pclk_name,
2086 unsigned long rate, unsigned int rate_set)
2088 struct clk *sclk = NULL;
2089 struct clk *pclk = NULL;
2091 sclk = clk_get(NULL, sclk_name);
2093 printk(KERN_ERR "failed to get %s clock.\n", sclk_name);
2097 pclk = clk_get(NULL, pclk_name);
2099 printk(KERN_ERR "failed to get %s clock.\n", pclk_name);
2103 clk_set_parent(sclk, pclk);
2105 printk(KERN_INFO "set parent clock of %s to %s\n", sclk_name,
2113 clk_set_rate(sclk, rate);
2114 printk(KERN_INFO "set %s rate to %lu\n", sclk_name, rate);
2130 #ifdef CONFIG_S5PV310_DEV_PD
2131 static inline void powerdomain_boot_on(int pd)
2133 struct samsung_pd_info *pdinfo = (struct samsung_pd_info *)
2134 s5pv310_device_pd[pd].dev.platform_data;
2135 pdinfo->boot_on = true;
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;
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],
2156 #ifdef CONFIG_DRM_MALI
2157 &s5p_device_mali_drm,
2159 #ifdef CONFIG_DRM_FIMD
2160 &s5p_device_fimd_drm,
2175 &s3c_device_timer[0],
2176 &s3c_device_timer[1],
2178 &s5p_device_usb_ehci,
2181 #ifdef CONFIG_S3C_DEV_RTC
2185 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_FIMC
2191 #ifdef CONFIG_VIDEO_S5P_MIPI_CSIS
2192 &s5p_device_mipi_csis0,
2194 #ifdef CONFIG_VIDEO_JPEG
2200 #ifdef CONFIG_USB_GADGET
2201 &s3c_device_usbgadget,
2203 #ifdef CONFIG_S3C_DEV_HSMMC4
2208 &emmc_fixed_voltage,
2214 &s5pv310_device_i2s0,
2218 &c1_micro_usb_switch,
2220 #ifdef CONFIG_S3C2410_WATCHDOG
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],
2233 #ifdef CONFIG_VIDEO_FIMG2D
2236 #ifdef CONFIG_VIDEO_SAMSUNG_S5P_MFC
2239 #ifdef CONFIG_FB_S3C
2243 #ifdef CONFIG_ANDROID_RAM_CONSOLE
2244 &ram_console_device,
2247 #ifdef CONFIG_CHARGER_MANAGER
2248 /* Should be placed after fuel gauge, charger control chips, pmics */
2249 &c1_ncp15wb473_thermistor,
2250 &c1_charger_manager,
2254 static void __init c1_machine_init(void)
2258 /* Initialize GPIO default setting */
2259 mobile_gpios_init();
2261 s3c_i2c0_set_platdata(&c1_i2c0_platdata);
2264 s3c_i2c1_set_platdata(NULL);
2266 if (system_rev == SLP_C1_REV03)
2267 i2c_register_board_info(1, i2c1_devs_rev03, ARRAY_SIZE(i2c1_devs_rev03));
2269 i2c_register_board_info(1, i2c1_devs_rev04, ARRAY_SIZE(i2c1_devs_rev04));
2272 s3c_i2c3_set_platdata(NULL);
2273 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
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);
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);
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));
2297 s3c_i2c6_set_platdata(NULL);
2298 i2c_register_board_info(6, i2c6_devs, ARRAY_SIZE(i2c6_devs));
2300 s3c_i2c7_set_platdata(NULL);
2301 i2c_register_board_info(7, i2c7_devs, ARRAY_SIZE(i2c7_devs));
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));
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));
2314 i2c_register_board_info(12, i2c12_devs_cypress, ARRAY_SIZE(i2c12_devs_cypress));
2316 i2c_register_board_info(14, i2c14_devs, ARRAY_SIZE(i2c14_devs));
2318 i2c_register_board_info(15, i2c15_devs, ARRAY_SIZE(i2c15_devs));
2322 i2c_register_board_info(16, i2c16_devs, ARRAY_SIZE(i2c16_devs));
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;
2336 pm_cpu_prepare = c1_pm_prepare;
2337 pm_cpu_finish = c1_pm_finish;
2340 s3c_irq_wake(IRQ_RTC_ALARM, 1);
2343 #if defined(CONFIG_S5PV310_DEV_PD) && !defined(CONFIG_PM_RUNTIME)
2345 * These power domains should be always on
2346 * without runtime pm support.
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);
2357 #ifdef CONFIG_VIDEO_FIMG2D
2358 /* setup fimg2d parent clock. */
2359 universal_fimg2d_setup_clock("mout_g2d0", "mout_mpll");
2363 #ifdef CONFIG_S5P_ADC
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;
2378 s3c_set_platdata(&c1_fimc_platdata[0], sizeof(c1_fimc_platdata[0]),
2380 s3c_set_platdata(&c1_fimc_platdata[1], sizeof(c1_fimc_platdata[1]),
2382 s3c_set_platdata(&c1_fimc_platdata[2], sizeof(c1_fimc_platdata[2]),
2384 s3c_set_platdata(&c1_fimc_platdata[3], sizeof(c1_fimc_platdata[3]),
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;
2397 #ifdef CONFIG_VIDEO_JPEG
2398 #ifdef CONFIG_S5PV310_DEV_PD
2399 s5p_device_jpeg.dev.parent = &s5pv310_device_pd[PD_CAM].dev;
2402 #ifdef CONFIG_CHARGER_MANAGER
2403 setup_charger_manager(&c1_charger_g_desc);
2407 platform_add_devices(c1_devices, ARRAY_SIZE(c1_devices));
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.
2413 c1_fimc_setup_clks();
2414 regulator_has_full_constraints();
2416 if (s5pv310_subrev() != 0) {
2417 pr_emerg("\n\n This kernel does NOT support subrevision %d of S5PC210.\n\n\n",
2419 panic("Not supported subrevision");
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,