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