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