blob: e1e640e5b52a2353bc0f6e9ed459de607b7e4885 [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 = {
Marek Szyprowski0d88f942011-08-11 19:57:28 +0900217 .max_bpp = 24,
218 .default_bpp = 16,
Thomas Abraham79d3c412012-03-24 21:58:48 +0530219 .xres = 1024,
220 .yres = 600,
Sylwester Nawrocki7cc98aa2012-01-31 12:58:31 +0900221 .virtual_x = 1024,
222 .virtual_y = 2 * 600,
Marek Szyprowski0d88f942011-08-11 19:57:28 +0900223};
224
Thomas Abraham79d3c412012-03-24 21:58:48 +0530225static struct fb_videomode nuri_lcd_timing = {
226 .left_margin = 64,
227 .right_margin = 16,
228 .upper_margin = 64,
229 .lower_margin = 1,
230 .hsync_len = 48,
231 .vsync_len = 3,
232 .xres = 1024,
233 .yres = 600,
234 .refresh = 60,
235};
236
Marek Szyprowski0d88f942011-08-11 19:57:28 +0900237static struct s3c_fb_platdata nuri_fb_pdata __initdata = {
238 .win[0] = &nuri_fb_win0,
Thomas Abraham79d3c412012-03-24 21:58:48 +0530239 .vtiming = &nuri_lcd_timing,
Marek Szyprowski0d88f942011-08-11 19:57:28 +0900240 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
241 VIDCON0_CLKSEL_LCD,
242 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
243 .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
244};
245
Donghwa Leecc7df872011-03-08 07:17:09 +0900246static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
247{
248 int gpio = EXYNOS4_GPE1(5);
249
250 gpio_request(gpio, "LVDS_nSHDN");
251 gpio_direction_output(gpio, power);
252 gpio_free(gpio);
253}
254
255static int nuri_bl_init(struct device *dev)
256{
Jingoo Han321655e2011-12-24 11:58:32 +0900257 return gpio_request_one(EXYNOS4_GPE2(3), GPIOF_OUT_INIT_LOW,
258 "LCD_LD0_EN");
Donghwa Leecc7df872011-03-08 07:17:09 +0900259}
260
261static int nuri_bl_notify(struct device *dev, int brightness)
262{
263 if (brightness < 1)
264 brightness = 0;
265
266 gpio_set_value(EXYNOS4_GPE2(3), 1);
267
268 return brightness;
269}
270
271static void nuri_bl_exit(struct device *dev)
272{
273 gpio_free(EXYNOS4_GPE2(3));
274}
275
276/* nuri pwm backlight */
277static struct platform_pwm_backlight_data nuri_backlight_data = {
278 .pwm_id = 0,
279 .pwm_period_ns = 30000,
280 .max_brightness = 100,
281 .dft_brightness = 50,
282 .init = nuri_bl_init,
283 .notify = nuri_bl_notify,
284 .exit = nuri_bl_exit,
285};
286
287static struct platform_device nuri_backlight_device = {
288 .name = "pwm-backlight",
289 .id = -1,
290 .dev = {
291 .parent = &s3c_device_timer[0].dev,
292 .platform_data = &nuri_backlight_data,
293 },
294};
295
296static struct plat_lcd_data nuri_lcd_platform_data = {
297 .set_power = nuri_lcd_power_on,
298};
299
300static struct platform_device nuri_lcd_device = {
301 .name = "platform-lcd",
302 .id = -1,
303 .dev = {
304 .platform_data = &nuri_lcd_platform_data,
305 },
306};
307
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900308/* I2C1 */
309static struct i2c_board_info i2c1_devs[] __initdata = {
310 /* Gyro, To be updated */
311};
312
Joonyoung Shim3260ecd2011-03-23 15:25:14 +0900313/* TSP */
314static u8 mxt_init_vals[] = {
315 /* MXT_GEN_COMMAND(6) */
316 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
317 /* MXT_GEN_POWER(7) */
318 0x20, 0xff, 0x32,
319 /* MXT_GEN_ACQUIRE(8) */
320 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23,
321 /* MXT_TOUCH_MULTI(9) */
322 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00,
323 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00,
324 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
325 0x00,
326 /* MXT_TOUCH_KEYARRAY(15) */
327 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
328 0x00,
329 /* MXT_SPT_GPIOPWM(19) */
330 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
331 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
332 /* MXT_PROCI_GRIPFACE(20) */
333 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04,
334 0x0f, 0x0a,
335 /* MXT_PROCG_NOISE(22) */
336 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00,
337 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03,
338 /* MXT_TOUCH_PROXIMITY(23) */
339 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
340 0x00, 0x00, 0x00, 0x00, 0x00,
341 /* MXT_PROCI_ONETOUCH(24) */
342 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
343 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
344 /* MXT_SPT_SELFTEST(25) */
345 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
346 0x00, 0x00, 0x00, 0x00,
347 /* MXT_PROCI_TWOTOUCH(27) */
348 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
349 /* MXT_SPT_CTECONFIG(28) */
350 0x00, 0x00, 0x02, 0x08, 0x10, 0x00,
351};
352
353static struct mxt_platform_data mxt_platform_data = {
354 .config = mxt_init_vals,
355 .config_length = ARRAY_SIZE(mxt_init_vals),
356
357 .x_line = 18,
358 .y_line = 11,
359 .x_size = 1024,
360 .y_size = 600,
361 .blen = 0x1,
362 .threshold = 0x28,
363 .voltage = 2800000, /* 2.8V */
364 .orient = MXT_DIAGONAL_COUNTER,
365 .irqflags = IRQF_TRIGGER_FALLING,
366};
367
368static struct s3c2410_platform_i2c i2c3_data __initdata = {
369 .flags = 0,
370 .bus_num = 3,
371 .slave_addr = 0x10,
372 .frequency = 400 * 1000,
373 .sda_delay = 100,
374};
375
376static struct i2c_board_info i2c3_devs[] __initdata = {
377 {
378 I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
379 .platform_data = &mxt_platform_data,
380 .irq = IRQ_EINT(4),
381 },
382};
383
384static void __init nuri_tsp_init(void)
385{
386 int gpio;
387
388 /* TOUCH_INT: XEINT_4 */
389 gpio = EXYNOS4_GPX0(4);
390 gpio_request(gpio, "TOUCH_INT");
391 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
392 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
393}
394
MyungJoo Ham29dee862011-07-21 00:31:27 +0900395static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
396 REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +0900397};
MyungJoo Ham29dee862011-07-21 00:31:27 +0900398static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
399 REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
400};
401static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
402 REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
403};
404static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
405 REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
406};
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +0900407static struct regulator_consumer_supply nuri_max8997_ldo6_consumer[] = {
408 REGULATOR_SUPPLY("vdd_reg", "6-003c"), /* S5K6AA camera */
409};
MyungJoo Ham29dee862011-07-21 00:31:27 +0900410static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
411 REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
412};
413static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
414 REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */
415 REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
416};
417static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
418 REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */
419};
420static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
421 REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
422};
423static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
Jaehoon Chungf5cca862012-03-10 03:59:50 -0800424 REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */
MyungJoo Ham29dee862011-07-21 00:31:27 +0900425};
426static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
427 REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
428};
429static struct regulator_consumer_supply __initdata max8997_ldo15_[] = {
430 REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */
431};
432static struct regulator_consumer_supply __initdata max8997_ldo16_[] = {
433 REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */
434};
435static struct regulator_consumer_supply __initdata max8997_ldo18_[] = {
436 REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */
437};
438static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
439 REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
440};
441static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
MyungJoo Hambae82bd2011-12-01 16:00:38 +0900442 REGULATOR_SUPPLY("vdd_int", "exynos4210-busfreq.0"), /* CPUFREQ */
MyungJoo Ham29dee862011-07-21 00:31:27 +0900443};
444static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
445 REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
446};
447static struct regulator_consumer_supply __initdata max8997_buck4_[] = {
448 REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */
449};
450static struct regulator_consumer_supply __initdata max8997_buck6_[] = {
451 REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */
452};
453static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = {
454 REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */
455};
456static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = {
457 REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */
458};
459
460static struct regulator_consumer_supply __initdata max8997_charger_[] = {
461 REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
462};
463static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = {
464 REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */
465};
466
467static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = {
468 REGULATOR_SUPPLY("gps_clk", "bcm4751"),
469 REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"),
470 REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"),
471};
472
473static struct regulator_init_data __initdata max8997_ldo1_data = {
474 .constraints = {
475 .name = "VADC_3.3V_C210",
476 .min_uV = 3300000,
477 .max_uV = 3300000,
478 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
479 .apply_uV = 1,
480 .state_mem = {
481 .disabled = 1,
482 },
483 },
484 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_),
485 .consumer_supplies = max8997_ldo1_,
486};
487
488static struct regulator_init_data __initdata max8997_ldo2_data = {
489 .constraints = {
490 .name = "VALIVE_1.1V_C210",
491 .min_uV = 1100000,
492 .max_uV = 1100000,
493 .apply_uV = 1,
494 .always_on = 1,
495 .state_mem = {
496 .enabled = 1,
497 },
498 },
499};
500
501static struct regulator_init_data __initdata max8997_ldo3_data = {
502 .constraints = {
503 .name = "VUSB_1.1V_C210",
504 .min_uV = 1100000,
505 .max_uV = 1100000,
506 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
507 .apply_uV = 1,
508 .state_mem = {
509 .disabled = 1,
510 },
511 },
512 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_),
513 .consumer_supplies = max8997_ldo3_,
514};
515
516static struct regulator_init_data __initdata max8997_ldo4_data = {
517 .constraints = {
518 .name = "VMIPI_1.8V",
519 .min_uV = 1800000,
520 .max_uV = 1800000,
521 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
522 .apply_uV = 1,
523 .state_mem = {
524 .disabled = 1,
525 },
526 },
527 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_),
528 .consumer_supplies = max8997_ldo4_,
529};
530
531static struct regulator_init_data __initdata max8997_ldo5_data = {
532 .constraints = {
533 .name = "VHSIC_1.2V_C210",
534 .min_uV = 1200000,
535 .max_uV = 1200000,
536 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
537 .apply_uV = 1,
538 .state_mem = {
539 .disabled = 1,
540 },
541 },
542 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_),
543 .consumer_supplies = max8997_ldo5_,
544};
545
546static struct regulator_init_data __initdata max8997_ldo6_data = {
547 .constraints = {
548 .name = "VCC_1.8V_PDA",
549 .min_uV = 1800000,
550 .max_uV = 1800000,
551 .apply_uV = 1,
552 .always_on = 1,
553 .state_mem = {
554 .enabled = 1,
555 },
556 },
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +0900557 .num_consumer_supplies = ARRAY_SIZE(nuri_max8997_ldo6_consumer),
558 .consumer_supplies = nuri_max8997_ldo6_consumer,
MyungJoo Ham29dee862011-07-21 00:31:27 +0900559};
560
561static struct regulator_init_data __initdata max8997_ldo7_data = {
562 .constraints = {
563 .name = "CAM_ISP_1.8V",
564 .min_uV = 1800000,
565 .max_uV = 1800000,
566 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
567 .apply_uV = 1,
568 .state_mem = {
569 .disabled = 1,
570 },
571 },
572 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_),
573 .consumer_supplies = max8997_ldo7_,
574};
575
576static struct regulator_init_data __initdata max8997_ldo8_data = {
577 .constraints = {
578 .name = "VUSB/VDAC_3.3V_C210",
579 .min_uV = 3300000,
580 .max_uV = 3300000,
581 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
582 .apply_uV = 1,
583 .state_mem = {
584 .disabled = 1,
585 },
586 },
587 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_),
588 .consumer_supplies = max8997_ldo8_,
589};
590
591static struct regulator_init_data __initdata max8997_ldo9_data = {
592 .constraints = {
593 .name = "VCC_2.8V_PDA",
594 .min_uV = 2800000,
595 .max_uV = 2800000,
596 .apply_uV = 1,
597 .always_on = 1,
598 .state_mem = {
599 .enabled = 1,
600 },
601 },
602};
603
604static struct regulator_init_data __initdata max8997_ldo10_data = {
605 .constraints = {
606 .name = "VPLL_1.1V_C210",
607 .min_uV = 1100000,
608 .max_uV = 1100000,
609 .apply_uV = 1,
610 .always_on = 1,
611 .state_mem = {
612 .disabled = 1,
613 },
614 },
615};
616
617static struct regulator_init_data __initdata max8997_ldo11_data = {
618 .constraints = {
619 .name = "LVDS_VDD3.3V",
620 .min_uV = 3300000,
621 .max_uV = 3300000,
622 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
623 .apply_uV = 1,
624 .boot_on = 1,
625 .state_mem = {
626 .disabled = 1,
627 },
628 },
629 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_),
630 .consumer_supplies = max8997_ldo11_,
631};
632
633static struct regulator_init_data __initdata max8997_ldo12_data = {
634 .constraints = {
635 .name = "VT_CAM_1.8V",
636 .min_uV = 1800000,
637 .max_uV = 1800000,
638 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
639 .apply_uV = 1,
640 .state_mem = {
641 .disabled = 1,
642 },
643 },
644 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_),
645 .consumer_supplies = max8997_ldo12_,
646};
647
648static struct regulator_init_data __initdata max8997_ldo13_data = {
649 .constraints = {
650 .name = "VTF_2.8V",
651 .min_uV = 2800000,
652 .max_uV = 2800000,
653 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
654 .apply_uV = 1,
655 .state_mem = {
656 .disabled = 1,
657 },
658 },
659 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_),
660 .consumer_supplies = max8997_ldo13_,
661};
662
663static struct regulator_init_data __initdata max8997_ldo14_data = {
664 .constraints = {
665 .name = "VCC_3.0V_MOTOR",
666 .min_uV = 3000000,
667 .max_uV = 3000000,
668 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
669 .apply_uV = 1,
670 .state_mem = {
671 .disabled = 1,
672 },
673 },
674 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_),
675 .consumer_supplies = max8997_ldo14_,
676};
677
678static struct regulator_init_data __initdata max8997_ldo15_data = {
679 .constraints = {
680 .name = "VTOUCH_ADVV2.8V",
681 .min_uV = 2800000,
682 .max_uV = 2800000,
683 .apply_uV = 1,
684 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
685 .state_mem = {
686 .disabled = 1,
687 },
688 },
689 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_),
690 .consumer_supplies = max8997_ldo15_,
691};
692
693static struct regulator_init_data __initdata max8997_ldo16_data = {
694 .constraints = {
695 .name = "CAM_SENSOR_IO_1.8V",
696 .min_uV = 1800000,
697 .max_uV = 1800000,
698 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
699 .apply_uV = 1,
700 .state_mem = {
701 .disabled = 1,
702 },
703 },
704 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_),
705 .consumer_supplies = max8997_ldo16_,
706};
707
708static struct regulator_init_data __initdata max8997_ldo18_data = {
709 .constraints = {
710 .name = "VTOUCH_VDD2.8V",
711 .min_uV = 2800000,
712 .max_uV = 2800000,
713 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
714 .apply_uV = 1,
715 .state_mem = {
716 .disabled = 1,
717 },
718 },
719 .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_),
720 .consumer_supplies = max8997_ldo18_,
721};
722
723static struct regulator_init_data __initdata max8997_ldo21_data = {
724 .constraints = {
725 .name = "VDDQ_M1M2_1.2V",
726 .min_uV = 1200000,
727 .max_uV = 1200000,
728 .apply_uV = 1,
729 .always_on = 1,
730 .state_mem = {
731 .disabled = 1,
732 },
733 },
734};
735
736static struct regulator_init_data __initdata max8997_buck1_data = {
737 .constraints = {
738 .name = "VARM_1.2V_C210",
739 .min_uV = 900000,
740 .max_uV = 1350000,
741 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
742 .always_on = 1,
743 .state_mem = {
744 .disabled = 1,
745 },
746 },
747 .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_),
748 .consumer_supplies = max8997_buck1_,
749};
750
751static struct regulator_init_data __initdata max8997_buck2_data = {
752 .constraints = {
753 .name = "VINT_1.1V_C210",
754 .min_uV = 900000,
MyungJoo Hambae82bd2011-12-01 16:00:38 +0900755 .max_uV = 1200000,
MyungJoo Ham29dee862011-07-21 00:31:27 +0900756 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
757 .always_on = 1,
758 .state_mem = {
759 .disabled = 1,
760 },
761 },
762 .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_),
763 .consumer_supplies = max8997_buck2_,
764};
765
766static struct regulator_init_data __initdata max8997_buck3_data = {
767 .constraints = {
768 .name = "VG3D_1.1V_C210",
769 .min_uV = 900000,
770 .max_uV = 1100000,
771 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
772 REGULATOR_CHANGE_STATUS,
773 .state_mem = {
774 .disabled = 1,
775 },
776 },
777 .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_),
778 .consumer_supplies = max8997_buck3_,
779};
780
781static struct regulator_init_data __initdata max8997_buck4_data = {
782 .constraints = {
783 .name = "CAM_ISP_CORE_1.2V",
784 .min_uV = 1200000,
785 .max_uV = 1200000,
786 .apply_uV = 1,
787 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
788 .state_mem = {
789 .disabled = 1,
790 },
791 },
792 .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_),
793 .consumer_supplies = max8997_buck4_,
794};
795
796static struct regulator_init_data __initdata max8997_buck5_data = {
797 .constraints = {
798 .name = "VMEM_1.2V_C210",
799 .min_uV = 1200000,
800 .max_uV = 1200000,
801 .apply_uV = 1,
802 .always_on = 1,
803 .state_mem = {
804 .enabled = 1,
805 },
806 },
807};
808
809static struct regulator_init_data __initdata max8997_buck6_data = {
810 .constraints = {
811 .name = "CAM_AF_2.8V",
812 .min_uV = 2800000,
813 .max_uV = 2800000,
814 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
815 .state_mem = {
816 .disabled = 1,
817 },
818 },
819 .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_),
820 .consumer_supplies = max8997_buck6_,
821};
822
823static struct regulator_init_data __initdata max8997_buck7_data = {
824 .constraints = {
825 .name = "VCC_SUB_2.0V",
826 .min_uV = 2000000,
827 .max_uV = 2000000,
828 .apply_uV = 1,
829 .always_on = 1,
830 .state_mem = {
831 .enabled = 1,
832 },
833 },
834};
835
836static struct regulator_init_data __initdata max8997_32khz_ap_data = {
837 .constraints = {
838 .name = "32KHz AP",
839 .always_on = 1,
840 .state_mem = {
841 .enabled = 1,
842 },
843 },
844 .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_),
845 .consumer_supplies = max8997_32khz_ap_,
846};
847
848static struct regulator_init_data __initdata max8997_32khz_cp_data = {
849 .constraints = {
850 .name = "32KHz CP",
851 .state_mem = {
852 .disabled = 1,
853 },
854 },
855};
856
857static struct regulator_init_data __initdata max8997_vichg_data = {
858 .constraints = {
859 .name = "VICHG",
860 .state_mem = {
861 .disabled = 1,
862 },
863 },
864};
865
866static struct regulator_init_data __initdata max8997_esafeout1_data = {
867 .constraints = {
868 .name = "SAFEOUT1",
869 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
870 .state_mem = {
871 .disabled = 1,
872 },
873 },
874 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_),
875 .consumer_supplies = max8997_esafeout1_,
876};
877
878static struct regulator_init_data __initdata max8997_esafeout2_data = {
879 .constraints = {
880 .name = "SAFEOUT2",
881 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
882 .state_mem = {
883 .disabled = 1,
884 },
885 },
886 .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_),
887 .consumer_supplies = max8997_esafeout2_,
888};
889
890static struct regulator_init_data __initdata max8997_charger_cv_data = {
891 .constraints = {
892 .name = "CHARGER_CV",
893 .min_uV = 4200000,
894 .max_uV = 4200000,
895 .apply_uV = 1,
896 },
897};
898
899static struct regulator_init_data __initdata max8997_charger_data = {
900 .constraints = {
901 .name = "CHARGER",
902 .min_uA = 200000,
903 .max_uA = 950000,
904 .boot_on = 1,
905 .valid_ops_mask = REGULATOR_CHANGE_STATUS |
906 REGULATOR_CHANGE_CURRENT,
907 },
908 .num_consumer_supplies = ARRAY_SIZE(max8997_charger_),
909 .consumer_supplies = max8997_charger_,
910};
911
912static struct regulator_init_data __initdata max8997_charger_topoff_data = {
913 .constraints = {
914 .name = "CHARGER TOPOFF",
915 .min_uA = 50000,
916 .max_uA = 200000,
917 .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
918 },
919 .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_),
920 .consumer_supplies = max8997_chg_toff_,
921};
922
923static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = {
924 { MAX8997_LDO1, &max8997_ldo1_data },
925 { MAX8997_LDO2, &max8997_ldo2_data },
926 { MAX8997_LDO3, &max8997_ldo3_data },
927 { MAX8997_LDO4, &max8997_ldo4_data },
928 { MAX8997_LDO5, &max8997_ldo5_data },
929 { MAX8997_LDO6, &max8997_ldo6_data },
930 { MAX8997_LDO7, &max8997_ldo7_data },
931 { MAX8997_LDO8, &max8997_ldo8_data },
932 { MAX8997_LDO9, &max8997_ldo9_data },
933 { MAX8997_LDO10, &max8997_ldo10_data },
934 { MAX8997_LDO11, &max8997_ldo11_data },
935 { MAX8997_LDO12, &max8997_ldo12_data },
936 { MAX8997_LDO13, &max8997_ldo13_data },
937 { MAX8997_LDO14, &max8997_ldo14_data },
938 { MAX8997_LDO15, &max8997_ldo15_data },
939 { MAX8997_LDO16, &max8997_ldo16_data },
940
941 { MAX8997_LDO18, &max8997_ldo18_data },
942 { MAX8997_LDO21, &max8997_ldo21_data },
943
944 { MAX8997_BUCK1, &max8997_buck1_data },
945 { MAX8997_BUCK2, &max8997_buck2_data },
946 { MAX8997_BUCK3, &max8997_buck3_data },
947 { MAX8997_BUCK4, &max8997_buck4_data },
948 { MAX8997_BUCK5, &max8997_buck5_data },
949 { MAX8997_BUCK6, &max8997_buck6_data },
950 { MAX8997_BUCK7, &max8997_buck7_data },
951
952 { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data },
953 { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data },
954
955 { MAX8997_ENVICHG, &max8997_vichg_data },
956 { MAX8997_ESAFEOUT1, &max8997_esafeout1_data },
957 { MAX8997_ESAFEOUT2, &max8997_esafeout2_data },
958 { MAX8997_CHARGER_CV, &max8997_charger_cv_data },
959 { MAX8997_CHARGER, &max8997_charger_data },
960 { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data },
961};
962
963static struct max8997_platform_data __initdata nuri_max8997_pdata = {
964 .wakeup = 1,
965
966 .num_regulators = ARRAY_SIZE(nuri_max8997_regulators),
967 .regulators = nuri_max8997_regulators,
968
969 .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
MyungJoo Ham29dee862011-07-21 00:31:27 +0900970
971 .buck1_voltage[0] = 1350000, /* 1.35V */
972 .buck1_voltage[1] = 1300000, /* 1.3V */
973 .buck1_voltage[2] = 1250000, /* 1.25V */
974 .buck1_voltage[3] = 1200000, /* 1.2V */
975 .buck1_voltage[4] = 1150000, /* 1.15V */
976 .buck1_voltage[5] = 1100000, /* 1.1V */
977 .buck1_voltage[6] = 1000000, /* 1.0V */
978 .buck1_voltage[7] = 950000, /* 0.95V */
979
980 .buck2_voltage[0] = 1100000, /* 1.1V */
981 .buck2_voltage[1] = 1000000, /* 1.0V */
982 .buck2_voltage[2] = 950000, /* 0.95V */
983 .buck2_voltage[3] = 900000, /* 0.9V */
984 .buck2_voltage[4] = 1100000, /* 1.1V */
985 .buck2_voltage[5] = 1000000, /* 1.0V */
986 .buck2_voltage[6] = 950000, /* 0.95V */
987 .buck2_voltage[7] = 900000, /* 0.9V */
988
989 .buck5_voltage[0] = 1200000, /* 1.2V */
990 .buck5_voltage[1] = 1200000, /* 1.2V */
991 .buck5_voltage[2] = 1200000, /* 1.2V */
992 .buck5_voltage[3] = 1200000, /* 1.2V */
993 .buck5_voltage[4] = 1200000, /* 1.2V */
994 .buck5_voltage[5] = 1200000, /* 1.2V */
995 .buck5_voltage[6] = 1200000, /* 1.2V */
996 .buck5_voltage[7] = 1200000, /* 1.2V */
997};
998
999/* GPIO I2C 5 (PMIC) */
1000enum { I2C5_MAX8997 };
1001static struct i2c_board_info i2c5_devs[] __initdata = {
1002 [I2C5_MAX8997] = {
1003 I2C_BOARD_INFO("max8997", 0xCC >> 1),
1004 .platform_data = &nuri_max8997_pdata,
1005 },
1006};
1007
MyungJoo Hama140b922011-07-21 00:31:27 +09001008static struct max17042_platform_data nuri_battery_platform_data = {
1009};
1010
1011/* GPIO I2C 9 (Fuel Gauge) */
1012static struct i2c_gpio_platform_data i2c9_gpio_data = {
1013 .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */
1014 .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */
1015};
1016static struct platform_device i2c9_gpio = {
1017 .name = "i2c-gpio",
1018 .id = 9,
1019 .dev = {
1020 .platform_data = &i2c9_gpio_data,
1021 },
1022};
1023enum { I2C9_MAX17042};
1024static struct i2c_board_info i2c9_devs[] __initdata = {
1025 [I2C9_MAX17042] = {
1026 I2C_BOARD_INFO("max17042", 0x36),
1027 .platform_data = &nuri_battery_platform_data,
1028 },
1029};
1030
MyungJoo Ham605baf62011-07-21 00:31:27 +09001031/* MAX8903 Secondary Charger */
1032static struct regulator_consumer_supply supplies_max8903[] = {
1033 REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
1034};
1035
1036static struct regulator_init_data max8903_charger_en_data = {
1037 .constraints = {
1038 .name = "VOUT_CHARGER",
1039 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
1040 .boot_on = 1,
1041 },
1042 .num_consumer_supplies = ARRAY_SIZE(supplies_max8903),
1043 .consumer_supplies = supplies_max8903,
1044};
1045
1046static struct fixed_voltage_config max8903_charger_en = {
1047 .supply_name = "VOUT_CHARGER",
1048 .microvolts = 5000000, /* Assume 5VDC */
1049 .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */
1050 .enable_high = 0, /* Enable = Low */
1051 .enabled_at_boot = 1,
1052 .init_data = &max8903_charger_en_data,
1053};
1054
1055static struct platform_device max8903_fixed_reg_dev = {
1056 .name = "reg-fixed-voltage",
1057 .id = FIXED_REG_ID_MAX8903,
1058 .dev = { .platform_data = &max8903_charger_en },
1059};
1060
1061static struct max8903_pdata nuri_max8903 = {
1062 /*
1063 * cen: don't control with the driver, let it be
1064 * controlled by regulator above
1065 */
1066 .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */
1067 /* uok, usus: not connected */
1068 .chg = EXYNOS4_GPE2(0), /* TA_nCHG */
1069 /* flt: vcc_1.8V_pda */
1070 .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */
1071
1072 .dc_valid = true,
1073 .usb_valid = false, /* USB is not wired to MAX8903 */
1074};
1075
1076static struct platform_device nuri_max8903_device = {
1077 .name = "max8903-charger",
1078 .dev = {
1079 .platform_data = &nuri_max8903,
1080 },
1081};
1082
MyungJoo Ham29dee862011-07-21 00:31:27 +09001083static void __init nuri_power_init(void)
1084{
1085 int gpio;
1086 int irq_base = IRQ_GPIO_END + 1;
MyungJoo Ham605baf62011-07-21 00:31:27 +09001087 int ta_en = 0;
MyungJoo Ham29dee862011-07-21 00:31:27 +09001088
1089 nuri_max8997_pdata.irq_base = irq_base;
1090 irq_base += MAX8997_IRQ_NR;
1091
1092 gpio = EXYNOS4_GPX0(7);
1093 gpio_request(gpio, "AP_PMIC_IRQ");
1094 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1095 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
MyungJoo Hama140b922011-07-21 00:31:27 +09001096
1097 gpio = EXYNOS4_GPX2(3);
1098 gpio_request(gpio, "FUEL_ALERT");
1099 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1100 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
MyungJoo Ham605baf62011-07-21 00:31:27 +09001101
1102 gpio = nuri_max8903.dok;
1103 gpio_request(gpio, "TA_nCONNECTED");
1104 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
1105 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
1106 ta_en = gpio_get_value(gpio) ? 0 : 1;
1107
1108 gpio = nuri_max8903.chg;
1109 gpio_request(gpio, "TA_nCHG");
1110 gpio_direction_input(gpio);
1111
1112 gpio = nuri_max8903.dcm;
1113 gpio_request(gpio, "CURR_ADJ");
1114 gpio_direction_output(gpio, ta_en);
MyungJoo Ham29dee862011-07-21 00:31:27 +09001115}
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001116
Joonyoung Shim01da92f2011-04-08 13:22:11 +09001117/* USB EHCI */
1118static struct s5p_ehci_platdata nuri_ehci_pdata;
1119
1120static void __init nuri_ehci_init(void)
1121{
1122 struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
1123
1124 s5p_ehci_set_platdata(pdata);
1125}
1126
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001127/* CAMERA */
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001128static struct regulator_consumer_supply cam_vt_cam15_supply =
1129 REGULATOR_SUPPLY("vdd_core", "6-003c");
1130
1131static struct regulator_init_data cam_vt_cam15_reg_init_data = {
1132 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1133 .num_consumer_supplies = 1,
1134 .consumer_supplies = &cam_vt_cam15_supply,
1135};
1136
1137static struct fixed_voltage_config cam_vt_cam15_fixed_voltage_cfg = {
1138 .supply_name = "VT_CAM_1.5V",
1139 .microvolts = 1500000,
1140 .gpio = EXYNOS4_GPE2(2), /* VT_CAM_1.5V_EN */
1141 .enable_high = 1,
1142 .init_data = &cam_vt_cam15_reg_init_data,
1143};
1144
1145static struct platform_device cam_vt_cam15_fixed_rdev = {
1146 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_15V,
1147 .dev = { .platform_data = &cam_vt_cam15_fixed_voltage_cfg },
1148};
1149
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001150static struct regulator_consumer_supply cam_vdda_supply[] = {
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001151 REGULATOR_SUPPLY("vdda", "6-003c"),
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001152 REGULATOR_SUPPLY("a_sensor", "0-001f"),
1153};
1154
1155static struct regulator_init_data cam_vdda_reg_init_data = {
1156 .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
1157 .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply),
1158 .consumer_supplies = cam_vdda_supply,
1159};
1160
1161static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = {
1162 .supply_name = "CAM_IO_EN",
1163 .microvolts = 2800000,
1164 .gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */
1165 .enable_high = 1,
1166 .init_data = &cam_vdda_reg_init_data,
1167};
1168
1169static struct platform_device cam_vdda_fixed_rdev = {
1170 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V,
1171 .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg },
1172};
1173
1174static struct regulator_consumer_supply camera_8m_12v_supply =
1175 REGULATOR_SUPPLY("dig_12", "0-001f");
1176
1177static struct regulator_init_data cam_8m_12v_reg_init_data = {
1178 .num_consumer_supplies = 1,
1179 .consumer_supplies = &camera_8m_12v_supply,
1180 .constraints = {
1181 .valid_ops_mask = REGULATOR_CHANGE_STATUS
1182 },
1183};
1184
1185static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = {
1186 .supply_name = "8M_1.2V",
1187 .microvolts = 1200000,
1188 .gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */
1189 .enable_high = 1,
1190 .init_data = &cam_8m_12v_reg_init_data,
1191};
1192
1193static struct platform_device cam_8m_12v_fixed_rdev = {
1194 .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V,
1195 .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg },
1196};
1197
1198static struct s5p_platform_mipi_csis mipi_csis_platdata = {
1199 .clk_rate = 166000000UL,
1200 .lanes = 2,
1201 .alignment = 32,
1202 .hs_settle = 12,
1203 .phy_enable = s5p_csis_phy_enable,
1204};
1205
1206#define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */
1207#define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5)
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001208#define GPIO_CAM_VT_NSTBY EXYNOS4_GPL2(0)
1209#define GPIO_CAM_VT_NRST EXYNOS4_GPL2(1)
1210
1211static struct s5k6aa_platform_data s5k6aa_pldata = {
1212 .mclk_frequency = 24000000UL,
1213 .gpio_reset = { GPIO_CAM_VT_NRST, 0 },
1214 .gpio_stby = { GPIO_CAM_VT_NSTBY, 0 },
1215 .bus_type = V4L2_MBUS_PARALLEL,
1216 .horiz_flip = 1,
1217};
1218
1219static struct i2c_board_info s5k6aa_board_info = {
1220 I2C_BOARD_INFO("S5K6AA", 0x3c),
1221 .platform_data = &s5k6aa_pldata,
1222};
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001223
1224static struct m5mols_platform_data m5mols_platdata = {
1225 .gpio_reset = GPIO_CAM_MEGA_RST,
1226};
1227
1228static struct i2c_board_info m5mols_board_info = {
1229 I2C_BOARD_INFO("M5MOLS", 0x1F),
1230 .platform_data = &m5mols_platdata,
1231};
1232
1233static struct s5p_fimc_isp_info nuri_camera_sensors[] = {
1234 {
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001235 .flags = V4L2_MBUS_PCLK_SAMPLE_RISING |
1236 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1237 .bus_type = FIMC_ITU_601,
1238 .board_info = &s5k6aa_board_info,
1239 .clk_frequency = 24000000UL,
1240 .i2c_bus_num = 6,
1241 }, {
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001242 .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
1243 V4L2_MBUS_VSYNC_ACTIVE_LOW,
1244 .bus_type = FIMC_MIPI_CSI2,
1245 .board_info = &m5mols_board_info,
1246 .clk_frequency = 24000000UL,
1247 .csi_data_align = 32,
1248 },
1249};
1250
1251static struct s5p_platform_fimc fimc_md_platdata = {
1252 .isp_info = nuri_camera_sensors,
1253 .num_clients = ARRAY_SIZE(nuri_camera_sensors),
1254};
1255
1256static struct gpio nuri_camera_gpios[] = {
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001257 { GPIO_CAM_VT_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
1258 { GPIO_CAM_VT_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" },
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001259 { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
1260 { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
1261};
1262
Tushar Beherafdaf1302012-03-09 08:02:33 -08001263static void __init nuri_camera_init(void)
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001264{
1265 s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
1266 &s5p_device_mipi_csis0);
1267 s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
1268 &s5p_device_fimc_md);
1269
1270 if (gpio_request_array(nuri_camera_gpios,
1271 ARRAY_SIZE(nuri_camera_gpios))) {
1272 pr_err("%s: GPIO request failed\n", __func__);
1273 return;
1274 }
1275
1276 m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT);
1277 if (!IS_ERR_VALUE(m5mols_board_info.irq))
1278 s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF));
1279 else
1280 pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__);
1281
1282 /* Free GPIOs controlled directly by the sensor drivers. */
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001283 gpio_free(GPIO_CAM_VT_NRST);
1284 gpio_free(GPIO_CAM_VT_NSTBY);
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001285 gpio_free(GPIO_CAM_MEGA_RST);
1286
1287 if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) {
1288 pr_err("%s: Camera port A setup failed\n", __func__);
1289 return;
1290 }
1291 /* Increase drive strength of the sensor clock output */
1292 s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4);
1293}
1294
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001295static struct s3c2410_platform_i2c nuri_i2c6_platdata __initdata = {
1296 .frequency = 400000U,
1297 .sda_delay = 200,
1298 .bus_num = 6,
1299};
1300
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001301static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = {
1302 .frequency = 400000U,
1303 .sda_delay = 200,
1304};
1305
MyungJoo Hambae82bd2011-12-01 16:00:38 +09001306/* DEVFREQ controlling memory/bus */
1307static struct platform_device exynos4_bus_devfreq = {
1308 .name = "exynos4210-busfreq",
1309};
1310
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001311static struct platform_device *nuri_devices[] __initdata = {
1312 /* Samsung Platform Devices */
MyungJoo Ham29dee862011-07-21 00:31:27 +09001313 &s3c_device_i2c5, /* PMIC should initialize first */
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001314 &s3c_device_i2c0,
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001315 &s3c_device_i2c6,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001316 &emmc_fixed_voltage,
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001317 &s5p_device_mipi_csis0,
1318 &s5p_device_fimc0,
1319 &s5p_device_fimc1,
1320 &s5p_device_fimc2,
1321 &s5p_device_fimc3,
Marek Szyprowski0d88f942011-08-11 19:57:28 +09001322 &s5p_device_fimd0,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001323 &s3c_device_hsmmc0,
1324 &s3c_device_hsmmc2,
1325 &s3c_device_hsmmc3,
1326 &s3c_device_wdt,
Donghwa Leecc7df872011-03-08 07:17:09 +09001327 &s3c_device_timer[0],
Joonyoung Shim01da92f2011-04-08 13:22:11 +09001328 &s5p_device_ehci,
Joonyoung Shim3260ecd2011-03-23 15:25:14 +09001329 &s3c_device_i2c3,
MyungJoo Hama140b922011-07-21 00:31:27 +09001330 &i2c9_gpio,
MyungJoo Hamed9ba312011-07-21 00:31:27 +09001331 &s3c_device_adc,
Kamil Debskiec004662011-12-27 17:16:47 +09001332 &s5p_device_g2d,
Andrzej Pietrasiewicz72bce7b2012-03-09 08:25:25 -08001333 &s5p_device_jpeg,
MyungJoo Ham3a1a2b92011-07-21 00:31:27 +09001334 &s3c_device_rtc,
Marek Szyprowski4c0f0a32011-07-21 16:43:25 +09001335 &s5p_device_mfc,
1336 &s5p_device_mfc_l,
1337 &s5p_device_mfc_r,
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001338 &s5p_device_fimc_md,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001339
1340 /* NURI Devices */
1341 &nuri_gpio_keys,
Donghwa Leecc7df872011-03-08 07:17:09 +09001342 &nuri_lcd_device,
1343 &nuri_backlight_device,
MyungJoo Ham605baf62011-07-21 00:31:27 +09001344 &max8903_fixed_reg_dev,
1345 &nuri_max8903_device,
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001346 &cam_vt_cam15_fixed_rdev,
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001347 &cam_vdda_fixed_rdev,
1348 &cam_8m_12v_fixed_rdev,
MyungJoo Hambae82bd2011-12-01 16:00:38 +09001349 &exynos4_bus_devfreq,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001350};
1351
1352static void __init nuri_map_io(void)
1353{
Kukjin Kimcc511b82011-12-27 08:18:36 +01001354 exynos_init_io(NULL, 0);
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001355 s3c24xx_init_clocks(24000000);
1356 s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
1357}
1358
Marek Szyprowski4c0f0a32011-07-21 16:43:25 +09001359static void __init nuri_reserve(void)
1360{
1361 s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
1362}
1363
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001364static void __init nuri_machine_init(void)
1365{
1366 nuri_sdhci_init();
Joonyoung Shim3260ecd2011-03-23 15:25:14 +09001367 nuri_tsp_init();
MyungJoo Ham29dee862011-07-21 00:31:27 +09001368 nuri_power_init();
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001369
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001370 s3c_i2c0_set_platdata(&nuri_i2c0_platdata);
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001371 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
Joonyoung Shim3260ecd2011-03-23 15:25:14 +09001372 s3c_i2c3_set_platdata(&i2c3_data);
1373 i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
MyungJoo Ham29dee862011-07-21 00:31:27 +09001374 s3c_i2c5_set_platdata(NULL);
1375 i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7));
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001376 i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
MyungJoo Hama140b922011-07-21 00:31:27 +09001377 i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
1378 i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
Sylwester Nawrocki8f114e62012-01-31 13:27:02 +09001379 s3c_i2c6_set_platdata(&nuri_i2c6_platdata);
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001380
Marek Szyprowski0d88f942011-08-11 19:57:28 +09001381 s5p_fimd0_set_platdata(&nuri_fb_pdata);
1382
Sylwester Nawrocki716e84d2011-10-13 15:41:00 +09001383 nuri_camera_init();
1384
Joonyoung Shim01da92f2011-04-08 13:22:11 +09001385 nuri_ehci_init();
1386 clk_xusbxti.rate = 24000000;
1387
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001388 /* Last */
1389 platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
1390}
1391
1392MACHINE_START(NURI, "NURI")
1393 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
Nicolas Pitre2be5a4a2011-07-05 22:38:11 -04001394 .atag_offset = 0x100,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001395 .init_irq = exynos4_init_irq,
1396 .map_io = nuri_map_io,
Marc Zyngier4e44d2c2011-05-30 11:04:53 +01001397 .handle_irq = gic_handle_irq,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001398 .init_machine = nuri_machine_init,
1399 .timer = &exynos4_timer,
Marek Szyprowski4c0f0a32011-07-21 16:43:25 +09001400 .reserve = &nuri_reserve,
Russell King9eb48592012-01-03 11:56:53 +01001401 .restart = exynos4_restart,
Minkyu Kangcaf8b1f22011-02-28 20:39:43 +09001402MACHINE_END