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