blob: d0999519e9ac8af022dc3989e75257e9c8e9b9ae [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 Hama140b922011-07-21 00:31:27 +090019#include <linux/power/max17042_battery.h>
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +090020#include <linux/regulator/machine.h>
21#include <linux/regulator/fixed.h>
MyungJoo Ham29dee862011-07-21 00:31:27 +090022#include <linux/mfd/max8997.h>
23#include <linux/mfd/max8997-private.h>
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +090024#include <linux/mmc/host.h>
Donghwa Leecc7df872011-03-08 07:17:09 +090025#include <linux/fb.h>
26#include <linux/pwm_backlight.h>
27
28#include <video/platform_lcd.h>
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +090029
30#include <asm/mach/arch.h>
31#include <asm/mach-types.h>
32
MyungJoo Hamed9ba312011-07-21 00:31:27 +090033#include <plat/adc.h>
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +090034#include <plat/regs-serial.h>
35#include <plat/exynos4.h>
36#include <plat/cpu.h>
37#include <plat/devs.h>
38#include <plat/sdhci.h>
Joonyoung Shim01da92f2011-04-08 13:22:11 +090039#include <plat/ehci.h>
40#include <plat/clock.h>
Joonyoung Shim3260ecd2011-03-23 15:25:14 +090041#include <plat/gpio-cfg.h>
42#include <plat/iic.h>
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +090043
44#include <mach/map.h>
45
46/* Following are default values for UCON, ULCON and UFCON UART registers */
47#define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
48 S3C2410_UCON_RXILEVEL | \
49 S3C2410_UCON_TXIRQMODE | \
50 S3C2410_UCON_RXIRQMODE | \
51 S3C2410_UCON_RXFIFO_TOI | \
52 S3C2443_UCON_RXERR_IRQEN)
53
54#define NURI_ULCON_DEFAULT S3C2410_LCON_CS8
55
56#define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
57 S5PV210_UFCON_TXTRIG256 | \
58 S5PV210_UFCON_RXTRIG256)
59
60enum fixed_regulator_id {
61 FIXED_REG_ID_MMC = 0,
62};
63
64static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
65 {
66 .hwport = 0,
67 .ucon = NURI_UCON_DEFAULT,
68 .ulcon = NURI_ULCON_DEFAULT,
69 .ufcon = NURI_UFCON_DEFAULT,
70 },
71 {
72 .hwport = 1,
73 .ucon = NURI_UCON_DEFAULT,
74 .ulcon = NURI_ULCON_DEFAULT,
75 .ufcon = NURI_UFCON_DEFAULT,
76 },
77 {
78 .hwport = 2,
79 .ucon = NURI_UCON_DEFAULT,
80 .ulcon = NURI_ULCON_DEFAULT,
81 .ufcon = NURI_UFCON_DEFAULT,
82 },
83 {
84 .hwport = 3,
85 .ucon = NURI_UCON_DEFAULT,
86 .ulcon = NURI_ULCON_DEFAULT,
87 .ufcon = NURI_UFCON_DEFAULT,
88 },
89};
90
91/* eMMC */
92static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
93 .max_width = 8,
94 .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
95 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
96 MMC_CAP_DISABLE | MMC_CAP_ERASE),
97 .cd_type = S3C_SDHCI_CD_PERMANENT,
98 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
99};
100
101static struct regulator_consumer_supply emmc_supplies[] = {
102 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
103 REGULATOR_SUPPLY("vmmc", "dw_mmc"),
104};
105
106static struct regulator_init_data emmc_fixed_voltage_init_data = {
107 .constraints = {
108 .name = "VMEM_VDD_2.8V",
109 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
110 },
111 .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
112 .consumer_supplies = emmc_supplies,
113};
114
115static struct fixed_voltage_config emmc_fixed_voltage_config = {
116 .supply_name = "MASSMEMORY_EN (inverted)",
117 .microvolts = 2800000,
118 .gpio = EXYNOS4_GPL1(1),
119 .enable_high = false,
120 .init_data = &emmc_fixed_voltage_init_data,
121};
122
123static struct platform_device emmc_fixed_voltage = {
124 .name = "reg-fixed-voltage",
125 .id = FIXED_REG_ID_MMC,
126 .dev = {
127 .platform_data = &emmc_fixed_voltage_config,
128 },
129};
130
131/* SD */
132static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
133 .max_width = 4,
134 .host_caps = MMC_CAP_4_BIT_DATA |
135 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
136 MMC_CAP_DISABLE,
137 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
138 .ext_cd_gpio_invert = 1,
139 .cd_type = S3C_SDHCI_CD_GPIO,
140 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
141};
142
143/* WLAN */
144static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
145 .max_width = 4,
146 .host_caps = MMC_CAP_4_BIT_DATA |
147 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
148 .cd_type = S3C_SDHCI_CD_EXTERNAL,
149 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
150};
151
152static void __init nuri_sdhci_init(void)
153{
154 s3c_sdhci0_set_platdata(&nuri_hsmmc0_data);
155 s3c_sdhci2_set_platdata(&nuri_hsmmc2_data);
156 s3c_sdhci3_set_platdata(&nuri_hsmmc3_data);
157}
158
159/* GPIO KEYS */
160static struct gpio_keys_button nuri_gpio_keys_tables[] = {
161 {
162 .code = KEY_VOLUMEUP,
163 .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
164 .desc = "gpio-keys: KEY_VOLUMEUP",
165 .type = EV_KEY,
166 .active_low = 1,
167 .debounce_interval = 1,
168 }, {
169 .code = KEY_VOLUMEDOWN,
170 .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
171 .desc = "gpio-keys: KEY_VOLUMEDOWN",
172 .type = EV_KEY,
173 .active_low = 1,
174 .debounce_interval = 1,
175 }, {
176 .code = KEY_POWER,
177 .gpio = EXYNOS4_GPX2(7), /* XEINT23 */
178 .desc = "gpio-keys: KEY_POWER",
179 .type = EV_KEY,
180 .active_low = 1,
181 .wakeup = 1,
182 .debounce_interval = 1,
183 },
184};
185
186static struct gpio_keys_platform_data nuri_gpio_keys_data = {
187 .buttons = nuri_gpio_keys_tables,
188 .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables),
189};
190
191static struct platform_device nuri_gpio_keys = {
192 .name = "gpio-keys",
193 .dev = {
194 .platform_data = &nuri_gpio_keys_data,
195 },
196};
197
Donghwa Leecc7df872011-03-08 07:17:09 +0900198static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
199{
200 int gpio = EXYNOS4_GPE1(5);
201
202 gpio_request(gpio, "LVDS_nSHDN");
203 gpio_direction_output(gpio, power);
204 gpio_free(gpio);
205}
206
207static int nuri_bl_init(struct device *dev)
208{
209 int ret, gpio = EXYNOS4_GPE2(3);
210
211 ret = gpio_request(gpio, "LCD_LDO_EN");
212 if (!ret)
213 gpio_direction_output(gpio, 0);
214
215 return ret;
216}
217
218static int nuri_bl_notify(struct device *dev, int brightness)
219{
220 if (brightness < 1)
221 brightness = 0;
222
223 gpio_set_value(EXYNOS4_GPE2(3), 1);
224
225 return brightness;
226}
227
228static void nuri_bl_exit(struct device *dev)
229{
230 gpio_free(EXYNOS4_GPE2(3));
231}
232
233/* nuri pwm backlight */
234static struct platform_pwm_backlight_data nuri_backlight_data = {
235 .pwm_id = 0,
236 .pwm_period_ns = 30000,
237 .max_brightness = 100,
238 .dft_brightness = 50,
239 .init = nuri_bl_init,
240 .notify = nuri_bl_notify,
241 .exit = nuri_bl_exit,
242};
243
244static struct platform_device nuri_backlight_device = {
245 .name = "pwm-backlight",
246 .id = -1,
247 .dev = {
248 .parent = &s3c_device_timer[0].dev,
249 .platform_data = &nuri_backlight_data,
250 },
251};
252
253static struct plat_lcd_data nuri_lcd_platform_data = {
254 .set_power = nuri_lcd_power_on,
255};
256
257static struct platform_device nuri_lcd_device = {
258 .name = "platform-lcd",
259 .id = -1,
260 .dev = {
261 .platform_data = &nuri_lcd_platform_data,
262 },
263};
264
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900265/* I2C1 */
266static struct i2c_board_info i2c1_devs[] __initdata = {
267 /* Gyro, To be updated */
268};
269
Joonyoung Shim3260ecd2011-03-23 15:25:14 +0900270/* TSP */
271static u8 mxt_init_vals[] = {
272 /* MXT_GEN_COMMAND(6) */
273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
274 /* MXT_GEN_POWER(7) */
275 0x20, 0xff, 0x32,
276 /* MXT_GEN_ACQUIRE(8) */
277 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23,
278 /* MXT_TOUCH_MULTI(9) */
279 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00,
280 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00,
281 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
282 0x00,
283 /* MXT_TOUCH_KEYARRAY(15) */
284 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
285 0x00,
286 /* MXT_SPT_GPIOPWM(19) */
287 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
288 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
289 /* MXT_PROCI_GRIPFACE(20) */
290 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04,
291 0x0f, 0x0a,
292 /* MXT_PROCG_NOISE(22) */
293 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00,
294 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03,
295 /* MXT_TOUCH_PROXIMITY(23) */
296 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
297 0x00, 0x00, 0x00, 0x00, 0x00,
298 /* MXT_PROCI_ONETOUCH(24) */
299 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
301 /* MXT_SPT_SELFTEST(25) */
302 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
303 0x00, 0x00, 0x00, 0x00,
304 /* MXT_PROCI_TWOTOUCH(27) */
305 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
306 /* MXT_SPT_CTECONFIG(28) */
307 0x00, 0x00, 0x02, 0x08, 0x10, 0x00,
308};
309
310static struct mxt_platform_data mxt_platform_data = {
311 .config = mxt_init_vals,
312 .config_length = ARRAY_SIZE(mxt_init_vals),
313
314 .x_line = 18,
315 .y_line = 11,
316 .x_size = 1024,
317 .y_size = 600,
318 .blen = 0x1,
319 .threshold = 0x28,
320 .voltage = 2800000, /* 2.8V */
321 .orient = MXT_DIAGONAL_COUNTER,
322 .irqflags = IRQF_TRIGGER_FALLING,
323};
324
325static struct s3c2410_platform_i2c i2c3_data __initdata = {
326 .flags = 0,
327 .bus_num = 3,
328 .slave_addr = 0x10,
329 .frequency = 400 * 1000,
330 .sda_delay = 100,
331};
332
333static struct i2c_board_info i2c3_devs[] __initdata = {
334 {
335 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
336 .platform_data = &mxt_platform_data,
337 .irq = IRQ_EINT(4),
338 },
339};
340
341static void __init nuri_tsp_init(void)
342{
343 int gpio;
344
345 /* TOUCH_INT: XEINT_4 */
346 gpio = EXYNOS4_GPX0(4);
347 gpio_request(gpio, "TOUCH_INT");
348 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
349 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
350}
351
MyungJoo Ham29dee862011-07-21 00:31:27 +0900352static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
353 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900354};
MyungJoo Ham29dee862011-07-21 00:31:27 +0900355static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
356 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
357};
358static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
359 REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
360};
361static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
362 REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
363};
364static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
365 REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
366};
367static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
368 REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */
369 REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
370};
371static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
372 REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */
373};
374static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
375 REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
376};
377static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
378 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), /* TFLASH */
379};
380static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
381 REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
382};
383static struct regulator_consumer_supply __initdata max8997_ldo15_[] = {
384 REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */
385};
386static struct regulator_consumer_supply __initdata max8997_ldo16_[] = {
387 REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */
388};
389static struct regulator_consumer_supply __initdata max8997_ldo18_[] = {
390 REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */
391};
392static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
393 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
394};
395static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
396 REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */
397};
398static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
399 REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
400};
401static struct regulator_consumer_supply __initdata max8997_buck4_[] = {
402 REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */
403};
404static struct regulator_consumer_supply __initdata max8997_buck6_[] = {
405 REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */
406};
407static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = {
408 REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */
409};
410static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = {
411 REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */
412};
413
414static struct regulator_consumer_supply __initdata max8997_charger_[] = {
415 REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
416};
417static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = {
418 REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */
419};
420
421static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = {
422 REGULATOR_SUPPLY("gps_clk", "bcm4751"),
423 REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"),
424 REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"),
425};
426
427static struct regulator_init_data __initdata max8997_ldo1_data = {
428 .constraints = {
429 .name = "VADC_3.3V_C210",
430 .min_uV = 3300000,
431 .max_uV = 3300000,
432 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
433 .apply_uV = 1,
434 .state_mem = {
435 .disabled = 1,
436 },
437 },
438 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_),
439 .consumer_supplies = max8997_ldo1_,
440};
441
442static struct regulator_init_data __initdata max8997_ldo2_data = {
443 .constraints = {
444 .name = "VALIVE_1.1V_C210",
445 .min_uV = 1100000,
446 .max_uV = 1100000,
447 .apply_uV = 1,
448 .always_on = 1,
449 .state_mem = {
450 .enabled = 1,
451 },
452 },
453};
454
455static struct regulator_init_data __initdata max8997_ldo3_data = {
456 .constraints = {
457 .name = "VUSB_1.1V_C210",
458 .min_uV = 1100000,
459 .max_uV = 1100000,
460 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
461 .apply_uV = 1,
462 .state_mem = {
463 .disabled = 1,
464 },
465 },
466 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_),
467 .consumer_supplies = max8997_ldo3_,
468};
469
470static struct regulator_init_data __initdata max8997_ldo4_data = {
471 .constraints = {
472 .name = "VMIPI_1.8V",
473 .min_uV = 1800000,
474 .max_uV = 1800000,
475 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
476 .apply_uV = 1,
477 .state_mem = {
478 .disabled = 1,
479 },
480 },
481 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_),
482 .consumer_supplies = max8997_ldo4_,
483};
484
485static struct regulator_init_data __initdata max8997_ldo5_data = {
486 .constraints = {
487 .name = "VHSIC_1.2V_C210",
488 .min_uV = 1200000,
489 .max_uV = 1200000,
490 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
491 .apply_uV = 1,
492 .state_mem = {
493 .disabled = 1,
494 },
495 },
496 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_),
497 .consumer_supplies = max8997_ldo5_,
498};
499
500static struct regulator_init_data __initdata max8997_ldo6_data = {
501 .constraints = {
502 .name = "VCC_1.8V_PDA",
503 .min_uV = 1800000,
504 .max_uV = 1800000,
505 .apply_uV = 1,
506 .always_on = 1,
507 .state_mem = {
508 .enabled = 1,
509 },
510 },
511};
512
513static struct regulator_init_data __initdata max8997_ldo7_data = {
514 .constraints = {
515 .name = "CAM_ISP_1.8V",
516 .min_uV = 1800000,
517 .max_uV = 1800000,
518 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
519 .apply_uV = 1,
520 .state_mem = {
521 .disabled = 1,
522 },
523 },
524 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_),
525 .consumer_supplies = max8997_ldo7_,
526};
527
528static struct regulator_init_data __initdata max8997_ldo8_data = {
529 .constraints = {
530 .name = "VUSB/VDAC_3.3V_C210",
531 .min_uV = 3300000,
532 .max_uV = 3300000,
533 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
534 .apply_uV = 1,
535 .state_mem = {
536 .disabled = 1,
537 },
538 },
539 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_),
540 .consumer_supplies = max8997_ldo8_,
541};
542
543static struct regulator_init_data __initdata max8997_ldo9_data = {
544 .constraints = {
545 .name = "VCC_2.8V_PDA",
546 .min_uV = 2800000,
547 .max_uV = 2800000,
548 .apply_uV = 1,
549 .always_on = 1,
550 .state_mem = {
551 .enabled = 1,
552 },
553 },
554};
555
556static struct regulator_init_data __initdata max8997_ldo10_data = {
557 .constraints = {
558 .name = "VPLL_1.1V_C210",
559 .min_uV = 1100000,
560 .max_uV = 1100000,
561 .apply_uV = 1,
562 .always_on = 1,
563 .state_mem = {
564 .disabled = 1,
565 },
566 },
567};
568
569static struct regulator_init_data __initdata max8997_ldo11_data = {
570 .constraints = {
571 .name = "LVDS_VDD3.3V",
572 .min_uV = 3300000,
573 .max_uV = 3300000,
574 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
575 .apply_uV = 1,
576 .boot_on = 1,
577 .state_mem = {
578 .disabled = 1,
579 },
580 },
581 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_),
582 .consumer_supplies = max8997_ldo11_,
583};
584
585static struct regulator_init_data __initdata max8997_ldo12_data = {
586 .constraints = {
587 .name = "VT_CAM_1.8V",
588 .min_uV = 1800000,
589 .max_uV = 1800000,
590 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
591 .apply_uV = 1,
592 .state_mem = {
593 .disabled = 1,
594 },
595 },
596 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_),
597 .consumer_supplies = max8997_ldo12_,
598};
599
600static struct regulator_init_data __initdata max8997_ldo13_data = {
601 .constraints = {
602 .name = "VTF_2.8V",
603 .min_uV = 2800000,
604 .max_uV = 2800000,
605 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
606 .apply_uV = 1,
607 .state_mem = {
608 .disabled = 1,
609 },
610 },
611 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_),
612 .consumer_supplies = max8997_ldo13_,
613};
614
615static struct regulator_init_data __initdata max8997_ldo14_data = {
616 .constraints = {
617 .name = "VCC_3.0V_MOTOR",
618 .min_uV = 3000000,
619 .max_uV = 3000000,
620 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
621 .apply_uV = 1,
622 .state_mem = {
623 .disabled = 1,
624 },
625 },
626 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_),
627 .consumer_supplies = max8997_ldo14_,
628};
629
630static struct regulator_init_data __initdata max8997_ldo15_data = {
631 .constraints = {
632 .name = "VTOUCH_ADVV2.8V",
633 .min_uV = 2800000,
634 .max_uV = 2800000,
635 .apply_uV = 1,
636 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
637 .state_mem = {
638 .disabled = 1,
639 },
640 },
641 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_),
642 .consumer_supplies = max8997_ldo15_,
643};
644
645static struct regulator_init_data __initdata max8997_ldo16_data = {
646 .constraints = {
647 .name = "CAM_SENSOR_IO_1.8V",
648 .min_uV = 1800000,
649 .max_uV = 1800000,
650 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
651 .apply_uV = 1,
652 .state_mem = {
653 .disabled = 1,
654 },
655 },
656 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_),
657 .consumer_supplies = max8997_ldo16_,
658};
659
660static struct regulator_init_data __initdata max8997_ldo18_data = {
661 .constraints = {
662 .name = "VTOUCH_VDD2.8V",
663 .min_uV = 2800000,
664 .max_uV = 2800000,
665 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
666 .apply_uV = 1,
667 .state_mem = {
668 .disabled = 1,
669 },
670 },
671 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_),
672 .consumer_supplies = max8997_ldo18_,
673};
674
675static struct regulator_init_data __initdata max8997_ldo21_data = {
676 .constraints = {
677 .name = "VDDQ_M1M2_1.2V",
678 .min_uV = 1200000,
679 .max_uV = 1200000,
680 .apply_uV = 1,
681 .always_on = 1,
682 .state_mem = {
683 .disabled = 1,
684 },
685 },
686};
687
688static struct regulator_init_data __initdata max8997_buck1_data = {
689 .constraints = {
690 .name = "VARM_1.2V_C210",
691 .min_uV = 900000,
692 .max_uV = 1350000,
693 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
694 .always_on = 1,
695 .state_mem = {
696 .disabled = 1,
697 },
698 },
699 .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_),
700 .consumer_supplies = max8997_buck1_,
701};
702
703static struct regulator_init_data __initdata max8997_buck2_data = {
704 .constraints = {
705 .name = "VINT_1.1V_C210",
706 .min_uV = 900000,
707 .max_uV = 1100000,
708 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
709 .always_on = 1,
710 .state_mem = {
711 .disabled = 1,
712 },
713 },
714 .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_),
715 .consumer_supplies = max8997_buck2_,
716};
717
718static struct regulator_init_data __initdata max8997_buck3_data = {
719 .constraints = {
720 .name = "VG3D_1.1V_C210",
721 .min_uV = 900000,
722 .max_uV = 1100000,
723 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
724 REGULATOR_CHANGE_STATUS,
725 .state_mem = {
726 .disabled = 1,
727 },
728 },
729 .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_),
730 .consumer_supplies = max8997_buck3_,
731};
732
733static struct regulator_init_data __initdata max8997_buck4_data = {
734 .constraints = {
735 .name = "CAM_ISP_CORE_1.2V",
736 .min_uV = 1200000,
737 .max_uV = 1200000,
738 .apply_uV = 1,
739 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
740 .state_mem = {
741 .disabled = 1,
742 },
743 },
744 .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_),
745 .consumer_supplies = max8997_buck4_,
746};
747
748static struct regulator_init_data __initdata max8997_buck5_data = {
749 .constraints = {
750 .name = "VMEM_1.2V_C210",
751 .min_uV = 1200000,
752 .max_uV = 1200000,
753 .apply_uV = 1,
754 .always_on = 1,
755 .state_mem = {
756 .enabled = 1,
757 },
758 },
759};
760
761static struct regulator_init_data __initdata max8997_buck6_data = {
762 .constraints = {
763 .name = "CAM_AF_2.8V",
764 .min_uV = 2800000,
765 .max_uV = 2800000,
766 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
767 .state_mem = {
768 .disabled = 1,
769 },
770 },
771 .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_),
772 .consumer_supplies = max8997_buck6_,
773};
774
775static struct regulator_init_data __initdata max8997_buck7_data = {
776 .constraints = {
777 .name = "VCC_SUB_2.0V",
778 .min_uV = 2000000,
779 .max_uV = 2000000,
780 .apply_uV = 1,
781 .always_on = 1,
782 .state_mem = {
783 .enabled = 1,
784 },
785 },
786};
787
788static struct regulator_init_data __initdata max8997_32khz_ap_data = {
789 .constraints = {
790 .name = "32KHz AP",
791 .always_on = 1,
792 .state_mem = {
793 .enabled = 1,
794 },
795 },
796 .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_),
797 .consumer_supplies = max8997_32khz_ap_,
798};
799
800static struct regulator_init_data __initdata max8997_32khz_cp_data = {
801 .constraints = {
802 .name = "32KHz CP",
803 .state_mem = {
804 .disabled = 1,
805 },
806 },
807};
808
809static struct regulator_init_data __initdata max8997_vichg_data = {
810 .constraints = {
811 .name = "VICHG",
812 .state_mem = {
813 .disabled = 1,
814 },
815 },
816};
817
818static struct regulator_init_data __initdata max8997_esafeout1_data = {
819 .constraints = {
820 .name = "SAFEOUT1",
821 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
822 .state_mem = {
823 .disabled = 1,
824 },
825 },
826 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_),
827 .consumer_supplies = max8997_esafeout1_,
828};
829
830static struct regulator_init_data __initdata max8997_esafeout2_data = {
831 .constraints = {
832 .name = "SAFEOUT2",
833 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
834 .state_mem = {
835 .disabled = 1,
836 },
837 },
838 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_),
839 .consumer_supplies = max8997_esafeout2_,
840};
841
842static struct regulator_init_data __initdata max8997_charger_cv_data = {
843 .constraints = {
844 .name = "CHARGER_CV",
845 .min_uV = 4200000,
846 .max_uV = 4200000,
847 .apply_uV = 1,
848 },
849};
850
851static struct regulator_init_data __initdata max8997_charger_data = {
852 .constraints = {
853 .name = "CHARGER",
854 .min_uA = 200000,
855 .max_uA = 950000,
856 .boot_on = 1,
857 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
858 REGULATOR_CHANGE_CURRENT,
859 },
860 .num_consumer_supplies = ARRAY_SIZE(max8997_charger_),
861 .consumer_supplies = max8997_charger_,
862};
863
864static struct regulator_init_data __initdata max8997_charger_topoff_data = {
865 .constraints = {
866 .name = "CHARGER TOPOFF",
867 .min_uA = 50000,
868 .max_uA = 200000,
869 .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
870 },
871 .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_),
872 .consumer_supplies = max8997_chg_toff_,
873};
874
875static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = {
876 { MAX8997_LDO1, &max8997_ldo1_data },
877 { MAX8997_LDO2, &max8997_ldo2_data },
878 { MAX8997_LDO3, &max8997_ldo3_data },
879 { MAX8997_LDO4, &max8997_ldo4_data },
880 { MAX8997_LDO5, &max8997_ldo5_data },
881 { MAX8997_LDO6, &max8997_ldo6_data },
882 { MAX8997_LDO7, &max8997_ldo7_data },
883 { MAX8997_LDO8, &max8997_ldo8_data },
884 { MAX8997_LDO9, &max8997_ldo9_data },
885 { MAX8997_LDO10, &max8997_ldo10_data },
886 { MAX8997_LDO11, &max8997_ldo11_data },
887 { MAX8997_LDO12, &max8997_ldo12_data },
888 { MAX8997_LDO13, &max8997_ldo13_data },
889 { MAX8997_LDO14, &max8997_ldo14_data },
890 { MAX8997_LDO15, &max8997_ldo15_data },
891 { MAX8997_LDO16, &max8997_ldo16_data },
892
893 { MAX8997_LDO18, &max8997_ldo18_data },
894 { MAX8997_LDO21, &max8997_ldo21_data },
895
896 { MAX8997_BUCK1, &max8997_buck1_data },
897 { MAX8997_BUCK2, &max8997_buck2_data },
898 { MAX8997_BUCK3, &max8997_buck3_data },
899 { MAX8997_BUCK4, &max8997_buck4_data },
900 { MAX8997_BUCK5, &max8997_buck5_data },
901 { MAX8997_BUCK6, &max8997_buck6_data },
902 { MAX8997_BUCK7, &max8997_buck7_data },
903
904 { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data },
905 { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data },
906
907 { MAX8997_ENVICHG, &max8997_vichg_data },
908 { MAX8997_ESAFEOUT1, &max8997_esafeout1_data },
909 { MAX8997_ESAFEOUT2, &max8997_esafeout2_data },
910 { MAX8997_CHARGER_CV, &max8997_charger_cv_data },
911 { MAX8997_CHARGER, &max8997_charger_data },
912 { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data },
913};
914
915static struct max8997_platform_data __initdata nuri_max8997_pdata = {
916 .wakeup = 1,
917
918 .num_regulators = ARRAY_SIZE(nuri_max8997_regulators),
919 .regulators = nuri_max8997_regulators,
920
921 .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
922 .buck2_gpiodvs = true,
923
924 .buck1_voltage[0] = 1350000, /* 1.35V */
925 .buck1_voltage[1] = 1300000, /* 1.3V */
926 .buck1_voltage[2] = 1250000, /* 1.25V */
927 .buck1_voltage[3] = 1200000, /* 1.2V */
928 .buck1_voltage[4] = 1150000, /* 1.15V */
929 .buck1_voltage[5] = 1100000, /* 1.1V */
930 .buck1_voltage[6] = 1000000, /* 1.0V */
931 .buck1_voltage[7] = 950000, /* 0.95V */
932
933 .buck2_voltage[0] = 1100000, /* 1.1V */
934 .buck2_voltage[1] = 1000000, /* 1.0V */
935 .buck2_voltage[2] = 950000, /* 0.95V */
936 .buck2_voltage[3] = 900000, /* 0.9V */
937 .buck2_voltage[4] = 1100000, /* 1.1V */
938 .buck2_voltage[5] = 1000000, /* 1.0V */
939 .buck2_voltage[6] = 950000, /* 0.95V */
940 .buck2_voltage[7] = 900000, /* 0.9V */
941
942 .buck5_voltage[0] = 1200000, /* 1.2V */
943 .buck5_voltage[1] = 1200000, /* 1.2V */
944 .buck5_voltage[2] = 1200000, /* 1.2V */
945 .buck5_voltage[3] = 1200000, /* 1.2V */
946 .buck5_voltage[4] = 1200000, /* 1.2V */
947 .buck5_voltage[5] = 1200000, /* 1.2V */
948 .buck5_voltage[6] = 1200000, /* 1.2V */
949 .buck5_voltage[7] = 1200000, /* 1.2V */
950};
951
952/* GPIO I2C 5 (PMIC) */
953enum { I2C5_MAX8997 };
954static struct i2c_board_info i2c5_devs[] __initdata = {
955 [I2C5_MAX8997] = {
956 I2C_BOARD_INFO("max8997", 0xCC >> 1),
957 .platform_data = &nuri_max8997_pdata,
958 },
959};
960
MyungJoo Hama140b922011-07-21 00:31:27 +0900961static struct max17042_platform_data nuri_battery_platform_data = {
962};
963
964/* GPIO I2C 9 (Fuel Gauge) */
965static struct i2c_gpio_platform_data i2c9_gpio_data = {
966 .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */
967 .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */
968};
969static struct platform_device i2c9_gpio = {
970 .name = "i2c-gpio",
971 .id = 9,
972 .dev = {
973 .platform_data = &i2c9_gpio_data,
974 },
975};
976enum { I2C9_MAX17042};
977static struct i2c_board_info i2c9_devs[] __initdata = {
978 [I2C9_MAX17042] = {
979 I2C_BOARD_INFO("max17042", 0x36),
980 .platform_data = &nuri_battery_platform_data,
981 },
982};
983
MyungJoo Ham29dee862011-07-21 00:31:27 +0900984static void __init nuri_power_init(void)
985{
986 int gpio;
987 int irq_base = IRQ_GPIO_END + 1;
988
989 nuri_max8997_pdata.irq_base = irq_base;
990 irq_base += MAX8997_IRQ_NR;
991
992 gpio = EXYNOS4_GPX0(7);
993 gpio_request(gpio, "AP_PMIC_IRQ");
994 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
995 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
MyungJoo Hama140b922011-07-21 00:31:27 +0900996
997 gpio = EXYNOS4_GPX2(3);
998 gpio_request(gpio, "FUEL_ALERT");
999 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1000 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
MyungJoo Ham29dee862011-07-21 00:31:27 +09001001}
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001002
Joonyoung Shim01da92f2011-04-08 13:22:11 +09001003/* USB EHCI */
1004static struct s5p_ehci_platdata nuri_ehci_pdata;
1005
1006static void __init nuri_ehci_init(void)
1007{
1008 struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
1009
1010 s5p_ehci_set_platdata(pdata);
1011}
1012
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001013static struct platform_device *nuri_devices[] __initdata = {
1014 /* Samsung Platform Devices */
MyungJoo Ham29dee862011-07-21 00:31:27 +09001015 &s3c_device_i2c5, /* PMIC should initialize first */
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001016 &emmc_fixed_voltage,
1017 &s3c_device_hsmmc0,
1018 &s3c_device_hsmmc2,
1019 &s3c_device_hsmmc3,
1020 &s3c_device_wdt,
Donghwa Leecc7df872011-03-08 07:17:09 +09001021 &s3c_device_timer[0],
Joonyoung Shim01da92f2011-04-08 13:22:11 +09001022 &s5p_device_ehci,
Joonyoung Shim3260ecd2011-03-23 15:25:14 +09001023 &s3c_device_i2c3,
MyungJoo Hama140b922011-07-21 00:31:27 +09001024 &i2c9_gpio,
MyungJoo Hamed9ba312011-07-21 00:31:27 +09001025 &s3c_device_adc,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001026
1027 /* NURI Devices */
1028 &nuri_gpio_keys,
Donghwa Leecc7df872011-03-08 07:17:09 +09001029 &nuri_lcd_device,
1030 &nuri_backlight_device,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001031};
1032
1033static void __init nuri_map_io(void)
1034{
1035 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
1036 s3c24xx_init_clocks(24000000);
1037 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
1038}
1039
1040static void __init nuri_machine_init(void)
1041{
1042 nuri_sdhci_init();
Joonyoung Shim3260ecd2011-03-23 15:25:14 +09001043 nuri_tsp_init();
MyungJoo Ham29dee862011-07-21 00:31:27 +09001044 nuri_power_init();
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001045
1046 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
Joonyoung Shim3260ecd2011-03-23 15:25:14 +09001047 s3c_i2c3_set_platdata(&i2c3_data);
1048 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
MyungJoo Ham29dee862011-07-21 00:31:27 +09001049 s3c_i2c5_set_platdata(NULL);
1050 i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7));
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001051 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
MyungJoo Hama140b922011-07-21 00:31:27 +09001052 i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
1053 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001054
Joonyoung Shim01da92f2011-04-08 13:22:11 +09001055 nuri_ehci_init();
1056 clk_xusbxti.rate = 24000000;
1057
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001058 /* Last */
1059 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
1060}
1061
1062MACHINE_START(NURI, "NURI")
1063 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
1064 .boot_params = S5P_PA_SDRAM + 0x100,
1065 .init_irq = exynos4_init_irq,
1066 .map_io = nuri_map_io,
1067 .init_machine = nuri_machine_init,
1068 .timer = &exynos4_timer,
1069MACHINE_END