OSDN Git Service

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