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