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