Merge remote-tracking branch 'agust/next' into merge
[pandora-kernel.git] / arch / arm / mach-exynos / mach-nuri.c
1 /*
2  * linux/arch/arm/mach-exynos4/mach-nuri.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/i2c.h>
15 #include <linux/i2c/atmel_mxt_ts.h>
16 #include <linux/i2c-gpio.h>
17 #include <linux/gpio_keys.h>
18 #include <linux/gpio.h>
19 #include <linux/power/max8903_charger.h>
20 #include <linux/power/max17042_battery.h>
21 #include <linux/regulator/machine.h>
22 #include <linux/regulator/fixed.h>
23 #include <linux/mfd/max8997.h>
24 #include <linux/mfd/max8997-private.h>
25 #include <linux/mmc/host.h>
26 #include <linux/fb.h>
27 #include <linux/pwm_backlight.h>
28
29 #include <video/platform_lcd.h>
30 #include <media/m5mols.h>
31 #include <media/s5p_fimc.h>
32 #include <media/v4l2-mediabus.h>
33
34 #include <asm/mach/arch.h>
35 #include <asm/mach-types.h>
36
37 #include <plat/adc.h>
38 #include <plat/regs-fb-v4.h>
39 #include <plat/regs-serial.h>
40 #include <plat/exynos4.h>
41 #include <plat/cpu.h>
42 #include <plat/devs.h>
43 #include <plat/fb.h>
44 #include <plat/sdhci.h>
45 #include <plat/ehci.h>
46 #include <plat/clock.h>
47 #include <plat/gpio-cfg.h>
48 #include <plat/iic.h>
49 #include <plat/mfc.h>
50 #include <plat/pd.h>
51 #include <plat/fimc-core.h>
52 #include <plat/camport.h>
53 #include <plat/mipi_csis.h>
54
55 #include <mach/map.h>
56
57 /* Following are default values for UCON, ULCON and UFCON UART registers */
58 #define NURI_UCON_DEFAULT       (S3C2410_UCON_TXILEVEL |        \
59                                  S3C2410_UCON_RXILEVEL |        \
60                                  S3C2410_UCON_TXIRQMODE |       \
61                                  S3C2410_UCON_RXIRQMODE |       \
62                                  S3C2410_UCON_RXFIFO_TOI |      \
63                                  S3C2443_UCON_RXERR_IRQEN)
64
65 #define NURI_ULCON_DEFAULT      S3C2410_LCON_CS8
66
67 #define NURI_UFCON_DEFAULT      (S3C2410_UFCON_FIFOMODE |       \
68                                  S5PV210_UFCON_TXTRIG256 |      \
69                                  S5PV210_UFCON_RXTRIG256)
70
71 enum fixed_regulator_id {
72         FIXED_REG_ID_MMC = 0,
73         FIXED_REG_ID_MAX8903,
74         FIXED_REG_ID_CAM_A28V,
75         FIXED_REG_ID_CAM_12V,
76 };
77
78 static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
79         {
80                 .hwport         = 0,
81                 .ucon           = NURI_UCON_DEFAULT,
82                 .ulcon          = NURI_ULCON_DEFAULT,
83                 .ufcon          = NURI_UFCON_DEFAULT,
84         },
85         {
86                 .hwport         = 1,
87                 .ucon           = NURI_UCON_DEFAULT,
88                 .ulcon          = NURI_ULCON_DEFAULT,
89                 .ufcon          = NURI_UFCON_DEFAULT,
90         },
91         {
92                 .hwport         = 2,
93                 .ucon           = NURI_UCON_DEFAULT,
94                 .ulcon          = NURI_ULCON_DEFAULT,
95                 .ufcon          = NURI_UFCON_DEFAULT,
96         },
97         {
98                 .hwport         = 3,
99                 .ucon           = NURI_UCON_DEFAULT,
100                 .ulcon          = NURI_ULCON_DEFAULT,
101                 .ufcon          = NURI_UFCON_DEFAULT,
102         },
103 };
104
105 /* eMMC */
106 static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
107         .max_width              = 8,
108         .host_caps              = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
109                                 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
110                                 MMC_CAP_DISABLE | MMC_CAP_ERASE),
111         .cd_type                = S3C_SDHCI_CD_PERMANENT,
112         .clk_type               = S3C_SDHCI_CLK_DIV_EXTERNAL,
113 };
114
115 static struct regulator_consumer_supply emmc_supplies[] = {
116         REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
117         REGULATOR_SUPPLY("vmmc", "dw_mmc"),
118 };
119
120 static struct regulator_init_data emmc_fixed_voltage_init_data = {
121         .constraints            = {
122                 .name           = "VMEM_VDD_2.8V",
123                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
124         },
125         .num_consumer_supplies  = ARRAY_SIZE(emmc_supplies),
126         .consumer_supplies      = emmc_supplies,
127 };
128
129 static struct fixed_voltage_config emmc_fixed_voltage_config = {
130         .supply_name            = "MASSMEMORY_EN (inverted)",
131         .microvolts             = 2800000,
132         .gpio                   = EXYNOS4_GPL1(1),
133         .enable_high            = false,
134         .init_data              = &emmc_fixed_voltage_init_data,
135 };
136
137 static struct platform_device emmc_fixed_voltage = {
138         .name                   = "reg-fixed-voltage",
139         .id                     = FIXED_REG_ID_MMC,
140         .dev                    = {
141                 .platform_data  = &emmc_fixed_voltage_config,
142         },
143 };
144
145 /* SD */
146 static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
147         .max_width              = 4,
148         .host_caps              = MMC_CAP_4_BIT_DATA |
149                                 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
150                                 MMC_CAP_DISABLE,
151         .ext_cd_gpio            = EXYNOS4_GPX3(3),      /* XEINT_27 */
152         .ext_cd_gpio_invert     = 1,
153         .cd_type                = S3C_SDHCI_CD_GPIO,
154         .clk_type               = S3C_SDHCI_CLK_DIV_EXTERNAL,
155 };
156
157 /* WLAN */
158 static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
159         .max_width              = 4,
160         .host_caps              = MMC_CAP_4_BIT_DATA |
161                                 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
162         .cd_type                = S3C_SDHCI_CD_EXTERNAL,
163         .clk_type               = S3C_SDHCI_CLK_DIV_EXTERNAL,
164 };
165
166 static void __init nuri_sdhci_init(void)
167 {
168         s3c_sdhci0_set_platdata(&nuri_hsmmc0_data);
169         s3c_sdhci2_set_platdata(&nuri_hsmmc2_data);
170         s3c_sdhci3_set_platdata(&nuri_hsmmc3_data);
171 }
172
173 /* GPIO KEYS */
174 static struct gpio_keys_button nuri_gpio_keys_tables[] = {
175         {
176                 .code                   = KEY_VOLUMEUP,
177                 .gpio                   = EXYNOS4_GPX2(0),      /* XEINT16 */
178                 .desc                   = "gpio-keys: KEY_VOLUMEUP",
179                 .type                   = EV_KEY,
180                 .active_low             = 1,
181                 .debounce_interval      = 1,
182         }, {
183                 .code                   = KEY_VOLUMEDOWN,
184                 .gpio                   = EXYNOS4_GPX2(1),      /* XEINT17 */
185                 .desc                   = "gpio-keys: KEY_VOLUMEDOWN",
186                 .type                   = EV_KEY,
187                 .active_low             = 1,
188                 .debounce_interval      = 1,
189         }, {
190                 .code                   = KEY_POWER,
191                 .gpio                   = EXYNOS4_GPX2(7),      /* XEINT23 */
192                 .desc                   = "gpio-keys: KEY_POWER",
193                 .type                   = EV_KEY,
194                 .active_low             = 1,
195                 .wakeup                 = 1,
196                 .debounce_interval      = 1,
197         },
198 };
199
200 static struct gpio_keys_platform_data nuri_gpio_keys_data = {
201         .buttons                = nuri_gpio_keys_tables,
202         .nbuttons               = ARRAY_SIZE(nuri_gpio_keys_tables),
203 };
204
205 static struct platform_device nuri_gpio_keys = {
206         .name                   = "gpio-keys",
207         .dev                    = {
208                 .platform_data  = &nuri_gpio_keys_data,
209         },
210 };
211
212 /* Frame Buffer */
213 static struct s3c_fb_pd_win nuri_fb_win0 = {
214         .win_mode = {
215                 .left_margin    = 64,
216                 .right_margin   = 16,
217                 .upper_margin   = 64,
218                 .lower_margin   = 1,
219                 .hsync_len      = 48,
220                 .vsync_len      = 3,
221                 .xres           = 1280,
222                 .yres           = 800,
223                 .refresh        = 60,
224         },
225         .max_bpp        = 24,
226         .default_bpp    = 16,
227         .virtual_x      = 1280,
228         .virtual_y      = 800,
229 };
230
231 static struct s3c_fb_platdata nuri_fb_pdata __initdata = {
232         .win[0]         = &nuri_fb_win0,
233         .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
234                           VIDCON0_CLKSEL_LCD,
235         .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
236         .setup_gpio     = exynos4_fimd0_gpio_setup_24bpp,
237 };
238
239 static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
240 {
241         int gpio = EXYNOS4_GPE1(5);
242
243         gpio_request(gpio, "LVDS_nSHDN");
244         gpio_direction_output(gpio, power);
245         gpio_free(gpio);
246 }
247
248 static int nuri_bl_init(struct device *dev)
249 {
250         int ret, gpio = EXYNOS4_GPE2(3);
251
252         ret = gpio_request(gpio, "LCD_LDO_EN");
253         if (!ret)
254                 gpio_direction_output(gpio, 0);
255
256         return ret;
257 }
258
259 static int nuri_bl_notify(struct device *dev, int brightness)
260 {
261         if (brightness < 1)
262                 brightness = 0;
263
264         gpio_set_value(EXYNOS4_GPE2(3), 1);
265
266         return brightness;
267 }
268
269 static void nuri_bl_exit(struct device *dev)
270 {
271         gpio_free(EXYNOS4_GPE2(3));
272 }
273
274 /* nuri pwm backlight */
275 static struct platform_pwm_backlight_data nuri_backlight_data = {
276         .pwm_id                 = 0,
277         .pwm_period_ns          = 30000,
278         .max_brightness         = 100,
279         .dft_brightness         = 50,
280         .init                   = nuri_bl_init,
281         .notify                 = nuri_bl_notify,
282         .exit                   = nuri_bl_exit,
283 };
284
285 static struct platform_device nuri_backlight_device = {
286         .name                   = "pwm-backlight",
287         .id                     = -1,
288         .dev                    = {
289                 .parent         = &s3c_device_timer[0].dev,
290                 .platform_data  = &nuri_backlight_data,
291         },
292 };
293
294 static struct plat_lcd_data nuri_lcd_platform_data = {
295         .set_power              = nuri_lcd_power_on,
296 };
297
298 static struct platform_device nuri_lcd_device = {
299         .name                   = "platform-lcd",
300         .id                     = -1,
301         .dev                    = {
302                 .platform_data  = &nuri_lcd_platform_data,
303         },
304 };
305
306 /* I2C1 */
307 static struct i2c_board_info i2c1_devs[] __initdata = {
308         /* Gyro, To be updated */
309 };
310
311 /* TSP */
312 static u8 mxt_init_vals[] = {
313         /* MXT_GEN_COMMAND(6) */
314         0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
315         /* MXT_GEN_POWER(7) */
316         0x20, 0xff, 0x32,
317         /* MXT_GEN_ACQUIRE(8) */
318         0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23,
319         /* MXT_TOUCH_MULTI(9) */
320         0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00,
321         0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00,
322         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
323         0x00,
324         /* MXT_TOUCH_KEYARRAY(15) */
325         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
326         0x00,
327         /* MXT_SPT_GPIOPWM(19) */
328         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
329         0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
330         /* MXT_PROCI_GRIPFACE(20) */
331         0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04,
332         0x0f, 0x0a,
333         /* MXT_PROCG_NOISE(22) */
334         0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00,
335         0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03,
336         /* MXT_TOUCH_PROXIMITY(23) */
337         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
338         0x00, 0x00, 0x00, 0x00, 0x00,
339         /* MXT_PROCI_ONETOUCH(24) */
340         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
341         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
342         /* MXT_SPT_SELFTEST(25) */
343         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344         0x00, 0x00, 0x00, 0x00,
345         /* MXT_PROCI_TWOTOUCH(27) */
346         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
347         /* MXT_SPT_CTECONFIG(28) */
348         0x00, 0x00, 0x02, 0x08, 0x10, 0x00,
349 };
350
351 static struct mxt_platform_data mxt_platform_data = {
352         .config                 = mxt_init_vals,
353         .config_length          = ARRAY_SIZE(mxt_init_vals),
354
355         .x_line                 = 18,
356         .y_line                 = 11,
357         .x_size                 = 1024,
358         .y_size                 = 600,
359         .blen                   = 0x1,
360         .threshold              = 0x28,
361         .voltage                = 2800000,              /* 2.8V */
362         .orient                 = MXT_DIAGONAL_COUNTER,
363         .irqflags               = IRQF_TRIGGER_FALLING,
364 };
365
366 static struct s3c2410_platform_i2c i2c3_data __initdata = {
367         .flags          = 0,
368         .bus_num        = 3,
369         .slave_addr     = 0x10,
370         .frequency      = 400 * 1000,
371         .sda_delay      = 100,
372 };
373
374 static struct i2c_board_info i2c3_devs[] __initdata = {
375         {
376                 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
377                 .platform_data  = &mxt_platform_data,
378                 .irq            = IRQ_EINT(4),
379         },
380 };
381
382 static void __init nuri_tsp_init(void)
383 {
384         int gpio;
385
386         /* TOUCH_INT: XEINT_4 */
387         gpio = EXYNOS4_GPX0(4);
388         gpio_request(gpio, "TOUCH_INT");
389         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
390         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
391 }
392
393 static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
394         REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
395 };
396 static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
397         REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
398 };
399 static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
400         REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
401 };
402 static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
403         REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
404 };
405 static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
406         REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
407 };
408 static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
409         REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */
410         REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
411 };
412 static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
413         REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */
414 };
415 static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
416         REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
417 };
418 static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
419         REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), /* TFLASH */
420 };
421 static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
422         REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
423 };
424 static struct regulator_consumer_supply __initdata max8997_ldo15_[] = {
425         REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */
426 };
427 static struct regulator_consumer_supply __initdata max8997_ldo16_[] = {
428         REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */
429 };
430 static struct regulator_consumer_supply __initdata max8997_ldo18_[] = {
431         REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */
432 };
433 static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
434         REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
435 };
436 static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
437         REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */
438 };
439 static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
440         REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
441 };
442 static struct regulator_consumer_supply __initdata max8997_buck4_[] = {
443         REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */
444 };
445 static struct regulator_consumer_supply __initdata max8997_buck6_[] = {
446         REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */
447 };
448 static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = {
449         REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */
450 };
451 static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = {
452         REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */
453 };
454
455 static struct regulator_consumer_supply __initdata max8997_charger_[] = {
456         REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
457 };
458 static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = {
459         REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */
460 };
461
462 static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = {
463         REGULATOR_SUPPLY("gps_clk", "bcm4751"),
464         REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"),
465         REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"),
466 };
467
468 static struct regulator_init_data __initdata max8997_ldo1_data = {
469         .constraints    = {
470                 .name           = "VADC_3.3V_C210",
471                 .min_uV         = 3300000,
472                 .max_uV         = 3300000,
473                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
474                 .apply_uV       = 1,
475                 .state_mem      = {
476                         .disabled       = 1,
477                 },
478         },
479         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo1_),
480         .consumer_supplies      = max8997_ldo1_,
481 };
482
483 static struct regulator_init_data __initdata max8997_ldo2_data = {
484         .constraints    = {
485                 .name           = "VALIVE_1.1V_C210",
486                 .min_uV         = 1100000,
487                 .max_uV         = 1100000,
488                 .apply_uV       = 1,
489                 .always_on      = 1,
490                 .state_mem      = {
491                         .enabled        = 1,
492                 },
493         },
494 };
495
496 static struct regulator_init_data __initdata max8997_ldo3_data = {
497         .constraints    = {
498                 .name           = "VUSB_1.1V_C210",
499                 .min_uV         = 1100000,
500                 .max_uV         = 1100000,
501                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
502                 .apply_uV       = 1,
503                 .state_mem      = {
504                         .disabled       = 1,
505                 },
506         },
507         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo3_),
508         .consumer_supplies      = max8997_ldo3_,
509 };
510
511 static struct regulator_init_data __initdata max8997_ldo4_data = {
512         .constraints    = {
513                 .name           = "VMIPI_1.8V",
514                 .min_uV         = 1800000,
515                 .max_uV         = 1800000,
516                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
517                 .apply_uV       = 1,
518                 .state_mem      = {
519                         .disabled       = 1,
520                 },
521         },
522         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo4_),
523         .consumer_supplies      = max8997_ldo4_,
524 };
525
526 static struct regulator_init_data __initdata max8997_ldo5_data = {
527         .constraints    = {
528                 .name           = "VHSIC_1.2V_C210",
529                 .min_uV         = 1200000,
530                 .max_uV         = 1200000,
531                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
532                 .apply_uV       = 1,
533                 .state_mem      = {
534                         .disabled       = 1,
535                 },
536         },
537         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo5_),
538         .consumer_supplies      = max8997_ldo5_,
539 };
540
541 static struct regulator_init_data __initdata max8997_ldo6_data = {
542         .constraints    = {
543                 .name           = "VCC_1.8V_PDA",
544                 .min_uV         = 1800000,
545                 .max_uV         = 1800000,
546                 .apply_uV       = 1,
547                 .always_on      = 1,
548                 .state_mem      = {
549                         .enabled        = 1,
550                 },
551         },
552 };
553
554 static struct regulator_init_data __initdata max8997_ldo7_data = {
555         .constraints    = {
556                 .name           = "CAM_ISP_1.8V",
557                 .min_uV         = 1800000,
558                 .max_uV         = 1800000,
559                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
560                 .apply_uV       = 1,
561                 .state_mem      = {
562                         .disabled       = 1,
563                 },
564         },
565         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo7_),
566         .consumer_supplies      = max8997_ldo7_,
567 };
568
569 static struct regulator_init_data __initdata max8997_ldo8_data = {
570         .constraints    = {
571                 .name           = "VUSB/VDAC_3.3V_C210",
572                 .min_uV         = 3300000,
573                 .max_uV         = 3300000,
574                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
575                 .apply_uV       = 1,
576                 .state_mem      = {
577                         .disabled       = 1,
578                 },
579         },
580         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo8_),
581         .consumer_supplies      = max8997_ldo8_,
582 };
583
584 static struct regulator_init_data __initdata max8997_ldo9_data = {
585         .constraints    = {
586                 .name           = "VCC_2.8V_PDA",
587                 .min_uV         = 2800000,
588                 .max_uV         = 2800000,
589                 .apply_uV       = 1,
590                 .always_on      = 1,
591                 .state_mem      = {
592                         .enabled        = 1,
593                 },
594         },
595 };
596
597 static struct regulator_init_data __initdata max8997_ldo10_data = {
598         .constraints    = {
599                 .name           = "VPLL_1.1V_C210",
600                 .min_uV         = 1100000,
601                 .max_uV         = 1100000,
602                 .apply_uV       = 1,
603                 .always_on      = 1,
604                 .state_mem      = {
605                         .disabled       = 1,
606                 },
607         },
608 };
609
610 static struct regulator_init_data __initdata max8997_ldo11_data = {
611         .constraints    = {
612                 .name           = "LVDS_VDD3.3V",
613                 .min_uV         = 3300000,
614                 .max_uV         = 3300000,
615                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
616                 .apply_uV       = 1,
617                 .boot_on        = 1,
618                 .state_mem      = {
619                         .disabled       = 1,
620                 },
621         },
622         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo11_),
623         .consumer_supplies      = max8997_ldo11_,
624 };
625
626 static struct regulator_init_data __initdata max8997_ldo12_data = {
627         .constraints    = {
628                 .name           = "VT_CAM_1.8V",
629                 .min_uV         = 1800000,
630                 .max_uV         = 1800000,
631                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
632                 .apply_uV       = 1,
633                 .state_mem      = {
634                         .disabled       = 1,
635                 },
636         },
637         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo12_),
638         .consumer_supplies      = max8997_ldo12_,
639 };
640
641 static struct regulator_init_data __initdata max8997_ldo13_data = {
642         .constraints    = {
643                 .name           = "VTF_2.8V",
644                 .min_uV         = 2800000,
645                 .max_uV         = 2800000,
646                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
647                 .apply_uV       = 1,
648                 .state_mem      = {
649                         .disabled       = 1,
650                 },
651         },
652         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo13_),
653         .consumer_supplies      = max8997_ldo13_,
654 };
655
656 static struct regulator_init_data __initdata max8997_ldo14_data = {
657         .constraints    = {
658                 .name           = "VCC_3.0V_MOTOR",
659                 .min_uV         = 3000000,
660                 .max_uV         = 3000000,
661                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
662                 .apply_uV       = 1,
663                 .state_mem      = {
664                         .disabled       = 1,
665                 },
666         },
667         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo14_),
668         .consumer_supplies      = max8997_ldo14_,
669 };
670
671 static struct regulator_init_data __initdata max8997_ldo15_data = {
672         .constraints    = {
673                 .name           = "VTOUCH_ADVV2.8V",
674                 .min_uV         = 2800000,
675                 .max_uV         = 2800000,
676                 .apply_uV       = 1,
677                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
678                 .state_mem      = {
679                         .disabled       = 1,
680                 },
681         },
682         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo15_),
683         .consumer_supplies      = max8997_ldo15_,
684 };
685
686 static struct regulator_init_data __initdata max8997_ldo16_data = {
687         .constraints    = {
688                 .name           = "CAM_SENSOR_IO_1.8V",
689                 .min_uV         = 1800000,
690                 .max_uV         = 1800000,
691                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
692                 .apply_uV       = 1,
693                 .state_mem      = {
694                         .disabled       = 1,
695                 },
696         },
697         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo16_),
698         .consumer_supplies      = max8997_ldo16_,
699 };
700
701 static struct regulator_init_data __initdata max8997_ldo18_data = {
702         .constraints    = {
703                 .name           = "VTOUCH_VDD2.8V",
704                 .min_uV         = 2800000,
705                 .max_uV         = 2800000,
706                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
707                 .apply_uV       = 1,
708                 .state_mem      = {
709                         .disabled       = 1,
710                 },
711         },
712         .num_consumer_supplies  = ARRAY_SIZE(max8997_ldo18_),
713         .consumer_supplies      = max8997_ldo18_,
714 };
715
716 static struct regulator_init_data __initdata max8997_ldo21_data = {
717         .constraints    = {
718                 .name           = "VDDQ_M1M2_1.2V",
719                 .min_uV         = 1200000,
720                 .max_uV         = 1200000,
721                 .apply_uV       = 1,
722                 .always_on      = 1,
723                 .state_mem      = {
724                         .disabled       = 1,
725                 },
726         },
727 };
728
729 static struct regulator_init_data __initdata max8997_buck1_data = {
730         .constraints    = {
731                 .name           = "VARM_1.2V_C210",
732                 .min_uV         = 900000,
733                 .max_uV         = 1350000,
734                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
735                 .always_on      = 1,
736                 .state_mem      = {
737                         .disabled       = 1,
738                 },
739         },
740         .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_),
741         .consumer_supplies = max8997_buck1_,
742 };
743
744 static struct regulator_init_data __initdata max8997_buck2_data = {
745         .constraints    = {
746                 .name           = "VINT_1.1V_C210",
747                 .min_uV         = 900000,
748                 .max_uV         = 1100000,
749                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
750                 .always_on      = 1,
751                 .state_mem      = {
752                         .disabled       = 1,
753                 },
754         },
755         .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_),
756         .consumer_supplies = max8997_buck2_,
757 };
758
759 static struct regulator_init_data __initdata max8997_buck3_data = {
760         .constraints    = {
761                 .name           = "VG3D_1.1V_C210",
762                 .min_uV         = 900000,
763                 .max_uV         = 1100000,
764                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
765                                   REGULATOR_CHANGE_STATUS,
766                 .state_mem      = {
767                         .disabled       = 1,
768                 },
769         },
770         .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_),
771         .consumer_supplies = max8997_buck3_,
772 };
773
774 static struct regulator_init_data __initdata max8997_buck4_data = {
775         .constraints    = {
776                 .name           = "CAM_ISP_CORE_1.2V",
777                 .min_uV         = 1200000,
778                 .max_uV         = 1200000,
779                 .apply_uV       = 1,
780                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
781                 .state_mem      = {
782                         .disabled       = 1,
783                 },
784         },
785         .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_),
786         .consumer_supplies = max8997_buck4_,
787 };
788
789 static struct regulator_init_data __initdata max8997_buck5_data = {
790         .constraints    = {
791                 .name           = "VMEM_1.2V_C210",
792                 .min_uV         = 1200000,
793                 .max_uV         = 1200000,
794                 .apply_uV       = 1,
795                 .always_on      = 1,
796                 .state_mem      = {
797                         .enabled        = 1,
798                 },
799         },
800 };
801
802 static struct regulator_init_data __initdata max8997_buck6_data = {
803         .constraints    = {
804                 .name           = "CAM_AF_2.8V",
805                 .min_uV         = 2800000,
806                 .max_uV         = 2800000,
807                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
808                 .state_mem      = {
809                         .disabled       = 1,
810                 },
811         },
812         .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_),
813         .consumer_supplies = max8997_buck6_,
814 };
815
816 static struct regulator_init_data __initdata max8997_buck7_data = {
817         .constraints    = {
818                 .name           = "VCC_SUB_2.0V",
819                 .min_uV         = 2000000,
820                 .max_uV         = 2000000,
821                 .apply_uV       = 1,
822                 .always_on      = 1,
823                 .state_mem      = {
824                         .enabled        = 1,
825                 },
826         },
827 };
828
829 static struct regulator_init_data __initdata max8997_32khz_ap_data = {
830         .constraints    = {
831                 .name           = "32KHz AP",
832                 .always_on      = 1,
833                 .state_mem      = {
834                         .enabled        = 1,
835                 },
836         },
837         .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_),
838         .consumer_supplies = max8997_32khz_ap_,
839 };
840
841 static struct regulator_init_data __initdata max8997_32khz_cp_data = {
842         .constraints    = {
843                 .name           = "32KHz CP",
844                 .state_mem      = {
845                         .disabled       = 1,
846                 },
847         },
848 };
849
850 static struct regulator_init_data __initdata max8997_vichg_data = {
851         .constraints    = {
852                 .name           = "VICHG",
853                 .state_mem      = {
854                         .disabled       = 1,
855                 },
856         },
857 };
858
859 static struct regulator_init_data __initdata max8997_esafeout1_data = {
860         .constraints    = {
861                 .name           = "SAFEOUT1",
862                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
863                 .state_mem      = {
864                         .disabled       = 1,
865                 },
866         },
867         .num_consumer_supplies  = ARRAY_SIZE(max8997_esafeout1_),
868         .consumer_supplies      = max8997_esafeout1_,
869 };
870
871 static struct regulator_init_data __initdata max8997_esafeout2_data = {
872         .constraints    = {
873                 .name           = "SAFEOUT2",
874                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
875                 .state_mem      = {
876                         .disabled       = 1,
877                 },
878         },
879         .num_consumer_supplies  = ARRAY_SIZE(max8997_esafeout2_),
880         .consumer_supplies      = max8997_esafeout2_,
881 };
882
883 static struct regulator_init_data __initdata max8997_charger_cv_data = {
884         .constraints    = {
885                 .name           = "CHARGER_CV",
886                 .min_uV         = 4200000,
887                 .max_uV         = 4200000,
888                 .apply_uV       = 1,
889         },
890 };
891
892 static struct regulator_init_data __initdata max8997_charger_data = {
893         .constraints    = {
894                 .name           = "CHARGER",
895                 .min_uA         = 200000,
896                 .max_uA         = 950000,
897                 .boot_on        = 1,
898                 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
899                                 REGULATOR_CHANGE_CURRENT,
900         },
901         .num_consumer_supplies  = ARRAY_SIZE(max8997_charger_),
902         .consumer_supplies      = max8997_charger_,
903 };
904
905 static struct regulator_init_data __initdata max8997_charger_topoff_data = {
906         .constraints    = {
907                 .name           = "CHARGER TOPOFF",
908                 .min_uA         = 50000,
909                 .max_uA         = 200000,
910                 .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
911         },
912         .num_consumer_supplies  = ARRAY_SIZE(max8997_chg_toff_),
913         .consumer_supplies      = max8997_chg_toff_,
914 };
915
916 static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = {
917         { MAX8997_LDO1, &max8997_ldo1_data },
918         { MAX8997_LDO2, &max8997_ldo2_data },
919         { MAX8997_LDO3, &max8997_ldo3_data },
920         { MAX8997_LDO4, &max8997_ldo4_data },
921         { MAX8997_LDO5, &max8997_ldo5_data },
922         { MAX8997_LDO6, &max8997_ldo6_data },
923         { MAX8997_LDO7, &max8997_ldo7_data },
924         { MAX8997_LDO8, &max8997_ldo8_data },
925         { MAX8997_LDO9, &max8997_ldo9_data },
926         { MAX8997_LDO10, &max8997_ldo10_data },
927         { MAX8997_LDO11, &max8997_ldo11_data },
928         { MAX8997_LDO12, &max8997_ldo12_data },
929         { MAX8997_LDO13, &max8997_ldo13_data },
930         { MAX8997_LDO14, &max8997_ldo14_data },
931         { MAX8997_LDO15, &max8997_ldo15_data },
932         { MAX8997_LDO16, &max8997_ldo16_data },
933
934         { MAX8997_LDO18, &max8997_ldo18_data },
935         { MAX8997_LDO21, &max8997_ldo21_data },
936
937         { MAX8997_BUCK1, &max8997_buck1_data },
938         { MAX8997_BUCK2, &max8997_buck2_data },
939         { MAX8997_BUCK3, &max8997_buck3_data },
940         { MAX8997_BUCK4, &max8997_buck4_data },
941         { MAX8997_BUCK5, &max8997_buck5_data },
942         { MAX8997_BUCK6, &max8997_buck6_data },
943         { MAX8997_BUCK7, &max8997_buck7_data },
944
945         { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data },
946         { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data },
947
948         { MAX8997_ENVICHG, &max8997_vichg_data },
949         { MAX8997_ESAFEOUT1, &max8997_esafeout1_data },
950         { MAX8997_ESAFEOUT2, &max8997_esafeout2_data },
951         { MAX8997_CHARGER_CV, &max8997_charger_cv_data },
952         { MAX8997_CHARGER, &max8997_charger_data },
953         { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data },
954 };
955
956 static struct max8997_platform_data __initdata nuri_max8997_pdata = {
957         .wakeup                 = 1,
958
959         .num_regulators         = ARRAY_SIZE(nuri_max8997_regulators),
960         .regulators             = nuri_max8997_regulators,
961
962         .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
963         .buck2_gpiodvs = true,
964
965         .buck1_voltage[0] = 1350000, /* 1.35V */
966         .buck1_voltage[1] = 1300000, /* 1.3V */
967         .buck1_voltage[2] = 1250000, /* 1.25V */
968         .buck1_voltage[3] = 1200000, /* 1.2V */
969         .buck1_voltage[4] = 1150000, /* 1.15V */
970         .buck1_voltage[5] = 1100000, /* 1.1V */
971         .buck1_voltage[6] = 1000000, /* 1.0V */
972         .buck1_voltage[7] = 950000, /* 0.95V */
973
974         .buck2_voltage[0] = 1100000, /* 1.1V */
975         .buck2_voltage[1] = 1000000, /* 1.0V */
976         .buck2_voltage[2] = 950000, /* 0.95V */
977         .buck2_voltage[3] = 900000, /* 0.9V */
978         .buck2_voltage[4] = 1100000, /* 1.1V */
979         .buck2_voltage[5] = 1000000, /* 1.0V */
980         .buck2_voltage[6] = 950000, /* 0.95V */
981         .buck2_voltage[7] = 900000, /* 0.9V */
982
983         .buck5_voltage[0] = 1200000, /* 1.2V */
984         .buck5_voltage[1] = 1200000, /* 1.2V */
985         .buck5_voltage[2] = 1200000, /* 1.2V */
986         .buck5_voltage[3] = 1200000, /* 1.2V */
987         .buck5_voltage[4] = 1200000, /* 1.2V */
988         .buck5_voltage[5] = 1200000, /* 1.2V */
989         .buck5_voltage[6] = 1200000, /* 1.2V */
990         .buck5_voltage[7] = 1200000, /* 1.2V */
991 };
992
993 /* GPIO I2C 5 (PMIC) */
994 enum { I2C5_MAX8997 };
995 static struct i2c_board_info i2c5_devs[] __initdata = {
996         [I2C5_MAX8997] = {
997                 I2C_BOARD_INFO("max8997", 0xCC >> 1),
998                 .platform_data  = &nuri_max8997_pdata,
999         },
1000 };
1001
1002 static struct max17042_platform_data nuri_battery_platform_data = {
1003 };
1004
1005 /* GPIO I2C 9 (Fuel Gauge) */
1006 static struct i2c_gpio_platform_data i2c9_gpio_data = {
1007         .sda_pin                = EXYNOS4_GPY4(0),      /* XM0ADDR_8 */
1008         .scl_pin                = EXYNOS4_GPY4(1),      /* XM0ADDR_9 */
1009 };
1010 static struct platform_device i2c9_gpio = {
1011         .name                   = "i2c-gpio",
1012         .id                     = 9,
1013         .dev                    = {
1014                 .platform_data  = &i2c9_gpio_data,
1015         },
1016 };
1017 enum { I2C9_MAX17042};
1018 static struct i2c_board_info i2c9_devs[] __initdata = {
1019         [I2C9_MAX17042] = {
1020                 I2C_BOARD_INFO("max17042", 0x36),
1021                 .platform_data = &nuri_battery_platform_data,
1022         },
1023 };
1024
1025 /* MAX8903 Secondary Charger */
1026 static struct regulator_consumer_supply supplies_max8903[] = {
1027         REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
1028 };
1029
1030 static struct regulator_init_data max8903_charger_en_data = {
1031         .constraints = {
1032                 .name           = "VOUT_CHARGER",
1033                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
1034                 .boot_on        = 1,
1035         },
1036         .num_consumer_supplies = ARRAY_SIZE(supplies_max8903),
1037         .consumer_supplies = supplies_max8903,
1038 };
1039
1040 static struct fixed_voltage_config max8903_charger_en = {
1041         .supply_name = "VOUT_CHARGER",
1042         .microvolts = 5000000, /* Assume 5VDC */
1043         .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */
1044         .enable_high = 0, /* Enable = Low */
1045         .enabled_at_boot = 1,
1046         .init_data = &max8903_charger_en_data,
1047 };
1048
1049 static struct platform_device max8903_fixed_reg_dev = {
1050         .name = "reg-fixed-voltage",
1051         .id = FIXED_REG_ID_MAX8903,
1052         .dev = { .platform_data = &max8903_charger_en },
1053 };
1054
1055 static struct max8903_pdata nuri_max8903 = {
1056         /*
1057          * cen: don't control with the driver, let it be
1058          * controlled by regulator above
1059          */
1060         .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */
1061         /* uok, usus: not connected */
1062         .chg = EXYNOS4_GPE2(0), /* TA_nCHG */
1063         /* flt: vcc_1.8V_pda */
1064         .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */
1065
1066         .dc_valid = true,
1067         .usb_valid = false, /* USB is not wired to MAX8903 */
1068 };
1069
1070 static struct platform_device nuri_max8903_device = {
1071         .name                   = "max8903-charger",
1072         .dev                    = {
1073                 .platform_data  = &nuri_max8903,
1074         },
1075 };
1076
1077 static void __init nuri_power_init(void)
1078 {
1079         int gpio;
1080         int irq_base = IRQ_GPIO_END + 1;
1081         int ta_en = 0;
1082
1083         nuri_max8997_pdata.irq_base = irq_base;
1084         irq_base += MAX8997_IRQ_NR;
1085
1086         gpio = EXYNOS4_GPX0(7);
1087         gpio_request(gpio, "AP_PMIC_IRQ");
1088         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1089         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1090
1091         gpio = EXYNOS4_GPX2(3);
1092         gpio_request(gpio, "FUEL_ALERT");
1093         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1094         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1095
1096         gpio = nuri_max8903.dok;
1097         gpio_request(gpio, "TA_nCONNECTED");
1098         s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1099         s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1100         ta_en = gpio_get_value(gpio) ? 0 : 1;
1101
1102         gpio = nuri_max8903.chg;
1103         gpio_request(gpio, "TA_nCHG");
1104         gpio_direction_input(gpio);
1105
1106         gpio = nuri_max8903.dcm;
1107         gpio_request(gpio, "CURR_ADJ");
1108         gpio_direction_output(gpio, ta_en);
1109 }
1110
1111 /* USB EHCI */
1112 static struct s5p_ehci_platdata nuri_ehci_pdata;
1113
1114 static void __init nuri_ehci_init(void)
1115 {
1116         struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
1117
1118         s5p_ehci_set_platdata(pdata);
1119 }
1120
1121 /* CAMERA */
1122 static struct regulator_consumer_supply cam_vdda_supply[] = {
1123         REGULATOR_SUPPLY("a_sensor", "0-001f"),
1124 };
1125
1126 static struct regulator_init_data cam_vdda_reg_init_data = {
1127         .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1128         .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply),
1129         .consumer_supplies = cam_vdda_supply,
1130 };
1131
1132 static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = {
1133         .supply_name    = "CAM_IO_EN",
1134         .microvolts     = 2800000,
1135         .gpio           = EXYNOS4_GPE2(1), /* CAM_IO_EN */
1136         .enable_high    = 1,
1137         .init_data      = &cam_vdda_reg_init_data,
1138 };
1139
1140 static struct platform_device cam_vdda_fixed_rdev = {
1141         .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V,
1142         .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg },
1143 };
1144
1145 static struct regulator_consumer_supply camera_8m_12v_supply =
1146         REGULATOR_SUPPLY("dig_12", "0-001f");
1147
1148 static struct regulator_init_data cam_8m_12v_reg_init_data = {
1149         .num_consumer_supplies  = 1,
1150         .consumer_supplies      = &camera_8m_12v_supply,
1151         .constraints = {
1152                 .valid_ops_mask = REGULATOR_CHANGE_STATUS
1153         },
1154 };
1155
1156 static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = {
1157         .supply_name    = "8M_1.2V",
1158         .microvolts     = 1200000,
1159         .gpio           = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */
1160         .enable_high    = 1,
1161         .init_data      = &cam_8m_12v_reg_init_data,
1162 };
1163
1164 static struct platform_device cam_8m_12v_fixed_rdev = {
1165         .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V,
1166         .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg },
1167 };
1168
1169 static struct s5p_platform_mipi_csis mipi_csis_platdata = {
1170         .clk_rate       = 166000000UL,
1171         .lanes          = 2,
1172         .alignment      = 32,
1173         .hs_settle      = 12,
1174         .phy_enable     = s5p_csis_phy_enable,
1175 };
1176
1177 #define GPIO_CAM_MEGA_RST       EXYNOS4_GPY3(7) /* ISP_RESET */
1178 #define GPIO_CAM_8M_ISP_INT     EXYNOS4_GPL2(5)
1179
1180 static struct m5mols_platform_data m5mols_platdata = {
1181         .gpio_reset = GPIO_CAM_MEGA_RST,
1182 };
1183
1184 static struct i2c_board_info m5mols_board_info = {
1185         I2C_BOARD_INFO("M5MOLS", 0x1F),
1186         .platform_data  = &m5mols_platdata,
1187 };
1188
1189 static struct s5p_fimc_isp_info nuri_camera_sensors[] = {
1190         {
1191                 .flags          = V4L2_MBUS_PCLK_SAMPLE_FALLING |
1192                                   V4L2_MBUS_VSYNC_ACTIVE_LOW,
1193                 .bus_type       = FIMC_MIPI_CSI2,
1194                 .board_info     = &m5mols_board_info,
1195                 .clk_frequency  = 24000000UL,
1196                 .csi_data_align = 32,
1197         },
1198 };
1199
1200 static struct s5p_platform_fimc fimc_md_platdata = {
1201         .isp_info       = nuri_camera_sensors,
1202         .num_clients    = ARRAY_SIZE(nuri_camera_sensors),
1203 };
1204
1205 static struct gpio nuri_camera_gpios[] = {
1206         { GPIO_CAM_8M_ISP_INT,  GPIOF_IN,           "8M_ISP_INT"  },
1207         { GPIO_CAM_MEGA_RST,    GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
1208 };
1209
1210 static void nuri_camera_init(void)
1211 {
1212         s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
1213                          &s5p_device_mipi_csis0);
1214         s3c_set_platdata(&fimc_md_platdata,  sizeof(fimc_md_platdata),
1215                          &s5p_device_fimc_md);
1216
1217         if (gpio_request_array(nuri_camera_gpios,
1218                                ARRAY_SIZE(nuri_camera_gpios))) {
1219                 pr_err("%s: GPIO request failed\n", __func__);
1220                 return;
1221         }
1222
1223         m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT);
1224         if (!IS_ERR_VALUE(m5mols_board_info.irq))
1225                 s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF));
1226         else
1227                 pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__);
1228
1229         /* Free GPIOs controlled directly by the sensor drivers. */
1230         gpio_free(GPIO_CAM_MEGA_RST);
1231
1232         if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) {
1233                 pr_err("%s: Camera port A setup failed\n", __func__);
1234                 return;
1235         }
1236         /* Increase drive strength of the sensor clock output */
1237         s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4);
1238 }
1239
1240 static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = {
1241         .frequency      = 400000U,
1242         .sda_delay      = 200,
1243 };
1244
1245 static struct platform_device *nuri_devices[] __initdata = {
1246         /* Samsung Platform Devices */
1247         &s3c_device_i2c5, /* PMIC should initialize first */
1248         &s3c_device_i2c0,
1249         &emmc_fixed_voltage,
1250         &s5p_device_mipi_csis0,
1251         &s5p_device_fimc0,
1252         &s5p_device_fimc1,
1253         &s5p_device_fimc2,
1254         &s5p_device_fimc3,
1255         &s5p_device_fimd0,
1256         &s3c_device_hsmmc0,
1257         &s3c_device_hsmmc2,
1258         &s3c_device_hsmmc3,
1259         &s3c_device_wdt,
1260         &s3c_device_timer[0],
1261         &s5p_device_ehci,
1262         &s3c_device_i2c3,
1263         &i2c9_gpio,
1264         &s3c_device_adc,
1265         &s3c_device_rtc,
1266         &s5p_device_mfc,
1267         &s5p_device_mfc_l,
1268         &s5p_device_mfc_r,
1269         &exynos4_device_pd[PD_MFC],
1270         &exynos4_device_pd[PD_LCD0],
1271         &exynos4_device_pd[PD_CAM],
1272         &s5p_device_fimc_md,
1273
1274         /* NURI Devices */
1275         &nuri_gpio_keys,
1276         &nuri_lcd_device,
1277         &nuri_backlight_device,
1278         &max8903_fixed_reg_dev,
1279         &nuri_max8903_device,
1280         &cam_vdda_fixed_rdev,
1281         &cam_8m_12v_fixed_rdev,
1282 };
1283
1284 static void __init nuri_map_io(void)
1285 {
1286         s5p_init_io(NULL, 0, S5P_VA_CHIPID);
1287         s3c24xx_init_clocks(24000000);
1288         s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
1289 }
1290
1291 static void __init nuri_reserve(void)
1292 {
1293         s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
1294 }
1295
1296 static void __init nuri_machine_init(void)
1297 {
1298         nuri_sdhci_init();
1299         nuri_tsp_init();
1300         nuri_power_init();
1301
1302         s3c_i2c0_set_platdata(&nuri_i2c0_platdata);
1303         i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
1304         s3c_i2c3_set_platdata(&i2c3_data);
1305         i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
1306         s3c_i2c5_set_platdata(NULL);
1307         i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7));
1308         i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
1309         i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
1310         i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
1311
1312         s5p_fimd0_set_platdata(&nuri_fb_pdata);
1313
1314         nuri_camera_init();
1315
1316         nuri_ehci_init();
1317         clk_xusbxti.rate = 24000000;
1318
1319         /* Last */
1320         platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
1321         s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
1322         s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
1323
1324         s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
1325         s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
1326         s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
1327         s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
1328         s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
1329 }
1330
1331 MACHINE_START(NURI, "NURI")
1332         /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
1333         .atag_offset    = 0x100,
1334         .init_irq       = exynos4_init_irq,
1335         .map_io         = nuri_map_io,
1336         .init_machine   = nuri_machine_init,
1337         .timer          = &exynos4_timer,
1338         .reserve        = &nuri_reserve,
1339 MACHINE_END