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