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