0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #include <linux/kernel.h>
0012 #include <linux/types.h>
0013 #include <linux/interrupt.h>
0014 #include <linux/list.h>
0015 #include <linux/timer.h>
0016 #include <linux/init.h>
0017 #include <linux/gpio.h>
0018 #include <linux/gpio/machine.h>
0019 #include <linux/input.h>
0020 #include <linux/io.h>
0021 #include <linux/serial_core.h>
0022 #include <linux/serial_s3c.h>
0023 #include <linux/dm9000.h>
0024 #include <linux/property.h>
0025 #include <linux/platform_device.h>
0026 #include <linux/gpio_keys.h>
0027 #include <linux/i2c.h>
0028 #include <linux/mmc/host.h>
0029
0030 #include <asm/mach/arch.h>
0031 #include <asm/mach/map.h>
0032
0033 #include <linux/platform_data/fb-s3c2410.h>
0034 #include <asm/mach-types.h>
0035
0036 #include "regs-gpio.h"
0037 #include <linux/platform_data/leds-s3c24xx.h>
0038 #include "irqs.h"
0039 #include "gpio-samsung.h"
0040 #include <linux/platform_data/mtd-nand-s3c2410.h>
0041 #include <linux/platform_data/i2c-s3c2410.h>
0042 #include <linux/platform_data/mmc-s3cmci.h>
0043 #include <linux/platform_data/usb-s3c2410_udc.h>
0044
0045 #include <linux/mtd/mtd.h>
0046 #include <linux/mtd/rawnand.h>
0047 #include <linux/mtd/nand-ecc-sw-hamming.h>
0048 #include <linux/mtd/partitions.h>
0049
0050 #include "gpio-cfg.h"
0051 #include "devs.h"
0052 #include "cpu.h"
0053
0054 #include <sound/s3c24xx_uda134x.h>
0055
0056 #include "s3c24xx.h"
0057
0058 #define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)
0059
0060 static struct map_desc mini2440_iodesc[] __initdata = {
0061
0062 };
0063
0064 #define UCON S3C2410_UCON_DEFAULT
0065 #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
0066 #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
0067
0068
0069 static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
0070 [0] = {
0071 .hwport = 0,
0072 .flags = 0,
0073 .ucon = UCON,
0074 .ulcon = ULCON,
0075 .ufcon = UFCON,
0076 },
0077 [1] = {
0078 .hwport = 1,
0079 .flags = 0,
0080 .ucon = UCON,
0081 .ulcon = ULCON,
0082 .ufcon = UFCON,
0083 },
0084 [2] = {
0085 .hwport = 2,
0086 .flags = 0,
0087 .ucon = UCON,
0088 .ulcon = ULCON,
0089 .ufcon = UFCON,
0090 },
0091 };
0092
0093
0094
0095 static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
0096 .pullup_pin = S3C2410_GPC(5),
0097 };
0098
0099
0100
0101
0102
0103
0104
0105 #define _LCD_DECLARE(_clock, _xres, margin_left, margin_right, hsync, \
0106 _yres, margin_top, margin_bottom, vsync, refresh) \
0107 .width = _xres, \
0108 .xres = _xres, \
0109 .height = _yres, \
0110 .yres = _yres, \
0111 .left_margin = margin_left, \
0112 .right_margin = margin_right, \
0113 .upper_margin = margin_top, \
0114 .lower_margin = margin_bottom, \
0115 .hsync_len = hsync, \
0116 .vsync_len = vsync, \
0117 .pixclock = ((_clock*100000000000LL) / \
0118 ((refresh) * \
0119 (hsync + margin_left + _xres + margin_right) * \
0120 (vsync + margin_top + _yres + margin_bottom))), \
0121 .bpp = 16,\
0122 .type = (S3C2410_LCDCON1_TFT16BPP |\
0123 S3C2410_LCDCON1_TFT)
0124
0125 static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
0126 [0] = {
0127 _LCD_DECLARE(
0128 7,
0129 240, 21, 38, 6,
0130 320, 4, 4, 2,
0131 60),
0132 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
0133 S3C2410_LCDCON5_INVVLINE |
0134 S3C2410_LCDCON5_INVVFRAME |
0135 S3C2410_LCDCON5_INVVDEN |
0136 S3C2410_LCDCON5_PWREN),
0137 },
0138 [1] = {
0139 _LCD_DECLARE(
0140 10,
0141 800, 40, 40, 48,
0142 480, 29, 3, 3,
0143 50),
0144 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
0145 S3C2410_LCDCON5_INVVLINE |
0146 S3C2410_LCDCON5_INVVFRAME |
0147 S3C2410_LCDCON5_PWREN),
0148 },
0149
0150
0151
0152
0153
0154
0155 [2] = {
0156 _LCD_DECLARE(
0157 10,
0158 1024, 1, 2, 2,
0159 768, 200, 16, 16,
0160 24),
0161
0162
0163 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
0164 S3C2410_LCDCON5_HWSWP),
0165 },
0166
0167 [3] = {
0168 _LCD_DECLARE(
0169
0170 7,
0171
0172 320, 68, 66, 4,
0173
0174 240, 4, 4, 9,
0175
0176 60),
0177 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
0178 S3C2410_LCDCON5_INVVDEN |
0179 S3C2410_LCDCON5_INVVFRAME |
0180 S3C2410_LCDCON5_INVVLINE |
0181 S3C2410_LCDCON5_INVVCLK |
0182 S3C2410_LCDCON5_HWSWP),
0183 },
0184 };
0185
0186
0187
0188 #define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
0189 #define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
0190
0191 static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
0192 .displays = &mini2440_lcd_cfg[0],
0193 .num_displays = 1,
0194 .default_display = 0,
0195
0196
0197
0198
0199
0200
0201 .gpcup = (0xf << 1) | (0x3f << 10),
0202
0203 .gpccon = (S3C2410_GPC1_VCLK | S3C2410_GPC2_VLINE |
0204 S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
0205 S3C2410_GPC10_VD2 | S3C2410_GPC11_VD3 |
0206 S3C2410_GPC12_VD4 | S3C2410_GPC13_VD5 |
0207 S3C2410_GPC14_VD6 | S3C2410_GPC15_VD7),
0208
0209 .gpccon_mask = (S3C2410_GPCCON_MASK(1) | S3C2410_GPCCON_MASK(2) |
0210 S3C2410_GPCCON_MASK(3) | S3C2410_GPCCON_MASK(4) |
0211 S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
0212 S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
0213 S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
0214
0215 .gpccon_reg = S3C2410_GPCCON,
0216 .gpcup_reg = S3C2410_GPCUP,
0217
0218 .gpdup = (0x3f << 2) | (0x3f << 10),
0219
0220 .gpdcon = (S3C2410_GPD2_VD10 | S3C2410_GPD3_VD11 |
0221 S3C2410_GPD4_VD12 | S3C2410_GPD5_VD13 |
0222 S3C2410_GPD6_VD14 | S3C2410_GPD7_VD15 |
0223 S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
0224 S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
0225 S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
0226
0227 .gpdcon_mask = (S3C2410_GPDCON_MASK(2) | S3C2410_GPDCON_MASK(3) |
0228 S3C2410_GPDCON_MASK(4) | S3C2410_GPDCON_MASK(5) |
0229 S3C2410_GPDCON_MASK(6) | S3C2410_GPDCON_MASK(7) |
0230 S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
0231 S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
0232 S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
0233
0234 .gpdcon_reg = S3C2410_GPDCON,
0235 .gpdup_reg = S3C2410_GPDUP,
0236 };
0237
0238
0239
0240 static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
0241 .wprotect_invert = 1,
0242 .set_power = s3c24xx_mci_def_set_power,
0243 .ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34,
0244 };
0245
0246 static struct gpiod_lookup_table mini2440_mmc_gpio_table = {
0247 .dev_id = "s3c2410-sdi",
0248 .table = {
0249
0250 GPIO_LOOKUP("GPIOG", 8, "cd", GPIO_ACTIVE_LOW),
0251
0252 GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_HIGH),
0253
0254 GPIO_LOOKUP_IDX("GPIOE", 5, "bus", 0, GPIO_ACTIVE_HIGH),
0255 GPIO_LOOKUP_IDX("GPIOE", 6, "bus", 1, GPIO_ACTIVE_HIGH),
0256 GPIO_LOOKUP_IDX("GPIOE", 7, "bus", 2, GPIO_ACTIVE_HIGH),
0257 GPIO_LOOKUP_IDX("GPIOE", 8, "bus", 3, GPIO_ACTIVE_HIGH),
0258 GPIO_LOOKUP_IDX("GPIOE", 9, "bus", 4, GPIO_ACTIVE_HIGH),
0259 GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
0260 { },
0261 },
0262 };
0263
0264
0265
0266 static struct mtd_partition mini2440_default_nand_part[] __initdata = {
0267 [0] = {
0268 .name = "u-boot",
0269 .size = SZ_256K,
0270 .offset = 0,
0271 },
0272 [1] = {
0273 .name = "u-boot-env",
0274 .size = SZ_128K,
0275 .offset = SZ_256K,
0276 },
0277 [2] = {
0278 .name = "kernel",
0279
0280
0281
0282 .size = 0x00500000,
0283 .offset = SZ_256K + SZ_128K,
0284 },
0285 [3] = {
0286 .name = "root",
0287 .offset = SZ_256K + SZ_128K + 0x00500000,
0288 .size = MTDPART_SIZ_FULL,
0289 },
0290 };
0291
0292 static struct s3c2410_nand_set mini2440_nand_sets[] __initdata = {
0293 [0] = {
0294 .name = "nand",
0295 .nr_chips = 1,
0296 .nr_partitions = ARRAY_SIZE(mini2440_default_nand_part),
0297 .partitions = mini2440_default_nand_part,
0298 .flash_bbt = 1,
0299 },
0300 };
0301
0302 static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
0303 .tacls = 0,
0304 .twrph0 = 25,
0305 .twrph1 = 15,
0306 .nr_sets = ARRAY_SIZE(mini2440_nand_sets),
0307 .sets = mini2440_nand_sets,
0308 .ignore_unset_ecc = 1,
0309 .engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST,
0310 };
0311
0312
0313
0314 static struct resource mini2440_dm9k_resource[] = {
0315 [0] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE, 4),
0316 [1] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE + 4, 4),
0317 [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ
0318 | IORESOURCE_IRQ_HIGHEDGE),
0319 };
0320
0321
0322
0323
0324
0325 static struct dm9000_plat_data mini2440_dm9k_pdata = {
0326 .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
0327 };
0328
0329 static struct platform_device mini2440_device_eth = {
0330 .name = "dm9000",
0331 .id = -1,
0332 .num_resources = ARRAY_SIZE(mini2440_dm9k_resource),
0333 .resource = mini2440_dm9k_resource,
0334 .dev = {
0335 .platform_data = &mini2440_dm9k_pdata,
0336 },
0337 };
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356 static struct gpio_keys_button mini2440_buttons[] = {
0357 {
0358 .gpio = S3C2410_GPG(0),
0359 .code = KEY_F1,
0360 .desc = "Button 1",
0361 .active_low = 1,
0362 },
0363 {
0364 .gpio = S3C2410_GPG(3),
0365 .code = KEY_F2,
0366 .desc = "Button 2",
0367 .active_low = 1,
0368 },
0369 {
0370 .gpio = S3C2410_GPG(5),
0371 .code = KEY_F3,
0372 .desc = "Button 3",
0373 .active_low = 1,
0374 },
0375 {
0376 .gpio = S3C2410_GPG(6),
0377 .code = KEY_POWER,
0378 .desc = "Power",
0379 .active_low = 1,
0380 },
0381 {
0382 .gpio = S3C2410_GPG(7),
0383 .code = KEY_F5,
0384 .desc = "Button 5",
0385 .active_low = 1,
0386 },
0387 #if 0
0388
0389
0390
0391 {
0392 .gpio = S3C2410_GPG(11),
0393 .code = KEY_F6,
0394 .desc = "Button 6",
0395 .active_low = 1,
0396 },
0397 #endif
0398 };
0399
0400 static struct gpio_keys_platform_data mini2440_button_data = {
0401 .buttons = mini2440_buttons,
0402 .nbuttons = ARRAY_SIZE(mini2440_buttons),
0403 };
0404
0405 static struct platform_device mini2440_button_device = {
0406 .name = "gpio-keys",
0407 .id = -1,
0408 .dev = {
0409 .platform_data = &mini2440_button_data,
0410 }
0411 };
0412
0413
0414
0415 static struct gpiod_lookup_table mini2440_led1_gpio_table = {
0416 .dev_id = "s3c24xx_led.1",
0417 .table = {
0418 GPIO_LOOKUP("GPB", 5, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
0419 { },
0420 },
0421 };
0422
0423 static struct gpiod_lookup_table mini2440_led2_gpio_table = {
0424 .dev_id = "s3c24xx_led.2",
0425 .table = {
0426 GPIO_LOOKUP("GPB", 6, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
0427 { },
0428 },
0429 };
0430
0431 static struct gpiod_lookup_table mini2440_led3_gpio_table = {
0432 .dev_id = "s3c24xx_led.3",
0433 .table = {
0434 GPIO_LOOKUP("GPB", 7, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
0435 { },
0436 },
0437 };
0438
0439 static struct gpiod_lookup_table mini2440_led4_gpio_table = {
0440 .dev_id = "s3c24xx_led.4",
0441 .table = {
0442 GPIO_LOOKUP("GPB", 8, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
0443 { },
0444 },
0445 };
0446
0447 static struct gpiod_lookup_table mini2440_backlight_gpio_table = {
0448 .dev_id = "s3c24xx_led.5",
0449 .table = {
0450 GPIO_LOOKUP("GPG", 4, NULL, GPIO_ACTIVE_HIGH),
0451 { },
0452 },
0453 };
0454
0455 static struct s3c24xx_led_platdata mini2440_led1_pdata = {
0456 .name = "led1",
0457 .def_trigger = "heartbeat",
0458 };
0459
0460 static struct s3c24xx_led_platdata mini2440_led2_pdata = {
0461 .name = "led2",
0462 .def_trigger = "nand-disk",
0463 };
0464
0465 static struct s3c24xx_led_platdata mini2440_led3_pdata = {
0466 .name = "led3",
0467 .def_trigger = "mmc0",
0468 };
0469
0470 static struct s3c24xx_led_platdata mini2440_led4_pdata = {
0471 .name = "led4",
0472 .def_trigger = "",
0473 };
0474
0475 static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
0476 .name = "backlight",
0477 .def_trigger = "backlight",
0478 };
0479
0480 static struct platform_device mini2440_led1 = {
0481 .name = "s3c24xx_led",
0482 .id = 1,
0483 .dev = {
0484 .platform_data = &mini2440_led1_pdata,
0485 },
0486 };
0487
0488 static struct platform_device mini2440_led2 = {
0489 .name = "s3c24xx_led",
0490 .id = 2,
0491 .dev = {
0492 .platform_data = &mini2440_led2_pdata,
0493 },
0494 };
0495
0496 static struct platform_device mini2440_led3 = {
0497 .name = "s3c24xx_led",
0498 .id = 3,
0499 .dev = {
0500 .platform_data = &mini2440_led3_pdata,
0501 },
0502 };
0503
0504 static struct platform_device mini2440_led4 = {
0505 .name = "s3c24xx_led",
0506 .id = 4,
0507 .dev = {
0508 .platform_data = &mini2440_led4_pdata,
0509 },
0510 };
0511
0512 static struct platform_device mini2440_led_backlight = {
0513 .name = "s3c24xx_led",
0514 .id = 5,
0515 .dev = {
0516 .platform_data = &mini2440_led_backlight_pdata,
0517 },
0518 };
0519
0520
0521
0522 static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
0523 .l3_clk = S3C2410_GPB(4),
0524 .l3_mode = S3C2410_GPB(2),
0525 .l3_data = S3C2410_GPB(3),
0526 .model = UDA134X_UDA1341
0527 };
0528
0529 static struct platform_device mini2440_audio = {
0530 .name = "s3c24xx_uda134x",
0531 .id = 0,
0532 .dev = {
0533 .platform_data = &mini2440_audio_pins,
0534 },
0535 };
0536
0537
0538
0539
0540 static const struct property_entry mini2440_at24_properties[] = {
0541 PROPERTY_ENTRY_U32("pagesize", 16),
0542 { }
0543 };
0544
0545 static const struct software_node mini2440_at24_node = {
0546 .properties = mini2440_at24_properties,
0547 };
0548
0549 static struct i2c_board_info mini2440_i2c_devs[] __initdata = {
0550 {
0551 I2C_BOARD_INFO("24c08", 0x50),
0552 .swnode = &mini2440_at24_node,
0553 },
0554 };
0555
0556 static struct uda134x_platform_data s3c24xx_uda134x = {
0557 .l3 = {
0558 .gpio_clk = S3C2410_GPB(4),
0559 .gpio_data = S3C2410_GPB(3),
0560 .gpio_mode = S3C2410_GPB(2),
0561 .use_gpios = 1,
0562 .data_hold = 1,
0563 .data_setup = 1,
0564 .clock_high = 1,
0565 .mode_hold = 1,
0566 .mode = 1,
0567 .mode_setup = 1,
0568 },
0569 .model = UDA134X_UDA1341,
0570 };
0571
0572 static struct platform_device uda1340_codec = {
0573 .name = "uda134x-codec",
0574 .id = -1,
0575 .dev = {
0576 .platform_data = &s3c24xx_uda134x,
0577 },
0578 };
0579
0580 static struct platform_device *mini2440_devices[] __initdata = {
0581 &s3c_device_ohci,
0582 &s3c_device_wdt,
0583 &s3c_device_i2c0,
0584 &s3c_device_rtc,
0585 &s3c_device_usbgadget,
0586 &mini2440_device_eth,
0587 &mini2440_led1,
0588 &mini2440_led2,
0589 &mini2440_led3,
0590 &mini2440_led4,
0591 &mini2440_button_device,
0592 &s3c_device_nand,
0593 &s3c_device_sdi,
0594 &s3c2440_device_dma,
0595 &s3c_device_iis,
0596 &uda1340_codec,
0597 &mini2440_audio,
0598 };
0599
0600 static void __init mini2440_map_io(void)
0601 {
0602 s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
0603 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
0604 s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
0605 }
0606
0607 static void __init mini2440_init_time(void)
0608 {
0609 s3c2440_init_clocks(12000000);
0610 s3c24xx_timer_init();
0611 }
0612
0613
0614
0615
0616
0617
0618
0619
0620
0621
0622 static char mini2440_features_str[12] __initdata = "0tb";
0623
0624 static int __init mini2440_features_setup(char *str)
0625 {
0626 if (str)
0627 strscpy(mini2440_features_str, str,
0628 sizeof(mini2440_features_str));
0629 return 1;
0630 }
0631
0632 __setup("mini2440=", mini2440_features_setup);
0633
0634 #define FEATURE_SCREEN (1 << 0)
0635 #define FEATURE_BACKLIGHT (1 << 1)
0636 #define FEATURE_TOUCH (1 << 2)
0637 #define FEATURE_CAMERA (1 << 3)
0638
0639 struct mini2440_features_t {
0640 int count;
0641 int done;
0642 int lcd_index;
0643 struct platform_device *optional[8];
0644 };
0645
0646 static void __init mini2440_parse_features(
0647 struct mini2440_features_t *features,
0648 const char *features_str)
0649 {
0650 const char *fp = features_str;
0651
0652 features->count = 0;
0653 features->done = 0;
0654 features->lcd_index = -1;
0655
0656 while (*fp) {
0657 char f = *fp++;
0658
0659 switch (f) {
0660 case '0'...'9':
0661 if (features->done & FEATURE_SCREEN) {
0662 pr_info("MINI2440: '%c' ignored, screen type already set\n",
0663 f);
0664 } else {
0665 int li = f - '0';
0666
0667 if (li >= ARRAY_SIZE(mini2440_lcd_cfg))
0668 pr_info("MINI2440: '%c' out of range LCD mode\n",
0669 f);
0670 else {
0671 features->optional[features->count++] =
0672 &s3c_device_lcd;
0673 features->lcd_index = li;
0674 }
0675 }
0676 features->done |= FEATURE_SCREEN;
0677 break;
0678 case 'b':
0679 if (features->done & FEATURE_BACKLIGHT)
0680 pr_info("MINI2440: '%c' ignored, backlight already set\n",
0681 f);
0682 else {
0683 features->optional[features->count++] =
0684 &mini2440_led_backlight;
0685 }
0686 features->done |= FEATURE_BACKLIGHT;
0687 break;
0688 case 't':
0689 pr_info("MINI2440: '%c' ignored, touchscreen not compiled in\n",
0690 f);
0691 break;
0692 case 'c':
0693 if (features->done & FEATURE_CAMERA)
0694 pr_info("MINI2440: '%c' ignored, camera already registered\n",
0695 f);
0696 else
0697 features->optional[features->count++] =
0698 &s3c_device_camif;
0699 features->done |= FEATURE_CAMERA;
0700 break;
0701 }
0702 }
0703 }
0704
0705 static void __init mini2440_init(void)
0706 {
0707 struct mini2440_features_t features = { 0 };
0708 int i;
0709
0710 pr_info("MINI2440: Option string mini2440=%s\n",
0711 mini2440_features_str);
0712
0713
0714 mini2440_parse_features(&features, mini2440_features_str);
0715
0716
0717 s3c_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
0718
0719
0720 WARN_ON(gpio_request_one(S3C2410_GPG(4), GPIOF_OUT_INIT_HIGH, NULL));
0721 gpio_free(S3C2410_GPG(4));
0722
0723
0724 gpio_request_one(S3C2410_GPB(1), GPIOF_IN, NULL);
0725 s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP);
0726 gpio_free(S3C2410_GPB(1));
0727
0728
0729 for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) {
0730 s3c_gpio_setpull(mini2440_buttons[i].gpio, S3C_GPIO_PULL_UP);
0731 s3c_gpio_cfgpin(mini2440_buttons[i].gpio, S3C2410_GPIO_INPUT);
0732 }
0733
0734
0735 s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
0736 S3C_GPIO_PULL_NONE);
0737
0738 if (features.lcd_index != -1) {
0739 int li;
0740
0741 mini2440_fb_info.displays =
0742 &mini2440_lcd_cfg[features.lcd_index];
0743
0744 pr_info("MINI2440: LCD");
0745 for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++)
0746 if (li == features.lcd_index)
0747 pr_cont(" [%d:%dx%d]", li,
0748 mini2440_lcd_cfg[li].width,
0749 mini2440_lcd_cfg[li].height);
0750 else
0751 pr_cont(" %d:%dx%d", li,
0752 mini2440_lcd_cfg[li].width,
0753 mini2440_lcd_cfg[li].height);
0754 pr_cont("\n");
0755 s3c24xx_fb_set_platdata(&mini2440_fb_info);
0756 }
0757
0758 s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
0759 gpiod_add_lookup_table(&mini2440_mmc_gpio_table);
0760 s3c24xx_mci_set_platdata(&mini2440_mmc_cfg);
0761 s3c_nand_set_platdata(&mini2440_nand_info);
0762 s3c_i2c0_set_platdata(NULL);
0763
0764 i2c_register_board_info(0, mini2440_i2c_devs,
0765 ARRAY_SIZE(mini2440_i2c_devs));
0766
0767
0768 s3c_gpio_setpull(S3C2410_GPB(5), S3C_GPIO_PULL_NONE);
0769 s3c_gpio_setpull(S3C2410_GPB(6), S3C_GPIO_PULL_NONE);
0770 s3c_gpio_setpull(S3C2410_GPB(7), S3C_GPIO_PULL_NONE);
0771 s3c_gpio_setpull(S3C2410_GPB(8), S3C_GPIO_PULL_NONE);
0772 s3c_gpio_setpull(S3C2410_GPG(4), S3C_GPIO_PULL_NONE);
0773
0774
0775 gpiod_add_lookup_table(&mini2440_led1_gpio_table);
0776 gpiod_add_lookup_table(&mini2440_led2_gpio_table);
0777 gpiod_add_lookup_table(&mini2440_led3_gpio_table);
0778 gpiod_add_lookup_table(&mini2440_led4_gpio_table);
0779 gpiod_add_lookup_table(&mini2440_backlight_gpio_table);
0780
0781 platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
0782
0783 if (features.count)
0784 platform_add_devices(features.optional, features.count);
0785
0786 }
0787
0788
0789 MACHINE_START(MINI2440, "MINI2440")
0790
0791 .atag_offset = 0x100,
0792 .nr_irqs = NR_IRQS_S3C2440,
0793 .map_io = mini2440_map_io,
0794 .init_machine = mini2440_init,
0795 .init_irq = s3c2440_init_irq,
0796 .init_time = mini2440_init_time,
0797 MACHINE_END