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