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