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