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