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