Commit | Line | Data |
---|---|---|
2e57da41 JS |
1 | /* linux/arch/arm/mach-s5pv210/mach-goni.c |
2 | * | |
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | |
4 | * http://www.samsung.com/ | |
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/kernel.h> | |
12 | #include <linux/types.h> | |
13 | #include <linux/init.h> | |
14 | #include <linux/serial_core.h> | |
3965fdee | 15 | #include <linux/fb.h> |
ba149f3a MS |
16 | #include <linux/i2c.h> |
17 | #include <linux/i2c-gpio.h> | |
964de521 | 18 | #include <linux/i2c/atmel_mxt_ts.h> |
ba149f3a | 19 | #include <linux/mfd/max8998.h> |
80849798 | 20 | #include <linux/mfd/wm8994/pdata.h> |
e9dde6f1 | 21 | #include <linux/regulator/fixed.h> |
8415d5c4 MS |
22 | #include <linux/spi/spi.h> |
23 | #include <linux/spi/spi_gpio.h> | |
24 | #include <linux/lcd.h> | |
ba149f3a MS |
25 | #include <linux/gpio_keys.h> |
26 | #include <linux/input.h> | |
27 | #include <linux/gpio.h> | |
919ed895 | 28 | #include <linux/interrupt.h> |
2e57da41 JS |
29 | |
30 | #include <asm/mach/arch.h> | |
31 | #include <asm/mach/map.h> | |
32 | #include <asm/setup.h> | |
33 | #include <asm/mach-types.h> | |
34 | ||
35 | #include <mach/map.h> | |
36 | #include <mach/regs-clock.h> | |
37 | ||
ba149f3a | 38 | #include <plat/gpio-cfg.h> |
2e57da41 JS |
39 | #include <plat/regs-serial.h> |
40 | #include <plat/s5pv210.h> | |
41 | #include <plat/devs.h> | |
42 | #include <plat/cpu.h> | |
3965fdee | 43 | #include <plat/fb.h> |
528ef1b5 | 44 | #include <plat/iic.h> |
2a555582 | 45 | #include <plat/keypad.h> |
19b90c7c | 46 | #include <plat/sdhci.h> |
d5889d5d | 47 | #include <plat/clock.h> |
20780fcc | 48 | #include <plat/s5p-time.h> |
66eb1238 | 49 | #include <plat/mfc.h> |
7bf3ba6b | 50 | #include <plat/regs-fb-v4.h> |
2e57da41 JS |
51 | |
52 | /* Following are default values for UCON, ULCON and UFCON UART registers */ | |
c8def085 | 53 | #define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
2e57da41 JS |
54 | S3C2410_UCON_RXILEVEL | \ |
55 | S3C2410_UCON_TXIRQMODE | \ | |
56 | S3C2410_UCON_RXIRQMODE | \ | |
57 | S3C2410_UCON_RXFIFO_TOI | \ | |
58 | S3C2443_UCON_RXERR_IRQEN) | |
59 | ||
c8def085 | 60 | #define GONI_ULCON_DEFAULT S3C2410_LCON_CS8 |
2e57da41 | 61 | |
f2b7e3c5 | 62 | #define GONI_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE |
2e57da41 JS |
63 | |
64 | static struct s3c2410_uartcfg goni_uartcfgs[] __initdata = { | |
65 | [0] = { | |
66 | .hwport = 0, | |
67 | .flags = 0, | |
c8def085 KK |
68 | .ucon = GONI_UCON_DEFAULT, |
69 | .ulcon = GONI_ULCON_DEFAULT, | |
f2b7e3c5 | 70 | .ufcon = GONI_UFCON_DEFAULT | |
bbf7b358 | 71 | S5PV210_UFCON_TXTRIG256 | S5PV210_UFCON_RXTRIG256, |
2e57da41 JS |
72 | }, |
73 | [1] = { | |
74 | .hwport = 1, | |
75 | .flags = 0, | |
c8def085 KK |
76 | .ucon = GONI_UCON_DEFAULT, |
77 | .ulcon = GONI_ULCON_DEFAULT, | |
f2b7e3c5 | 78 | .ufcon = GONI_UFCON_DEFAULT | |
bbf7b358 | 79 | S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64, |
2e57da41 JS |
80 | }, |
81 | [2] = { | |
82 | .hwport = 2, | |
83 | .flags = 0, | |
c8def085 KK |
84 | .ucon = GONI_UCON_DEFAULT, |
85 | .ulcon = GONI_ULCON_DEFAULT, | |
f2b7e3c5 | 86 | .ufcon = GONI_UFCON_DEFAULT | |
bbf7b358 | 87 | S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16, |
2e57da41 JS |
88 | }, |
89 | [3] = { | |
90 | .hwport = 3, | |
91 | .flags = 0, | |
c8def085 KK |
92 | .ucon = GONI_UCON_DEFAULT, |
93 | .ulcon = GONI_ULCON_DEFAULT, | |
f2b7e3c5 | 94 | .ufcon = GONI_UFCON_DEFAULT | |
bbf7b358 | 95 | S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16, |
2e57da41 JS |
96 | }, |
97 | }; | |
98 | ||
3965fdee MS |
99 | /* Frame Buffer */ |
100 | static struct s3c_fb_pd_win goni_fb_win0 = { | |
101 | .win_mode = { | |
3965fdee MS |
102 | .left_margin = 16, |
103 | .right_margin = 16, | |
9d1fc39c | 104 | .upper_margin = 2, |
3965fdee MS |
105 | .lower_margin = 28, |
106 | .hsync_len = 2, | |
9d1fc39c | 107 | .vsync_len = 1, |
3965fdee MS |
108 | .xres = 480, |
109 | .yres = 800, | |
110 | .refresh = 55, | |
111 | }, | |
112 | .max_bpp = 32, | |
113 | .default_bpp = 16, | |
c472da6d SN |
114 | .virtual_x = 480, |
115 | .virtual_y = 2 * 800, | |
3965fdee MS |
116 | }; |
117 | ||
118 | static struct s3c_fb_platdata goni_lcd_pdata __initdata = { | |
119 | .win[0] = &goni_fb_win0, | |
120 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB | | |
121 | VIDCON0_CLKSEL_LCD, | |
122 | .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN | |
123 | | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, | |
124 | .setup_gpio = s5pv210_fb_gpio_setup_24bpp, | |
125 | }; | |
126 | ||
8415d5c4 MS |
127 | static int lcd_power_on(struct lcd_device *ld, int enable) |
128 | { | |
129 | return 1; | |
130 | } | |
131 | ||
132 | static int reset_lcd(struct lcd_device *ld) | |
133 | { | |
134 | static unsigned int first = 1; | |
135 | int reset_gpio = -1; | |
136 | ||
137 | reset_gpio = S5PV210_MP05(5); | |
138 | ||
139 | if (first) { | |
140 | gpio_request(reset_gpio, "MLCD_RST"); | |
141 | first = 0; | |
142 | } | |
143 | ||
144 | gpio_direction_output(reset_gpio, 1); | |
145 | return 1; | |
146 | } | |
147 | ||
148 | static struct lcd_platform_data goni_lcd_platform_data = { | |
149 | .reset = reset_lcd, | |
150 | .power_on = lcd_power_on, | |
151 | .lcd_enabled = 0, | |
152 | .reset_delay = 120, /* 120ms */ | |
153 | .power_on_delay = 25, /* 25ms */ | |
154 | .power_off_delay = 200, /* 200ms */ | |
155 | }; | |
156 | ||
157 | #define LCD_BUS_NUM 3 | |
158 | static struct spi_board_info spi_board_info[] __initdata = { | |
159 | { | |
160 | .modalias = "s6e63m0", | |
161 | .platform_data = &goni_lcd_platform_data, | |
162 | .max_speed_hz = 1200000, | |
163 | .bus_num = LCD_BUS_NUM, | |
164 | .chip_select = 0, | |
165 | .mode = SPI_MODE_3, | |
166 | .controller_data = (void *)S5PV210_MP01(1), /* DISPLAY_CS */ | |
167 | }, | |
168 | }; | |
169 | ||
170 | static struct spi_gpio_platform_data lcd_spi_gpio_data = { | |
171 | .sck = S5PV210_MP04(1), /* DISPLAY_CLK */ | |
172 | .mosi = S5PV210_MP04(3), /* DISPLAY_SI */ | |
173 | .miso = SPI_GPIO_NO_MISO, | |
174 | .num_chipselect = 1, | |
175 | }; | |
176 | ||
177 | static struct platform_device goni_spi_gpio = { | |
178 | .name = "spi_gpio", | |
179 | .id = LCD_BUS_NUM, | |
180 | .dev = { | |
181 | .parent = &s3c_device_fb.dev, | |
182 | .platform_data = &lcd_spi_gpio_data, | |
183 | }, | |
184 | }; | |
185 | ||
2a555582 JS |
186 | /* KEYPAD */ |
187 | static uint32_t keymap[] __initdata = { | |
188 | /* KEY(row, col, keycode) */ | |
189 | KEY(0, 1, KEY_MENU), /* Send */ | |
190 | KEY(0, 2, KEY_BACK), /* End */ | |
191 | KEY(1, 1, KEY_CONFIG), /* Half shot */ | |
192 | KEY(1, 2, KEY_VOLUMEUP), | |
193 | KEY(2, 1, KEY_CAMERA), /* Full shot */ | |
194 | KEY(2, 2, KEY_VOLUMEDOWN), | |
195 | }; | |
196 | ||
197 | static struct matrix_keymap_data keymap_data __initdata = { | |
198 | .keymap = keymap, | |
199 | .keymap_size = ARRAY_SIZE(keymap), | |
200 | }; | |
201 | ||
202 | static struct samsung_keypad_platdata keypad_data __initdata = { | |
203 | .keymap_data = &keymap_data, | |
204 | .rows = 3, | |
205 | .cols = 3, | |
206 | }; | |
207 | ||
528ef1b5 MS |
208 | /* Radio */ |
209 | static struct i2c_board_info i2c1_devs[] __initdata = { | |
210 | { | |
211 | I2C_BOARD_INFO("si470x", 0x10), | |
212 | }, | |
213 | }; | |
214 | ||
215 | static void __init goni_radio_init(void) | |
216 | { | |
217 | int gpio; | |
218 | ||
219 | gpio = S5PV210_GPJ2(4); /* XMSMDATA_4 */ | |
220 | gpio_request(gpio, "FM_INT"); | |
221 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | |
222 | i2c1_devs[0].irq = gpio_to_irq(gpio); | |
223 | ||
224 | gpio = S5PV210_GPJ2(5); /* XMSMDATA_5 */ | |
225 | gpio_request(gpio, "FM_RST"); | |
226 | gpio_direction_output(gpio, 1); | |
227 | } | |
228 | ||
b4a0dca7 | 229 | /* TSP */ |
7686b108 | 230 | static struct mxt_platform_data qt602240_platform_data = { |
b4a0dca7 MS |
231 | .x_line = 17, |
232 | .y_line = 11, | |
233 | .x_size = 800, | |
234 | .y_size = 480, | |
235 | .blen = 0x21, | |
236 | .threshold = 0x28, | |
237 | .voltage = 2800000, /* 2.8V */ | |
7686b108 | 238 | .orient = MXT_DIAGONAL, |
919ed895 | 239 | .irqflags = IRQF_TRIGGER_FALLING, |
b4a0dca7 MS |
240 | }; |
241 | ||
242 | static struct s3c2410_platform_i2c i2c2_data __initdata = { | |
243 | .flags = 0, | |
244 | .bus_num = 2, | |
245 | .slave_addr = 0x10, | |
246 | .frequency = 400 * 1000, | |
247 | .sda_delay = 100, | |
248 | }; | |
249 | ||
250 | static struct i2c_board_info i2c2_devs[] __initdata = { | |
251 | { | |
252 | I2C_BOARD_INFO("qt602240_ts", 0x4a), | |
253 | .platform_data = &qt602240_platform_data, | |
254 | }, | |
255 | }; | |
256 | ||
257 | static void __init goni_tsp_init(void) | |
258 | { | |
259 | int gpio; | |
260 | ||
261 | gpio = S5PV210_GPJ1(3); /* XMSMADDR_11 */ | |
262 | gpio_request(gpio, "TSP_LDO_ON"); | |
263 | gpio_direction_output(gpio, 1); | |
264 | gpio_export(gpio, 0); | |
265 | ||
266 | gpio = S5PV210_GPJ0(5); /* XMSMADDR_5 */ | |
267 | gpio_request(gpio, "TSP_INT"); | |
268 | ||
269 | s5p_register_gpio_interrupt(gpio); | |
270 | s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf)); | |
271 | s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP); | |
272 | i2c2_devs[0].irq = gpio_to_irq(gpio); | |
273 | } | |
274 | ||
ba149f3a MS |
275 | /* MAX8998 regulators */ |
276 | #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE) | |
277 | ||
1d017fee MS |
278 | static struct regulator_consumer_supply goni_ldo3_consumers[] = { |
279 | REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"), | |
280 | }; | |
281 | ||
e9dde6f1 MS |
282 | static struct regulator_consumer_supply goni_ldo5_consumers[] = { |
283 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"), | |
284 | }; | |
285 | ||
1d017fee MS |
286 | static struct regulator_consumer_supply goni_ldo8_consumers[] = { |
287 | REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"), | |
288 | }; | |
289 | ||
9a16afdf SN |
290 | static struct regulator_consumer_supply goni_ldo11_consumers[] = { |
291 | REGULATOR_SUPPLY("vddio", "0-0030"), /* "CAM_IO_2.8V" */ | |
292 | }; | |
293 | ||
294 | static struct regulator_consumer_supply goni_ldo13_consumers[] = { | |
295 | REGULATOR_SUPPLY("vdda", "0-0030"), /* "CAM_A_2.8V" */ | |
296 | }; | |
297 | ||
298 | static struct regulator_consumer_supply goni_ldo14_consumers[] = { | |
299 | REGULATOR_SUPPLY("vdd_core", "0-0030"), /* "CAM_CIF_1.8V" */ | |
300 | }; | |
301 | ||
ba149f3a MS |
302 | static struct regulator_init_data goni_ldo2_data = { |
303 | .constraints = { | |
304 | .name = "VALIVE_1.1V", | |
305 | .min_uV = 1100000, | |
306 | .max_uV = 1100000, | |
307 | .apply_uV = 1, | |
308 | .always_on = 1, | |
309 | .state_mem = { | |
310 | .enabled = 1, | |
311 | }, | |
312 | }, | |
313 | }; | |
314 | ||
315 | static struct regulator_init_data goni_ldo3_data = { | |
316 | .constraints = { | |
d1061331 | 317 | .name = "VUSB+MIPI_1.1V", |
ba149f3a MS |
318 | .min_uV = 1100000, |
319 | .max_uV = 1100000, | |
320 | .apply_uV = 1, | |
1d017fee | 321 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
ba149f3a | 322 | }, |
1d017fee MS |
323 | .num_consumer_supplies = ARRAY_SIZE(goni_ldo3_consumers), |
324 | .consumer_supplies = goni_ldo3_consumers, | |
ba149f3a MS |
325 | }; |
326 | ||
327 | static struct regulator_init_data goni_ldo4_data = { | |
328 | .constraints = { | |
329 | .name = "VDAC_3.3V", | |
330 | .min_uV = 3300000, | |
331 | .max_uV = 3300000, | |
332 | .apply_uV = 1, | |
333 | }, | |
334 | }; | |
335 | ||
336 | static struct regulator_init_data goni_ldo5_data = { | |
337 | .constraints = { | |
338 | .name = "VTF_2.8V", | |
339 | .min_uV = 2800000, | |
340 | .max_uV = 2800000, | |
341 | .apply_uV = 1, | |
9b8306c6 | 342 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
ba149f3a | 343 | }, |
e9dde6f1 MS |
344 | .num_consumer_supplies = ARRAY_SIZE(goni_ldo5_consumers), |
345 | .consumer_supplies = goni_ldo5_consumers, | |
ba149f3a MS |
346 | }; |
347 | ||
348 | static struct regulator_init_data goni_ldo6_data = { | |
349 | .constraints = { | |
350 | .name = "VCC_3.3V", | |
351 | .min_uV = 3300000, | |
352 | .max_uV = 3300000, | |
353 | .apply_uV = 1, | |
354 | }, | |
355 | }; | |
356 | ||
357 | static struct regulator_init_data goni_ldo7_data = { | |
358 | .constraints = { | |
359 | .name = "VLCD_1.8V", | |
360 | .min_uV = 1800000, | |
361 | .max_uV = 1800000, | |
362 | .apply_uV = 1, | |
363 | .always_on = 1, | |
364 | }, | |
365 | }; | |
366 | ||
367 | static struct regulator_init_data goni_ldo8_data = { | |
368 | .constraints = { | |
d1061331 | 369 | .name = "VUSB+VADC_3.3V", |
ba149f3a MS |
370 | .min_uV = 3300000, |
371 | .max_uV = 3300000, | |
372 | .apply_uV = 1, | |
1d017fee | 373 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
ba149f3a | 374 | }, |
1d017fee MS |
375 | .num_consumer_supplies = ARRAY_SIZE(goni_ldo8_consumers), |
376 | .consumer_supplies = goni_ldo8_consumers, | |
ba149f3a MS |
377 | }; |
378 | ||
379 | static struct regulator_init_data goni_ldo9_data = { | |
380 | .constraints = { | |
d1061331 | 381 | .name = "VCC+VCAM_2.8V", |
ba149f3a MS |
382 | .min_uV = 2800000, |
383 | .max_uV = 2800000, | |
384 | .apply_uV = 1, | |
ba149f3a MS |
385 | }, |
386 | }; | |
387 | ||
388 | static struct regulator_init_data goni_ldo10_data = { | |
389 | .constraints = { | |
390 | .name = "VPLL_1.1V", | |
391 | .min_uV = 1100000, | |
392 | .max_uV = 1100000, | |
393 | .apply_uV = 1, | |
394 | .boot_on = 1, | |
395 | }, | |
396 | }; | |
397 | ||
398 | static struct regulator_init_data goni_ldo11_data = { | |
399 | .constraints = { | |
400 | .name = "CAM_IO_2.8V", | |
401 | .min_uV = 2800000, | |
402 | .max_uV = 2800000, | |
403 | .apply_uV = 1, | |
9a16afdf | 404 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
ba149f3a | 405 | }, |
9a16afdf SN |
406 | .num_consumer_supplies = ARRAY_SIZE(goni_ldo11_consumers), |
407 | .consumer_supplies = goni_ldo11_consumers, | |
ba149f3a MS |
408 | }; |
409 | ||
410 | static struct regulator_init_data goni_ldo12_data = { | |
411 | .constraints = { | |
412 | .name = "CAM_ISP_1.2V", | |
413 | .min_uV = 1200000, | |
414 | .max_uV = 1200000, | |
415 | .apply_uV = 1, | |
ba149f3a MS |
416 | }, |
417 | }; | |
418 | ||
419 | static struct regulator_init_data goni_ldo13_data = { | |
420 | .constraints = { | |
421 | .name = "CAM_A_2.8V", | |
422 | .min_uV = 2800000, | |
423 | .max_uV = 2800000, | |
424 | .apply_uV = 1, | |
9a16afdf | 425 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
ba149f3a | 426 | }, |
9a16afdf SN |
427 | .num_consumer_supplies = ARRAY_SIZE(goni_ldo13_consumers), |
428 | .consumer_supplies = goni_ldo13_consumers, | |
ba149f3a MS |
429 | }; |
430 | ||
431 | static struct regulator_init_data goni_ldo14_data = { | |
432 | .constraints = { | |
433 | .name = "CAM_CIF_1.8V", | |
434 | .min_uV = 1800000, | |
435 | .max_uV = 1800000, | |
436 | .apply_uV = 1, | |
9a16afdf | 437 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
ba149f3a | 438 | }, |
9a16afdf SN |
439 | .num_consumer_supplies = ARRAY_SIZE(goni_ldo14_consumers), |
440 | .consumer_supplies = goni_ldo14_consumers, | |
ba149f3a MS |
441 | }; |
442 | ||
443 | static struct regulator_init_data goni_ldo15_data = { | |
444 | .constraints = { | |
445 | .name = "CAM_AF_3.3V", | |
446 | .min_uV = 3300000, | |
447 | .max_uV = 3300000, | |
448 | .apply_uV = 1, | |
ba149f3a MS |
449 | }, |
450 | }; | |
451 | ||
452 | static struct regulator_init_data goni_ldo16_data = { | |
453 | .constraints = { | |
454 | .name = "VMIPI_1.8V", | |
455 | .min_uV = 1800000, | |
456 | .max_uV = 1800000, | |
457 | .apply_uV = 1, | |
ba149f3a MS |
458 | }, |
459 | }; | |
460 | ||
461 | static struct regulator_init_data goni_ldo17_data = { | |
462 | .constraints = { | |
463 | .name = "VCC_3.0V_LCD", | |
464 | .min_uV = 3000000, | |
465 | .max_uV = 3000000, | |
466 | .apply_uV = 1, | |
467 | .always_on = 1, | |
468 | }, | |
469 | }; | |
470 | ||
471 | /* BUCK */ | |
d3f9c570 KK |
472 | static struct regulator_consumer_supply buck1_consumer = |
473 | REGULATOR_SUPPLY("vddarm", NULL); | |
ba149f3a | 474 | |
d3f9c570 KK |
475 | static struct regulator_consumer_supply buck2_consumer = |
476 | REGULATOR_SUPPLY("vddint", NULL); | |
ba149f3a MS |
477 | |
478 | static struct regulator_init_data goni_buck1_data = { | |
479 | .constraints = { | |
480 | .name = "VARM_1.2V", | |
481 | .min_uV = 1200000, | |
482 | .max_uV = 1200000, | |
483 | .apply_uV = 1, | |
484 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
485 | REGULATOR_CHANGE_STATUS, | |
486 | }, | |
d3f9c570 KK |
487 | .num_consumer_supplies = 1, |
488 | .consumer_supplies = &buck1_consumer, | |
ba149f3a MS |
489 | }; |
490 | ||
491 | static struct regulator_init_data goni_buck2_data = { | |
492 | .constraints = { | |
493 | .name = "VINT_1.2V", | |
494 | .min_uV = 1200000, | |
495 | .max_uV = 1200000, | |
496 | .apply_uV = 1, | |
497 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | | |
498 | REGULATOR_CHANGE_STATUS, | |
499 | }, | |
d3f9c570 KK |
500 | .num_consumer_supplies = 1, |
501 | .consumer_supplies = &buck2_consumer, | |
ba149f3a MS |
502 | }; |
503 | ||
504 | static struct regulator_init_data goni_buck3_data = { | |
505 | .constraints = { | |
506 | .name = "VCC_1.8V", | |
507 | .min_uV = 1800000, | |
508 | .max_uV = 1800000, | |
509 | .apply_uV = 1, | |
510 | .state_mem = { | |
511 | .enabled = 1, | |
512 | }, | |
513 | }, | |
514 | }; | |
515 | ||
516 | static struct regulator_init_data goni_buck4_data = { | |
517 | .constraints = { | |
518 | .name = "CAM_CORE_1.2V", | |
519 | .min_uV = 1200000, | |
520 | .max_uV = 1200000, | |
521 | .apply_uV = 1, | |
522 | .always_on = 1, | |
523 | }, | |
524 | }; | |
525 | ||
526 | static struct max8998_regulator_data goni_regulators[] = { | |
527 | { MAX8998_LDO2, &goni_ldo2_data }, | |
528 | { MAX8998_LDO3, &goni_ldo3_data }, | |
529 | { MAX8998_LDO4, &goni_ldo4_data }, | |
530 | { MAX8998_LDO5, &goni_ldo5_data }, | |
531 | { MAX8998_LDO6, &goni_ldo6_data }, | |
532 | { MAX8998_LDO7, &goni_ldo7_data }, | |
533 | { MAX8998_LDO8, &goni_ldo8_data }, | |
534 | { MAX8998_LDO9, &goni_ldo9_data }, | |
535 | { MAX8998_LDO10, &goni_ldo10_data }, | |
536 | { MAX8998_LDO11, &goni_ldo11_data }, | |
537 | { MAX8998_LDO12, &goni_ldo12_data }, | |
538 | { MAX8998_LDO13, &goni_ldo13_data }, | |
539 | { MAX8998_LDO14, &goni_ldo14_data }, | |
540 | { MAX8998_LDO15, &goni_ldo15_data }, | |
541 | { MAX8998_LDO16, &goni_ldo16_data }, | |
542 | { MAX8998_LDO17, &goni_ldo17_data }, | |
543 | { MAX8998_BUCK1, &goni_buck1_data }, | |
544 | { MAX8998_BUCK2, &goni_buck2_data }, | |
545 | { MAX8998_BUCK3, &goni_buck3_data }, | |
546 | { MAX8998_BUCK4, &goni_buck4_data }, | |
547 | }; | |
548 | ||
549 | static struct max8998_platform_data goni_max8998_pdata = { | |
550 | .num_regulators = ARRAY_SIZE(goni_regulators), | |
551 | .regulators = goni_regulators, | |
cb186886 MS |
552 | .buck1_set1 = S5PV210_GPH0(3), |
553 | .buck1_set2 = S5PV210_GPH0(4), | |
554 | .buck2_set3 = S5PV210_GPH0(5), | |
979f395d MS |
555 | .buck1_voltage1 = 1200000, |
556 | .buck1_voltage2 = 1200000, | |
557 | .buck1_voltage3 = 1200000, | |
558 | .buck1_voltage4 = 1200000, | |
559 | .buck2_voltage1 = 1200000, | |
560 | .buck2_voltage2 = 1200000, | |
ba149f3a MS |
561 | }; |
562 | #endif | |
563 | ||
80849798 | 564 | static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = { |
d3f9c570 KK |
565 | REGULATOR_SUPPLY("DBVDD", "5-001a"), |
566 | REGULATOR_SUPPLY("AVDD2", "5-001a"), | |
567 | REGULATOR_SUPPLY("CPVDD", "5-001a"), | |
80849798 CC |
568 | }; |
569 | ||
570 | static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = { | |
d3f9c570 KK |
571 | REGULATOR_SUPPLY("SPKVDD1", "5-001a"), |
572 | REGULATOR_SUPPLY("SPKVDD2", "5-001a"), | |
80849798 CC |
573 | }; |
574 | ||
575 | static struct regulator_init_data wm8994_fixed_voltage0_init_data = { | |
576 | .constraints = { | |
577 | .always_on = 1, | |
578 | }, | |
579 | .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies), | |
580 | .consumer_supplies = wm8994_fixed_voltage0_supplies, | |
581 | }; | |
582 | ||
583 | static struct regulator_init_data wm8994_fixed_voltage1_init_data = { | |
584 | .constraints = { | |
585 | .always_on = 1, | |
586 | }, | |
587 | .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies), | |
588 | .consumer_supplies = wm8994_fixed_voltage1_supplies, | |
589 | }; | |
590 | ||
591 | static struct fixed_voltage_config wm8994_fixed_voltage0_config = { | |
592 | .supply_name = "VCC_1.8V_PDA", | |
593 | .microvolts = 1800000, | |
594 | .gpio = -EINVAL, | |
595 | .init_data = &wm8994_fixed_voltage0_init_data, | |
596 | }; | |
597 | ||
598 | static struct fixed_voltage_config wm8994_fixed_voltage1_config = { | |
599 | .supply_name = "V_BAT", | |
600 | .microvolts = 3700000, | |
601 | .gpio = -EINVAL, | |
602 | .init_data = &wm8994_fixed_voltage1_init_data, | |
603 | }; | |
604 | ||
605 | static struct platform_device wm8994_fixed_voltage0 = { | |
606 | .name = "reg-fixed-voltage", | |
607 | .id = 0, | |
608 | .dev = { | |
609 | .platform_data = &wm8994_fixed_voltage0_config, | |
610 | }, | |
611 | }; | |
612 | ||
613 | static struct platform_device wm8994_fixed_voltage1 = { | |
614 | .name = "reg-fixed-voltage", | |
615 | .id = 1, | |
616 | .dev = { | |
617 | .platform_data = &wm8994_fixed_voltage1_config, | |
618 | }, | |
619 | }; | |
620 | ||
d3f9c570 KK |
621 | static struct regulator_consumer_supply wm8994_avdd1_supply = |
622 | REGULATOR_SUPPLY("AVDD1", "5-001a"); | |
80849798 | 623 | |
d3f9c570 KK |
624 | static struct regulator_consumer_supply wm8994_dcvdd_supply = |
625 | REGULATOR_SUPPLY("DCVDD", "5-001a"); | |
80849798 CC |
626 | |
627 | static struct regulator_init_data wm8994_ldo1_data = { | |
628 | .constraints = { | |
629 | .name = "AVDD1_3.0V", | |
630 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
631 | }, | |
632 | .num_consumer_supplies = 1, | |
633 | .consumer_supplies = &wm8994_avdd1_supply, | |
634 | }; | |
635 | ||
636 | static struct regulator_init_data wm8994_ldo2_data = { | |
637 | .constraints = { | |
638 | .name = "DCVDD_1.0V", | |
639 | }, | |
640 | .num_consumer_supplies = 1, | |
641 | .consumer_supplies = &wm8994_dcvdd_supply, | |
642 | }; | |
643 | ||
644 | static struct wm8994_pdata wm8994_platform_data = { | |
645 | /* configure gpio1 function: 0x0001(Logic level input/output) */ | |
646 | .gpio_defaults[0] = 0x0001, | |
647 | /* configure gpio3/4/5/7 function for AIF2 voice */ | |
648 | .gpio_defaults[2] = 0x8100, | |
649 | .gpio_defaults[3] = 0x8100, | |
650 | .gpio_defaults[4] = 0x8100, | |
651 | .gpio_defaults[6] = 0x0100, | |
652 | /* configure gpio8/9/10/11 function for AIF3 BT */ | |
653 | .gpio_defaults[7] = 0x8100, | |
654 | .gpio_defaults[8] = 0x0100, | |
655 | .gpio_defaults[9] = 0x0100, | |
656 | .gpio_defaults[10] = 0x0100, | |
657 | .ldo[0] = { S5PV210_MP03(6), NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */ | |
658 | .ldo[1] = { 0, NULL, &wm8994_ldo2_data }, | |
659 | }; | |
660 | ||
ba149f3a MS |
661 | /* GPIO I2C PMIC */ |
662 | #define AP_I2C_GPIO_PMIC_BUS_4 4 | |
663 | static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = { | |
664 | .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */ | |
665 | .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */ | |
666 | }; | |
667 | ||
668 | static struct platform_device goni_i2c_gpio_pmic = { | |
669 | .name = "i2c-gpio", | |
670 | .id = AP_I2C_GPIO_PMIC_BUS_4, | |
671 | .dev = { | |
672 | .platform_data = &goni_i2c_gpio_pmic_data, | |
673 | }, | |
674 | }; | |
675 | ||
676 | static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = { | |
677 | #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE) | |
678 | { | |
679 | /* 0xCC when SRAD = 0 */ | |
680 | I2C_BOARD_INFO("max8998", 0xCC >> 1), | |
681 | .platform_data = &goni_max8998_pdata, | |
682 | }, | |
683 | #endif | |
684 | }; | |
685 | ||
5112267e CC |
686 | /* GPIO I2C AP 1.8V */ |
687 | #define AP_I2C_GPIO_BUS_5 5 | |
688 | static struct i2c_gpio_platform_data goni_i2c_gpio5_data = { | |
689 | .sda_pin = S5PV210_MP05(3), /* XM0ADDR_11 */ | |
690 | .scl_pin = S5PV210_MP05(2), /* XM0ADDR_10 */ | |
691 | }; | |
692 | ||
693 | static struct platform_device goni_i2c_gpio5 = { | |
694 | .name = "i2c-gpio", | |
695 | .id = AP_I2C_GPIO_BUS_5, | |
696 | .dev = { | |
697 | .platform_data = &goni_i2c_gpio5_data, | |
698 | }, | |
699 | }; | |
700 | ||
701 | static struct i2c_board_info i2c_gpio5_devs[] __initdata = { | |
702 | { | |
703 | /* CS/ADDR = low 0x34 (FYI: high = 0x36) */ | |
704 | I2C_BOARD_INFO("wm8994", 0x1a), | |
80849798 | 705 | .platform_data = &wm8994_platform_data, |
5112267e CC |
706 | }, |
707 | }; | |
708 | ||
ba149f3a MS |
709 | /* PMIC Power button */ |
710 | static struct gpio_keys_button goni_gpio_keys_table[] = { | |
711 | { | |
712 | .code = KEY_POWER, | |
713 | .gpio = S5PV210_GPH2(6), | |
714 | .desc = "gpio-keys: KEY_POWER", | |
715 | .type = EV_KEY, | |
716 | .active_low = 1, | |
717 | .wakeup = 1, | |
718 | .debounce_interval = 1, | |
719 | }, | |
720 | }; | |
721 | ||
722 | static struct gpio_keys_platform_data goni_gpio_keys_data = { | |
723 | .buttons = goni_gpio_keys_table, | |
724 | .nbuttons = ARRAY_SIZE(goni_gpio_keys_table), | |
725 | }; | |
726 | ||
727 | static struct platform_device goni_device_gpiokeys = { | |
728 | .name = "gpio-keys", | |
729 | .dev = { | |
730 | .platform_data = &goni_gpio_keys_data, | |
731 | }, | |
732 | }; | |
733 | ||
734 | static void __init goni_pmic_init(void) | |
735 | { | |
736 | /* AP_PMIC_IRQ: EINT7 */ | |
737 | s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf)); | |
738 | s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP); | |
739 | ||
740 | /* nPower: EINT22 */ | |
741 | s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf)); | |
742 | s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP); | |
743 | } | |
744 | ||
19b90c7c MS |
745 | /* MoviNAND */ |
746 | static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = { | |
747 | .max_width = 4, | |
748 | .cd_type = S3C_SDHCI_CD_PERMANENT, | |
749 | }; | |
750 | ||
751 | /* Wireless LAN */ | |
752 | static struct s3c_sdhci_platdata goni_hsmmc1_data __initdata = { | |
753 | .max_width = 4, | |
754 | .cd_type = S3C_SDHCI_CD_EXTERNAL, | |
755 | /* ext_cd_{init,cleanup} callbacks will be added later */ | |
756 | }; | |
757 | ||
758 | /* External Flash */ | |
759 | #define GONI_EXT_FLASH_EN S5PV210_MP05(4) | |
760 | #define GONI_EXT_FLASH_CD S5PV210_GPH3(4) | |
761 | static struct s3c_sdhci_platdata goni_hsmmc2_data __initdata = { | |
762 | .max_width = 4, | |
763 | .cd_type = S3C_SDHCI_CD_GPIO, | |
764 | .ext_cd_gpio = GONI_EXT_FLASH_CD, | |
765 | .ext_cd_gpio_invert = 1, | |
766 | }; | |
767 | ||
e9dde6f1 MS |
768 | static struct regulator_consumer_supply mmc2_supplies[] = { |
769 | REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), | |
770 | }; | |
771 | ||
772 | static struct regulator_init_data mmc2_fixed_voltage_init_data = { | |
773 | .constraints = { | |
774 | .name = "V_TF_2.8V", | |
775 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, | |
776 | }, | |
777 | .num_consumer_supplies = ARRAY_SIZE(mmc2_supplies), | |
778 | .consumer_supplies = mmc2_supplies, | |
779 | }; | |
780 | ||
781 | static struct fixed_voltage_config mmc2_fixed_voltage_config = { | |
782 | .supply_name = "EXT_FLASH_EN", | |
783 | .microvolts = 2800000, | |
784 | .gpio = GONI_EXT_FLASH_EN, | |
785 | .enable_high = true, | |
786 | .init_data = &mmc2_fixed_voltage_init_data, | |
787 | }; | |
788 | ||
789 | static struct platform_device mmc2_fixed_voltage = { | |
790 | .name = "reg-fixed-voltage", | |
791 | .id = 2, | |
792 | .dev = { | |
793 | .platform_data = &mmc2_fixed_voltage_config, | |
794 | }, | |
795 | }; | |
796 | ||
19b90c7c MS |
797 | static void goni_setup_sdhci(void) |
798 | { | |
19b90c7c MS |
799 | s3c_sdhci0_set_platdata(&goni_hsmmc0_data); |
800 | s3c_sdhci1_set_platdata(&goni_hsmmc1_data); | |
801 | s3c_sdhci2_set_platdata(&goni_hsmmc2_data); | |
802 | }; | |
ba149f3a | 803 | |
2e57da41 | 804 | static struct platform_device *goni_devices[] __initdata = { |
3965fdee | 805 | &s3c_device_fb, |
13904fba | 806 | &s5p_device_onenand, |
8415d5c4 | 807 | &goni_spi_gpio, |
ba149f3a | 808 | &goni_i2c_gpio_pmic, |
5112267e | 809 | &goni_i2c_gpio5, |
e9dde6f1 | 810 | &mmc2_fixed_voltage, |
ba149f3a | 811 | &goni_device_gpiokeys, |
66eb1238 KD |
812 | &s5p_device_mfc, |
813 | &s5p_device_mfc_l, | |
814 | &s5p_device_mfc_r, | |
9c4f0a39 | 815 | &s3c_device_i2c0, |
9f488c6f SN |
816 | &s5p_device_fimc0, |
817 | &s5p_device_fimc1, | |
818 | &s5p_device_fimc2, | |
19b90c7c MS |
819 | &s3c_device_hsmmc0, |
820 | &s3c_device_hsmmc1, | |
821 | &s3c_device_hsmmc2, | |
6c29e71c | 822 | &s5pv210_device_iis0, |
d5889d5d | 823 | &s3c_device_usb_hsotg, |
2a555582 | 824 | &samsung_device_keypad, |
528ef1b5 | 825 | &s3c_device_i2c1, |
b4a0dca7 | 826 | &s3c_device_i2c2, |
80849798 CC |
827 | &wm8994_fixed_voltage0, |
828 | &wm8994_fixed_voltage1, | |
2e57da41 JS |
829 | }; |
830 | ||
6c29e71c CC |
831 | static void __init goni_sound_init(void) |
832 | { | |
833 | /* Ths main clock of WM8994 codec uses the output of CLKOUT pin. | |
834 | * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS) | |
835 | * because it needs 24MHz clock to operate WM8994 codec. | |
836 | */ | |
837 | __raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS); | |
838 | } | |
839 | ||
2e57da41 JS |
840 | static void __init goni_map_io(void) |
841 | { | |
842 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); | |
843 | s3c24xx_init_clocks(24000000); | |
844 | s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs)); | |
20780fcc | 845 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); |
2e57da41 JS |
846 | } |
847 | ||
66eb1238 KD |
848 | static void __init goni_reserve(void) |
849 | { | |
850 | s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20); | |
851 | } | |
852 | ||
2e57da41 JS |
853 | static void __init goni_machine_init(void) |
854 | { | |
528ef1b5 MS |
855 | /* Radio: call before I2C 1 registeration */ |
856 | goni_radio_init(); | |
857 | ||
9c4f0a39 SN |
858 | /* I2C0 */ |
859 | s3c_i2c0_set_platdata(NULL); | |
860 | ||
528ef1b5 MS |
861 | /* I2C1 */ |
862 | s3c_i2c1_set_platdata(NULL); | |
863 | i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs)); | |
864 | ||
b4a0dca7 MS |
865 | /* TSP: call before I2C 2 registeration */ |
866 | goni_tsp_init(); | |
867 | ||
868 | /* I2C2 */ | |
869 | s3c_i2c2_set_platdata(&i2c2_data); | |
870 | i2c_register_board_info(2, i2c2_devs, ARRAY_SIZE(i2c2_devs)); | |
871 | ||
ba149f3a MS |
872 | /* PMIC */ |
873 | goni_pmic_init(); | |
874 | i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs, | |
875 | ARRAY_SIZE(i2c_gpio_pmic_devs)); | |
19b90c7c MS |
876 | /* SDHCI */ |
877 | goni_setup_sdhci(); | |
878 | ||
5112267e | 879 | /* SOUND */ |
6c29e71c | 880 | goni_sound_init(); |
5112267e CC |
881 | i2c_register_board_info(AP_I2C_GPIO_BUS_5, i2c_gpio5_devs, |
882 | ARRAY_SIZE(i2c_gpio5_devs)); | |
883 | ||
3965fdee MS |
884 | /* FB */ |
885 | s3c_fb_set_platdata(&goni_lcd_pdata); | |
886 | ||
8415d5c4 MS |
887 | /* SPI */ |
888 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); | |
889 | ||
2a555582 JS |
890 | /* KEYPAD */ |
891 | samsung_keypad_set_platdata(&keypad_data); | |
892 | ||
d5889d5d MS |
893 | clk_xusbxti.rate = 24000000; |
894 | ||
2e57da41 JS |
895 | platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices)); |
896 | } | |
897 | ||
898 | MACHINE_START(GONI, "GONI") | |
899 | /* Maintainers: Kyungmin Park <kyungmin.park@samsung.com> */ | |
2e57da41 JS |
900 | .boot_params = S5P_PA_SDRAM + 0x100, |
901 | .init_irq = s5pv210_init_irq, | |
902 | .map_io = goni_map_io, | |
903 | .init_machine = goni_machine_init, | |
20780fcc | 904 | .timer = &s5p_timer, |
66eb1238 | 905 | .reserve = &goni_reserve, |
2e57da41 | 906 | MACHINE_END |