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