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