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