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