blob: ea785fcaf6c3262892f26dc6a3a7264d22a2e3d3 [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>
Lukasz Majewski126625e2012-05-09 13:16:53 +020028#include <linux/platform_data/s3c-hsotg.h>
Marek Szyprowskidb6856e2012-05-12 06:41:06 +090029#include <drm/exynos_drm.h>
Donghwa Leecc7df872011-03-08 07:17:09 +090030
31#include <video/platform_lcd.h>
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +090032#include <media/m5mols.h>
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +090033#include <media/s5k6aa.h>
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +090034#include <media/s5p_fimc.h>
35#include <media/v4l2-mediabus.h>
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +090036
37#include <asm/mach/arch.h>
Marc Zyngier4e44d2c2011-05-30 11:04:53 +010038#include <asm/hardware/gic.h>
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +090039#include <asm/mach-types.h>
40
MyungJoo Hamed9ba312011-07-21 00:31:27 +090041#include <plat/adc.h>
Marek Szyprowski0d88f942011-08-11 19:57:28 +090042#include <plat/regs-fb-v4.h>
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +090043#include <plat/regs-serial.h>
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +090044#include <plat/cpu.h>
45#include <plat/devs.h>
Marek Szyprowski0d88f942011-08-11 19:57:28 +090046#include <plat/fb.h>
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +090047#include <plat/sdhci.h>
Joonyoung Shim01da92f2011-04-08 13:22:11 +090048#include <plat/ehci.h>
49#include <plat/clock.h>
Joonyoung Shim3260ecd2011-03-23 15:25:14 +090050#include <plat/gpio-cfg.h>
51#include <plat/iic.h>
Marek Szyprowski4c0f0a32011-07-21 16:43:25 +090052#include <plat/mfc.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,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900118};
119
120static struct regulator_consumer_supply emmc_supplies[] = {
Jaehoon Chungf5cca862012-03-10 03:59:50 -0800121 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"),
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900122 REGULATOR_SUPPLY("vmmc", "dw_mmc"),
123};
124
125static struct regulator_init_data emmc_fixed_voltage_init_data = {
126 .constraints = {
127 .name = "VMEM_VDD_2.8V",
128 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
129 },
130 .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
131 .consumer_supplies = emmc_supplies,
132};
133
134static struct fixed_voltage_config emmc_fixed_voltage_config = {
135 .supply_name = "MASSMEMORY_EN (inverted)",
136 .microvolts = 2800000,
137 .gpio = EXYNOS4_GPL1(1),
138 .enable_high = false,
139 .init_data = &emmc_fixed_voltage_init_data,
140};
141
142static struct platform_device emmc_fixed_voltage = {
143 .name = "reg-fixed-voltage",
144 .id = FIXED_REG_ID_MMC,
145 .dev = {
146 .platform_data = &emmc_fixed_voltage_config,
147 },
148};
149
150/* SD */
151static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
152 .max_width = 4,
153 .host_caps = MMC_CAP_4_BIT_DATA |
Adrian Hunter907d2e72012-02-29 09:17:21 +0200154 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900155 .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
156 .ext_cd_gpio_invert = 1,
157 .cd_type = S3C_SDHCI_CD_GPIO,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900158};
159
160/* WLAN */
161static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
162 .max_width = 4,
163 .host_caps = MMC_CAP_4_BIT_DATA |
164 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
165 .cd_type = S3C_SDHCI_CD_EXTERNAL,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900166};
167
168static void __init nuri_sdhci_init(void)
169{
170 s3c_sdhci0_set_platdata(&nuri_hsmmc0_data);
171 s3c_sdhci2_set_platdata(&nuri_hsmmc2_data);
172 s3c_sdhci3_set_platdata(&nuri_hsmmc3_data);
173}
174
175/* GPIO KEYS */
176static struct gpio_keys_button nuri_gpio_keys_tables[] = {
177 {
178 .code = KEY_VOLUMEUP,
179 .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
180 .desc = "gpio-keys: KEY_VOLUMEUP",
181 .type = EV_KEY,
182 .active_low = 1,
183 .debounce_interval = 1,
184 }, {
185 .code = KEY_VOLUMEDOWN,
186 .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
187 .desc = "gpio-keys: KEY_VOLUMEDOWN",
188 .type = EV_KEY,
189 .active_low = 1,
190 .debounce_interval = 1,
191 }, {
192 .code = KEY_POWER,
193 .gpio = EXYNOS4_GPX2(7), /* XEINT23 */
194 .desc = "gpio-keys: KEY_POWER",
195 .type = EV_KEY,
196 .active_low = 1,
197 .wakeup = 1,
198 .debounce_interval = 1,
199 },
200};
201
202static struct gpio_keys_platform_data nuri_gpio_keys_data = {
203 .buttons = nuri_gpio_keys_tables,
204 .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables),
205};
206
207static struct platform_device nuri_gpio_keys = {
208 .name = "gpio-keys",
209 .dev = {
210 .platform_data = &nuri_gpio_keys_data,
211 },
212};
213
Marek Szyprowskidb6856e2012-05-12 06:41:06 +0900214#ifdef CONFIG_DRM_EXYNOS
215static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
216 .panel = {
217 .timing = {
218 .xres = 1024,
219 .yres = 600,
220 .hsync_len = 40,
221 .left_margin = 79,
222 .right_margin = 200,
223 .vsync_len = 10,
224 .upper_margin = 10,
225 .lower_margin = 11,
226 .refresh = 60,
227 },
228 },
229 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
230 VIDCON0_CLKSEL_LCD,
231 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
232 .default_win = 3,
233 .bpp = 32,
234};
235
236#else
Marek Szyprowski0d88f942011-08-11 19:57:28 +0900237/* Frame Buffer */
238static struct s3c_fb_pd_win nuri_fb_win0 = {
Marek Szyprowski0d88f942011-08-11 19:57:28 +0900239 .max_bpp = 24,
240 .default_bpp = 16,
Thomas Abraham79d3c412012-03-24 21:58:48 +0530241 .xres = 1024,
242 .yres = 600,
Sylwester Nawrocki7cc98aa2012-01-31 12:58:31 +0900243 .virtual_x = 1024,
244 .virtual_y = 2 * 600,
Marek Szyprowski0d88f942011-08-11 19:57:28 +0900245};
246
Thomas Abraham79d3c412012-03-24 21:58:48 +0530247static struct fb_videomode nuri_lcd_timing = {
248 .left_margin = 64,
249 .right_margin = 16,
250 .upper_margin = 64,
251 .lower_margin = 1,
252 .hsync_len = 48,
253 .vsync_len = 3,
254 .xres = 1024,
255 .yres = 600,
256 .refresh = 60,
257};
258
Marek Szyprowski0d88f942011-08-11 19:57:28 +0900259static struct s3c_fb_platdata nuri_fb_pdata __initdata = {
260 .win[0] = &nuri_fb_win0,
Thomas Abraham79d3c412012-03-24 21:58:48 +0530261 .vtiming = &nuri_lcd_timing,
Marek Szyprowski0d88f942011-08-11 19:57:28 +0900262 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
263 VIDCON0_CLKSEL_LCD,
264 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
265 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
266};
Marek Szyprowskidb6856e2012-05-12 06:41:06 +0900267#endif
Marek Szyprowski0d88f942011-08-11 19:57:28 +0900268
Donghwa Leecc7df872011-03-08 07:17:09 +0900269static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
270{
271 int gpio = EXYNOS4_GPE1(5);
272
273 gpio_request(gpio, "LVDS_nSHDN");
274 gpio_direction_output(gpio, power);
275 gpio_free(gpio);
276}
277
278static int nuri_bl_init(struct device *dev)
279{
Jingoo Han321655e2011-12-24 11:58:32 +0900280 return gpio_request_one(EXYNOS4_GPE2(3), GPIOF_OUT_INIT_LOW,
281 "LCD_LD0_EN");
Donghwa Leecc7df872011-03-08 07:17:09 +0900282}
283
284static int nuri_bl_notify(struct device *dev, int brightness)
285{
286 if (brightness < 1)
287 brightness = 0;
288
289 gpio_set_value(EXYNOS4_GPE2(3), 1);
290
291 return brightness;
292}
293
294static void nuri_bl_exit(struct device *dev)
295{
296 gpio_free(EXYNOS4_GPE2(3));
297}
298
299/* nuri pwm backlight */
300static struct platform_pwm_backlight_data nuri_backlight_data = {
301 .pwm_id = 0,
302 .pwm_period_ns = 30000,
303 .max_brightness = 100,
304 .dft_brightness = 50,
305 .init = nuri_bl_init,
306 .notify = nuri_bl_notify,
307 .exit = nuri_bl_exit,
308};
309
310static struct platform_device nuri_backlight_device = {
311 .name = "pwm-backlight",
312 .id = -1,
313 .dev = {
314 .parent = &s3c_device_timer[0].dev,
315 .platform_data = &nuri_backlight_data,
316 },
317};
318
319static struct plat_lcd_data nuri_lcd_platform_data = {
320 .set_power = nuri_lcd_power_on,
321};
322
323static struct platform_device nuri_lcd_device = {
324 .name = "platform-lcd",
325 .id = -1,
326 .dev = {
327 .platform_data = &nuri_lcd_platform_data,
328 },
329};
330
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900331/* I2C1 */
332static struct i2c_board_info i2c1_devs[] __initdata = {
333 /* Gyro, To be updated */
334};
335
Joonyoung Shim3260ecd2011-03-23 15:25:14 +0900336/* TSP */
Joonyoung Shim3260ecd2011-03-23 15:25:14 +0900337static struct mxt_platform_data mxt_platform_data = {
Joonyoung Shim3260ecd2011-03-23 15:25:14 +0900338 .x_line = 18,
339 .y_line = 11,
340 .x_size = 1024,
341 .y_size = 600,
342 .blen = 0x1,
343 .threshold = 0x28,
344 .voltage = 2800000, /* 2.8V */
345 .orient = MXT_DIAGONAL_COUNTER,
346 .irqflags = IRQF_TRIGGER_FALLING,
347};
348
349static struct s3c2410_platform_i2c i2c3_data __initdata = {
350 .flags = 0,
351 .bus_num = 3,
352 .slave_addr = 0x10,
353 .frequency = 400 * 1000,
354 .sda_delay = 100,
355};
356
357static struct i2c_board_info i2c3_devs[] __initdata = {
358 {
359 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
360 .platform_data = &mxt_platform_data,
361 .irq = IRQ_EINT(4),
362 },
363};
364
365static void __init nuri_tsp_init(void)
366{
367 int gpio;
368
369 /* TOUCH_INT: XEINT_4 */
370 gpio = EXYNOS4_GPX0(4);
371 gpio_request(gpio, "TOUCH_INT");
372 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
373 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
374}
375
MyungJoo Ham29dee862011-07-21 00:31:27 +0900376static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
377 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900378};
MyungJoo Ham29dee862011-07-21 00:31:27 +0900379static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
Joonyoung Shim8d07dbb2012-05-13 08:25:24 +0900380 REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"), /* USB */
MyungJoo Ham29dee862011-07-21 00:31:27 +0900381 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
382};
383static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
384 REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
385};
386static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
387 REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
388};
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +0900389static struct regulator_consumer_supply nuri_max8997_ldo6_consumer[] = {
390 REGULATOR_SUPPLY("vdd_reg", "6-003c"), /* S5K6AA camera */
391};
MyungJoo Ham29dee862011-07-21 00:31:27 +0900392static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
393 REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
394};
395static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
Joonyoung Shim8d07dbb2012-05-13 08:25:24 +0900396 REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"), /* USB */
MyungJoo Ham29dee862011-07-21 00:31:27 +0900397 REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
398};
399static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
400 REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */
401};
402static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
403 REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
404};
405static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
Jaehoon Chungf5cca862012-03-10 03:59:50 -0800406 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */
MyungJoo Ham29dee862011-07-21 00:31:27 +0900407};
408static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
409 REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
410};
411static struct regulator_consumer_supply __initdata max8997_ldo15_[] = {
412 REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */
413};
414static struct regulator_consumer_supply __initdata max8997_ldo16_[] = {
415 REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */
416};
417static struct regulator_consumer_supply __initdata max8997_ldo18_[] = {
418 REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */
419};
420static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
421 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
422};
423static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
MyungJoo Hambae82bd2011-12-01 16:00:38 +0900424 REGULATOR_SUPPLY("vdd_int", "exynos4210-busfreq.0"), /* CPUFREQ */
MyungJoo Ham29dee862011-07-21 00:31:27 +0900425};
426static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
427 REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
428};
429static struct regulator_consumer_supply __initdata max8997_buck4_[] = {
430 REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */
431};
432static struct regulator_consumer_supply __initdata max8997_buck6_[] = {
433 REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */
434};
435static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = {
436 REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */
437};
438static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = {
439 REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */
440};
441
442static struct regulator_consumer_supply __initdata max8997_charger_[] = {
443 REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
444};
445static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = {
446 REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */
447};
448
449static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = {
450 REGULATOR_SUPPLY("gps_clk", "bcm4751"),
451 REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"),
452 REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"),
453};
454
455static struct regulator_init_data __initdata max8997_ldo1_data = {
456 .constraints = {
457 .name = "VADC_3.3V_C210",
458 .min_uV = 3300000,
459 .max_uV = 3300000,
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_ldo1_),
467 .consumer_supplies = max8997_ldo1_,
468};
469
470static struct regulator_init_data __initdata max8997_ldo2_data = {
471 .constraints = {
472 .name = "VALIVE_1.1V_C210",
473 .min_uV = 1100000,
474 .max_uV = 1100000,
475 .apply_uV = 1,
476 .always_on = 1,
477 .state_mem = {
478 .enabled = 1,
479 },
480 },
481};
482
483static struct regulator_init_data __initdata max8997_ldo3_data = {
484 .constraints = {
485 .name = "VUSB_1.1V_C210",
486 .min_uV = 1100000,
487 .max_uV = 1100000,
488 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
489 .apply_uV = 1,
490 .state_mem = {
491 .disabled = 1,
492 },
493 },
494 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_),
495 .consumer_supplies = max8997_ldo3_,
496};
497
498static struct regulator_init_data __initdata max8997_ldo4_data = {
499 .constraints = {
500 .name = "VMIPI_1.8V",
501 .min_uV = 1800000,
502 .max_uV = 1800000,
503 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
504 .apply_uV = 1,
505 .state_mem = {
506 .disabled = 1,
507 },
508 },
509 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_),
510 .consumer_supplies = max8997_ldo4_,
511};
512
513static struct regulator_init_data __initdata max8997_ldo5_data = {
514 .constraints = {
515 .name = "VHSIC_1.2V_C210",
516 .min_uV = 1200000,
517 .max_uV = 1200000,
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_ldo5_),
525 .consumer_supplies = max8997_ldo5_,
526};
527
528static struct regulator_init_data __initdata max8997_ldo6_data = {
529 .constraints = {
530 .name = "VCC_1.8V_PDA",
531 .min_uV = 1800000,
532 .max_uV = 1800000,
533 .apply_uV = 1,
534 .always_on = 1,
535 .state_mem = {
536 .enabled = 1,
537 },
538 },
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +0900539 .num_consumer_supplies = ARRAY_SIZE(nuri_max8997_ldo6_consumer),
540 .consumer_supplies = nuri_max8997_ldo6_consumer,
MyungJoo Ham29dee862011-07-21 00:31:27 +0900541};
542
543static struct regulator_init_data __initdata max8997_ldo7_data = {
544 .constraints = {
545 .name = "CAM_ISP_1.8V",
546 .min_uV = 1800000,
547 .max_uV = 1800000,
548 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
549 .apply_uV = 1,
550 .state_mem = {
551 .disabled = 1,
552 },
553 },
554 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_),
555 .consumer_supplies = max8997_ldo7_,
556};
557
558static struct regulator_init_data __initdata max8997_ldo8_data = {
559 .constraints = {
Marek Szyprowskif441f8a2012-04-09 21:10:32 -0700560 .name = "VUSB+VDAC_3.3V_C210",
MyungJoo Ham29dee862011-07-21 00:31:27 +0900561 .min_uV = 3300000,
562 .max_uV = 3300000,
563 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
564 .apply_uV = 1,
565 .state_mem = {
566 .disabled = 1,
567 },
568 },
569 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_),
570 .consumer_supplies = max8997_ldo8_,
571};
572
573static struct regulator_init_data __initdata max8997_ldo9_data = {
574 .constraints = {
575 .name = "VCC_2.8V_PDA",
576 .min_uV = 2800000,
577 .max_uV = 2800000,
578 .apply_uV = 1,
579 .always_on = 1,
580 .state_mem = {
581 .enabled = 1,
582 },
583 },
584};
585
586static struct regulator_init_data __initdata max8997_ldo10_data = {
587 .constraints = {
588 .name = "VPLL_1.1V_C210",
589 .min_uV = 1100000,
590 .max_uV = 1100000,
591 .apply_uV = 1,
592 .always_on = 1,
593 .state_mem = {
594 .disabled = 1,
595 },
596 },
597};
598
599static struct regulator_init_data __initdata max8997_ldo11_data = {
600 .constraints = {
601 .name = "LVDS_VDD3.3V",
602 .min_uV = 3300000,
603 .max_uV = 3300000,
604 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
605 .apply_uV = 1,
606 .boot_on = 1,
607 .state_mem = {
608 .disabled = 1,
609 },
610 },
611 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_),
612 .consumer_supplies = max8997_ldo11_,
613};
614
615static struct regulator_init_data __initdata max8997_ldo12_data = {
616 .constraints = {
617 .name = "VT_CAM_1.8V",
618 .min_uV = 1800000,
619 .max_uV = 1800000,
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_ldo12_),
627 .consumer_supplies = max8997_ldo12_,
628};
629
630static struct regulator_init_data __initdata max8997_ldo13_data = {
631 .constraints = {
632 .name = "VTF_2.8V",
633 .min_uV = 2800000,
634 .max_uV = 2800000,
635 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
636 .apply_uV = 1,
637 .state_mem = {
638 .disabled = 1,
639 },
640 },
641 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_),
642 .consumer_supplies = max8997_ldo13_,
643};
644
645static struct regulator_init_data __initdata max8997_ldo14_data = {
646 .constraints = {
647 .name = "VCC_3.0V_MOTOR",
648 .min_uV = 3000000,
649 .max_uV = 3000000,
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_ldo14_),
657 .consumer_supplies = max8997_ldo14_,
658};
659
660static struct regulator_init_data __initdata max8997_ldo15_data = {
661 .constraints = {
662 .name = "VTOUCH_ADVV2.8V",
663 .min_uV = 2800000,
664 .max_uV = 2800000,
665 .apply_uV = 1,
666 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
667 .state_mem = {
668 .disabled = 1,
669 },
670 },
671 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_),
672 .consumer_supplies = max8997_ldo15_,
673};
674
675static struct regulator_init_data __initdata max8997_ldo16_data = {
676 .constraints = {
677 .name = "CAM_SENSOR_IO_1.8V",
678 .min_uV = 1800000,
679 .max_uV = 1800000,
680 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
681 .apply_uV = 1,
682 .state_mem = {
683 .disabled = 1,
684 },
685 },
686 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_),
687 .consumer_supplies = max8997_ldo16_,
688};
689
690static struct regulator_init_data __initdata max8997_ldo18_data = {
691 .constraints = {
692 .name = "VTOUCH_VDD2.8V",
693 .min_uV = 2800000,
694 .max_uV = 2800000,
695 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
696 .apply_uV = 1,
697 .state_mem = {
698 .disabled = 1,
699 },
700 },
701 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_),
702 .consumer_supplies = max8997_ldo18_,
703};
704
705static struct regulator_init_data __initdata max8997_ldo21_data = {
706 .constraints = {
707 .name = "VDDQ_M1M2_1.2V",
708 .min_uV = 1200000,
709 .max_uV = 1200000,
710 .apply_uV = 1,
711 .always_on = 1,
712 .state_mem = {
713 .disabled = 1,
714 },
715 },
716};
717
718static struct regulator_init_data __initdata max8997_buck1_data = {
719 .constraints = {
720 .name = "VARM_1.2V_C210",
721 .min_uV = 900000,
722 .max_uV = 1350000,
723 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
724 .always_on = 1,
725 .state_mem = {
726 .disabled = 1,
727 },
728 },
729 .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_),
730 .consumer_supplies = max8997_buck1_,
731};
732
733static struct regulator_init_data __initdata max8997_buck2_data = {
734 .constraints = {
735 .name = "VINT_1.1V_C210",
736 .min_uV = 900000,
MyungJoo Hambae82bd2011-12-01 16:00:38 +0900737 .max_uV = 1200000,
MyungJoo Ham29dee862011-07-21 00:31:27 +0900738 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
739 .always_on = 1,
740 .state_mem = {
741 .disabled = 1,
742 },
743 },
744 .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_),
745 .consumer_supplies = max8997_buck2_,
746};
747
748static struct regulator_init_data __initdata max8997_buck3_data = {
749 .constraints = {
750 .name = "VG3D_1.1V_C210",
751 .min_uV = 900000,
752 .max_uV = 1100000,
753 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
754 REGULATOR_CHANGE_STATUS,
755 .state_mem = {
756 .disabled = 1,
757 },
758 },
759 .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_),
760 .consumer_supplies = max8997_buck3_,
761};
762
763static struct regulator_init_data __initdata max8997_buck4_data = {
764 .constraints = {
765 .name = "CAM_ISP_CORE_1.2V",
766 .min_uV = 1200000,
767 .max_uV = 1200000,
768 .apply_uV = 1,
769 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
770 .state_mem = {
771 .disabled = 1,
772 },
773 },
774 .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_),
775 .consumer_supplies = max8997_buck4_,
776};
777
778static struct regulator_init_data __initdata max8997_buck5_data = {
779 .constraints = {
780 .name = "VMEM_1.2V_C210",
781 .min_uV = 1200000,
782 .max_uV = 1200000,
783 .apply_uV = 1,
784 .always_on = 1,
785 .state_mem = {
786 .enabled = 1,
787 },
788 },
789};
790
791static struct regulator_init_data __initdata max8997_buck6_data = {
792 .constraints = {
793 .name = "CAM_AF_2.8V",
794 .min_uV = 2800000,
795 .max_uV = 2800000,
796 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
797 .state_mem = {
798 .disabled = 1,
799 },
800 },
801 .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_),
802 .consumer_supplies = max8997_buck6_,
803};
804
805static struct regulator_init_data __initdata max8997_buck7_data = {
806 .constraints = {
807 .name = "VCC_SUB_2.0V",
808 .min_uV = 2000000,
809 .max_uV = 2000000,
810 .apply_uV = 1,
811 .always_on = 1,
812 .state_mem = {
813 .enabled = 1,
814 },
815 },
816};
817
818static struct regulator_init_data __initdata max8997_32khz_ap_data = {
819 .constraints = {
820 .name = "32KHz AP",
821 .always_on = 1,
822 .state_mem = {
823 .enabled = 1,
824 },
825 },
826 .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_),
827 .consumer_supplies = max8997_32khz_ap_,
828};
829
830static struct regulator_init_data __initdata max8997_32khz_cp_data = {
831 .constraints = {
832 .name = "32KHz CP",
833 .state_mem = {
834 .disabled = 1,
835 },
836 },
837};
838
839static struct regulator_init_data __initdata max8997_vichg_data = {
840 .constraints = {
841 .name = "VICHG",
842 .state_mem = {
843 .disabled = 1,
844 },
845 },
846};
847
848static struct regulator_init_data __initdata max8997_esafeout1_data = {
849 .constraints = {
850 .name = "SAFEOUT1",
851 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
Joonyoung Shim8d07dbb2012-05-13 08:25:24 +0900852 .always_on = 1,
MyungJoo Ham29dee862011-07-21 00:31:27 +0900853 .state_mem = {
854 .disabled = 1,
855 },
856 },
857 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_),
858 .consumer_supplies = max8997_esafeout1_,
859};
860
861static struct regulator_init_data __initdata max8997_esafeout2_data = {
862 .constraints = {
863 .name = "SAFEOUT2",
864 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
865 .state_mem = {
866 .disabled = 1,
867 },
868 },
869 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_),
870 .consumer_supplies = max8997_esafeout2_,
871};
872
873static struct regulator_init_data __initdata max8997_charger_cv_data = {
874 .constraints = {
875 .name = "CHARGER_CV",
876 .min_uV = 4200000,
877 .max_uV = 4200000,
878 .apply_uV = 1,
879 },
880};
881
882static struct regulator_init_data __initdata max8997_charger_data = {
883 .constraints = {
884 .name = "CHARGER",
885 .min_uA = 200000,
886 .max_uA = 950000,
887 .boot_on = 1,
888 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
889 REGULATOR_CHANGE_CURRENT,
890 },
891 .num_consumer_supplies = ARRAY_SIZE(max8997_charger_),
892 .consumer_supplies = max8997_charger_,
893};
894
895static struct regulator_init_data __initdata max8997_charger_topoff_data = {
896 .constraints = {
897 .name = "CHARGER TOPOFF",
898 .min_uA = 50000,
899 .max_uA = 200000,
900 .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
901 },
902 .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_),
903 .consumer_supplies = max8997_chg_toff_,
904};
905
906static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = {
907 { MAX8997_LDO1, &max8997_ldo1_data },
908 { MAX8997_LDO2, &max8997_ldo2_data },
909 { MAX8997_LDO3, &max8997_ldo3_data },
910 { MAX8997_LDO4, &max8997_ldo4_data },
911 { MAX8997_LDO5, &max8997_ldo5_data },
912 { MAX8997_LDO6, &max8997_ldo6_data },
913 { MAX8997_LDO7, &max8997_ldo7_data },
914 { MAX8997_LDO8, &max8997_ldo8_data },
915 { MAX8997_LDO9, &max8997_ldo9_data },
916 { MAX8997_LDO10, &max8997_ldo10_data },
917 { MAX8997_LDO11, &max8997_ldo11_data },
918 { MAX8997_LDO12, &max8997_ldo12_data },
919 { MAX8997_LDO13, &max8997_ldo13_data },
920 { MAX8997_LDO14, &max8997_ldo14_data },
921 { MAX8997_LDO15, &max8997_ldo15_data },
922 { MAX8997_LDO16, &max8997_ldo16_data },
923
924 { MAX8997_LDO18, &max8997_ldo18_data },
925 { MAX8997_LDO21, &max8997_ldo21_data },
926
927 { MAX8997_BUCK1, &max8997_buck1_data },
928 { MAX8997_BUCK2, &max8997_buck2_data },
929 { MAX8997_BUCK3, &max8997_buck3_data },
930 { MAX8997_BUCK4, &max8997_buck4_data },
931 { MAX8997_BUCK5, &max8997_buck5_data },
932 { MAX8997_BUCK6, &max8997_buck6_data },
933 { MAX8997_BUCK7, &max8997_buck7_data },
934
935 { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data },
936 { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data },
937
938 { MAX8997_ENVICHG, &max8997_vichg_data },
939 { MAX8997_ESAFEOUT1, &max8997_esafeout1_data },
940 { MAX8997_ESAFEOUT2, &max8997_esafeout2_data },
941 { MAX8997_CHARGER_CV, &max8997_charger_cv_data },
942 { MAX8997_CHARGER, &max8997_charger_data },
943 { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data },
944};
945
946static struct max8997_platform_data __initdata nuri_max8997_pdata = {
947 .wakeup = 1,
948
949 .num_regulators = ARRAY_SIZE(nuri_max8997_regulators),
950 .regulators = nuri_max8997_regulators,
951
952 .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
MyungJoo Ham29dee862011-07-21 00:31:27 +0900953
954 .buck1_voltage[0] = 1350000, /* 1.35V */
955 .buck1_voltage[1] = 1300000, /* 1.3V */
956 .buck1_voltage[2] = 1250000, /* 1.25V */
957 .buck1_voltage[3] = 1200000, /* 1.2V */
958 .buck1_voltage[4] = 1150000, /* 1.15V */
959 .buck1_voltage[5] = 1100000, /* 1.1V */
960 .buck1_voltage[6] = 1000000, /* 1.0V */
961 .buck1_voltage[7] = 950000, /* 0.95V */
962
963 .buck2_voltage[0] = 1100000, /* 1.1V */
964 .buck2_voltage[1] = 1000000, /* 1.0V */
965 .buck2_voltage[2] = 950000, /* 0.95V */
966 .buck2_voltage[3] = 900000, /* 0.9V */
967 .buck2_voltage[4] = 1100000, /* 1.1V */
968 .buck2_voltage[5] = 1000000, /* 1.0V */
969 .buck2_voltage[6] = 950000, /* 0.95V */
970 .buck2_voltage[7] = 900000, /* 0.9V */
971
972 .buck5_voltage[0] = 1200000, /* 1.2V */
973 .buck5_voltage[1] = 1200000, /* 1.2V */
974 .buck5_voltage[2] = 1200000, /* 1.2V */
975 .buck5_voltage[3] = 1200000, /* 1.2V */
976 .buck5_voltage[4] = 1200000, /* 1.2V */
977 .buck5_voltage[5] = 1200000, /* 1.2V */
978 .buck5_voltage[6] = 1200000, /* 1.2V */
979 .buck5_voltage[7] = 1200000, /* 1.2V */
980};
981
982/* GPIO I2C 5 (PMIC) */
983enum { I2C5_MAX8997 };
984static struct i2c_board_info i2c5_devs[] __initdata = {
985 [I2C5_MAX8997] = {
986 I2C_BOARD_INFO("max8997", 0xCC >> 1),
987 .platform_data = &nuri_max8997_pdata,
988 },
989};
990
MyungJoo Hama140b922011-07-21 00:31:27 +0900991static struct max17042_platform_data nuri_battery_platform_data = {
992};
993
994/* GPIO I2C 9 (Fuel Gauge) */
995static struct i2c_gpio_platform_data i2c9_gpio_data = {
996 .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */
997 .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */
998};
999static struct platform_device i2c9_gpio = {
1000 .name = "i2c-gpio",
1001 .id = 9,
1002 .dev = {
1003 .platform_data = &i2c9_gpio_data,
1004 },
1005};
1006enum { I2C9_MAX17042};
1007static struct i2c_board_info i2c9_devs[] __initdata = {
1008 [I2C9_MAX17042] = {
1009 I2C_BOARD_INFO("max17042", 0x36),
1010 .platform_data = &nuri_battery_platform_data,
1011 },
1012};
1013
MyungJoo Ham605baf62011-07-21 00:31:27 +09001014/* MAX8903 Secondary Charger */
1015static struct regulator_consumer_supply supplies_max8903[] = {
1016 REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
1017};
1018
1019static struct regulator_init_data max8903_charger_en_data = {
1020 .constraints = {
1021 .name = "VOUT_CHARGER",
1022 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
1023 .boot_on = 1,
1024 },
1025 .num_consumer_supplies = ARRAY_SIZE(supplies_max8903),
1026 .consumer_supplies = supplies_max8903,
1027};
1028
1029static struct fixed_voltage_config max8903_charger_en = {
1030 .supply_name = "VOUT_CHARGER",
1031 .microvolts = 5000000, /* Assume 5VDC */
1032 .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */
1033 .enable_high = 0, /* Enable = Low */
1034 .enabled_at_boot = 1,
1035 .init_data = &max8903_charger_en_data,
1036};
1037
1038static struct platform_device max8903_fixed_reg_dev = {
1039 .name = "reg-fixed-voltage",
1040 .id = FIXED_REG_ID_MAX8903,
1041 .dev = { .platform_data = &max8903_charger_en },
1042};
1043
1044static struct max8903_pdata nuri_max8903 = {
1045 /*
1046 * cen: don't control with the driver, let it be
1047 * controlled by regulator above
1048 */
1049 .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */
1050 /* uok, usus: not connected */
1051 .chg = EXYNOS4_GPE2(0), /* TA_nCHG */
1052 /* flt: vcc_1.8V_pda */
1053 .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */
1054
1055 .dc_valid = true,
1056 .usb_valid = false, /* USB is not wired to MAX8903 */
1057};
1058
1059static struct platform_device nuri_max8903_device = {
1060 .name = "max8903-charger",
1061 .dev = {
1062 .platform_data = &nuri_max8903,
1063 },
1064};
1065
MyungJoo Ham29dee862011-07-21 00:31:27 +09001066static void __init nuri_power_init(void)
1067{
1068 int gpio;
MyungJoo Ham605baf62011-07-21 00:31:27 +09001069 int ta_en = 0;
MyungJoo Ham29dee862011-07-21 00:31:27 +09001070
MyungJoo Ham29dee862011-07-21 00:31:27 +09001071 gpio = EXYNOS4_GPX0(7);
1072 gpio_request(gpio, "AP_PMIC_IRQ");
1073 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1074 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
MyungJoo Hama140b922011-07-21 00:31:27 +09001075
1076 gpio = EXYNOS4_GPX2(3);
1077 gpio_request(gpio, "FUEL_ALERT");
1078 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1079 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
MyungJoo Ham605baf62011-07-21 00:31:27 +09001080
1081 gpio = nuri_max8903.dok;
1082 gpio_request(gpio, "TA_nCONNECTED");
1083 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1084 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1085 ta_en = gpio_get_value(gpio) ? 0 : 1;
1086
1087 gpio = nuri_max8903.chg;
1088 gpio_request(gpio, "TA_nCHG");
1089 gpio_direction_input(gpio);
1090
1091 gpio = nuri_max8903.dcm;
1092 gpio_request(gpio, "CURR_ADJ");
1093 gpio_direction_output(gpio, ta_en);
MyungJoo Ham29dee862011-07-21 00:31:27 +09001094}
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001095
Joonyoung Shim01da92f2011-04-08 13:22:11 +09001096/* USB EHCI */
1097static struct s5p_ehci_platdata nuri_ehci_pdata;
1098
1099static void __init nuri_ehci_init(void)
1100{
1101 struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
1102
1103 s5p_ehci_set_platdata(pdata);
1104}
1105
Joonyoung Shim8d07dbb2012-05-13 08:25:24 +09001106/* USB OTG */
1107static struct s3c_hsotg_plat nuri_hsotg_pdata;
1108
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001109/* CAMERA */
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001110static struct regulator_consumer_supply cam_vt_cam15_supply =
1111 REGULATOR_SUPPLY("vdd_core", "6-003c");
1112
1113static struct regulator_init_data cam_vt_cam15_reg_init_data = {
1114 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1115 .num_consumer_supplies = 1,
1116 .consumer_supplies = &cam_vt_cam15_supply,
1117};
1118
1119static struct fixed_voltage_config cam_vt_cam15_fixed_voltage_cfg = {
1120 .supply_name = "VT_CAM_1.5V",
1121 .microvolts = 1500000,
1122 .gpio = EXYNOS4_GPE2(2), /* VT_CAM_1.5V_EN */
1123 .enable_high = 1,
1124 .init_data = &cam_vt_cam15_reg_init_data,
1125};
1126
1127static struct platform_device cam_vt_cam15_fixed_rdev = {
1128 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_15V,
1129 .dev = { .platform_data = &cam_vt_cam15_fixed_voltage_cfg },
1130};
1131
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001132static struct regulator_consumer_supply cam_vdda_supply[] = {
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001133 REGULATOR_SUPPLY("vdda", "6-003c"),
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001134 REGULATOR_SUPPLY("a_sensor", "0-001f"),
1135};
1136
1137static struct regulator_init_data cam_vdda_reg_init_data = {
1138 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1139 .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply),
1140 .consumer_supplies = cam_vdda_supply,
1141};
1142
1143static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = {
1144 .supply_name = "CAM_IO_EN",
1145 .microvolts = 2800000,
1146 .gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */
1147 .enable_high = 1,
1148 .init_data = &cam_vdda_reg_init_data,
1149};
1150
1151static struct platform_device cam_vdda_fixed_rdev = {
1152 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V,
1153 .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg },
1154};
1155
1156static struct regulator_consumer_supply camera_8m_12v_supply =
1157 REGULATOR_SUPPLY("dig_12", "0-001f");
1158
1159static struct regulator_init_data cam_8m_12v_reg_init_data = {
1160 .num_consumer_supplies = 1,
1161 .consumer_supplies = &camera_8m_12v_supply,
1162 .constraints = {
1163 .valid_ops_mask = REGULATOR_CHANGE_STATUS
1164 },
1165};
1166
1167static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = {
1168 .supply_name = "8M_1.2V",
1169 .microvolts = 1200000,
1170 .gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */
1171 .enable_high = 1,
1172 .init_data = &cam_8m_12v_reg_init_data,
1173};
1174
1175static struct platform_device cam_8m_12v_fixed_rdev = {
1176 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V,
1177 .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg },
1178};
1179
1180static struct s5p_platform_mipi_csis mipi_csis_platdata = {
1181 .clk_rate = 166000000UL,
1182 .lanes = 2,
1183 .alignment = 32,
1184 .hs_settle = 12,
1185 .phy_enable = s5p_csis_phy_enable,
1186};
1187
1188#define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */
1189#define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5)
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001190#define GPIO_CAM_VT_NSTBY EXYNOS4_GPL2(0)
1191#define GPIO_CAM_VT_NRST EXYNOS4_GPL2(1)
1192
1193static struct s5k6aa_platform_data s5k6aa_pldata = {
1194 .mclk_frequency = 24000000UL,
1195 .gpio_reset = { GPIO_CAM_VT_NRST, 0 },
1196 .gpio_stby = { GPIO_CAM_VT_NSTBY, 0 },
1197 .bus_type = V4L2_MBUS_PARALLEL,
1198 .horiz_flip = 1,
1199};
1200
1201static struct i2c_board_info s5k6aa_board_info = {
1202 I2C_BOARD_INFO("S5K6AA", 0x3c),
1203 .platform_data = &s5k6aa_pldata,
1204};
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001205
1206static struct m5mols_platform_data m5mols_platdata = {
1207 .gpio_reset = GPIO_CAM_MEGA_RST,
1208};
1209
1210static struct i2c_board_info m5mols_board_info = {
1211 I2C_BOARD_INFO("M5MOLS", 0x1F),
1212 .platform_data = &m5mols_platdata,
1213};
1214
1215static struct s5p_fimc_isp_info nuri_camera_sensors[] = {
1216 {
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001217 .flags = V4L2_MBUS_PCLK_SAMPLE_RISING |
1218 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1219 .bus_type = FIMC_ITU_601,
1220 .board_info = &s5k6aa_board_info,
1221 .clk_frequency = 24000000UL,
1222 .i2c_bus_num = 6,
1223 }, {
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001224 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
1225 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1226 .bus_type = FIMC_MIPI_CSI2,
1227 .board_info = &m5mols_board_info,
1228 .clk_frequency = 24000000UL,
1229 .csi_data_align = 32,
1230 },
1231};
1232
1233static struct s5p_platform_fimc fimc_md_platdata = {
1234 .isp_info = nuri_camera_sensors,
1235 .num_clients = ARRAY_SIZE(nuri_camera_sensors),
1236};
1237
1238static struct gpio nuri_camera_gpios[] = {
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001239 { GPIO_CAM_VT_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
1240 { GPIO_CAM_VT_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" },
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001241 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
1242 { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
1243};
1244
Tushar Beherafdaf1302012-03-09 08:02:33 -08001245static void __init nuri_camera_init(void)
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001246{
1247 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
1248 &s5p_device_mipi_csis0);
1249 s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
1250 &s5p_device_fimc_md);
1251
1252 if (gpio_request_array(nuri_camera_gpios,
1253 ARRAY_SIZE(nuri_camera_gpios))) {
1254 pr_err("%s: GPIO request failed\n", __func__);
1255 return;
1256 }
1257
1258 m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT);
1259 if (!IS_ERR_VALUE(m5mols_board_info.irq))
1260 s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF));
1261 else
1262 pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__);
1263
1264 /* Free GPIOs controlled directly by the sensor drivers. */
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001265 gpio_free(GPIO_CAM_VT_NRST);
1266 gpio_free(GPIO_CAM_VT_NSTBY);
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001267 gpio_free(GPIO_CAM_MEGA_RST);
1268
1269 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) {
1270 pr_err("%s: Camera port A setup failed\n", __func__);
1271 return;
1272 }
1273 /* Increase drive strength of the sensor clock output */
1274 s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4);
1275}
1276
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001277static struct s3c2410_platform_i2c nuri_i2c6_platdata __initdata = {
1278 .frequency = 400000U,
1279 .sda_delay = 200,
1280 .bus_num = 6,
1281};
1282
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001283static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = {
1284 .frequency = 400000U,
1285 .sda_delay = 200,
1286};
1287
MyungJoo Hambae82bd2011-12-01 16:00:38 +09001288/* DEVFREQ controlling memory/bus */
1289static struct platform_device exynos4_bus_devfreq = {
1290 .name = "exynos4210-busfreq",
1291};
1292
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001293static struct platform_device *nuri_devices[] __initdata = {
1294 /* Samsung Platform Devices */
MyungJoo Ham29dee862011-07-21 00:31:27 +09001295 &s3c_device_i2c5, /* PMIC should initialize first */
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001296 &s3c_device_i2c0,
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001297 &s3c_device_i2c6,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001298 &emmc_fixed_voltage,
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001299 &s5p_device_mipi_csis0,
1300 &s5p_device_fimc0,
1301 &s5p_device_fimc1,
1302 &s5p_device_fimc2,
1303 &s5p_device_fimc3,
Marek Szyprowski0d88f942011-08-11 19:57:28 +09001304 &s5p_device_fimd0,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001305 &s3c_device_hsmmc0,
1306 &s3c_device_hsmmc2,
1307 &s3c_device_hsmmc3,
1308 &s3c_device_wdt,
Donghwa Leecc7df872011-03-08 07:17:09 +09001309 &s3c_device_timer[0],
Joonyoung Shim01da92f2011-04-08 13:22:11 +09001310 &s5p_device_ehci,
Joonyoung Shim3260ecd2011-03-23 15:25:14 +09001311 &s3c_device_i2c3,
MyungJoo Hama140b922011-07-21 00:31:27 +09001312 &i2c9_gpio,
MyungJoo Hamed9ba312011-07-21 00:31:27 +09001313 &s3c_device_adc,
Kamil Debskiec004662011-12-27 17:16:47 +09001314 &s5p_device_g2d,
Andrzej Pietrasiewicz72bce7b2012-03-09 08:25:25 -08001315 &s5p_device_jpeg,
MyungJoo Ham3a1a2b92011-07-21 00:31:27 +09001316 &s3c_device_rtc,
Marek Szyprowski4c0f0a32011-07-21 16:43:25 +09001317 &s5p_device_mfc,
1318 &s5p_device_mfc_l,
1319 &s5p_device_mfc_r,
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001320 &s5p_device_fimc_md,
Joonyoung Shim8d07dbb2012-05-13 08:25:24 +09001321 &s3c_device_usb_hsotg,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001322
1323 /* NURI Devices */
1324 &nuri_gpio_keys,
Donghwa Leecc7df872011-03-08 07:17:09 +09001325 &nuri_lcd_device,
1326 &nuri_backlight_device,
MyungJoo Ham605baf62011-07-21 00:31:27 +09001327 &max8903_fixed_reg_dev,
1328 &nuri_max8903_device,
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001329 &cam_vt_cam15_fixed_rdev,
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001330 &cam_vdda_fixed_rdev,
1331 &cam_8m_12v_fixed_rdev,
MyungJoo Hambae82bd2011-12-01 16:00:38 +09001332 &exynos4_bus_devfreq,
Marek Szyprowskidb6856e2012-05-12 06:41:06 +09001333#ifdef CONFIG_DRM_EXYNOS
1334 &exynos_device_drm,
1335#endif
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001336};
1337
1338static void __init nuri_map_io(void)
1339{
Kukjin Kimcc511b82011-12-27 08:18:36 +01001340 exynos_init_io(NULL, 0);
Kukjin Kim2e274372012-07-12 18:03:52 +09001341 s3c24xx_init_clocks(clk_xusbxti.rate);
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001342 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
1343}
1344
Marek Szyprowski4c0f0a32011-07-21 16:43:25 +09001345static void __init nuri_reserve(void)
1346{
1347 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
1348}
1349
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001350static void __init nuri_machine_init(void)
1351{
1352 nuri_sdhci_init();
Joonyoung Shim3260ecd2011-03-23 15:25:14 +09001353 nuri_tsp_init();
MyungJoo Ham29dee862011-07-21 00:31:27 +09001354 nuri_power_init();
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001355
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001356 s3c_i2c0_set_platdata(&nuri_i2c0_platdata);
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001357 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
Joonyoung Shim3260ecd2011-03-23 15:25:14 +09001358 s3c_i2c3_set_platdata(&i2c3_data);
1359 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
MyungJoo Ham29dee862011-07-21 00:31:27 +09001360 s3c_i2c5_set_platdata(NULL);
1361 i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7));
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001362 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
MyungJoo Hama140b922011-07-21 00:31:27 +09001363 i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
1364 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001365 s3c_i2c6_set_platdata(&nuri_i2c6_platdata);
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001366
Marek Szyprowskidb6856e2012-05-12 06:41:06 +09001367#ifdef CONFIG_DRM_EXYNOS
1368 s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
1369 exynos4_fimd0_gpio_setup_24bpp();
1370#else
Marek Szyprowski0d88f942011-08-11 19:57:28 +09001371 s5p_fimd0_set_platdata(&nuri_fb_pdata);
Marek Szyprowskidb6856e2012-05-12 06:41:06 +09001372#endif
Marek Szyprowski0d88f942011-08-11 19:57:28 +09001373
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001374 nuri_camera_init();
1375
Joonyoung Shim01da92f2011-04-08 13:22:11 +09001376 nuri_ehci_init();
Joonyoung Shim8d07dbb2012-05-13 08:25:24 +09001377 s3c_hsotg_set_platdata(&nuri_hsotg_pdata);
Joonyoung Shim01da92f2011-04-08 13:22:11 +09001378
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001379 /* Last */
1380 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
1381}
1382
1383MACHINE_START(NURI, "NURI")
1384 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
Nicolas Pitre2be5a4a2011-07-05 22:38:11 -04001385 .atag_offset = 0x100,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001386 .init_irq = exynos4_init_irq,
1387 .map_io = nuri_map_io,
Marc Zyngier4e44d2c2011-05-30 11:04:53 +01001388 .handle_irq = gic_handle_irq,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001389 .init_machine = nuri_machine_init,
Shawn Guobb13fab2012-04-26 10:35:40 +08001390 .init_late = exynos_init_late,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001391 .timer = &exynos4_timer,
Marek Szyprowski4c0f0a32011-07-21 16:43:25 +09001392 .reserve = &nuri_reserve,
Russell King9eb48592012-01-03 11:56:53 +01001393 .restart = exynos4_restart,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001394MACHINE_END