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