Commit | Line | Data |
---|---|---|
caf8b1f2 MK |
1 | /* |
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> | |
3260ecd8 | 15 | #include <linux/i2c/atmel_mxt_ts.h> |
a140b92e | 16 | #include <linux/i2c-gpio.h> |
caf8b1f2 MK |
17 | #include <linux/gpio_keys.h> |
18 | #include <linux/gpio.h> | |
605baf67 | 19 | #include <linux/power/max8903_charger.h> |
a140b92e | 20 | #include <linux/power/max17042_battery.h> |
caf8b1f2 MK |
21 | #include <linux/regulator/machine.h> |
22 | #include <linux/regulator/fixed.h> | |
29dee863 MH |
23 | #include <linux/mfd/max8997.h> |
24 | #include <linux/mfd/max8997-private.h> | |
caf8b1f2 | 25 | #include <linux/mmc/host.h> |
cc7df872 DL |
26 | #include <linux/fb.h> |
27 | #include <linux/pwm_backlight.h> | |
28 | ||
29 | #include <video/platform_lcd.h> | |
716e84d1 | 30 | #include <media/m5mols.h> |
8f114e6e | 31 | #include <media/s5k6aa.h> |
716e84d1 SN |
32 | #include <media/s5p_fimc.h> |
33 | #include <media/v4l2-mediabus.h> | |
caf8b1f2 MK |
34 | |
35 | #include <asm/mach/arch.h> | |
4e44d2cb | 36 | #include <asm/hardware/gic.h> |
caf8b1f2 MK |
37 | #include <asm/mach-types.h> |
38 | ||
ed9ba31f | 39 | #include <plat/adc.h> |
0d88f946 | 40 | #include <plat/regs-fb-v4.h> |
caf8b1f2 | 41 | #include <plat/regs-serial.h> |
caf8b1f2 MK |
42 | #include <plat/cpu.h> |
43 | #include <plat/devs.h> | |
0d88f946 | 44 | #include <plat/fb.h> |
caf8b1f2 | 45 | #include <plat/sdhci.h> |
01da92f7 | 46 | #include <plat/ehci.h> |
127d42ae | 47 | #include <linux/platform_data/s3c-hsotg.h> |
01da92f7 | 48 | #include <plat/clock.h> |
3260ecd8 JS |
49 | #include <plat/gpio-cfg.h> |
50 | #include <plat/iic.h> | |
4c0f0a3e MS |
51 | #include <plat/mfc.h> |
52 | #include <plat/pd.h> | |
716e84d1 SN |
53 | #include <plat/fimc-core.h> |
54 | #include <plat/camport.h> | |
55 | #include <plat/mipi_csis.h> | |
caf8b1f2 MK |
56 | |
57 | #include <mach/map.h> | |
58 | ||
cc511b8d KK |
59 | #include "common.h" |
60 | ||
caf8b1f2 MK |
61 | /* 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 | ||
75 | enum fixed_regulator_id { | |
76 | FIXED_REG_ID_MMC = 0, | |
605baf67 | 77 | FIXED_REG_ID_MAX8903, |
716e84d1 SN |
78 | FIXED_REG_ID_CAM_A28V, |
79 | FIXED_REG_ID_CAM_12V, | |
8f114e6e | 80 | FIXED_REG_ID_CAM_VT_15V, |
caf8b1f2 MK |
81 | }; |
82 | ||
83 | static 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 */ | |
111 | static 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 | | |
907d2e7c | 115 | MMC_CAP_ERASE), |
9b4d1cbb | 116 | .host_caps2 = MMC_CAP2_BROKEN_VOLTAGE, |
caf8b1f2 MK |
117 | .cd_type = S3C_SDHCI_CD_PERMANENT, |
118 | .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL, | |
119 | }; | |
120 | ||
121 | static struct regulator_consumer_supply emmc_supplies[] = { | |
f5cca864 | 122 | REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"), |
caf8b1f2 MK |
123 | REGULATOR_SUPPLY("vmmc", "dw_mmc"), |
124 | }; | |
125 | ||
126 | static 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 | ||
135 | static 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 | ||
143 | static 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 */ | |
152 | static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = { | |
153 | .max_width = 4, | |
154 | .host_caps = MMC_CAP_4_BIT_DATA | | |
907d2e7c | 155 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED, |
caf8b1f2 MK |
156 | .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 */ | |
163 | static 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 | ||
171 | static 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 */ | |
179 | static 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 | ||
205 | static 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 | ||
210 | static struct platform_device nuri_gpio_keys = { | |
211 | .name = "gpio-keys", | |
212 | .dev = { | |
213 | .platform_data = &nuri_gpio_keys_data, | |
214 | }, | |
215 | }; | |
216 | ||
0d88f946 MS |
217 | /* Frame Buffer */ |
218 | static struct s3c_fb_pd_win nuri_fb_win0 = { | |
219 | .win_mode = { | |
220 | .left_margin = 64, | |
221 | .right_margin = 16, | |
222 | .upper_margin = 64, | |
223 | .lower_margin = 1, | |
224 | .hsync_len = 48, | |
225 | .vsync_len = 3, | |
7cc98aae SN |
226 | .xres = 1024, |
227 | .yres = 600, | |
0d88f946 MS |
228 | .refresh = 60, |
229 | }, | |
230 | .max_bpp = 24, | |
231 | .default_bpp = 16, | |
7cc98aae SN |
232 | .virtual_x = 1024, |
233 | .virtual_y = 2 * 600, | |
0d88f946 MS |
234 | }; |
235 | ||
236 | static struct s3c_fb_platdata nuri_fb_pdata __initdata = { | |
237 | .win[0] = &nuri_fb_win0, | |
238 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB | | |
239 | VIDCON0_CLKSEL_LCD, | |
240 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, | |
241 | .setup_gpio = exynos4_fimd0_gpio_setup_24bpp, | |
242 | }; | |
243 | ||
cc7df872 DL |
244 | static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power) |
245 | { | |
246 | int gpio = EXYNOS4_GPE1(5); | |
247 | ||
248 | gpio_request(gpio, "LVDS_nSHDN"); | |
249 | gpio_direction_output(gpio, power); | |
250 | gpio_free(gpio); | |
251 | } | |
252 | ||
253 | static int nuri_bl_init(struct device *dev) | |
254 | { | |
321655ef JH |
255 | return gpio_request_one(EXYNOS4_GPE2(3), GPIOF_OUT_INIT_LOW, |
256 | "LCD_LD0_EN"); | |
cc7df872 DL |
257 | } |
258 | ||
259 | static int nuri_bl_notify(struct device *dev, int brightness) | |
260 | { | |
261 | if (brightness < 1) | |
262 | brightness = 0; | |
263 | ||
264 | gpio_set_value(EXYNOS4_GPE2(3), 1); | |
265 | ||
266 | return brightness; | |
267 | } | |
268 | ||
269 | static void nuri_bl_exit(struct device *dev) | |
270 | { | |
271 | gpio_free(EXYNOS4_GPE2(3)); | |
272 | } | |
273 | ||
274 | /* nuri pwm backlight */ | |
275 | static struct platform_pwm_backlight_data nuri_backlight_data = { | |
276 | .pwm_id = 0, | |
277 | .pwm_period_ns = 30000, | |
278 | .max_brightness = 100, | |
279 | .dft_brightness = 50, | |
280 | .init = nuri_bl_init, | |
281 | .notify = nuri_bl_notify, | |
282 | .exit = nuri_bl_exit, | |
283 | }; | |
284 | ||
285 | static struct platform_device nuri_backlight_device = { | |
286 | .name = "pwm-backlight", | |
287 | .id = -1, | |
288 | .dev = { | |
289 | .parent = &s3c_device_timer[0].dev, | |
290 | .platform_data = &nuri_backlight_data, | |
291 | }, | |
292 | }; | |
293 | ||
294 | static struct plat_lcd_data nuri_lcd_platform_data = { | |
295 | .set_power = nuri_lcd_power_on, | |
296 | }; | |
297 | ||
298 | static struct platform_device nuri_lcd_device = { | |
299 | .name = "platform-lcd", | |
300 | .id = -1, | |
301 | .dev = { | |
302 | .platform_data = &nuri_lcd_platform_data, | |
303 | }, | |
304 | }; | |
305 | ||
caf8b1f2 MK |
306 | /* I2C1 */ |
307 | static struct i2c_board_info i2c1_devs[] __initdata = { | |
308 | /* Gyro, To be updated */ | |
309 | }; | |
310 | ||
3260ecd8 | 311 | /* TSP */ |
3260ecd8 | 312 | static struct mxt_platform_data mxt_platform_data = { |
3260ecd8 JS |
313 | .x_line = 18, |
314 | .y_line = 11, | |
315 | .x_size = 1024, | |
316 | .y_size = 600, | |
317 | .blen = 0x1, | |
318 | .threshold = 0x28, | |
319 | .voltage = 2800000, /* 2.8V */ | |
320 | .orient = MXT_DIAGONAL_COUNTER, | |
321 | .irqflags = IRQF_TRIGGER_FALLING, | |
322 | }; | |
323 | ||
324 | static struct s3c2410_platform_i2c i2c3_data __initdata = { | |
325 | .flags = 0, | |
326 | .bus_num = 3, | |
327 | .slave_addr = 0x10, | |
328 | .frequency = 400 * 1000, | |
329 | .sda_delay = 100, | |
330 | }; | |
331 | ||
332 | static struct i2c_board_info i2c3_devs[] __initdata = { | |
333 | { | |
334 | I2C_BOARD_INFO("atmel_mxt_ts", 0x4a), | |
335 | .platform_data = &mxt_platform_data, | |
336 | .irq = IRQ_EINT(4), | |
337 | }, | |
338 | }; | |
339 | ||
340 | static void __init nuri_tsp_init(void) | |
341 | { | |
342 | int gpio; | |
343 | ||
344 | /* TOUCH_INT: XEINT_4 */ | |
345 | gpio = EXYNOS4_GPX0(4); | |
346 | gpio_request(gpio, "TOUCH_INT"); | |
347 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | |
348 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | |
349 | } | |
350 | ||
29dee863 MH |
351 | static struct regulator_consumer_supply __initdata max8997_ldo1_[] = { |
352 | REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */ | |
353 | }; | |
354 | static struct regulator_consumer_supply __initdata max8997_ldo3_[] = { | |
355 | REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */ | |
356 | }; | |
357 | static struct regulator_consumer_supply __initdata max8997_ldo4_[] = { | |
358 | REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */ | |
359 | }; | |
360 | static struct regulator_consumer_supply __initdata max8997_ldo5_[] = { | |
361 | REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */ | |
362 | }; | |
8f114e6e SN |
363 | static struct regulator_consumer_supply nuri_max8997_ldo6_consumer[] = { |
364 | REGULATOR_SUPPLY("vdd_reg", "6-003c"), /* S5K6AA camera */ | |
365 | }; | |
29dee863 MH |
366 | static struct regulator_consumer_supply __initdata max8997_ldo7_[] = { |
367 | REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */ | |
368 | }; | |
369 | static struct regulator_consumer_supply __initdata max8997_ldo8_[] = { | |
370 | REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */ | |
371 | REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */ | |
372 | }; | |
373 | static struct regulator_consumer_supply __initdata max8997_ldo11_[] = { | |
374 | REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */ | |
375 | }; | |
376 | static struct regulator_consumer_supply __initdata max8997_ldo12_[] = { | |
377 | REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */ | |
378 | }; | |
379 | static struct regulator_consumer_supply __initdata max8997_ldo13_[] = { | |
f5cca864 | 380 | REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */ |
29dee863 MH |
381 | }; |
382 | static struct regulator_consumer_supply __initdata max8997_ldo14_[] = { | |
383 | REGULATOR_SUPPLY("inmotor", "max8997-haptic"), | |
384 | }; | |
385 | static struct regulator_consumer_supply __initdata max8997_ldo15_[] = { | |
386 | REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */ | |
387 | }; | |
388 | static struct regulator_consumer_supply __initdata max8997_ldo16_[] = { | |
389 | REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */ | |
390 | }; | |
391 | static struct regulator_consumer_supply __initdata max8997_ldo18_[] = { | |
392 | REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */ | |
393 | }; | |
394 | static struct regulator_consumer_supply __initdata max8997_buck1_[] = { | |
395 | REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */ | |
396 | }; | |
397 | static struct regulator_consumer_supply __initdata max8997_buck2_[] = { | |
bae82bdf | 398 | REGULATOR_SUPPLY("vdd_int", "exynos4210-busfreq.0"), /* CPUFREQ */ |
29dee863 MH |
399 | }; |
400 | static struct regulator_consumer_supply __initdata max8997_buck3_[] = { | |
401 | REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */ | |
402 | }; | |
403 | static struct regulator_consumer_supply __initdata max8997_buck4_[] = { | |
404 | REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */ | |
405 | }; | |
406 | static struct regulator_consumer_supply __initdata max8997_buck6_[] = { | |
407 | REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */ | |
408 | }; | |
409 | static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = { | |
410 | REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */ | |
411 | }; | |
412 | static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = { | |
413 | REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */ | |
414 | }; | |
415 | ||
416 | static struct regulator_consumer_supply __initdata max8997_charger_[] = { | |
417 | REGULATOR_SUPPLY("vinchg1", "charger-manager.0"), | |
418 | }; | |
419 | static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = { | |
420 | REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */ | |
421 | }; | |
422 | ||
423 | static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = { | |
424 | REGULATOR_SUPPLY("gps_clk", "bcm4751"), | |
425 | REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"), | |
426 | REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"), | |
427 | }; | |
428 | ||
429 | static struct regulator_init_data __initdata max8997_ldo1_data = { | |
430 | .constraints = { | |
431 | .name = "VADC_3.3V_C210", | |
432 | .min_uV = 3300000, | |
433 | .max_uV = 3300000, | |
434 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
435 | .apply_uV = 1, | |
436 | .state_mem = { | |
437 | .disabled = 1, | |
438 | }, | |
439 | }, | |
440 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_), | |
441 | .consumer_supplies = max8997_ldo1_, | |
442 | }; | |
443 | ||
444 | static struct regulator_init_data __initdata max8997_ldo2_data = { | |
445 | .constraints = { | |
446 | .name = "VALIVE_1.1V_C210", | |
447 | .min_uV = 1100000, | |
448 | .max_uV = 1100000, | |
449 | .apply_uV = 1, | |
450 | .always_on = 1, | |
451 | .state_mem = { | |
452 | .enabled = 1, | |
453 | }, | |
454 | }, | |
455 | }; | |
456 | ||
457 | static struct regulator_init_data __initdata max8997_ldo3_data = { | |
458 | .constraints = { | |
459 | .name = "VUSB_1.1V_C210", | |
460 | .min_uV = 1100000, | |
461 | .max_uV = 1100000, | |
462 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
463 | .apply_uV = 1, | |
464 | .state_mem = { | |
465 | .disabled = 1, | |
466 | }, | |
467 | }, | |
468 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_), | |
469 | .consumer_supplies = max8997_ldo3_, | |
470 | }; | |
471 | ||
472 | static struct regulator_init_data __initdata max8997_ldo4_data = { | |
473 | .constraints = { | |
474 | .name = "VMIPI_1.8V", | |
475 | .min_uV = 1800000, | |
476 | .max_uV = 1800000, | |
477 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
478 | .apply_uV = 1, | |
479 | .state_mem = { | |
480 | .disabled = 1, | |
481 | }, | |
482 | }, | |
483 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_), | |
484 | .consumer_supplies = max8997_ldo4_, | |
485 | }; | |
486 | ||
487 | static struct regulator_init_data __initdata max8997_ldo5_data = { | |
488 | .constraints = { | |
489 | .name = "VHSIC_1.2V_C210", | |
490 | .min_uV = 1200000, | |
491 | .max_uV = 1200000, | |
492 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
493 | .apply_uV = 1, | |
494 | .state_mem = { | |
495 | .disabled = 1, | |
496 | }, | |
497 | }, | |
498 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_), | |
499 | .consumer_supplies = max8997_ldo5_, | |
500 | }; | |
501 | ||
502 | static struct regulator_init_data __initdata max8997_ldo6_data = { | |
503 | .constraints = { | |
504 | .name = "VCC_1.8V_PDA", | |
505 | .min_uV = 1800000, | |
506 | .max_uV = 1800000, | |
507 | .apply_uV = 1, | |
508 | .always_on = 1, | |
509 | .state_mem = { | |
510 | .enabled = 1, | |
511 | }, | |
512 | }, | |
8f114e6e SN |
513 | .num_consumer_supplies = ARRAY_SIZE(nuri_max8997_ldo6_consumer), |
514 | .consumer_supplies = nuri_max8997_ldo6_consumer, | |
29dee863 MH |
515 | }; |
516 | ||
517 | static struct regulator_init_data __initdata max8997_ldo7_data = { | |
518 | .constraints = { | |
519 | .name = "CAM_ISP_1.8V", | |
520 | .min_uV = 1800000, | |
521 | .max_uV = 1800000, | |
522 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
523 | .apply_uV = 1, | |
524 | .state_mem = { | |
525 | .disabled = 1, | |
526 | }, | |
527 | }, | |
528 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_), | |
529 | .consumer_supplies = max8997_ldo7_, | |
530 | }; | |
531 | ||
532 | static struct regulator_init_data __initdata max8997_ldo8_data = { | |
533 | .constraints = { | |
f441f8a0 | 534 | .name = "VUSB+VDAC_3.3V_C210", |
29dee863 MH |
535 | .min_uV = 3300000, |
536 | .max_uV = 3300000, | |
537 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
538 | .apply_uV = 1, | |
539 | .state_mem = { | |
540 | .disabled = 1, | |
541 | }, | |
542 | }, | |
543 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_), | |
544 | .consumer_supplies = max8997_ldo8_, | |
545 | }; | |
546 | ||
547 | static struct regulator_init_data __initdata max8997_ldo9_data = { | |
548 | .constraints = { | |
549 | .name = "VCC_2.8V_PDA", | |
550 | .min_uV = 2800000, | |
551 | .max_uV = 2800000, | |
552 | .apply_uV = 1, | |
553 | .always_on = 1, | |
554 | .state_mem = { | |
555 | .enabled = 1, | |
556 | }, | |
557 | }, | |
558 | }; | |
559 | ||
560 | static struct regulator_init_data __initdata max8997_ldo10_data = { | |
561 | .constraints = { | |
562 | .name = "VPLL_1.1V_C210", | |
563 | .min_uV = 1100000, | |
564 | .max_uV = 1100000, | |
565 | .apply_uV = 1, | |
566 | .always_on = 1, | |
567 | .state_mem = { | |
568 | .disabled = 1, | |
569 | }, | |
570 | }, | |
571 | }; | |
572 | ||
573 | static struct regulator_init_data __initdata max8997_ldo11_data = { | |
574 | .constraints = { | |
575 | .name = "LVDS_VDD3.3V", | |
576 | .min_uV = 3300000, | |
577 | .max_uV = 3300000, | |
578 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
579 | .apply_uV = 1, | |
580 | .boot_on = 1, | |
581 | .state_mem = { | |
582 | .disabled = 1, | |
583 | }, | |
584 | }, | |
585 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_), | |
586 | .consumer_supplies = max8997_ldo11_, | |
587 | }; | |
588 | ||
589 | static struct regulator_init_data __initdata max8997_ldo12_data = { | |
590 | .constraints = { | |
591 | .name = "VT_CAM_1.8V", | |
592 | .min_uV = 1800000, | |
593 | .max_uV = 1800000, | |
594 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
595 | .apply_uV = 1, | |
596 | .state_mem = { | |
597 | .disabled = 1, | |
598 | }, | |
599 | }, | |
600 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_), | |
601 | .consumer_supplies = max8997_ldo12_, | |
602 | }; | |
603 | ||
604 | static struct regulator_init_data __initdata max8997_ldo13_data = { | |
605 | .constraints = { | |
606 | .name = "VTF_2.8V", | |
607 | .min_uV = 2800000, | |
608 | .max_uV = 2800000, | |
609 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
610 | .apply_uV = 1, | |
611 | .state_mem = { | |
612 | .disabled = 1, | |
613 | }, | |
614 | }, | |
615 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_), | |
616 | .consumer_supplies = max8997_ldo13_, | |
617 | }; | |
618 | ||
619 | static struct regulator_init_data __initdata max8997_ldo14_data = { | |
620 | .constraints = { | |
621 | .name = "VCC_3.0V_MOTOR", | |
622 | .min_uV = 3000000, | |
623 | .max_uV = 3000000, | |
624 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
625 | .apply_uV = 1, | |
626 | .state_mem = { | |
627 | .disabled = 1, | |
628 | }, | |
629 | }, | |
630 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_), | |
631 | .consumer_supplies = max8997_ldo14_, | |
632 | }; | |
633 | ||
634 | static struct regulator_init_data __initdata max8997_ldo15_data = { | |
635 | .constraints = { | |
636 | .name = "VTOUCH_ADVV2.8V", | |
637 | .min_uV = 2800000, | |
638 | .max_uV = 2800000, | |
639 | .apply_uV = 1, | |
640 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
641 | .state_mem = { | |
642 | .disabled = 1, | |
643 | }, | |
644 | }, | |
645 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_), | |
646 | .consumer_supplies = max8997_ldo15_, | |
647 | }; | |
648 | ||
649 | static struct regulator_init_data __initdata max8997_ldo16_data = { | |
650 | .constraints = { | |
651 | .name = "CAM_SENSOR_IO_1.8V", | |
652 | .min_uV = 1800000, | |
653 | .max_uV = 1800000, | |
654 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
655 | .apply_uV = 1, | |
656 | .state_mem = { | |
657 | .disabled = 1, | |
658 | }, | |
659 | }, | |
660 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_), | |
661 | .consumer_supplies = max8997_ldo16_, | |
662 | }; | |
663 | ||
664 | static struct regulator_init_data __initdata max8997_ldo18_data = { | |
665 | .constraints = { | |
666 | .name = "VTOUCH_VDD2.8V", | |
667 | .min_uV = 2800000, | |
668 | .max_uV = 2800000, | |
669 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
670 | .apply_uV = 1, | |
671 | .state_mem = { | |
672 | .disabled = 1, | |
673 | }, | |
674 | }, | |
675 | .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_), | |
676 | .consumer_supplies = max8997_ldo18_, | |
677 | }; | |
678 | ||
679 | static struct regulator_init_data __initdata max8997_ldo21_data = { | |
680 | .constraints = { | |
681 | .name = "VDDQ_M1M2_1.2V", | |
682 | .min_uV = 1200000, | |
683 | .max_uV = 1200000, | |
684 | .apply_uV = 1, | |
685 | .always_on = 1, | |
686 | .state_mem = { | |
687 | .disabled = 1, | |
688 | }, | |
689 | }, | |
690 | }; | |
691 | ||
692 | static struct regulator_init_data __initdata max8997_buck1_data = { | |
693 | .constraints = { | |
694 | .name = "VARM_1.2V_C210", | |
695 | .min_uV = 900000, | |
696 | .max_uV = 1350000, | |
697 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | |
698 | .always_on = 1, | |
699 | .state_mem = { | |
700 | .disabled = 1, | |
701 | }, | |
702 | }, | |
703 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_), | |
704 | .consumer_supplies = max8997_buck1_, | |
705 | }; | |
706 | ||
707 | static struct regulator_init_data __initdata max8997_buck2_data = { | |
708 | .constraints = { | |
709 | .name = "VINT_1.1V_C210", | |
710 | .min_uV = 900000, | |
bae82bdf | 711 | .max_uV = 1200000, |
29dee863 MH |
712 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
713 | .always_on = 1, | |
714 | .state_mem = { | |
715 | .disabled = 1, | |
716 | }, | |
717 | }, | |
718 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_), | |
719 | .consumer_supplies = max8997_buck2_, | |
720 | }; | |
721 | ||
722 | static struct regulator_init_data __initdata max8997_buck3_data = { | |
723 | .constraints = { | |
724 | .name = "VG3D_1.1V_C210", | |
725 | .min_uV = 900000, | |
726 | .max_uV = 1100000, | |
727 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
728 | REGULATOR_CHANGE_STATUS, | |
729 | .state_mem = { | |
730 | .disabled = 1, | |
731 | }, | |
732 | }, | |
733 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_), | |
734 | .consumer_supplies = max8997_buck3_, | |
735 | }; | |
736 | ||
737 | static struct regulator_init_data __initdata max8997_buck4_data = { | |
738 | .constraints = { | |
739 | .name = "CAM_ISP_CORE_1.2V", | |
740 | .min_uV = 1200000, | |
741 | .max_uV = 1200000, | |
742 | .apply_uV = 1, | |
743 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
744 | .state_mem = { | |
745 | .disabled = 1, | |
746 | }, | |
747 | }, | |
748 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_), | |
749 | .consumer_supplies = max8997_buck4_, | |
750 | }; | |
751 | ||
752 | static struct regulator_init_data __initdata max8997_buck5_data = { | |
753 | .constraints = { | |
754 | .name = "VMEM_1.2V_C210", | |
755 | .min_uV = 1200000, | |
756 | .max_uV = 1200000, | |
757 | .apply_uV = 1, | |
758 | .always_on = 1, | |
759 | .state_mem = { | |
760 | .enabled = 1, | |
761 | }, | |
762 | }, | |
763 | }; | |
764 | ||
765 | static struct regulator_init_data __initdata max8997_buck6_data = { | |
766 | .constraints = { | |
767 | .name = "CAM_AF_2.8V", | |
768 | .min_uV = 2800000, | |
769 | .max_uV = 2800000, | |
770 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
771 | .state_mem = { | |
772 | .disabled = 1, | |
773 | }, | |
774 | }, | |
775 | .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_), | |
776 | .consumer_supplies = max8997_buck6_, | |
777 | }; | |
778 | ||
779 | static struct regulator_init_data __initdata max8997_buck7_data = { | |
780 | .constraints = { | |
781 | .name = "VCC_SUB_2.0V", | |
782 | .min_uV = 2000000, | |
783 | .max_uV = 2000000, | |
784 | .apply_uV = 1, | |
785 | .always_on = 1, | |
786 | .state_mem = { | |
787 | .enabled = 1, | |
788 | }, | |
789 | }, | |
790 | }; | |
791 | ||
792 | static struct regulator_init_data __initdata max8997_32khz_ap_data = { | |
793 | .constraints = { | |
794 | .name = "32KHz AP", | |
795 | .always_on = 1, | |
796 | .state_mem = { | |
797 | .enabled = 1, | |
798 | }, | |
799 | }, | |
800 | .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_), | |
801 | .consumer_supplies = max8997_32khz_ap_, | |
802 | }; | |
803 | ||
804 | static struct regulator_init_data __initdata max8997_32khz_cp_data = { | |
805 | .constraints = { | |
806 | .name = "32KHz CP", | |
807 | .state_mem = { | |
808 | .disabled = 1, | |
809 | }, | |
810 | }, | |
811 | }; | |
812 | ||
813 | static struct regulator_init_data __initdata max8997_vichg_data = { | |
814 | .constraints = { | |
815 | .name = "VICHG", | |
816 | .state_mem = { | |
817 | .disabled = 1, | |
818 | }, | |
819 | }, | |
820 | }; | |
821 | ||
822 | static struct regulator_init_data __initdata max8997_esafeout1_data = { | |
823 | .constraints = { | |
824 | .name = "SAFEOUT1", | |
825 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
826 | .state_mem = { | |
827 | .disabled = 1, | |
828 | }, | |
829 | }, | |
830 | .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_), | |
831 | .consumer_supplies = max8997_esafeout1_, | |
832 | }; | |
833 | ||
834 | static struct regulator_init_data __initdata max8997_esafeout2_data = { | |
835 | .constraints = { | |
836 | .name = "SAFEOUT2", | |
837 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
838 | .state_mem = { | |
839 | .disabled = 1, | |
840 | }, | |
841 | }, | |
842 | .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_), | |
843 | .consumer_supplies = max8997_esafeout2_, | |
844 | }; | |
845 | ||
846 | static struct regulator_init_data __initdata max8997_charger_cv_data = { | |
847 | .constraints = { | |
848 | .name = "CHARGER_CV", | |
849 | .min_uV = 4200000, | |
850 | .max_uV = 4200000, | |
851 | .apply_uV = 1, | |
852 | }, | |
853 | }; | |
854 | ||
855 | static struct regulator_init_data __initdata max8997_charger_data = { | |
856 | .constraints = { | |
857 | .name = "CHARGER", | |
858 | .min_uA = 200000, | |
859 | .max_uA = 950000, | |
860 | .boot_on = 1, | |
861 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | | |
862 | REGULATOR_CHANGE_CURRENT, | |
863 | }, | |
864 | .num_consumer_supplies = ARRAY_SIZE(max8997_charger_), | |
865 | .consumer_supplies = max8997_charger_, | |
866 | }; | |
867 | ||
868 | static struct regulator_init_data __initdata max8997_charger_topoff_data = { | |
869 | .constraints = { | |
870 | .name = "CHARGER TOPOFF", | |
871 | .min_uA = 50000, | |
872 | .max_uA = 200000, | |
873 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT, | |
874 | }, | |
875 | .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_), | |
876 | .consumer_supplies = max8997_chg_toff_, | |
877 | }; | |
878 | ||
879 | static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = { | |
880 | { MAX8997_LDO1, &max8997_ldo1_data }, | |
881 | { MAX8997_LDO2, &max8997_ldo2_data }, | |
882 | { MAX8997_LDO3, &max8997_ldo3_data }, | |
883 | { MAX8997_LDO4, &max8997_ldo4_data }, | |
884 | { MAX8997_LDO5, &max8997_ldo5_data }, | |
885 | { MAX8997_LDO6, &max8997_ldo6_data }, | |
886 | { MAX8997_LDO7, &max8997_ldo7_data }, | |
887 | { MAX8997_LDO8, &max8997_ldo8_data }, | |
888 | { MAX8997_LDO9, &max8997_ldo9_data }, | |
889 | { MAX8997_LDO10, &max8997_ldo10_data }, | |
890 | { MAX8997_LDO11, &max8997_ldo11_data }, | |
891 | { MAX8997_LDO12, &max8997_ldo12_data }, | |
892 | { MAX8997_LDO13, &max8997_ldo13_data }, | |
893 | { MAX8997_LDO14, &max8997_ldo14_data }, | |
894 | { MAX8997_LDO15, &max8997_ldo15_data }, | |
895 | { MAX8997_LDO16, &max8997_ldo16_data }, | |
896 | ||
897 | { MAX8997_LDO18, &max8997_ldo18_data }, | |
898 | { MAX8997_LDO21, &max8997_ldo21_data }, | |
899 | ||
900 | { MAX8997_BUCK1, &max8997_buck1_data }, | |
901 | { MAX8997_BUCK2, &max8997_buck2_data }, | |
902 | { MAX8997_BUCK3, &max8997_buck3_data }, | |
903 | { MAX8997_BUCK4, &max8997_buck4_data }, | |
904 | { MAX8997_BUCK5, &max8997_buck5_data }, | |
905 | { MAX8997_BUCK6, &max8997_buck6_data }, | |
906 | { MAX8997_BUCK7, &max8997_buck7_data }, | |
907 | ||
908 | { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data }, | |
909 | { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data }, | |
910 | ||
911 | { MAX8997_ENVICHG, &max8997_vichg_data }, | |
912 | { MAX8997_ESAFEOUT1, &max8997_esafeout1_data }, | |
913 | { MAX8997_ESAFEOUT2, &max8997_esafeout2_data }, | |
914 | { MAX8997_CHARGER_CV, &max8997_charger_cv_data }, | |
915 | { MAX8997_CHARGER, &max8997_charger_data }, | |
916 | { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data }, | |
917 | }; | |
918 | ||
919 | static struct max8997_platform_data __initdata nuri_max8997_pdata = { | |
920 | .wakeup = 1, | |
921 | ||
922 | .num_regulators = ARRAY_SIZE(nuri_max8997_regulators), | |
923 | .regulators = nuri_max8997_regulators, | |
924 | ||
925 | .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) }, | |
29dee863 MH |
926 | |
927 | .buck1_voltage[0] = 1350000, /* 1.35V */ | |
928 | .buck1_voltage[1] = 1300000, /* 1.3V */ | |
929 | .buck1_voltage[2] = 1250000, /* 1.25V */ | |
930 | .buck1_voltage[3] = 1200000, /* 1.2V */ | |
931 | .buck1_voltage[4] = 1150000, /* 1.15V */ | |
932 | .buck1_voltage[5] = 1100000, /* 1.1V */ | |
933 | .buck1_voltage[6] = 1000000, /* 1.0V */ | |
934 | .buck1_voltage[7] = 950000, /* 0.95V */ | |
935 | ||
936 | .buck2_voltage[0] = 1100000, /* 1.1V */ | |
937 | .buck2_voltage[1] = 1000000, /* 1.0V */ | |
938 | .buck2_voltage[2] = 950000, /* 0.95V */ | |
939 | .buck2_voltage[3] = 900000, /* 0.9V */ | |
940 | .buck2_voltage[4] = 1100000, /* 1.1V */ | |
941 | .buck2_voltage[5] = 1000000, /* 1.0V */ | |
942 | .buck2_voltage[6] = 950000, /* 0.95V */ | |
943 | .buck2_voltage[7] = 900000, /* 0.9V */ | |
944 | ||
945 | .buck5_voltage[0] = 1200000, /* 1.2V */ | |
946 | .buck5_voltage[1] = 1200000, /* 1.2V */ | |
947 | .buck5_voltage[2] = 1200000, /* 1.2V */ | |
948 | .buck5_voltage[3] = 1200000, /* 1.2V */ | |
949 | .buck5_voltage[4] = 1200000, /* 1.2V */ | |
950 | .buck5_voltage[5] = 1200000, /* 1.2V */ | |
951 | .buck5_voltage[6] = 1200000, /* 1.2V */ | |
952 | .buck5_voltage[7] = 1200000, /* 1.2V */ | |
953 | }; | |
954 | ||
caf8b1f2 | 955 | /* GPIO I2C 5 (PMIC) */ |
29dee863 | 956 | enum { I2C5_MAX8997 }; |
caf8b1f2 | 957 | static struct i2c_board_info i2c5_devs[] __initdata = { |
29dee863 MH |
958 | [I2C5_MAX8997] = { |
959 | I2C_BOARD_INFO("max8997", 0xCC >> 1), | |
960 | .platform_data = &nuri_max8997_pdata, | |
961 | }, | |
caf8b1f2 MK |
962 | }; |
963 | ||
a140b92e MH |
964 | static struct max17042_platform_data nuri_battery_platform_data = { |
965 | }; | |
966 | ||
967 | /* GPIO I2C 9 (Fuel Gauge) */ | |
968 | static struct i2c_gpio_platform_data i2c9_gpio_data = { | |
969 | .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */ | |
970 | .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */ | |
971 | }; | |
972 | static struct platform_device i2c9_gpio = { | |
973 | .name = "i2c-gpio", | |
974 | .id = 9, | |
975 | .dev = { | |
976 | .platform_data = &i2c9_gpio_data, | |
977 | }, | |
978 | }; | |
979 | enum { I2C9_MAX17042}; | |
980 | static struct i2c_board_info i2c9_devs[] __initdata = { | |
981 | [I2C9_MAX17042] = { | |
982 | I2C_BOARD_INFO("max17042", 0x36), | |
983 | .platform_data = &nuri_battery_platform_data, | |
984 | }, | |
985 | }; | |
986 | ||
605baf67 MH |
987 | /* MAX8903 Secondary Charger */ |
988 | static struct regulator_consumer_supply supplies_max8903[] = { | |
989 | REGULATOR_SUPPLY("vinchg2", "charger-manager.0"), | |
990 | }; | |
991 | ||
992 | static struct regulator_init_data max8903_charger_en_data = { | |
993 | .constraints = { | |
994 | .name = "VOUT_CHARGER", | |
995 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
996 | .boot_on = 1, | |
997 | }, | |
998 | .num_consumer_supplies = ARRAY_SIZE(supplies_max8903), | |
999 | .consumer_supplies = supplies_max8903, | |
1000 | }; | |
1001 | ||
1002 | static struct fixed_voltage_config max8903_charger_en = { | |
1003 | .supply_name = "VOUT_CHARGER", | |
1004 | .microvolts = 5000000, /* Assume 5VDC */ | |
1005 | .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */ | |
1006 | .enable_high = 0, /* Enable = Low */ | |
1007 | .enabled_at_boot = 1, | |
1008 | .init_data = &max8903_charger_en_data, | |
1009 | }; | |
1010 | ||
1011 | static struct platform_device max8903_fixed_reg_dev = { | |
1012 | .name = "reg-fixed-voltage", | |
1013 | .id = FIXED_REG_ID_MAX8903, | |
1014 | .dev = { .platform_data = &max8903_charger_en }, | |
1015 | }; | |
1016 | ||
1017 | static struct max8903_pdata nuri_max8903 = { | |
1018 | /* | |
1019 | * cen: don't control with the driver, let it be | |
1020 | * controlled by regulator above | |
1021 | */ | |
1022 | .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */ | |
1023 | /* uok, usus: not connected */ | |
1024 | .chg = EXYNOS4_GPE2(0), /* TA_nCHG */ | |
1025 | /* flt: vcc_1.8V_pda */ | |
1026 | .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */ | |
1027 | ||
1028 | .dc_valid = true, | |
1029 | .usb_valid = false, /* USB is not wired to MAX8903 */ | |
1030 | }; | |
1031 | ||
1032 | static struct platform_device nuri_max8903_device = { | |
1033 | .name = "max8903-charger", | |
1034 | .dev = { | |
1035 | .platform_data = &nuri_max8903, | |
1036 | }, | |
1037 | }; | |
1038 | ||
29dee863 MH |
1039 | static void __init nuri_power_init(void) |
1040 | { | |
1041 | int gpio; | |
1042 | int irq_base = IRQ_GPIO_END + 1; | |
605baf67 | 1043 | int ta_en = 0; |
29dee863 MH |
1044 | |
1045 | nuri_max8997_pdata.irq_base = irq_base; | |
1046 | irq_base += MAX8997_IRQ_NR; | |
1047 | ||
1048 | gpio = EXYNOS4_GPX0(7); | |
1049 | gpio_request(gpio, "AP_PMIC_IRQ"); | |
1050 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | |
1051 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | |
a140b92e MH |
1052 | |
1053 | gpio = EXYNOS4_GPX2(3); | |
1054 | gpio_request(gpio, "FUEL_ALERT"); | |
1055 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | |
1056 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | |
605baf67 MH |
1057 | |
1058 | gpio = nuri_max8903.dok; | |
1059 | gpio_request(gpio, "TA_nCONNECTED"); | |
1060 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | |
1061 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); | |
1062 | ta_en = gpio_get_value(gpio) ? 0 : 1; | |
1063 | ||
1064 | gpio = nuri_max8903.chg; | |
1065 | gpio_request(gpio, "TA_nCHG"); | |
1066 | gpio_direction_input(gpio); | |
1067 | ||
1068 | gpio = nuri_max8903.dcm; | |
1069 | gpio_request(gpio, "CURR_ADJ"); | |
1070 | gpio_direction_output(gpio, ta_en); | |
29dee863 MH |
1071 | } |
1072 | ||
01da92f7 JS |
1073 | /* USB EHCI */ |
1074 | static struct s5p_ehci_platdata nuri_ehci_pdata; | |
1075 | ||
1076 | static void __init nuri_ehci_init(void) | |
1077 | { | |
1078 | struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata; | |
1079 | ||
1080 | s5p_ehci_set_platdata(pdata); | |
1081 | } | |
1082 | ||
716e84d1 | 1083 | /* CAMERA */ |
8f114e6e SN |
1084 | static struct regulator_consumer_supply cam_vt_cam15_supply = |
1085 | REGULATOR_SUPPLY("vdd_core", "6-003c"); | |
1086 | ||
1087 | static struct regulator_init_data cam_vt_cam15_reg_init_data = { | |
1088 | .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS }, | |
1089 | .num_consumer_supplies = 1, | |
1090 | .consumer_supplies = &cam_vt_cam15_supply, | |
1091 | }; | |
1092 | ||
1093 | static struct fixed_voltage_config cam_vt_cam15_fixed_voltage_cfg = { | |
1094 | .supply_name = "VT_CAM_1.5V", | |
1095 | .microvolts = 1500000, | |
1096 | .gpio = EXYNOS4_GPE2(2), /* VT_CAM_1.5V_EN */ | |
1097 | .enable_high = 1, | |
1098 | .init_data = &cam_vt_cam15_reg_init_data, | |
1099 | }; | |
1100 | ||
1101 | static struct platform_device cam_vt_cam15_fixed_rdev = { | |
1102 | .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_15V, | |
1103 | .dev = { .platform_data = &cam_vt_cam15_fixed_voltage_cfg }, | |
1104 | }; | |
1105 | ||
716e84d1 | 1106 | static struct regulator_consumer_supply cam_vdda_supply[] = { |
8f114e6e | 1107 | REGULATOR_SUPPLY("vdda", "6-003c"), |
716e84d1 SN |
1108 | REGULATOR_SUPPLY("a_sensor", "0-001f"), |
1109 | }; | |
1110 | ||
1111 | static struct regulator_init_data cam_vdda_reg_init_data = { | |
1112 | .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS }, | |
1113 | .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply), | |
1114 | .consumer_supplies = cam_vdda_supply, | |
1115 | }; | |
1116 | ||
1117 | static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = { | |
1118 | .supply_name = "CAM_IO_EN", | |
1119 | .microvolts = 2800000, | |
1120 | .gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */ | |
1121 | .enable_high = 1, | |
1122 | .init_data = &cam_vdda_reg_init_data, | |
1123 | }; | |
1124 | ||
1125 | static struct platform_device cam_vdda_fixed_rdev = { | |
1126 | .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V, | |
1127 | .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg }, | |
1128 | }; | |
1129 | ||
1130 | static struct regulator_consumer_supply camera_8m_12v_supply = | |
1131 | REGULATOR_SUPPLY("dig_12", "0-001f"); | |
1132 | ||
1133 | static struct regulator_init_data cam_8m_12v_reg_init_data = { | |
1134 | .num_consumer_supplies = 1, | |
1135 | .consumer_supplies = &camera_8m_12v_supply, | |
1136 | .constraints = { | |
1137 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | |
1138 | }, | |
1139 | }; | |
1140 | ||
1141 | static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = { | |
1142 | .supply_name = "8M_1.2V", | |
1143 | .microvolts = 1200000, | |
1144 | .gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */ | |
1145 | .enable_high = 1, | |
1146 | .init_data = &cam_8m_12v_reg_init_data, | |
1147 | }; | |
1148 | ||
1149 | static struct platform_device cam_8m_12v_fixed_rdev = { | |
1150 | .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V, | |
1151 | .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg }, | |
1152 | }; | |
1153 | ||
1154 | static struct s5p_platform_mipi_csis mipi_csis_platdata = { | |
1155 | .clk_rate = 166000000UL, | |
1156 | .lanes = 2, | |
1157 | .alignment = 32, | |
1158 | .hs_settle = 12, | |
1159 | .phy_enable = s5p_csis_phy_enable, | |
1160 | }; | |
1161 | ||
1162 | #define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */ | |
1163 | #define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5) | |
8f114e6e SN |
1164 | #define GPIO_CAM_VT_NSTBY EXYNOS4_GPL2(0) |
1165 | #define GPIO_CAM_VT_NRST EXYNOS4_GPL2(1) | |
1166 | ||
1167 | static struct s5k6aa_platform_data s5k6aa_pldata = { | |
1168 | .mclk_frequency = 24000000UL, | |
1169 | .gpio_reset = { GPIO_CAM_VT_NRST, 0 }, | |
1170 | .gpio_stby = { GPIO_CAM_VT_NSTBY, 0 }, | |
1171 | .bus_type = V4L2_MBUS_PARALLEL, | |
1172 | .horiz_flip = 1, | |
1173 | }; | |
1174 | ||
1175 | static struct i2c_board_info s5k6aa_board_info = { | |
1176 | I2C_BOARD_INFO("S5K6AA", 0x3c), | |
1177 | .platform_data = &s5k6aa_pldata, | |
1178 | }; | |
716e84d1 SN |
1179 | |
1180 | static struct m5mols_platform_data m5mols_platdata = { | |
1181 | .gpio_reset = GPIO_CAM_MEGA_RST, | |
1182 | }; | |
1183 | ||
1184 | static struct i2c_board_info m5mols_board_info = { | |
1185 | I2C_BOARD_INFO("M5MOLS", 0x1F), | |
1186 | .platform_data = &m5mols_platdata, | |
1187 | }; | |
1188 | ||
1189 | static struct s5p_fimc_isp_info nuri_camera_sensors[] = { | |
1190 | { | |
8f114e6e SN |
1191 | .flags = V4L2_MBUS_PCLK_SAMPLE_RISING | |
1192 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | |
1193 | .bus_type = FIMC_ITU_601, | |
1194 | .board_info = &s5k6aa_board_info, | |
1195 | .clk_frequency = 24000000UL, | |
1196 | .i2c_bus_num = 6, | |
1197 | }, { | |
716e84d1 SN |
1198 | .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | |
1199 | V4L2_MBUS_VSYNC_ACTIVE_LOW, | |
1200 | .bus_type = FIMC_MIPI_CSI2, | |
1201 | .board_info = &m5mols_board_info, | |
1202 | .clk_frequency = 24000000UL, | |
1203 | .csi_data_align = 32, | |
1204 | }, | |
1205 | }; | |
1206 | ||
1207 | static struct s5p_platform_fimc fimc_md_platdata = { | |
1208 | .isp_info = nuri_camera_sensors, | |
1209 | .num_clients = ARRAY_SIZE(nuri_camera_sensors), | |
1210 | }; | |
1211 | ||
1212 | static struct gpio nuri_camera_gpios[] = { | |
8f114e6e SN |
1213 | { GPIO_CAM_VT_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" }, |
1214 | { GPIO_CAM_VT_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" }, | |
716e84d1 SN |
1215 | { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" }, |
1216 | { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" }, | |
1217 | }; | |
1218 | ||
fdaf1308 | 1219 | static void __init nuri_camera_init(void) |
716e84d1 SN |
1220 | { |
1221 | s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata), | |
1222 | &s5p_device_mipi_csis0); | |
1223 | s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata), | |
1224 | &s5p_device_fimc_md); | |
1225 | ||
1226 | if (gpio_request_array(nuri_camera_gpios, | |
1227 | ARRAY_SIZE(nuri_camera_gpios))) { | |
1228 | pr_err("%s: GPIO request failed\n", __func__); | |
1229 | return; | |
1230 | } | |
1231 | ||
1232 | m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT); | |
1233 | if (!IS_ERR_VALUE(m5mols_board_info.irq)) | |
1234 | s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF)); | |
1235 | else | |
1236 | pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__); | |
1237 | ||
1238 | /* Free GPIOs controlled directly by the sensor drivers. */ | |
8f114e6e SN |
1239 | gpio_free(GPIO_CAM_VT_NRST); |
1240 | gpio_free(GPIO_CAM_VT_NSTBY); | |
716e84d1 SN |
1241 | gpio_free(GPIO_CAM_MEGA_RST); |
1242 | ||
1243 | if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) { | |
1244 | pr_err("%s: Camera port A setup failed\n", __func__); | |
1245 | return; | |
1246 | } | |
1247 | /* Increase drive strength of the sensor clock output */ | |
1248 | s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4); | |
1249 | } | |
1250 | ||
8f114e6e SN |
1251 | static struct s3c2410_platform_i2c nuri_i2c6_platdata __initdata = { |
1252 | .frequency = 400000U, | |
1253 | .sda_delay = 200, | |
1254 | .bus_num = 6, | |
1255 | }; | |
1256 | ||
716e84d1 SN |
1257 | static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = { |
1258 | .frequency = 400000U, | |
1259 | .sda_delay = 200, | |
1260 | }; | |
1261 | ||
bae82bdf MH |
1262 | /* DEVFREQ controlling memory/bus */ |
1263 | static struct platform_device exynos4_bus_devfreq = { | |
1264 | .name = "exynos4210-busfreq", | |
1265 | }; | |
1266 | ||
caf8b1f2 MK |
1267 | static struct platform_device *nuri_devices[] __initdata = { |
1268 | /* Samsung Platform Devices */ | |
29dee863 | 1269 | &s3c_device_i2c5, /* PMIC should initialize first */ |
716e84d1 | 1270 | &s3c_device_i2c0, |
8f114e6e | 1271 | &s3c_device_i2c6, |
caf8b1f2 | 1272 | &emmc_fixed_voltage, |
716e84d1 SN |
1273 | &s5p_device_mipi_csis0, |
1274 | &s5p_device_fimc0, | |
1275 | &s5p_device_fimc1, | |
1276 | &s5p_device_fimc2, | |
1277 | &s5p_device_fimc3, | |
0d88f946 | 1278 | &s5p_device_fimd0, |
caf8b1f2 MK |
1279 | &s3c_device_hsmmc0, |
1280 | &s3c_device_hsmmc2, | |
1281 | &s3c_device_hsmmc3, | |
1282 | &s3c_device_wdt, | |
cc7df872 | 1283 | &s3c_device_timer[0], |
01da92f7 | 1284 | &s5p_device_ehci, |
3260ecd8 | 1285 | &s3c_device_i2c3, |
a140b92e | 1286 | &i2c9_gpio, |
ed9ba31f | 1287 | &s3c_device_adc, |
ec004669 | 1288 | &s5p_device_g2d, |
72bce7b1 | 1289 | &s5p_device_jpeg, |
3a1a2b9e | 1290 | &s3c_device_rtc, |
4c0f0a3e MS |
1291 | &s5p_device_mfc, |
1292 | &s5p_device_mfc_l, | |
1293 | &s5p_device_mfc_r, | |
716e84d1 | 1294 | &s5p_device_fimc_md, |
caf8b1f2 MK |
1295 | |
1296 | /* NURI Devices */ | |
1297 | &nuri_gpio_keys, | |
cc7df872 DL |
1298 | &nuri_lcd_device, |
1299 | &nuri_backlight_device, | |
605baf67 MH |
1300 | &max8903_fixed_reg_dev, |
1301 | &nuri_max8903_device, | |
8f114e6e | 1302 | &cam_vt_cam15_fixed_rdev, |
716e84d1 SN |
1303 | &cam_vdda_fixed_rdev, |
1304 | &cam_8m_12v_fixed_rdev, | |
bae82bdf | 1305 | &exynos4_bus_devfreq, |
caf8b1f2 MK |
1306 | }; |
1307 | ||
1308 | static void __init nuri_map_io(void) | |
1309 | { | |
3d3231b1 | 1310 | clk_xusbxti.rate = 24000000; |
cc511b8d | 1311 | exynos_init_io(NULL, 0); |
caf8b1f2 MK |
1312 | s3c24xx_init_clocks(24000000); |
1313 | s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs)); | |
1314 | } | |
1315 | ||
4c0f0a3e MS |
1316 | static void __init nuri_reserve(void) |
1317 | { | |
1318 | s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20); | |
1319 | } | |
1320 | ||
caf8b1f2 MK |
1321 | static void __init nuri_machine_init(void) |
1322 | { | |
1323 | nuri_sdhci_init(); | |
3260ecd8 | 1324 | nuri_tsp_init(); |
29dee863 | 1325 | nuri_power_init(); |
caf8b1f2 | 1326 | |
716e84d1 | 1327 | s3c_i2c0_set_platdata(&nuri_i2c0_platdata); |
caf8b1f2 | 1328 | i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); |
3260ecd8 JS |
1329 | s3c_i2c3_set_platdata(&i2c3_data); |
1330 | i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs)); | |
29dee863 MH |
1331 | s3c_i2c5_set_platdata(NULL); |
1332 | i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7)); | |
caf8b1f2 | 1333 | i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs)); |
a140b92e MH |
1334 | i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3)); |
1335 | i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs)); | |
8f114e6e | 1336 | s3c_i2c6_set_platdata(&nuri_i2c6_platdata); |
caf8b1f2 | 1337 | |
0d88f946 MS |
1338 | s5p_fimd0_set_platdata(&nuri_fb_pdata); |
1339 | ||
716e84d1 SN |
1340 | nuri_camera_init(); |
1341 | ||
01da92f7 | 1342 | nuri_ehci_init(); |
01da92f7 | 1343 | |
caf8b1f2 MK |
1344 | /* Last */ |
1345 | platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices)); | |
1346 | } | |
1347 | ||
1348 | MACHINE_START(NURI, "NURI") | |
1349 | /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */ | |
2be5a4a7 | 1350 | .atag_offset = 0x100, |
caf8b1f2 MK |
1351 | .init_irq = exynos4_init_irq, |
1352 | .map_io = nuri_map_io, | |
4e44d2cb | 1353 | .handle_irq = gic_handle_irq, |
caf8b1f2 MK |
1354 | .init_machine = nuri_machine_init, |
1355 | .timer = &exynos4_timer, | |
4c0f0a3e | 1356 | .reserve = &nuri_reserve, |
9eb48595 | 1357 | .restart = exynos4_restart, |
caf8b1f2 | 1358 | MACHINE_END |