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