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