0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/kernel.h>
0010 #include <linux/list.h>
0011 #include <linux/serial_core.h>
0012 #include <linux/serial_s3c.h>
0013 #include <linux/platform_device.h>
0014 #include <linux/fb.h>
0015 #include <linux/io.h>
0016 #include <linux/init.h>
0017 #include <linux/gpio.h>
0018 #include <linux/gpio/machine.h>
0019 #include <linux/leds.h>
0020 #include <linux/delay.h>
0021 #include <linux/mmc/host.h>
0022 #include <linux/regulator/machine.h>
0023 #include <linux/regulator/fixed.h>
0024 #include <linux/pwm.h>
0025 #include <linux/pwm_backlight.h>
0026 #include <linux/dm9000.h>
0027 #include <linux/gpio_keys.h>
0028 #include <linux/gpio/driver.h>
0029 #include <linux/spi/spi.h>
0030
0031 #include <linux/platform_data/pca953x.h>
0032 #include <linux/platform_data/s3c-hsotg.h>
0033
0034 #include <video/platform_lcd.h>
0035
0036 #include <linux/mfd/wm831x/core.h>
0037 #include <linux/mfd/wm831x/pdata.h>
0038 #include <linux/mfd/wm831x/irq.h>
0039 #include <linux/mfd/wm831x/gpio.h>
0040
0041 #include <sound/wm1250-ev1.h>
0042
0043 #include <asm/mach/arch.h>
0044 #include <asm/mach-types.h>
0045
0046 #include <video/samsung_fimd.h>
0047 #include "map.h"
0048 #include "regs-gpio.h"
0049 #include "gpio-samsung.h"
0050 #include "irqs.h"
0051
0052 #include "fb.h"
0053 #include "sdhci.h"
0054 #include "gpio-cfg.h"
0055 #include <linux/platform_data/spi-s3c64xx.h>
0056
0057 #include "keypad.h"
0058 #include "devs.h"
0059 #include "cpu.h"
0060 #include <linux/soc/samsung/s3c-adc.h>
0061 #include <linux/platform_data/i2c-s3c2410.h>
0062 #include "pm.h"
0063
0064 #include "s3c64xx.h"
0065 #include "crag6410.h"
0066 #include "regs-gpio-memport-s3c64xx.h"
0067 #include "regs-modem-s3c64xx.h"
0068 #include "regs-sys-s3c64xx.h"
0069
0070
0071
0072 #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
0073 #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
0074 #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
0075
0076 static struct s3c2410_uartcfg crag6410_uartcfgs[] __initdata = {
0077 [0] = {
0078 .hwport = 0,
0079 .flags = 0,
0080 .ucon = UCON,
0081 .ulcon = ULCON,
0082 .ufcon = UFCON,
0083 },
0084 [1] = {
0085 .hwport = 1,
0086 .flags = 0,
0087 .ucon = UCON,
0088 .ulcon = ULCON,
0089 .ufcon = UFCON,
0090 },
0091 [2] = {
0092 .hwport = 2,
0093 .flags = 0,
0094 .ucon = UCON,
0095 .ulcon = ULCON,
0096 .ufcon = UFCON,
0097 },
0098 [3] = {
0099 .hwport = 3,
0100 .flags = 0,
0101 .ucon = UCON,
0102 .ulcon = ULCON,
0103 .ufcon = UFCON,
0104 },
0105 };
0106
0107 static struct pwm_lookup crag6410_pwm_lookup[] = {
0108 PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight", NULL, 100000,
0109 PWM_POLARITY_NORMAL),
0110 };
0111
0112 static struct platform_pwm_backlight_data crag6410_backlight_data = {
0113 .max_brightness = 1000,
0114 .dft_brightness = 600,
0115 };
0116
0117 static struct platform_device crag6410_backlight_device = {
0118 .name = "pwm-backlight",
0119 .id = -1,
0120 .dev = {
0121 .parent = &samsung_device_pwm.dev,
0122 .platform_data = &crag6410_backlight_data,
0123 },
0124 };
0125
0126 static void crag6410_lcd_power_set(struct plat_lcd_data *pd, unsigned int power)
0127 {
0128 pr_debug("%s: setting power %d\n", __func__, power);
0129
0130 if (power) {
0131 gpio_set_value(S3C64XX_GPB(0), 1);
0132 msleep(1);
0133 s3c_gpio_cfgpin(S3C64XX_GPF(14), S3C_GPIO_SFN(2));
0134 } else {
0135 gpio_direction_output(S3C64XX_GPF(14), 0);
0136 gpio_set_value(S3C64XX_GPB(0), 0);
0137 }
0138 }
0139
0140 static struct platform_device crag6410_lcd_powerdev = {
0141 .name = "platform-lcd",
0142 .id = -1,
0143 .dev.parent = &s3c_device_fb.dev,
0144 .dev.platform_data = &(struct plat_lcd_data) {
0145 .set_power = crag6410_lcd_power_set,
0146 },
0147 };
0148
0149
0150 static struct s3c_fb_pd_win crag6410_fb_win0 = {
0151 .max_bpp = 32,
0152 .default_bpp = 16,
0153 .xres = 640,
0154 .yres = 480,
0155 .virtual_y = 480 * 2,
0156 .virtual_x = 640,
0157 };
0158
0159 static struct fb_videomode crag6410_lcd_timing = {
0160 .left_margin = 150,
0161 .right_margin = 80,
0162 .upper_margin = 40,
0163 .lower_margin = 5,
0164 .hsync_len = 40,
0165 .vsync_len = 5,
0166 .xres = 640,
0167 .yres = 480,
0168 };
0169
0170
0171 static struct s3c_fb_platdata crag6410_lcd_pdata = {
0172 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
0173 .vtiming = &crag6410_lcd_timing,
0174 .win[0] = &crag6410_fb_win0,
0175 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
0176 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
0177 };
0178
0179
0180
0181 static uint32_t crag6410_keymap[] = {
0182
0183 KEY(0, 0, KEY_VOLUMEUP),
0184 KEY(0, 1, KEY_HOME),
0185 KEY(0, 2, KEY_VOLUMEDOWN),
0186 KEY(0, 3, KEY_HELP),
0187 KEY(0, 4, KEY_MENU),
0188 KEY(0, 5, KEY_MEDIA),
0189 KEY(1, 0, 232),
0190 KEY(1, 1, KEY_DOWN),
0191 KEY(1, 2, KEY_LEFT),
0192 KEY(1, 3, KEY_UP),
0193 KEY(1, 4, KEY_RIGHT),
0194 KEY(1, 5, KEY_CAMERA),
0195 };
0196
0197 static struct matrix_keymap_data crag6410_keymap_data = {
0198 .keymap = crag6410_keymap,
0199 .keymap_size = ARRAY_SIZE(crag6410_keymap),
0200 };
0201
0202 static struct samsung_keypad_platdata crag6410_keypad_data = {
0203 .keymap_data = &crag6410_keymap_data,
0204 .rows = 2,
0205 .cols = 6,
0206 };
0207
0208 static struct gpio_keys_button crag6410_gpio_keys[] = {
0209 [0] = {
0210 .code = KEY_SUSPEND,
0211 .gpio = S3C64XX_GPL(10),
0212 .type = EV_KEY,
0213 .wakeup = 1,
0214 .active_low = 1,
0215 },
0216 [1] = {
0217 .code = SW_FRONT_PROXIMITY,
0218 .gpio = S3C64XX_GPN(11),
0219 .type = EV_SW,
0220 },
0221 };
0222
0223 static struct gpio_keys_platform_data crag6410_gpio_keydata = {
0224 .buttons = crag6410_gpio_keys,
0225 .nbuttons = ARRAY_SIZE(crag6410_gpio_keys),
0226 };
0227
0228 static struct platform_device crag6410_gpio_keydev = {
0229 .name = "gpio-keys",
0230 .id = 0,
0231 .dev.platform_data = &crag6410_gpio_keydata,
0232 };
0233
0234 static struct resource crag6410_dm9k_resource[] = {
0235 [0] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5, 2),
0236 [1] = DEFINE_RES_MEM(S3C64XX_PA_XM0CSN5 + (1 << 8), 2),
0237 [2] = DEFINE_RES_NAMED(S3C_EINT(17), 1, NULL, IORESOURCE_IRQ \
0238 | IORESOURCE_IRQ_HIGHLEVEL),
0239 };
0240
0241 static struct dm9000_plat_data mini6410_dm9k_pdata = {
0242 .flags = DM9000_PLATF_16BITONLY,
0243 };
0244
0245 static struct platform_device crag6410_dm9k_device = {
0246 .name = "dm9000",
0247 .id = -1,
0248 .num_resources = ARRAY_SIZE(crag6410_dm9k_resource),
0249 .resource = crag6410_dm9k_resource,
0250 .dev.platform_data = &mini6410_dm9k_pdata,
0251 };
0252
0253 static struct resource crag6410_mmgpio_resource[] = {
0254 [0] = DEFINE_RES_MEM_NAMED(S3C64XX_PA_XM0CSN4, 1, "dat"),
0255 };
0256
0257 static struct platform_device crag6410_mmgpio = {
0258 .name = "basic-mmio-gpio",
0259 .id = -1,
0260 .resource = crag6410_mmgpio_resource,
0261 .num_resources = ARRAY_SIZE(crag6410_mmgpio_resource),
0262 .dev.platform_data = &(struct bgpio_pdata) {
0263 .base = MMGPIO_GPIO_BASE,
0264 },
0265 };
0266
0267 static struct platform_device speyside_device = {
0268 .name = "speyside",
0269 .id = -1,
0270 };
0271
0272 static struct platform_device lowland_device = {
0273 .name = "lowland",
0274 .id = -1,
0275 };
0276
0277 static struct platform_device tobermory_device = {
0278 .name = "tobermory",
0279 .id = -1,
0280 };
0281
0282 static struct platform_device littlemill_device = {
0283 .name = "littlemill",
0284 .id = -1,
0285 };
0286
0287 static struct platform_device bells_wm2200_device = {
0288 .name = "bells",
0289 .id = 0,
0290 };
0291
0292 static struct platform_device bells_wm5102_device = {
0293 .name = "bells",
0294 .id = 1,
0295 };
0296
0297 static struct platform_device bells_wm5110_device = {
0298 .name = "bells",
0299 .id = 2,
0300 };
0301
0302 static struct regulator_consumer_supply wallvdd_consumers[] = {
0303 REGULATOR_SUPPLY("SPKVDD", "1-001a"),
0304 REGULATOR_SUPPLY("SPKVDD1", "1-001a"),
0305 REGULATOR_SUPPLY("SPKVDD2", "1-001a"),
0306 REGULATOR_SUPPLY("SPKVDDL", "1-001a"),
0307 REGULATOR_SUPPLY("SPKVDDR", "1-001a"),
0308
0309 REGULATOR_SUPPLY("SPKVDDL", "spi0.1"),
0310 REGULATOR_SUPPLY("SPKVDDR", "spi0.1"),
0311
0312 REGULATOR_SUPPLY("DC1VDD", "0-0034"),
0313 REGULATOR_SUPPLY("DC2VDD", "0-0034"),
0314 REGULATOR_SUPPLY("DC3VDD", "0-0034"),
0315 REGULATOR_SUPPLY("LDO1VDD", "0-0034"),
0316 REGULATOR_SUPPLY("LDO2VDD", "0-0034"),
0317 REGULATOR_SUPPLY("LDO4VDD", "0-0034"),
0318 REGULATOR_SUPPLY("LDO5VDD", "0-0034"),
0319 REGULATOR_SUPPLY("LDO6VDD", "0-0034"),
0320 REGULATOR_SUPPLY("LDO7VDD", "0-0034"),
0321 REGULATOR_SUPPLY("LDO8VDD", "0-0034"),
0322 REGULATOR_SUPPLY("LDO9VDD", "0-0034"),
0323 REGULATOR_SUPPLY("LDO10VDD", "0-0034"),
0324 REGULATOR_SUPPLY("LDO11VDD", "0-0034"),
0325
0326 REGULATOR_SUPPLY("DC1VDD", "1-0034"),
0327 REGULATOR_SUPPLY("DC2VDD", "1-0034"),
0328 REGULATOR_SUPPLY("DC3VDD", "1-0034"),
0329 REGULATOR_SUPPLY("LDO1VDD", "1-0034"),
0330 REGULATOR_SUPPLY("LDO2VDD", "1-0034"),
0331 REGULATOR_SUPPLY("LDO4VDD", "1-0034"),
0332 REGULATOR_SUPPLY("LDO5VDD", "1-0034"),
0333 REGULATOR_SUPPLY("LDO6VDD", "1-0034"),
0334 REGULATOR_SUPPLY("LDO7VDD", "1-0034"),
0335 REGULATOR_SUPPLY("LDO8VDD", "1-0034"),
0336 REGULATOR_SUPPLY("LDO9VDD", "1-0034"),
0337 REGULATOR_SUPPLY("LDO10VDD", "1-0034"),
0338 REGULATOR_SUPPLY("LDO11VDD", "1-0034"),
0339 };
0340
0341 static struct regulator_init_data wallvdd_data = {
0342 .constraints = {
0343 .always_on = 1,
0344 },
0345 .num_consumer_supplies = ARRAY_SIZE(wallvdd_consumers),
0346 .consumer_supplies = wallvdd_consumers,
0347 };
0348
0349 static struct fixed_voltage_config wallvdd_pdata = {
0350 .supply_name = "WALLVDD",
0351 .microvolts = 5000000,
0352 .init_data = &wallvdd_data,
0353 };
0354
0355 static struct platform_device wallvdd_device = {
0356 .name = "reg-fixed-voltage",
0357 .id = -1,
0358 .dev = {
0359 .platform_data = &wallvdd_pdata,
0360 },
0361 };
0362
0363 static struct platform_device *crag6410_devices[] __initdata = {
0364 &s3c_device_hsmmc0,
0365 &s3c_device_hsmmc2,
0366 &s3c_device_i2c0,
0367 &s3c_device_i2c1,
0368 &s3c_device_fb,
0369 &s3c_device_ohci,
0370 &s3c_device_usb_hsotg,
0371 &samsung_device_pwm,
0372 &s3c64xx_device_iis0,
0373 &s3c64xx_device_iis1,
0374 &samsung_device_keypad,
0375 &crag6410_gpio_keydev,
0376 &crag6410_dm9k_device,
0377 &s3c64xx_device_spi0,
0378 &crag6410_mmgpio,
0379 &crag6410_lcd_powerdev,
0380 &crag6410_backlight_device,
0381 &speyside_device,
0382 &tobermory_device,
0383 &littlemill_device,
0384 &lowland_device,
0385 &bells_wm2200_device,
0386 &bells_wm5102_device,
0387 &bells_wm5110_device,
0388 &wallvdd_device,
0389 };
0390
0391 static struct pca953x_platform_data crag6410_pca_data = {
0392 .gpio_base = PCA935X_GPIO_BASE,
0393 .irq_base = -1,
0394 };
0395
0396
0397 static struct wm831x_buckv_pdata vddarm_pdata = {
0398 .dvs_control_src = 1,
0399 };
0400
0401 static struct regulator_consumer_supply vddarm_consumers[] = {
0402 REGULATOR_SUPPLY("vddarm", NULL),
0403 };
0404
0405 static struct regulator_init_data vddarm = {
0406 .constraints = {
0407 .name = "VDDARM",
0408 .min_uV = 1000000,
0409 .max_uV = 1300000,
0410 .always_on = 1,
0411 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
0412 },
0413 .num_consumer_supplies = ARRAY_SIZE(vddarm_consumers),
0414 .consumer_supplies = vddarm_consumers,
0415 .supply_regulator = "WALLVDD",
0416 .driver_data = &vddarm_pdata,
0417 };
0418
0419 static struct regulator_consumer_supply vddint_consumers[] = {
0420 REGULATOR_SUPPLY("vddint", NULL),
0421 };
0422
0423 static struct regulator_init_data vddint = {
0424 .constraints = {
0425 .name = "VDDINT",
0426 .min_uV = 1000000,
0427 .max_uV = 1200000,
0428 .always_on = 1,
0429 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
0430 },
0431 .num_consumer_supplies = ARRAY_SIZE(vddint_consumers),
0432 .consumer_supplies = vddint_consumers,
0433 .supply_regulator = "WALLVDD",
0434 };
0435
0436 static struct regulator_init_data vddmem = {
0437 .constraints = {
0438 .name = "VDDMEM",
0439 .always_on = 1,
0440 },
0441 };
0442
0443 static struct regulator_init_data vddsys = {
0444 .constraints = {
0445 .name = "VDDSYS,VDDEXT,VDDPCM,VDDSS",
0446 .always_on = 1,
0447 },
0448 };
0449
0450 static struct regulator_consumer_supply vddmmc_consumers[] = {
0451 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
0452 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.1"),
0453 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
0454 };
0455
0456 static struct regulator_init_data vddmmc = {
0457 .constraints = {
0458 .name = "VDDMMC,UH",
0459 .always_on = 1,
0460 },
0461 .num_consumer_supplies = ARRAY_SIZE(vddmmc_consumers),
0462 .consumer_supplies = vddmmc_consumers,
0463 .supply_regulator = "WALLVDD",
0464 };
0465
0466 static struct regulator_init_data vddotgi = {
0467 .constraints = {
0468 .name = "VDDOTGi",
0469 .always_on = 1,
0470 },
0471 .supply_regulator = "WALLVDD",
0472 };
0473
0474 static struct regulator_init_data vddotg = {
0475 .constraints = {
0476 .name = "VDDOTG",
0477 .always_on = 1,
0478 },
0479 .supply_regulator = "WALLVDD",
0480 };
0481
0482 static struct regulator_init_data vddhi = {
0483 .constraints = {
0484 .name = "VDDHI",
0485 .always_on = 1,
0486 },
0487 .supply_regulator = "WALLVDD",
0488 };
0489
0490 static struct regulator_init_data vddadc = {
0491 .constraints = {
0492 .name = "VDDADC,VDDDAC",
0493 .always_on = 1,
0494 },
0495 .supply_regulator = "WALLVDD",
0496 };
0497
0498 static struct regulator_init_data vddmem0 = {
0499 .constraints = {
0500 .name = "VDDMEM0",
0501 .always_on = 1,
0502 },
0503 .supply_regulator = "WALLVDD",
0504 };
0505
0506 static struct regulator_init_data vddpll = {
0507 .constraints = {
0508 .name = "VDDPLL",
0509 .always_on = 1,
0510 },
0511 .supply_regulator = "WALLVDD",
0512 };
0513
0514 static struct regulator_init_data vddlcd = {
0515 .constraints = {
0516 .name = "VDDLCD",
0517 .always_on = 1,
0518 },
0519 .supply_regulator = "WALLVDD",
0520 };
0521
0522 static struct regulator_init_data vddalive = {
0523 .constraints = {
0524 .name = "VDDALIVE",
0525 .always_on = 1,
0526 },
0527 .supply_regulator = "WALLVDD",
0528 };
0529
0530 static struct wm831x_backup_pdata banff_backup_pdata = {
0531 .charger_enable = 1,
0532 .vlim = 2500,
0533 .ilim = 200,
0534 };
0535
0536 static struct wm831x_status_pdata banff_red_led = {
0537 .name = "banff:red:",
0538 .default_src = WM831X_STATUS_MANUAL,
0539 };
0540
0541 static struct wm831x_status_pdata banff_green_led = {
0542 .name = "banff:green:",
0543 .default_src = WM831X_STATUS_MANUAL,
0544 };
0545
0546 static struct wm831x_touch_pdata touch_pdata = {
0547 .data_irq = S3C_EINT(26),
0548 .pd_irq = S3C_EINT(27),
0549 };
0550
0551 static struct wm831x_pdata crag_pmic_pdata = {
0552 .wm831x_num = 1,
0553 .irq_base = BANFF_PMIC_IRQ_BASE,
0554 .gpio_base = BANFF_PMIC_GPIO_BASE,
0555 .soft_shutdown = true,
0556
0557 .backup = &banff_backup_pdata,
0558
0559 .gpio_defaults = {
0560
0561 [4] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA | 0x8,
0562
0563 [10] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x6,
0564
0565 [11] = WM831X_GPN_POL | WM831X_GPN_ENA | 0x7,
0566 },
0567
0568 .dcdc = {
0569 &vddarm,
0570 &vddint,
0571 &vddmem,
0572 },
0573
0574 .ldo = {
0575 &vddsys,
0576 &vddmmc,
0577 NULL,
0578 &vddotgi,
0579 &vddotg,
0580 &vddhi,
0581 &vddadc,
0582 &vddmem0,
0583 &vddpll,
0584 &vddlcd,
0585 &vddalive,
0586 },
0587
0588 .status = {
0589 &banff_green_led,
0590 &banff_red_led,
0591 },
0592
0593 .touch = &touch_pdata,
0594 };
0595
0596
0597
0598
0599
0600
0601
0602
0603
0604
0605
0606 static struct gpiod_lookup_table crag_pmic_gpiod_table = {
0607 .dev_id = "wm831x-buckv.11",
0608 .table = {
0609 GPIO_LOOKUP("GPIOK", 0, "dvs", GPIO_ACTIVE_HIGH),
0610 { },
0611 },
0612 };
0613
0614 static struct i2c_board_info i2c_devs0[] = {
0615 { I2C_BOARD_INFO("24c08", 0x50), },
0616 { I2C_BOARD_INFO("tca6408", 0x20),
0617 .platform_data = &crag6410_pca_data,
0618 },
0619 { I2C_BOARD_INFO("wm8312", 0x34),
0620 .platform_data = &crag_pmic_pdata,
0621 .irq = S3C_EINT(23),
0622 },
0623 };
0624
0625 static struct s3c2410_platform_i2c i2c0_pdata = {
0626 .frequency = 400000,
0627 };
0628
0629 static struct regulator_consumer_supply pvdd_1v2_consumers[] = {
0630 REGULATOR_SUPPLY("DCVDD", "spi0.0"),
0631 REGULATOR_SUPPLY("AVDD", "spi0.0"),
0632 REGULATOR_SUPPLY("AVDD", "spi0.1"),
0633 };
0634
0635 static struct regulator_init_data pvdd_1v2 = {
0636 .constraints = {
0637 .name = "PVDD_1V2",
0638 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
0639 },
0640
0641 .consumer_supplies = pvdd_1v2_consumers,
0642 .num_consumer_supplies = ARRAY_SIZE(pvdd_1v2_consumers),
0643 };
0644
0645 static struct regulator_consumer_supply pvdd_1v8_consumers[] = {
0646 REGULATOR_SUPPLY("LDOVDD", "1-001a"),
0647 REGULATOR_SUPPLY("PLLVDD", "1-001a"),
0648 REGULATOR_SUPPLY("DBVDD", "1-001a"),
0649 REGULATOR_SUPPLY("DBVDD1", "1-001a"),
0650 REGULATOR_SUPPLY("DBVDD2", "1-001a"),
0651 REGULATOR_SUPPLY("DBVDD3", "1-001a"),
0652 REGULATOR_SUPPLY("CPVDD", "1-001a"),
0653 REGULATOR_SUPPLY("AVDD2", "1-001a"),
0654 REGULATOR_SUPPLY("DCVDD", "1-001a"),
0655 REGULATOR_SUPPLY("AVDD", "1-001a"),
0656 REGULATOR_SUPPLY("DBVDD", "spi0.0"),
0657
0658 REGULATOR_SUPPLY("DBVDD", "1-003a"),
0659 REGULATOR_SUPPLY("LDOVDD", "1-003a"),
0660 REGULATOR_SUPPLY("CPVDD", "1-003a"),
0661 REGULATOR_SUPPLY("AVDD", "1-003a"),
0662 REGULATOR_SUPPLY("DBVDD1", "spi0.1"),
0663 REGULATOR_SUPPLY("DBVDD2", "spi0.1"),
0664 REGULATOR_SUPPLY("DBVDD3", "spi0.1"),
0665 REGULATOR_SUPPLY("LDOVDD", "spi0.1"),
0666 REGULATOR_SUPPLY("CPVDD", "spi0.1"),
0667 };
0668
0669 static struct regulator_init_data pvdd_1v8 = {
0670 .constraints = {
0671 .name = "PVDD_1V8",
0672 .always_on = 1,
0673 },
0674
0675 .consumer_supplies = pvdd_1v8_consumers,
0676 .num_consumer_supplies = ARRAY_SIZE(pvdd_1v8_consumers),
0677 };
0678
0679 static struct regulator_consumer_supply pvdd_3v3_consumers[] = {
0680 REGULATOR_SUPPLY("MICVDD", "1-001a"),
0681 REGULATOR_SUPPLY("AVDD1", "1-001a"),
0682 };
0683
0684 static struct regulator_init_data pvdd_3v3 = {
0685 .constraints = {
0686 .name = "PVDD_3V3",
0687 .always_on = 1,
0688 },
0689
0690 .consumer_supplies = pvdd_3v3_consumers,
0691 .num_consumer_supplies = ARRAY_SIZE(pvdd_3v3_consumers),
0692 };
0693
0694 static struct wm831x_pdata glenfarclas_pmic_pdata = {
0695 .wm831x_num = 2,
0696 .irq_base = GLENFARCLAS_PMIC_IRQ_BASE,
0697 .gpio_base = GLENFARCLAS_PMIC_GPIO_BASE,
0698 .soft_shutdown = true,
0699
0700 .gpio_defaults = {
0701
0702 [0] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
0703 [1] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
0704 [2] = WM831X_GPN_DIR | WM831X_GPN_POL | WM831X_GPN_ENA,
0705 },
0706
0707 .dcdc = {
0708 &pvdd_1v2,
0709 &pvdd_1v8,
0710 &pvdd_3v3,
0711 },
0712
0713 .disable_touch = true,
0714 };
0715
0716 static struct wm1250_ev1_pdata wm1250_ev1_pdata = {
0717 .gpios = {
0718 [WM1250_EV1_GPIO_CLK_ENA] = S3C64XX_GPN(12),
0719 [WM1250_EV1_GPIO_CLK_SEL0] = S3C64XX_GPL(12),
0720 [WM1250_EV1_GPIO_CLK_SEL1] = S3C64XX_GPL(13),
0721 [WM1250_EV1_GPIO_OSR] = S3C64XX_GPL(14),
0722 [WM1250_EV1_GPIO_MASTER] = S3C64XX_GPL(8),
0723 },
0724 };
0725
0726 static struct i2c_board_info i2c_devs1[] = {
0727 { I2C_BOARD_INFO("wm8311", 0x34),
0728 .irq = S3C_EINT(0),
0729 .platform_data = &glenfarclas_pmic_pdata },
0730
0731 { I2C_BOARD_INFO("wlf-gf-module", 0x20) },
0732 { I2C_BOARD_INFO("wlf-gf-module", 0x22) },
0733 { I2C_BOARD_INFO("wlf-gf-module", 0x24) },
0734 { I2C_BOARD_INFO("wlf-gf-module", 0x25) },
0735 { I2C_BOARD_INFO("wlf-gf-module", 0x26) },
0736
0737 { I2C_BOARD_INFO("wm1250-ev1", 0x27),
0738 .platform_data = &wm1250_ev1_pdata },
0739 };
0740
0741 static struct s3c2410_platform_i2c i2c1_pdata = {
0742 .frequency = 400000,
0743 .bus_num = 1,
0744 };
0745
0746 static void __init crag6410_map_io(void)
0747 {
0748 s3c64xx_init_io(NULL, 0);
0749 s3c64xx_set_xtal_freq(12000000);
0750 s3c24xx_init_uarts(crag6410_uartcfgs, ARRAY_SIZE(crag6410_uartcfgs));
0751 s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
0752
0753
0754 }
0755
0756 static struct s3c_sdhci_platdata crag6410_hsmmc2_pdata = {
0757 .max_width = 4,
0758 .cd_type = S3C_SDHCI_CD_PERMANENT,
0759 .host_caps = MMC_CAP_POWER_OFF_CARD,
0760 };
0761
0762 static void crag6410_cfg_sdhci0(struct platform_device *dev, int width)
0763 {
0764
0765 s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
0766
0767
0768 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_DOWN);
0769 }
0770
0771 static struct s3c_sdhci_platdata crag6410_hsmmc0_pdata = {
0772 .max_width = 4,
0773 .cd_type = S3C_SDHCI_CD_INTERNAL,
0774 .cfg_gpio = crag6410_cfg_sdhci0,
0775 .host_caps = MMC_CAP_POWER_OFF_CARD,
0776 };
0777
0778 static const struct gpio_led gpio_leds[] = {
0779 {
0780 .name = "d13:green:",
0781 .gpio = MMGPIO_GPIO_BASE + 0,
0782 .default_state = LEDS_GPIO_DEFSTATE_ON,
0783 },
0784 {
0785 .name = "d14:green:",
0786 .gpio = MMGPIO_GPIO_BASE + 1,
0787 .default_state = LEDS_GPIO_DEFSTATE_ON,
0788 },
0789 {
0790 .name = "d15:green:",
0791 .gpio = MMGPIO_GPIO_BASE + 2,
0792 .default_state = LEDS_GPIO_DEFSTATE_ON,
0793 },
0794 {
0795 .name = "d16:green:",
0796 .gpio = MMGPIO_GPIO_BASE + 3,
0797 .default_state = LEDS_GPIO_DEFSTATE_ON,
0798 },
0799 {
0800 .name = "d17:green:",
0801 .gpio = MMGPIO_GPIO_BASE + 4,
0802 .default_state = LEDS_GPIO_DEFSTATE_ON,
0803 },
0804 {
0805 .name = "d18:green:",
0806 .gpio = MMGPIO_GPIO_BASE + 5,
0807 .default_state = LEDS_GPIO_DEFSTATE_ON,
0808 },
0809 {
0810 .name = "d19:green:",
0811 .gpio = MMGPIO_GPIO_BASE + 6,
0812 .default_state = LEDS_GPIO_DEFSTATE_ON,
0813 },
0814 {
0815 .name = "d20:green:",
0816 .gpio = MMGPIO_GPIO_BASE + 7,
0817 .default_state = LEDS_GPIO_DEFSTATE_ON,
0818 },
0819 };
0820
0821 static const struct gpio_led_platform_data gpio_leds_pdata = {
0822 .leds = gpio_leds,
0823 .num_leds = ARRAY_SIZE(gpio_leds),
0824 };
0825
0826 static struct dwc2_hsotg_plat crag6410_hsotg_pdata;
0827
0828 static struct gpiod_lookup_table crag_spi0_gpiod_table = {
0829 .dev_id = "s3c6410-spi.0",
0830 .table = {
0831 GPIO_LOOKUP_IDX("GPIOC", 3, "cs", 0, GPIO_ACTIVE_LOW),
0832 GPIO_LOOKUP_IDX("GPION", 5, "cs", 1, GPIO_ACTIVE_LOW),
0833 { },
0834 },
0835 };
0836
0837 static void __init crag6410_machine_init(void)
0838 {
0839
0840 s3c_gpio_setpull(S3C64XX_GPM(0), S3C_GPIO_PULL_UP);
0841 s3c_gpio_setpull(S3C64XX_GPN(0), S3C_GPIO_PULL_UP);
0842
0843 gpio_request(S3C64XX_GPB(0), "LCD power");
0844 gpio_direction_output(S3C64XX_GPB(0), 0);
0845
0846 gpio_request(S3C64XX_GPF(14), "LCD PWM");
0847 gpio_direction_output(S3C64XX_GPF(14), 0);
0848
0849 gpio_request(S3C64XX_GPB(1), "SD power");
0850 gpio_direction_output(S3C64XX_GPB(1), 0);
0851
0852 gpio_request(S3C64XX_GPF(10), "nRESETSEL");
0853 gpio_direction_output(S3C64XX_GPF(10), 1);
0854
0855 s3c_sdhci0_set_platdata(&crag6410_hsmmc0_pdata);
0856 s3c_sdhci2_set_platdata(&crag6410_hsmmc2_pdata);
0857
0858 s3c_i2c0_set_platdata(&i2c0_pdata);
0859 s3c_i2c1_set_platdata(&i2c1_pdata);
0860 s3c_fb_set_platdata(&crag6410_lcd_pdata);
0861 dwc2_hsotg_set_platdata(&crag6410_hsotg_pdata);
0862
0863 gpiod_add_lookup_table(&crag_pmic_gpiod_table);
0864 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
0865 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
0866
0867 samsung_keypad_set_platdata(&crag6410_keypad_data);
0868
0869 gpiod_add_lookup_table(&crag_spi0_gpiod_table);
0870 s3c64xx_spi0_set_platdata(0, 2);
0871
0872 pwm_add_table(crag6410_pwm_lookup, ARRAY_SIZE(crag6410_pwm_lookup));
0873 platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
0874
0875 gpio_led_register_device(-1, &gpio_leds_pdata);
0876
0877 regulator_has_full_constraints();
0878
0879 s3c64xx_pm_init();
0880 }
0881
0882 MACHINE_START(WLF_CRAGG_6410, "Wolfson Cragganmore 6410")
0883
0884 .atag_offset = 0x100,
0885 .nr_irqs = S3C64XX_NR_IRQS,
0886 .init_irq = s3c6410_init_irq,
0887 .map_io = crag6410_map_io,
0888 .init_machine = crag6410_machine_init,
0889 .init_time = s3c64xx_timer_init,
0890 MACHINE_END