linux/arch/arm/mach-s3c2440/mach-mini2440.c
<<
>>
Prefs
   1/* linux/arch/arm/mach-s3c2440/mach-mini2440.c
   2 *
   3 * Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
   4 *      Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
   5 *      and modifications by SBZ <sbz@spgui.org> and
   6 *      Weibing <http://weibing.blogbus.com> and
   7 *      Michel Pollet <buserror@gmail.com>
   8 *
   9 * For product information, visit http://code.google.com/p/mini2440/
  10 *
  11 * This program is free software; you can redistribute it and/or modify
  12 * it under the terms of the GNU General Public License version 2 as
  13 * published by the Free Software Foundation.
  14*/
  15
  16#include <linux/kernel.h>
  17#include <linux/types.h>
  18#include <linux/interrupt.h>
  19#include <linux/list.h>
  20#include <linux/timer.h>
  21#include <linux/init.h>
  22#include <linux/gpio.h>
  23#include <linux/input.h>
  24#include <linux/io.h>
  25#include <linux/serial_core.h>
  26#include <linux/dm9000.h>
  27#include <linux/i2c/at24.h>
  28#include <linux/platform_device.h>
  29#include <linux/gpio_keys.h>
  30#include <linux/i2c.h>
  31#include <linux/mmc/host.h>
  32
  33#include <asm/mach/arch.h>
  34#include <asm/mach/map.h>
  35
  36#include <mach/hardware.h>
  37#include <mach/fb.h>
  38#include <asm/mach-types.h>
  39
  40#include <plat/regs-serial.h>
  41#include <mach/regs-gpio.h>
  42#include <mach/leds-gpio.h>
  43#include <mach/regs-mem.h>
  44#include <mach/regs-lcd.h>
  45#include <mach/irqs.h>
  46#include <plat/nand.h>
  47#include <plat/iic.h>
  48#include <plat/mci.h>
  49#include <plat/udc.h>
  50
  51#include <linux/mtd/mtd.h>
  52#include <linux/mtd/nand.h>
  53#include <linux/mtd/nand_ecc.h>
  54#include <linux/mtd/partitions.h>
  55
  56#include <plat/clock.h>
  57#include <plat/devs.h>
  58#include <plat/cpu.h>
  59
  60#include <sound/s3c24xx_uda134x.h>
  61
  62#define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)
  63
  64static struct map_desc mini2440_iodesc[] __initdata = {
  65        /* nothing to declare, move along */
  66};
  67
  68#define UCON S3C2410_UCON_DEFAULT
  69#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
  70#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
  71
  72
  73static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
  74        [0] = {
  75                .hwport      = 0,
  76                .flags       = 0,
  77                .ucon        = UCON,
  78                .ulcon       = ULCON,
  79                .ufcon       = UFCON,
  80        },
  81        [1] = {
  82                .hwport      = 1,
  83                .flags       = 0,
  84                .ucon        = UCON,
  85                .ulcon       = ULCON,
  86                .ufcon       = UFCON,
  87        },
  88        [2] = {
  89                .hwport      = 2,
  90                .flags       = 0,
  91                .ucon        = UCON,
  92                .ulcon       = ULCON,
  93                .ufcon       = UFCON,
  94        },
  95};
  96
  97/* USB device UDC support */
  98
  99static void mini2440_udc_pullup(enum s3c2410_udc_cmd_e cmd)
 100{
 101        pr_debug("udc: pullup(%d)\n", cmd);
 102
 103        switch (cmd) {
 104                case S3C2410_UDC_P_ENABLE :
 105                        s3c2410_gpio_setpin(S3C2410_GPC(5), 1);
 106                        break;
 107                case S3C2410_UDC_P_DISABLE :
 108                        s3c2410_gpio_setpin(S3C2410_GPC(5), 0);
 109                        break;
 110                case S3C2410_UDC_P_RESET :
 111                        break;
 112                default:
 113                        break;
 114        }
 115}
 116
 117static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
 118        .udc_command            = mini2440_udc_pullup,
 119};
 120
 121
 122/* LCD timing and setup */
 123
 124/*
 125 * This macro simplifies the table bellow
 126 */
 127#define _LCD_DECLARE(_clock,_xres,margin_left,margin_right,hsync, \
 128                        _yres,margin_top,margin_bottom,vsync, refresh) \
 129        .width = _xres, \
 130        .xres = _xres, \
 131        .height = _yres, \
 132        .yres = _yres, \
 133        .left_margin    = margin_left,  \
 134        .right_margin   = margin_right, \
 135        .upper_margin   = margin_top,   \
 136        .lower_margin   = margin_bottom,        \
 137        .hsync_len      = hsync,        \
 138        .vsync_len      = vsync,        \
 139        .pixclock       = ((_clock*100000000000LL) /    \
 140                           ((refresh) * \
 141                           (hsync + margin_left + _xres + margin_right) * \
 142                           (vsync + margin_top + _yres + margin_bottom))), \
 143        .bpp            = 16,\
 144        .type           = (S3C2410_LCDCON1_TFT16BPP |\
 145                           S3C2410_LCDCON1_TFT)
 146
 147static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
 148        [0] = { /* mini2440 + 3.5" TFT + touchscreen */
 149                _LCD_DECLARE(
 150                        7,                      /* The 3.5 is quite fast */
 151                        240, 21, 38, 6,         /* x timing */
 152                        320, 4, 4, 2,           /* y timing */
 153                        60),                    /* refresh rate */
 154                .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
 155                                   S3C2410_LCDCON5_INVVLINE |
 156                                   S3C2410_LCDCON5_INVVFRAME |
 157                                   S3C2410_LCDCON5_INVVDEN |
 158                                   S3C2410_LCDCON5_PWREN),
 159        },
 160        [1] = { /* mini2440 + 7" TFT + touchscreen */
 161                _LCD_DECLARE(
 162                        10,                     /* the 7" runs slower */
 163                        800, 40, 40, 48,        /* x timing */
 164                        480, 29, 3, 3,          /* y timing */
 165                        50),                    /* refresh rate */
 166                .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
 167                                   S3C2410_LCDCON5_INVVLINE |
 168                                   S3C2410_LCDCON5_INVVFRAME |
 169                                   S3C2410_LCDCON5_PWREN),
 170        },
 171        /* The VGA shield can outout at several resolutions. All share 
 172         * the same timings, however, anything smaller than 1024x768
 173         * will only be displayed in the top left corner of a 1024x768
 174         * XGA output unless you add optional dip switches to the shield.
 175         * Therefore timings for other resolutions have been ommited here.
 176         */
 177        [2] = {
 178                _LCD_DECLARE(
 179                        10,
 180                        1024, 1, 2, 2,          /* y timing */
 181                        768, 200, 16, 16,       /* x timing */
 182                        24),    /* refresh rate, maximum stable,
 183                                 tested with the FPGA shield */
 184                .lcdcon5        = (S3C2410_LCDCON5_FRM565 |
 185                                   S3C2410_LCDCON5_HWSWP),
 186        },
 187};
 188
 189/* todo - put into gpio header */
 190
 191#define S3C2410_GPCCON_MASK(x)  (3 << ((x) * 2))
 192#define S3C2410_GPDCON_MASK(x)  (3 << ((x) * 2))
 193
 194static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
 195        .displays        = &mini2440_lcd_cfg[0], /* not constant! see init */
 196        .num_displays    = 1,
 197        .default_display = 0,
 198
 199        /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
 200         * and disable the pull down resistors on pins we are using for LCD
 201         * data. */
 202
 203        .gpcup          = (0xf << 1) | (0x3f << 10),
 204
 205        .gpccon         = (S3C2410_GPC1_VCLK   | S3C2410_GPC2_VLINE |
 206                           S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
 207                           S3C2410_GPC10_VD2   | S3C2410_GPC11_VD3 |
 208                           S3C2410_GPC12_VD4   | S3C2410_GPC13_VD5 |
 209                           S3C2410_GPC14_VD6   | S3C2410_GPC15_VD7),
 210
 211        .gpccon_mask    = (S3C2410_GPCCON_MASK(1)  | S3C2410_GPCCON_MASK(2)  |
 212                           S3C2410_GPCCON_MASK(3)  | S3C2410_GPCCON_MASK(4)  |
 213                           S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
 214                           S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
 215                           S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
 216
 217        .gpdup          = (0x3f << 2) | (0x3f << 10),
 218
 219        .gpdcon         = (S3C2410_GPD2_VD10  | S3C2410_GPD3_VD11 |
 220                           S3C2410_GPD4_VD12  | S3C2410_GPD5_VD13 |
 221                           S3C2410_GPD6_VD14  | S3C2410_GPD7_VD15 |
 222                           S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
 223                           S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
 224                           S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
 225
 226        .gpdcon_mask    = (S3C2410_GPDCON_MASK(2)  | S3C2410_GPDCON_MASK(3) |
 227                           S3C2410_GPDCON_MASK(4)  | S3C2410_GPDCON_MASK(5) |
 228                           S3C2410_GPDCON_MASK(6)  | S3C2410_GPDCON_MASK(7) |
 229                           S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
 230                           S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
 231                           S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
 232};
 233
 234/* MMC/SD  */
 235
 236static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
 237   .gpio_detect   = S3C2410_GPG(8),
 238   .gpio_wprotect = S3C2410_GPH(8),
 239   .set_power     = NULL,
 240   .ocr_avail     = MMC_VDD_32_33|MMC_VDD_33_34,
 241};
 242
 243/* NAND Flash on MINI2440 board */
 244
 245static struct mtd_partition mini2440_default_nand_part[] __initdata = {
 246        [0] = {
 247                .name   = "u-boot",
 248                .size   = SZ_256K,
 249                .offset = 0,
 250        },
 251        [1] = {
 252                .name   = "u-boot-env",
 253                .size   = SZ_128K,
 254                .offset = SZ_256K,
 255        },
 256        [2] = {
 257                .name   = "kernel",
 258                /* 5 megabytes, for a kernel with no modules
 259                 * or a uImage with a ramdisk attached */
 260                .size   = 0x00500000,
 261                .offset = SZ_256K + SZ_128K,
 262        },
 263        [3] = {
 264                .name   = "root",
 265                .offset = SZ_256K + SZ_128K + 0x00500000,
 266                .size   = MTDPART_SIZ_FULL,
 267        },
 268};
 269
 270static struct s3c2410_nand_set mini2440_nand_sets[] __initdata = {
 271        [0] = {
 272                .name           = "nand",
 273                .nr_chips       = 1,
 274                .nr_partitions  = ARRAY_SIZE(mini2440_default_nand_part),
 275                .partitions     = mini2440_default_nand_part,
 276                .flash_bbt      = 1, /* we use u-boot to create a BBT */
 277        },
 278};
 279
 280static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
 281        .tacls          = 0,
 282        .twrph0         = 25,
 283        .twrph1         = 15,
 284        .nr_sets        = ARRAY_SIZE(mini2440_nand_sets),
 285        .sets           = mini2440_nand_sets,
 286        .ignore_unset_ecc = 1,
 287};
 288
 289/* DM9000AEP 10/100 ethernet controller */
 290
 291static struct resource mini2440_dm9k_resource[] __initdata = {
 292        [0] = {
 293                .start = MACH_MINI2440_DM9K_BASE,
 294                .end   = MACH_MINI2440_DM9K_BASE + 3,
 295                .flags = IORESOURCE_MEM
 296        },
 297        [1] = {
 298                .start = MACH_MINI2440_DM9K_BASE + 4,
 299                .end   = MACH_MINI2440_DM9K_BASE + 7,
 300                .flags = IORESOURCE_MEM
 301        },
 302        [2] = {
 303                .start = IRQ_EINT7,
 304                .end   = IRQ_EINT7,
 305                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
 306        }
 307};
 308
 309/*
 310 * The DM9000 has no eeprom, and it's MAC address is set by
 311 * the bootloader before starting the kernel.
 312 */
 313static struct dm9000_plat_data mini2440_dm9k_pdata __initdata = {
 314        .flags          = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
 315};
 316
 317static struct platform_device mini2440_device_eth __initdata = {
 318        .name           = "dm9000",
 319        .id             = -1,
 320        .num_resources  = ARRAY_SIZE(mini2440_dm9k_resource),
 321        .resource       = mini2440_dm9k_resource,
 322        .dev            = {
 323                .platform_data  = &mini2440_dm9k_pdata,
 324        },
 325};
 326
 327/*  CON5
 328 *      +--+     /-----\
 329 *      |  |    |       |
 330 *      |  |    |  BAT  |
 331 *      |  |     \_____/
 332 *      |  |
 333 *      |  |  +----+  +----+
 334 *      |  |  | K5 |  | K1 |
 335 *      |  |  +----+  +----+
 336 *      |  |  +----+  +----+
 337 *      |  |  | K4 |  | K2 |
 338 *      |  |  +----+  +----+
 339 *      |  |  +----+  +----+
 340 *      |  |  | K6 |  | K3 |
 341 *      |  |  +----+  +----+
 342 *        .....
 343 */
 344static struct gpio_keys_button mini2440_buttons[] __initdata = {
 345        {
 346                .gpio           = S3C2410_GPG(0),               /* K1 */
 347                .code           = KEY_F1,
 348                .desc           = "Button 1",
 349                .active_low     = 1,
 350        },
 351        {
 352                .gpio           = S3C2410_GPG(3),               /* K2 */
 353                .code           = KEY_F2,
 354                .desc           = "Button 2",
 355                .active_low     = 1,
 356        },
 357        {
 358                .gpio           = S3C2410_GPG(5),               /* K3 */
 359                .code           = KEY_F3,
 360                .desc           = "Button 3",
 361                .active_low     = 1,
 362        },
 363        {
 364                .gpio           = S3C2410_GPG(6),               /* K4 */
 365                .code           = KEY_POWER,
 366                .desc           = "Power",
 367                .active_low     = 1,
 368        },
 369        {
 370                .gpio           = S3C2410_GPG(7),               /* K5 */
 371                .code           = KEY_F5,
 372                .desc           = "Button 5",
 373                .active_low     = 1,
 374        },
 375#if 0
 376        /* this pin is also known as TCLK1 and seems to already
 377         * marked as "in use" somehow in the kernel -- possibly wrongly */
 378        {
 379                .gpio           = S3C2410_GPG(11),      /* K6 */
 380                .code           = KEY_F6,
 381                .desc           = "Button 6",
 382                .active_low     = 1,
 383        },
 384#endif
 385};
 386
 387static struct gpio_keys_platform_data mini2440_button_data __initdata = {
 388        .buttons        = mini2440_buttons,
 389        .nbuttons       = ARRAY_SIZE(mini2440_buttons),
 390};
 391
 392static struct platform_device mini2440_button_device __initdata = {
 393        .name           = "gpio-keys",
 394        .id             = -1,
 395        .dev            = {
 396                .platform_data  = &mini2440_button_data,
 397        }
 398};
 399
 400/* LEDS */
 401
 402static struct s3c24xx_led_platdata mini2440_led1_pdata __initdata = {
 403        .name           = "led1",
 404        .gpio           = S3C2410_GPB(5),
 405        .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
 406        .def_trigger    = "heartbeat",
 407};
 408
 409static struct s3c24xx_led_platdata mini2440_led2_pdata __initdata = {
 410        .name           = "led2",
 411        .gpio           = S3C2410_GPB(6),
 412        .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
 413        .def_trigger    = "nand-disk",
 414};
 415
 416static struct s3c24xx_led_platdata mini2440_led3_pdata __initdata = {
 417        .name           = "led3",
 418        .gpio           = S3C2410_GPB(7),
 419        .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
 420        .def_trigger    = "mmc0",
 421};
 422
 423static struct s3c24xx_led_platdata mini2440_led4_pdata __initdata = {
 424        .name           = "led4",
 425        .gpio           = S3C2410_GPB(8),
 426        .flags          = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
 427        .def_trigger    = "",
 428};
 429
 430static struct s3c24xx_led_platdata mini2440_led_backlight_pdata __initdata = {
 431        .name           = "backlight",
 432        .gpio           = S3C2410_GPG(4),
 433        .def_trigger    = "backlight",
 434};
 435
 436static struct platform_device mini2440_led1 __initdata = {
 437        .name           = "s3c24xx_led",
 438        .id             = 1,
 439        .dev            = {
 440                .platform_data  = &mini2440_led1_pdata,
 441        },
 442};
 443
 444static struct platform_device mini2440_led2 __initdata = {
 445        .name           = "s3c24xx_led",
 446        .id             = 2,
 447        .dev            = {
 448                .platform_data  = &mini2440_led2_pdata,
 449        },
 450};
 451
 452static struct platform_device mini2440_led3 __initdata = {
 453        .name           = "s3c24xx_led",
 454        .id             = 3,
 455        .dev            = {
 456                .platform_data  = &mini2440_led3_pdata,
 457        },
 458};
 459
 460static struct platform_device mini2440_led4 __initdata = {
 461        .name           = "s3c24xx_led",
 462        .id             = 4,
 463        .dev            = {
 464                .platform_data  = &mini2440_led4_pdata,
 465        },
 466};
 467
 468static struct platform_device mini2440_led_backlight __initdata = {
 469        .name           = "s3c24xx_led",
 470        .id             = 5,
 471        .dev            = {
 472                .platform_data  = &mini2440_led_backlight_pdata,
 473        },
 474};
 475
 476/* AUDIO */
 477
 478static struct s3c24xx_uda134x_platform_data mini2440_audio_pins __initdata = {
 479        .l3_clk = S3C2410_GPB(4),
 480        .l3_mode = S3C2410_GPB(2),
 481        .l3_data = S3C2410_GPB(3),
 482        .model = UDA134X_UDA1341
 483};
 484
 485static struct platform_device mini2440_audio __initdata = {
 486        .name           = "s3c24xx_uda134x",
 487        .id             = 0,
 488        .dev            = {
 489                .platform_data  = &mini2440_audio_pins,
 490        },
 491};
 492
 493/*
 494 * I2C devices
 495 */
 496static struct at24_platform_data at24c08 = {
 497        .byte_len       = SZ_8K / 8,
 498        .page_size      = 16,
 499};
 500
 501static struct i2c_board_info mini2440_i2c_devs[] __initdata = {
 502        {
 503                I2C_BOARD_INFO("24c08", 0x50),
 504                .platform_data = &at24c08,
 505        },
 506};
 507
 508static struct platform_device *mini2440_devices[] __initdata = {
 509        &s3c_device_usb,
 510        &s3c_device_wdt,
 511/*      &s3c_device_adc,*/ /* ADC doesn't like living with touchscreen ! */
 512        &s3c_device_i2c0,
 513        &s3c_device_rtc,
 514        &s3c_device_usbgadget,
 515        &mini2440_device_eth,
 516        &mini2440_led1,
 517        &mini2440_led2,
 518        &mini2440_led3,
 519        &mini2440_led4,
 520        &mini2440_button_device,
 521        &s3c_device_nand,
 522        &s3c_device_sdi,
 523        &s3c_device_iis,
 524        &mini2440_audio,
 525/*      &s3c_device_timer[0],*/ /* buzzer pwm, no API for it */
 526        /* remaining devices are optional */
 527};
 528
 529static void __init mini2440_map_io(void)
 530{
 531        s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
 532        s3c24xx_init_clocks(12000000);
 533        s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
 534
 535        s3c_device_nand.dev.platform_data = &mini2440_nand_info;
 536        s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg;
 537}
 538
 539/*
 540 * mini2440_features string
 541 *
 542 * t = Touchscreen present
 543 * b = backlight control
 544 * c = camera [TODO]
 545 * 0-9 LCD configuration
 546 *
 547 */
 548static char mini2440_features_str[12] __initdata = "0tb";
 549
 550static int __init mini2440_features_setup(char *str)
 551{
 552        if (str)
 553                strlcpy(mini2440_features_str, str, sizeof(mini2440_features_str));
 554        return 1;
 555}
 556
 557__setup("mini2440=", mini2440_features_setup);
 558
 559#define FEATURE_SCREEN (1 << 0)
 560#define FEATURE_BACKLIGHT (1 << 1)
 561#define FEATURE_TOUCH (1 << 2)
 562#define FEATURE_CAMERA (1 << 3)
 563
 564struct mini2440_features_t {
 565        int count;
 566        int done;
 567        int lcd_index;
 568        struct platform_device *optional[8];
 569};
 570
 571static void mini2440_parse_features(
 572                struct mini2440_features_t * features,
 573                const char * features_str )
 574{
 575        const char * fp = features_str;
 576
 577        features->count = 0;
 578        features->done = 0;
 579        features->lcd_index = -1;
 580
 581        while (*fp) {
 582                char f = *fp++;
 583
 584                switch (f) {
 585                case '0'...'9': /* tft screen */
 586                        if (features->done & FEATURE_SCREEN) {
 587                                printk(KERN_INFO "MINI2440: '%c' ignored, "
 588                                        "screen type already set\n", f);
 589                        } else {
 590                                int li = f - '0';
 591                                if (li >= ARRAY_SIZE(mini2440_lcd_cfg))
 592                                        printk(KERN_INFO "MINI2440: "
 593                                                "'%c' out of range LCD mode\n", f);
 594                                else {
 595                                        features->optional[features->count++] =
 596                                                        &s3c_device_lcd;
 597                                        features->lcd_index = li;
 598                                }
 599                        }
 600                        features->done |= FEATURE_SCREEN;
 601                        break;
 602                case 'b':
 603                        if (features->done & FEATURE_BACKLIGHT)
 604                                printk(KERN_INFO "MINI2440: '%c' ignored, "
 605                                        "backlight already set\n", f);
 606                        else {
 607                                features->optional[features->count++] =
 608                                                &mini2440_led_backlight;
 609                        }
 610                        features->done |= FEATURE_BACKLIGHT;
 611                        break;
 612                case 't':
 613                        printk(KERN_INFO "MINI2440: '%c' ignored, "
 614                                "touchscreen not compiled in\n", f);
 615                        break;
 616                case 'c':
 617                        if (features->done & FEATURE_CAMERA)
 618                                printk(KERN_INFO "MINI2440: '%c' ignored, "
 619                                        "camera already registered\n", f);
 620                        else
 621                                features->optional[features->count++] =
 622                                        &s3c_device_camif;
 623                        features->done |= FEATURE_CAMERA;
 624                        break;
 625                }
 626        }
 627}
 628
 629static void __init mini2440_init(void)
 630{
 631        struct mini2440_features_t features = { 0 };
 632        int i;
 633
 634        printk(KERN_INFO "MINI2440: Option string mini2440=%s\n",
 635                        mini2440_features_str);
 636
 637        /* Parse the feature string */
 638        mini2440_parse_features(&features, mini2440_features_str);
 639
 640        /* turn LCD on */
 641        s3c2410_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
 642
 643        /* Turn the backlight early on */
 644        s3c2410_gpio_setpin(S3C2410_GPG(4), 1);
 645        s3c2410_gpio_cfgpin(S3C2410_GPG(4), S3C2410_GPIO_OUTPUT);
 646
 647        /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */
 648        s3c2410_gpio_pullup(S3C2410_GPB(1), 0);
 649        s3c2410_gpio_setpin(S3C2410_GPB(1), 0);
 650        s3c2410_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPIO_INPUT);
 651
 652        /* Make sure the D+ pullup pin is output */
 653        s3c2410_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT);
 654
 655        /* mark the key as input, without pullups (there is one on the board) */
 656        for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) {
 657                s3c2410_gpio_pullup(mini2440_buttons[i].gpio, 0);
 658                s3c2410_gpio_cfgpin(mini2440_buttons[i].gpio,
 659                                        S3C2410_GPIO_INPUT);
 660        }
 661        if (features.lcd_index != -1) {
 662                int li;
 663
 664                mini2440_fb_info.displays =
 665                        &mini2440_lcd_cfg[features.lcd_index];
 666
 667                printk(KERN_INFO "MINI2440: LCD");
 668                for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++)
 669                        if (li == features.lcd_index)
 670                                printk(" [%d:%dx%d]", li,
 671                                        mini2440_lcd_cfg[li].width,
 672                                        mini2440_lcd_cfg[li].height);
 673                        else
 674                                printk(" %d:%dx%d", li,
 675                                        mini2440_lcd_cfg[li].width,
 676                                        mini2440_lcd_cfg[li].height);
 677                printk("\n");
 678                s3c24xx_fb_set_platdata(&mini2440_fb_info);
 679        }
 680        s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
 681        s3c_i2c0_set_platdata(NULL);
 682        i2c_register_board_info(0, mini2440_i2c_devs,
 683                                ARRAY_SIZE(mini2440_i2c_devs));
 684
 685        platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
 686
 687        if (features.count)     /* the optional features */
 688                platform_add_devices(features.optional, features.count);
 689
 690}
 691
 692
 693MACHINE_START(MINI2440, "MINI2440")
 694        /* Maintainer: Michel Pollet <buserror@gmail.com> */
 695        .phys_io        = S3C2410_PA_UART,
 696        .io_pg_offst    = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
 697        .boot_params    = S3C2410_SDRAM_PA + 0x100,
 698        .map_io         = mini2440_map_io,
 699        .init_machine   = mini2440_init,
 700        .init_irq       = s3c24xx_init_irq,
 701        .timer          = &s3c24xx_timer,
 702MACHINE_END
 703