Merge branch 'samsung/board' into next/boards
[linux-3.10.git] / arch / arm / mach-s3c64xx / mach-crag6410.c
1 /* linux/arch/arm/mach-s3c64xx/mach-crag6410.c
2  *
3  * Copyright 2011 Wolfson Microelectronics plc
4  *      Mark Brown <broonie@opensource.wolfsonmicro.com>
5  *
6  * Copyright 2011 Simtec Electronics
7  *      Ben Dooks <ben@simtec.co.uk>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13
14 #include <linux/kernel.h>
15 #include <linux/list.h>
16 #include <linux/serial_core.h>
17 #include <linux/platform_device.h>
18 #include <linux/fb.h>
19 #include <linux/io.h>
20 #include <linux/init.h>
21 #include <linux/gpio.h>
22 #include <linux/delay.h>
23 #include <linux/regulator/machine.h>
24 #include <linux/regulator/fixed.h>
25 #include <linux/pwm_backlight.h>
26 #include <linux/dm9000.h>
27 #include <linux/gpio_keys.h>
28 #include <linux/basic_mmio_gpio.h>
29 #include <linux/spi/spi.h>
30
31 #include <linux/i2c/pca953x.h>
32
33 #include <video/platform_lcd.h>
34
35 #include <linux/mfd/wm831x/core.h>
36 #include <linux/mfd/wm831x/pdata.h>
37 #include <linux/mfd/wm831x/irq.h>
38 #include <linux/mfd/wm831x/gpio.h>
39
40 #include <sound/wm1250-ev1.h>
41
42 #include <asm/hardware/vic.h>
43 #include <asm/mach/arch.h>
44 #include <asm/mach-types.h>
45
46 #include <mach/hardware.h>
47 #include <mach/map.h>
48
49 #include <mach/regs-sys.h>
50 #include <mach/regs-gpio.h>
51 #include <mach/regs-modem.h>
52 #include <mach/crag6410.h>
53
54 #include <mach/regs-gpio-memport.h>
55
56 #include <plat/s3c6410.h>
57 #include <plat/regs-serial.h>
58 #include <plat/regs-fb-v4.h>
59 #include <plat/fb.h>
60 #include <plat/sdhci.h>
61 #include <plat/gpio-cfg.h>
62 #include <plat/s3c64xx-spi.h>
63
64 #include <plat/keypad.h>
65 #include <plat/clock.h>
66 #include <plat/devs.h>
67 #include <plat/cpu.h>
68 #include <plat/adc.h>
69 #include <plat/iic.h>
70 #include <plat/pm.h>
71
72 /* serial port setup */
73
74 #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
75 #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
76 #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
77
78 static struct s3c2410_uartcfg crag6410_uartcfgs[] __initdata = {
79         [0] = {
80                 .hwport         = 0,
81                 .flags          = 0,
82                 .ucon           = UCON,
83                 .ulcon          = ULCON,
84                 .ufcon          = UFCON,
85         },
86         [1] = {
87                 .hwport         = 1,
88                 .flags          = 0,
89                 .ucon           = UCON,
90                 .ulcon          = ULCON,
91                 .ufcon          = UFCON,
92         },
93         [2] = {
94                 .hwport         = 2,
95                 .flags          = 0,
96                 .ucon           = UCON,
97                 .ulcon          = ULCON,
98                 .ufcon          = UFCON,
99         },
100         [3] = {
101                 .hwport         = 3,
102                 .flags          = 0,
103                 .ucon           = UCON,
104                 .ulcon          = ULCON,
105                 .ufcon          = UFCON,
106         },
107 };
108
109 static struct platform_pwm_backlight_data crag6410_backlight_data = {
110         .pwm_id         = 0,
111         .max_brightness = 1000,
112         .dft_brightness = 600,
113         .pwm_period_ns  = 100000,       /* about 1kHz */
114 };
115
116 static struct platform_device crag6410_backlight_device = {
117         .name           = "pwm-backlight",
118         .id             = -1,
119         .dev            = {
120                 .parent = &s3c_device_timer[0].dev,
121                 .platform_data = &crag6410_backlight_data,
122         },
123 };
124
125 static void crag6410_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
126 {
127         pr_debug("%s: setting power %d\n", __func__, power);
128
129         if (power) {
130                 gpio_set_value(S3C64XX_GPB(0), 1);
131                 msleep(1);
132                 s3c_gpio_cfgpin(S3C64XX_GPF(14), S3C_GPIO_SFN(2));
133         } else {
134                 gpio_direction_output(S3C64XX_GPF(14), 0);
135                 gpio_set_value(S3C64XX_GPB(0), 0);
136         }
137 }
138
139 static struct platform_device crag6410_lcd_powerdev = {
140         .name                   = "platform-lcd",
141         .id                     = -1,
142         .dev.parent             = &s3c_device_fb.dev,
143         .dev.platform_data      = &(struct plat_lcd_data) {
144                 .set_power      = crag6410_lcd_power_set,
145         },
146 };
147
148 /* 640x480 URT */
149 static struct s3c_fb_pd_win crag6410_fb_win0 = {
150         /* this is to ensure we use win0 */
151         .win_mode       = {
152                 .left_margin    = 150,
153                 .right_margin   = 80,
154                 .upper_margin   = 40,
155                 .lower_margin   = 5,
156                 .hsync_len      = 40,
157                 .vsync_len      = 5,
158                 .xres           = 640,
159                 .yres           = 480,
160         },
161         .max_bpp        = 32,
162         .default_bpp    = 16,
163         .virtual_y      = 480 * 2,
164         .virtual_x      = 640,
165 };
166
167 /* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
168 static struct s3c_fb_platdata crag6410_lcd_pdata __initdata = {
169         .setup_gpio     = s3c64xx_fb_gpio_setup_24bpp,
170         .win[0]         = &crag6410_fb_win0,
171         .vidcon0        = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
172         .vidcon1        = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
173 };
174
175 /* 2x6 keypad */
176
177 static uint32_t crag6410_keymap[] __initdata = {
178         /* KEY(row, col, keycode) */
179         KEY(0, 0, KEY_VOLUMEUP),
180         KEY(0, 1, KEY_HOME),
181         KEY(0, 2, KEY_VOLUMEDOWN),
182         KEY(0, 3, KEY_HELP),
183         KEY(0, 4, KEY_MENU),
184         KEY(0, 5, KEY_MEDIA),
185         KEY(1, 0, 232),
186         KEY(1, 1, KEY_DOWN),
187         KEY(1, 2, KEY_LEFT),
188         KEY(1, 3, KEY_UP),
189         KEY(1, 4, KEY_RIGHT),
190         KEY(1, 5, KEY_CAMERA),
191 };
192
193 static struct matrix_keymap_data crag6410_keymap_data __initdata = {
194         .keymap         = crag6410_keymap,
195         .keymap_size    = ARRAY_SIZE(crag6410_keymap),
196 };
197
198 static struct samsung_keypad_platdata crag6410_keypad_data __initdata = {
199         .keymap_data    = &crag6410_keymap_data,
200         .rows           = 2,
201         .cols           = 6,
202 };
203
204 static struct gpio_keys_button crag6410_gpio_keys[] = {
205         [0] = {
206                 .code   = KEY_SUSPEND,
207                 .gpio   = S3C64XX_GPL(10),      /* EINT 18 */
208                 .type   = EV_KEY,
209                 .wakeup = 1,
210                 .active_low = 1,
211         },
212         [1] = {
213                 .code   = SW_FRONT_PROXIMITY,
214                 .gpio   = S3C64XX_GPN(11),      /* EINT 11 */
215                 .type   = EV_SW,
216         },
217 };
218
219 static struct gpio_keys_platform_data crag6410_gpio_keydata = {
220         .buttons        = crag6410_gpio_keys,
221         .nbuttons       = ARRAY_SIZE(crag6410_gpio_keys),
222 };
223
224 static struct platform_device crag6410_gpio_keydev = {
225         .name           = "gpio-keys",
226         .id             = 0,
227         .dev.platform_data = &crag6410_gpio_keydata,
228 };
229
230 static struct resource crag6410_dm9k_resource[] = {
231         [0] = {
232                 .start  = S3C64XX_PA_XM0CSN5,
233                 .end    = S3C64XX_PA_XM0CSN5 + 1,
234                 .flags  = IORESOURCE_MEM,
235         },
236         [1] = {
237                 .start  = S3C64XX_PA_XM0CSN5 + (1 << 8),
238                 .end    = S3C64XX_PA_XM0CSN5 + (1 << 8) + 1,
239                 .flags  = IORESOURCE_MEM,
240         },
241         [2] = {
242                 .start  = S3C_EINT(17),
243                 .end    = S3C_EINT(17),
244                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
245         },
246 };
247
248 static struct dm9000_plat_data mini6410_dm9k_pdata = {
249         .flags  = DM9000_PLATF_16BITONLY,
250 };
251
252 static struct platform_device crag6410_dm9k_device = {
253         .name           = "dm9000",
254         .id             = -1,
255         .num_resources  = ARRAY_SIZE(crag6410_dm9k_resource),
256         .resource       = crag6410_dm9k_resource,
257         .dev.platform_data = &mini6410_dm9k_pdata,
258 };
259
260 static struct resource crag6410_mmgpio_resource[] = {
261         [0] = {
262                 .start  = S3C64XX_PA_XM0CSN4 + 1,
263                 .end    = S3C64XX_PA_XM0CSN4 + 1,
264                 .flags  = IORESOURCE_MEM,
265         },
266 };
267
268 static struct platform_device crag6410_mmgpio = {
269         .name           = "basic-mmio-gpio",
270         .id             = -1,
271         .resource       = crag6410_mmgpio_resource,
272         .num_resources  = ARRAY_SIZE(crag6410_mmgpio_resource),
273         .dev.platform_data = &(struct bgpio_pdata) {
274                 .base   = -1,
275         },
276 };
277
278 static struct platform_device speyside_device = {
279         .name           = "speyside",
280         .id             = -1,
281 };
282
283 static struct platform_device lowland_device = {
284         .name           = "lowland",
285         .id             = -1,
286 };
287
288 static struct platform_device speyside_wm8962_device = {
289         .name           = "speyside-wm8962",
290         .id             = -1,
291 };
292
293 static struct platform_device littlemill_device = {
294         .name           = "littlemill",
295         .id             = -1,
296 };
297
298 static struct regulator_consumer_supply wallvdd_consumers[] = {
299         REGULATOR_SUPPLY("SPKVDD1", "1-001a"),
300         REGULATOR_SUPPLY("SPKVDD2", "1-001a"),
301         REGULATOR_SUPPLY("SPKVDDL", "1-001a"),
302         REGULATOR_SUPPLY("SPKVDDR", "1-001a"),
303 };
304
305 static struct regulator_init_data wallvdd_data = {
306         .constraints = {
307                 .always_on = 1,
308         },
309         .num_consumer_supplies = ARRAY_SIZE(wallvdd_consumers),
310         .consumer_supplies = wallvdd_consumers,
311 };
312
313 static struct fixed_voltage_config wallvdd_pdata = {
314         .supply_name = "WALLVDD",
315         .microvolts = 5000000,
316         .init_data = &wallvdd_data,
317         .gpio = -EINVAL,
318 };
319
320 static struct platform_device wallvdd_device = {
321         .name           = "reg-fixed-voltage",
322         .id             = -1,
323         .dev = {
324                 .platform_data = &wallvdd_pdata,
325         },
326 };
327
328 static struct platform_device *crag6410_devices[] __initdata = {
329         &s3c_device_hsmmc0,
330         &s3c_device_hsmmc1,
331         &s3c_device_hsmmc2,
332         &s3c_device_i2c0,
333         &s3c_device_i2c1,
334         &s3c_device_fb,
335         &s3c_device_ohci,
336         &s3c_device_usb_hsotg,
337         &s3c_device_timer[0],
338         &s3c64xx_device_iis0,
339         &s3c64xx_device_iis1,
340         &samsung_asoc_dma,
341         &samsung_device_keypad,
342         &crag6410_gpio_keydev,
343         &crag6410_dm9k_device,
344         &s3c64xx_device_spi0,
345         &crag6410_mmgpio,
346         &crag6410_lcd_powerdev,
347         &crag6410_backlight_device,
348         &speyside_device,
349         &speyside_wm8962_device,
350         &littlemill_device,
351         &lowland_device,
352         &wallvdd_device,
353 };
354
355 static struct pca953x_platform_data crag6410_pca_data = {
356         .gpio_base      = PCA935X_GPIO_BASE,
357         .irq_base       = 0,
358 };
359
360 /* VDDARM is controlled by DVS1 connected to GPK(0) */
361 static struct wm831x_buckv_pdata vddarm_pdata = {
362         .dvs_control_src = 1,
363         .dvs_gpio = S3C64XX_GPK(0),
364 };
365
366 static struct regulator_consumer_supply vddarm_consumers[] __initdata = {
367         REGULATOR_SUPPLY("vddarm", NULL),
368 };
369
370 static struct regulator_init_data vddarm __initdata = {
371         .constraints = {
372                 .name = "VDDARM",
373                 .min_uV = 1000000,
374                 .max_uV = 1300000,
375                 .always_on = 1,
376                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
377         },
378         .num_consumer_supplies = ARRAY_SIZE(vddarm_consumers),
379         .consumer_supplies = vddarm_consumers,
380         .supply_regulator = "WALLVDD",
381         .driver_data = &vddarm_pdata,
382 };
383
384 static struct regulator_consumer_supply vddint_consumers[] __initdata = {
385         REGULATOR_SUPPLY("vddint", NULL),
386 };
387
388 static struct regulator_init_data vddint __initdata = {
389         .constraints = {
390                 .name = "VDDINT",
391                 .min_uV = 1000000,
392                 .max_uV = 1200000,
393                 .always_on = 1,
394                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
395         },
396         .num_consumer_supplies = ARRAY_SIZE(vddint_consumers),
397         .consumer_supplies = vddint_consumers,
398         .supply_regulator = "WALLVDD",
399 };
400
401 static struct regulator_init_data vddmem __initdata = {
402         .constraints = {
403                 .name = "VDDMEM",
404                 .always_on = 1,
405         },
406 };
407
408 static struct regulator_init_data vddsys __initdata = {
409         .constraints = {
410                 .name = "VDDSYS,VDDEXT,VDDPCM,VDDSS",
411                 .always_on = 1,
412         },
413 };
414
415 static struct regulator_consumer_supply vddmmc_consumers[] __initdata = {
416         REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
417         REGULATOR_SUPPLY("vmmc", "s3c-sdhci.1"),
418         REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
419 };
420
421 static struct regulator_init_data vddmmc __initdata = {
422         .constraints = {
423                 .name = "VDDMMC,UH",
424                 .always_on = 1,
425         },
426         .num_consumer_supplies = ARRAY_SIZE(vddmmc_consumers),
427         .consumer_supplies = vddmmc_consumers,
428         .supply_regulator = "WALLVDD",
429 };
430
431 static struct regulator_init_data vddotgi __initdata = {
432         .constraints = {
433                 .name = "VDDOTGi",
434                 .always_on = 1,
435         },
436         .supply_regulator = "WALLVDD",
437 };
438
439 static struct regulator_init_data vddotg __initdata = {
440         .constraints = {
441                 .name = "VDDOTG",
442                 .always_on = 1,
443         },
444         .supply_regulator = "WALLVDD",
445 };
446
447 static struct regulator_init_data vddhi __initdata = {
448         .constraints = {
449                 .name = "VDDHI",
450                 .always_on = 1,
451         },
452         .supply_regulator = "WALLVDD",
453 };
454
455 static struct regulator_init_data vddadc __initdata = {
456         .constraints = {
457                 .name = "VDDADC,VDDDAC",
458                 .always_on = 1,
459         },
460         .supply_regulator = "WALLVDD",
461 };
462
463 static struct regulator_init_data vddmem0 __initdata = {
464         .constraints = {
465                 .name = "VDDMEM0",
466                 .always_on = 1,
467         },
468         .supply_regulator = "WALLVDD",
469 };
470
471 static struct regulator_init_data vddpll __initdata = {
472         .constraints = {
473                 .name = "VDDPLL",
474                 .always_on = 1,
475         },
476         .supply_regulator = "WALLVDD",
477 };
478
479 static struct regulator_init_data vddlcd __initdata = {
480         .constraints = {
481                 .name = "VDDLCD",
482                 .always_on = 1,
483         },
484         .supply_regulator = "WALLVDD",
485 };
486
487 static struct regulator_init_data vddalive __initdata = {
488         .constraints = {
489                 .name = "VDDALIVE",
490                 .always_on = 1,
491         },
492         .supply_regulator = "WALLVDD",
493 };
494
495 static struct wm831x_backup_pdata banff_backup_pdata __initdata = {
496         .charger_enable = 1,
497         .vlim = 2500,  /* mV */
498         .ilim = 200,   /* uA */
499 };
500
501 static struct wm831x_status_pdata banff_red_led __initdata = {
502         .name = "banff:red:",
503         .default_src = WM831X_STATUS_MANUAL,
504 };
505
506 static struct wm831x_status_pdata banff_green_led __initdata = {
507         .name = "banff:green:",
508         .default_src = WM831X_STATUS_MANUAL,
509 };
510
511 static struct wm831x_touch_pdata touch_pdata __initdata = {
512         .data_irq = S3C_EINT(26),
513         .pd_irq = S3C_EINT(27),
514 };
515
516 static struct wm831x_pdata crag_pmic_pdata __initdata = {
517         .wm831x_num = 1,
518         .irq_base = BANFF_PMIC_IRQ_BASE,
519         .gpio_base = BANFF_PMIC_GPIO_BASE,
520         .soft_shutdown = true,
521
522         .backup = &banff_backup_pdata,
523
524         .gpio_defaults = {
525                 /* GPIO5: DVS1_REQ - CMOS, DBVDD, active high */
526                 [4] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA | 0x8,
527                 /* GPIO11: Touchscreen data - CMOS, DBVDD, active high*/
528                 [10] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x6,
529                 /* GPIO12: Touchscreen pen down - CMOS, DBVDD, active high*/
530                 [11] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x7,
531         },
532
533         .dcdc = {
534                 &vddarm,  /* DCDC1 */
535                 &vddint,  /* DCDC2 */
536                 &vddmem,  /* DCDC3 */
537         },
538
539         .ldo = {
540                 &vddsys,   /* LDO1 */
541                 &vddmmc,   /* LDO2 */
542                 NULL,      /* LDO3 */
543                 &vddotgi,  /* LDO4 */
544                 &vddotg,   /* LDO5 */
545                 &vddhi,    /* LDO6 */
546                 &vddadc,   /* LDO7 */
547                 &vddmem0,  /* LDO8 */
548                 &vddpll,   /* LDO9 */
549                 &vddlcd,   /* LDO10 */
550                 &vddalive, /* LDO11 */
551         },
552
553         .status = {
554                 &banff_green_led,
555                 &banff_red_led,
556         },
557
558         .touch = &touch_pdata,
559 };
560
561 static struct i2c_board_info i2c_devs0[] __initdata = {
562         { I2C_BOARD_INFO("24c08", 0x50), },
563         { I2C_BOARD_INFO("tca6408", 0x20),
564           .platform_data = &crag6410_pca_data,
565         },
566         { I2C_BOARD_INFO("wm8312", 0x34),
567           .platform_data = &crag_pmic_pdata,
568           .irq = S3C_EINT(23),
569         },
570 };
571
572 static struct s3c2410_platform_i2c i2c0_pdata = {
573         .frequency = 400000,
574 };
575
576 static struct regulator_init_data pvdd_1v2 __initdata = {
577         .constraints = {
578                 .name = "PVDD_1V2",
579                 .always_on = 1,
580         },
581 };
582
583 static struct regulator_consumer_supply pvdd_1v8_consumers[] __initdata = {
584         REGULATOR_SUPPLY("LDOVDD", "1-001a"),
585         REGULATOR_SUPPLY("PLLVDD", "1-001a"),
586         REGULATOR_SUPPLY("DBVDD", "1-001a"),
587         REGULATOR_SUPPLY("DBVDD1", "1-001a"),
588         REGULATOR_SUPPLY("DBVDD2", "1-001a"),
589         REGULATOR_SUPPLY("DBVDD3", "1-001a"),
590         REGULATOR_SUPPLY("CPVDD", "1-001a"),
591         REGULATOR_SUPPLY("AVDD2", "1-001a"),
592         REGULATOR_SUPPLY("DCVDD", "1-001a"),
593         REGULATOR_SUPPLY("AVDD", "1-001a"),
594 };
595
596 static struct regulator_init_data pvdd_1v8 __initdata = {
597         .constraints = {
598                 .name = "PVDD_1V8",
599                 .always_on = 1,
600         },
601
602         .consumer_supplies = pvdd_1v8_consumers,
603         .num_consumer_supplies = ARRAY_SIZE(pvdd_1v8_consumers),
604 };
605
606 static struct regulator_consumer_supply pvdd_3v3_consumers[] __initdata = {
607         REGULATOR_SUPPLY("MICVDD", "1-001a"),
608         REGULATOR_SUPPLY("AVDD1", "1-001a"),
609 };
610
611 static struct regulator_init_data pvdd_3v3 __initdata = {
612         .constraints = {
613                 .name = "PVDD_3V3",
614                 .always_on = 1,
615         },
616
617         .consumer_supplies = pvdd_3v3_consumers,
618         .num_consumer_supplies = ARRAY_SIZE(pvdd_3v3_consumers),
619 };
620
621 static struct wm831x_pdata glenfarclas_pmic_pdata __initdata = {
622         .wm831x_num = 2,
623         .irq_base = GLENFARCLAS_PMIC_IRQ_BASE,
624         .gpio_base = GLENFARCLAS_PMIC_GPIO_BASE,
625         .soft_shutdown = true,
626
627         .gpio_defaults = {
628                 /* GPIO1-3: IRQ inputs, rising edge triggered, CMOS */
629                 [0] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
630                 [1] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
631                 [2] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
632         },
633
634         .dcdc = {
635                 &pvdd_1v2,  /* DCDC1 */
636                 &pvdd_1v8,  /* DCDC2 */
637                 &pvdd_3v3,  /* DCDC3 */
638         },
639
640         .disable_touch = true,
641 };
642
643 static struct wm1250_ev1_pdata wm1250_ev1_pdata = {
644         .gpios = {
645                 [WM1250_EV1_GPIO_CLK_ENA] = S3C64XX_GPN(12),
646                 [WM1250_EV1_GPIO_CLK_SEL0] = S3C64XX_GPL(12),
647                 [WM1250_EV1_GPIO_CLK_SEL1] = S3C64XX_GPL(13),
648                 [WM1250_EV1_GPIO_OSR] = S3C64XX_GPL(14),
649                 [WM1250_EV1_GPIO_MASTER] = S3C64XX_GPL(8),
650         },
651 };
652
653 static struct i2c_board_info i2c_devs1[] __initdata = {
654         { I2C_BOARD_INFO("wm8311", 0x34),
655           .irq = S3C_EINT(0),
656           .platform_data = &glenfarclas_pmic_pdata },
657
658         { I2C_BOARD_INFO("wlf-gf-module", 0x24) },
659         { I2C_BOARD_INFO("wlf-gf-module", 0x25) },
660         { I2C_BOARD_INFO("wlf-gf-module", 0x26) },
661
662         { I2C_BOARD_INFO("wm1250-ev1", 0x27),
663           .platform_data = &wm1250_ev1_pdata },
664 };
665
666 static struct s3c2410_platform_i2c i2c1_pdata = {
667         .frequency = 400000,
668         .bus_num = 1,
669 };
670
671 static void __init crag6410_map_io(void)
672 {
673         s3c64xx_init_io(NULL, 0);
674         s3c24xx_init_clocks(12000000);
675         s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
676
677         /* LCD type and Bypass set by bootloader */
678 }
679
680 static struct s3c_sdhci_platdata crag6410_hsmmc2_pdata = {
681         .max_width              = 4,
682         .cd_type                = S3C_SDHCI_CD_PERMANENT,
683 };
684
685 static struct s3c_sdhci_platdata crag6410_hsmmc1_pdata = {
686         .max_width              = 4,
687         .cd_type                = S3C_SDHCI_CD_GPIO,
688         .ext_cd_gpio            = S3C64XX_GPF(11),
689 };
690
691 static void crag6410_cfg_sdhci0(struct platform_device *dev, int width)
692 {
693         /* Set all the necessary GPG pins to special-function 2 */
694         s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
695
696         /* force card-detected for prototype 0 */
697         s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_DOWN);
698 }
699
700 static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
701         .max_width              = 4,
702         .cd_type                = S3C_SDHCI_CD_INTERNAL,
703         .cfg_gpio               = crag6410_cfg_sdhci0,
704 };
705
706 static void __init crag6410_machine_init(void)
707 {
708         /* Open drain IRQs need pullups */
709         s3c_gpio_setpull(S3C64XX_GPM(0), S3C_GPIO_PULL_UP);
710         s3c_gpio_setpull(S3C64XX_GPN(0), S3C_GPIO_PULL_UP);
711
712         gpio_request(S3C64XX_GPB(0), "LCD power");
713         gpio_direction_output(S3C64XX_GPB(0), 0);
714
715         gpio_request(S3C64XX_GPF(14), "LCD PWM");
716         gpio_direction_output(S3C64XX_GPF(14), 0);  /* turn off */
717
718         gpio_request(S3C64XX_GPB(1), "SD power");
719         gpio_direction_output(S3C64XX_GPB(1), 0);
720
721         gpio_request(S3C64XX_GPF(10), "nRESETSEL");
722         gpio_direction_output(S3C64XX_GPF(10), 1);
723
724         s3c_sdhci0_set_platdata(&crag6410_hsmmc0_pdata);
725         s3c_sdhci1_set_platdata(&crag6410_hsmmc1_pdata);
726         s3c_sdhci2_set_platdata(&crag6410_hsmmc2_pdata);
727
728         s3c_i2c0_set_platdata(&i2c0_pdata);
729         s3c_i2c1_set_platdata(&i2c1_pdata);
730         s3c_fb_set_platdata(&crag6410_lcd_pdata);
731
732         i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
733         i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
734
735         samsung_keypad_set_platdata(&crag6410_keypad_data);
736
737         platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
738
739         regulator_has_full_constraints();
740
741         s3c_pm_init();
742 }
743
744 MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
745         /* Maintainer: Mark Brown <broonie@opensource.wolfsonmicro.com> */
746         .atag_offset    = 0x100,
747         .init_irq       = s3c6410_init_irq,
748         .handle_irq     = vic_handle_irq,
749         .map_io         = crag6410_map_io,
750         .init_machine   = crag6410_machine_init,
751         .timer          = &s3c24xx_timer,
752 MACHINE_END