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