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