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