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