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