9eb96fbab6db45347804537b47c1e39ac222a49f
[linux-2.6/mini2440.git] / arch / arm / mach-s3c2440 / mach-mini2440.c
blob9eb96fbab6db45347804537b47c1e39ac222a49f
1 /* linux/arch/arm/mach-s3c2440/mach-mini2440.c
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>
9 * For product information, visit http://code.google.com/p/mini2440/
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.
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>
33 #include <asm/mach/arch.h>
34 #include <asm/mach/map.h>
36 #include <mach/hardware.h>
37 #include <mach/fb.h>
38 #include <asm/mach-types.h>
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>
52 * This is compiled conditionaly, as:
53 * 1) not everyone needs the touchscreen
54 * 2) that s3c_ts code might not have been added
55 * to the kernel with this file
57 #ifdef CONFIG_TOUCHSCREEN_S3C2410
58 #include <mach/ts.h>
59 #endif
61 #include <linux/mtd/mtd.h>
62 #include <linux/mtd/nand.h>
63 #include <linux/mtd/nand_ecc.h>
64 #include <linux/mtd/partitions.h>
66 #include <plat/clock.h>
67 #include <plat/devs.h>
68 #include <plat/cpu.h>
70 #include <sound/s3c24xx_uda134x.h>
72 #ifdef CONFIG_TOUCHSCREEN_FILTER
73 #include <../drivers/input/touchscreen/ts_filter_linear.h>
74 #include <../drivers/input/touchscreen/ts_filter_mean.h>
75 #include <../drivers/input/touchscreen/ts_filter_median.h>
76 #include <../drivers/input/touchscreen/ts_filter_group.h>
77 #endif
79 #define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)
81 static struct map_desc mini2440_iodesc[] = {
82 /* nothing to declare, move along */
85 #define UCON S3C2410_UCON_DEFAULT
86 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
87 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
90 static struct s3c2410_uartcfg mini2440_uartcfgs[] = {
91 [0] = {
92 .hwport = 0,
93 .flags = 0,
94 .ucon = UCON,
95 .ulcon = ULCON,
96 .ufcon = UFCON,
98 [1] = {
99 .hwport = 1,
100 .flags = 0,
101 .ucon = UCON,
102 .ulcon = ULCON,
103 .ufcon = UFCON,
105 [2] = {
106 .hwport = 2,
107 .flags = 0,
108 .ucon = UCON,
109 .ulcon = ULCON,
110 .ufcon = UFCON,
114 /* USB device UDC support */
116 static void mini2440_udc_pullup(enum s3c2410_udc_cmd_e cmd)
118 pr_debug("udc: pullup(%d)\n", cmd);
120 switch (cmd) {
121 case S3C2410_UDC_P_ENABLE :
122 s3c2410_gpio_setpin(S3C2410_GPC(5), 1);
123 break;
124 case S3C2410_UDC_P_DISABLE :
125 s3c2410_gpio_setpin(S3C2410_GPC(5), 0);
126 break;
127 case S3C2410_UDC_P_RESET :
128 break;
129 default:
130 break;
134 static struct s3c2410_udc_mach_info mini2440_udc_cfg = {
135 .udc_command = mini2440_udc_pullup,
138 /* touchscreen configuration */
140 #ifdef CONFIG_TOUCHSCREEN_FILTER
141 static struct ts_filter_linear_configuration mini2440_ts_linear_config = {
142 .constants = {
143 0, /* x factor */
144 1, /* y proportion */
145 0, /* x offset */
147 1, /* x factor */
148 0, /* y factor */
149 0, /* y offset */
151 1 /* common divisor */
153 .coord0 = 0,
154 .coord1 = 1,
157 static struct ts_filter_group_configuration mini2440_ts_group_config = {
158 .extent = 12,
159 .close_enough = 10,
160 .threshold = 6, /* at least half of the points in a group */
161 .attempts = 10,
164 static struct ts_filter_median_configuration mini2440_ts_median_config = {
165 .extent = 20,
166 .decimation_below = 3,
167 .decimation_threshold = 8 * 3,
168 .decimation_above = 4,
171 static struct ts_filter_mean_configuration mini2440_ts_mean_config = {
172 .bits_filter_length = 2, /* 4 points */
175 static struct s3c2410_ts_mach_info mini2440_ts_cfg = {
176 .delay = 10000,
177 .presc = 0xff, /* slow as we can go */
178 .filter_sequence = {
179 [0] = &ts_filter_group_api,
180 [1] = &ts_filter_median_api,
181 [2] = &ts_filter_mean_api,
182 [3] = &ts_filter_linear_api,
184 .filter_config = {
185 [0] = &mini2440_ts_group_config,
186 [1] = &mini2440_ts_median_config,
187 [2] = &mini2440_ts_mean_config,
188 [3] = &mini2440_ts_linear_config,
191 #else /* !CONFIG_TOUCHSCREEN_FILTER */
192 #ifdef CONFIG_TOUCHSCREEN_S3C2410
193 static struct s3c2410_ts_mach_info mini2440_ts_cfg = {
194 .delay = 10000,
195 .presc = 0xff, /* slow as we can go */
197 #endif /* CONFIG_TOUCHSCREEN_S3C2410 */
198 #endif
200 /* LCD driver info */
202 /* LCD timing and setup */
205 * This macro simplifies the table bellow
207 #define _LCD_DECLARE(_clock,_xres,margin_left,margin_right,hsync, \
208 _yres,margin_top,margin_bottom,vsync, refresh) \
209 .width = _xres, \
210 .xres = _xres, \
211 .height = _yres, \
212 .yres = _yres, \
213 .left_margin = margin_left, \
214 .right_margin = margin_right, \
215 .upper_margin = margin_top, \
216 .lower_margin = margin_bottom, \
217 .hsync_len = hsync, \
218 .vsync_len = vsync, \
219 .pixclock = ((_clock*100000000000LL) / \
220 ((refresh) * \
221 (hsync + margin_left + _xres + margin_right) * \
222 (vsync + margin_top + _yres + margin_bottom))), \
223 .bpp = 16,\
224 .type = (S3C2410_LCDCON1_TFT16BPP |\
225 S3C2410_LCDCON1_TFT)
227 static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
228 [0] = { /* mini2440 + 3.5" TFT + touchscreen - old model "N35" */
229 _LCD_DECLARE(
230 7, /* The 3.5 is quite fast */
231 240, 21, 38, 6, /* x timing */
232 320, 4, 4, 2, /* y timing */
233 60), /* refresh rate */
234 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
235 S3C2410_LCDCON5_INVVLINE |
236 S3C2410_LCDCON5_INVVFRAME |
237 S3C2410_LCDCON5_INVVDEN |
238 S3C2410_LCDCON5_PWREN),
240 [1] = { /* mini2440 + 7" TFT + touchscreen */
241 _LCD_DECLARE(
242 10, /* the 7" runs slower */
243 800, 40, 40, 48, /* x timing */
244 480, 29, 3, 3, /* y timing */
245 50), /* refresh rate */
246 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
247 S3C2410_LCDCON5_INVVLINE |
248 S3C2410_LCDCON5_INVVFRAME |
249 S3C2410_LCDCON5_PWREN),
251 /* The VGA shield can outout at several resolutions. All share
252 * the same timings, however, anything smaller than 1024x768
253 * will only be displayed in the top left corner of a 1024x768
254 * XGA output unless you add optional dip switches to the shield.
255 * Therefore timings for other resolutions have been ommited here.
257 [2] = {
258 _LCD_DECLARE(
260 1024, 1, 2, 2, /* y timing */
261 768, 200, 16, 16, /* x timing */
262 24), /* refresh rate, maximum stable,
263 tested with the FPGA shield */
264 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
265 S3C2410_LCDCON5_HWSWP),
268 [3] = { /* mini2440 + 3.5" TFT + TS -- New model as Nov 2009 "T35" */
269 _LCD_DECLARE(
270 7, /* The 3.5 is quite fast */
271 240, 21, 25, 6, /* x timing */
272 320, 2, 4, 2, /* y timing */
273 40), /* refresh rate */
274 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
275 S3C2410_LCDCON5_INVVLINE |
276 S3C2410_LCDCON5_INVVFRAME |
277 S3C2410_LCDCON5_INVVDEN |
278 S3C2410_LCDCON5_PWREN),
280 [4] = { /* mini2440 + 5.6" TFT + touchscreen -- Innolux AT056TN52 */
281 /* be sure the "power" jumper is set accordingly ! */
282 _LCD_DECLARE(
283 10, /* the 5.3" runs slower */
284 640, 41, 68, 22, /* x timing */
285 480, 26, 6, 2, /* y timing */
286 40), /* refresh rate */
287 .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
288 S3C2410_LCDCON5_INVVLINE |
289 S3C2410_LCDCON5_INVVFRAME |
290 S3C2410_LCDCON5_PWREN),
294 /* todo - put into gpio header */
296 #define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
297 #define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
299 static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
300 .displays = &mini2440_lcd_cfg[0], /* not constant! see init */
301 .num_displays = 1,
302 .default_display = 0,
304 /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
305 * and disable the pull down resistors on pins we are using for LCD
306 * data. */
308 .gpcup = (0xf << 1) | (0x3f << 10),
310 .gpccon = (S3C2410_GPC1_VCLK | S3C2410_GPC2_VLINE |
311 S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
312 S3C2410_GPC10_VD2 | S3C2410_GPC11_VD3 |
313 S3C2410_GPC12_VD4 | S3C2410_GPC13_VD5 |
314 S3C2410_GPC14_VD6 | S3C2410_GPC15_VD7),
316 .gpccon_mask = (S3C2410_GPCCON_MASK(1) | S3C2410_GPCCON_MASK(2) |
317 S3C2410_GPCCON_MASK(3) | S3C2410_GPCCON_MASK(4) |
318 S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
319 S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
320 S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
322 .gpdup = (0x3f << 2) | (0x3f << 10),
324 .gpdcon = (S3C2410_GPD2_VD10 | S3C2410_GPD3_VD11 |
325 S3C2410_GPD4_VD12 | S3C2410_GPD5_VD13 |
326 S3C2410_GPD6_VD14 | S3C2410_GPD7_VD15 |
327 S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
328 S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
329 S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
331 .gpdcon_mask = (S3C2410_GPDCON_MASK(2) | S3C2410_GPDCON_MASK(3) |
332 S3C2410_GPDCON_MASK(4) | S3C2410_GPDCON_MASK(5) |
333 S3C2410_GPDCON_MASK(6) | S3C2410_GPDCON_MASK(7) |
334 S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
335 S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
336 S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
339 /* MMC/SD */
341 static struct s3c24xx_mci_pdata mini2440_mmc_cfg = {
342 .gpio_detect = S3C2410_GPG(8),
343 .gpio_wprotect = S3C2410_GPH(8),
344 .set_power = NULL,
345 .ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34,
348 /* NAND Flash on MINI2440 board */
350 static struct mtd_partition mini2440_default_nand_part[] = {
351 [0] = {
352 .name = "u-boot",
353 .size = SZ_256K,
354 .offset = 0,
356 [1] = {
357 .name = "u-boot-env",
358 .size = SZ_128K,
359 .offset = SZ_256K,
361 [2] = {
362 .name = "kernel",
363 /* 5 megabytes, for a kernel with no modules
364 * or a uImage with a ramdisk attached */
365 .size = 0x00500000,
366 .offset = SZ_256K + SZ_128K,
368 [3] = {
369 .name = "root",
370 .offset = SZ_256K + SZ_128K + 0x00500000,
371 .size = MTDPART_SIZ_FULL,
375 static struct s3c2410_nand_set mini2440_nand_sets[] = {
376 [0] = {
377 .name = "nand",
378 .nr_chips = 1,
379 .nr_partitions = ARRAY_SIZE(mini2440_default_nand_part),
380 .partitions = mini2440_default_nand_part,
381 .flash_bbt = 1, /* we use u-boot to create a BBT */
385 static struct s3c2410_platform_nand mini2440_nand_info = {
386 .tacls = 0,
387 .twrph0 = 25,
388 .twrph1 = 15,
389 .nr_sets = ARRAY_SIZE(mini2440_nand_sets),
390 .sets = mini2440_nand_sets,
391 .ignore_unset_ecc = 1,
394 /* DM9000AEP 10/100 ethernet controller */
396 static struct resource mini2440_dm9k_resource[] = {
397 [0] = {
398 .start = MACH_MINI2440_DM9K_BASE,
399 .end = MACH_MINI2440_DM9K_BASE + 3,
400 .flags = IORESOURCE_MEM
402 [1] = {
403 .start = MACH_MINI2440_DM9K_BASE + 4,
404 .end = MACH_MINI2440_DM9K_BASE + 7,
405 .flags = IORESOURCE_MEM
407 [2] = {
408 .start = IRQ_EINT7,
409 .end = IRQ_EINT7,
410 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
415 * The DM9000 has no eeprom, and it's MAC address is set by
416 * the bootloader before starting the kernel.
418 static struct dm9000_plat_data mini2440_dm9k_pdata = {
419 .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
422 static struct platform_device mini2440_device_eth = {
423 .name = "dm9000",
424 .id = -1,
425 .num_resources = ARRAY_SIZE(mini2440_dm9k_resource),
426 .resource = mini2440_dm9k_resource,
427 .dev = {
428 .platform_data = &mini2440_dm9k_pdata,
432 /* CON5
433 * +--+ /-----\
434 * | | | |
435 * | | | BAT |
436 * | | \_____/
437 * | |
438 * | | +----+ +----+
439 * | | | K5 | | K1 |
440 * | | +----+ +----+
441 * | | +----+ +----+
442 * | | | K4 | | K2 |
443 * | | +----+ +----+
444 * | | +----+ +----+
445 * | | | K6 | | K3 |
446 * | | +----+ +----+
447 * .....
449 static struct gpio_keys_button mini2440_buttons[] = {
451 .gpio = S3C2410_GPG(0), /* K1 */
452 .code = KEY_F1,
453 .desc = "Button 1",
454 .active_low = 1,
457 .gpio = S3C2410_GPG(3), /* K2 */
458 .code = KEY_F2,
459 .desc = "Button 2",
460 .active_low = 1,
463 .gpio = S3C2410_GPG(5), /* K3 */
464 .code = KEY_F3,
465 .desc = "Button 3",
466 .active_low = 1,
469 .gpio = S3C2410_GPG(6), /* K4 */
470 .code = KEY_POWER,
471 .desc = "Power",
472 .active_low = 1,
475 .gpio = S3C2410_GPG(7), /* K5 */
476 .code = KEY_F5,
477 .desc = "Button 5",
478 .active_low = 1,
480 #if 0
481 /* this pin is also known as TCLK1 and seems to already
482 * marked as "in use" somehow in the kernel -- possibly wrongly */
484 .gpio = S3C2410_GPG(11), /* K6 */
485 .code = KEY_F6,
486 .desc = "Button 6",
487 .active_low = 1,
489 #endif
492 static struct gpio_keys_platform_data mini2440_button_data = {
493 .buttons = mini2440_buttons,
494 .nbuttons = ARRAY_SIZE(mini2440_buttons),
497 static struct platform_device mini2440_button_device = {
498 .name = "gpio-keys",
499 .id = -1,
500 .dev = {
501 .platform_data = &mini2440_button_data,
505 /* LEDS */
507 static struct s3c24xx_led_platdata mini2440_led1_pdata = {
508 .name = "led1",
509 .gpio = S3C2410_GPB(5),
510 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
511 .def_trigger = "heartbeat",
514 static struct s3c24xx_led_platdata mini2440_led2_pdata = {
515 .name = "led2",
516 .gpio = S3C2410_GPB(6),
517 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
518 .def_trigger = "nand-disk",
521 static struct s3c24xx_led_platdata mini2440_led3_pdata = {
522 .name = "led3",
523 .gpio = S3C2410_GPB(7),
524 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
525 .def_trigger = "mmc0",
528 static struct s3c24xx_led_platdata mini2440_led4_pdata = {
529 .name = "led4",
530 .gpio = S3C2410_GPB(8),
531 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
532 .def_trigger = "",
535 static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
536 .name = "backlight",
537 .gpio = S3C2410_GPG(4),
538 .flags = S3C24XX_LEDF_STARTON,
539 .def_trigger = "backlight",
542 static struct platform_device mini2440_led1 = {
543 .name = "s3c24xx_led",
544 .id = 1,
545 .dev = {
546 .platform_data = &mini2440_led1_pdata,
550 static struct platform_device mini2440_led2 = {
551 .name = "s3c24xx_led",
552 .id = 2,
553 .dev = {
554 .platform_data = &mini2440_led2_pdata,
558 static struct platform_device mini2440_led3 = {
559 .name = "s3c24xx_led",
560 .id = 3,
561 .dev = {
562 .platform_data = &mini2440_led3_pdata,
566 static struct platform_device mini2440_led4 = {
567 .name = "s3c24xx_led",
568 .id = 4,
569 .dev = {
570 .platform_data = &mini2440_led4_pdata,
574 static struct platform_device mini2440_led_backlight = {
575 .name = "s3c24xx_led",
576 .id = 5,
577 .dev = {
578 .platform_data = &mini2440_led_backlight_pdata,
582 /* AUDIO */
584 static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
585 .l3_clk = S3C2410_GPB(4),
586 .l3_mode = S3C2410_GPB(2),
587 .l3_data = S3C2410_GPB(3),
588 .model = UDA134X_UDA1341
591 static struct platform_device mini2440_audio = {
592 .name = "s3c24xx_uda134x",
593 .id = 0,
594 .dev = {
595 .platform_data = &mini2440_audio_pins,
600 * I2C devices
602 static struct at24_platform_data at24c08 = {
603 .byte_len = SZ_8K / 8,
604 .page_size = 16,
607 static struct i2c_board_info mini2440_i2c_devs[] = {
609 I2C_BOARD_INFO("24c08", 0x50),
610 .platform_data = &at24c08,
614 static struct platform_device *mini2440_devices[] = {
615 &s3c_device_usb,
616 &s3c_device_wdt,
617 /* &s3c_device_adc,*/ /* ADC doesn't like living with touchscreen ! */
618 &s3c_device_i2c0,
619 &s3c_device_rtc,
620 &s3c_device_usbgadget,
621 &mini2440_device_eth,
622 &mini2440_led1,
623 &mini2440_led2,
624 &mini2440_led3,
625 &mini2440_led4,
626 &mini2440_button_device,
627 &s3c_device_nand,
628 &s3c_device_sdi,
629 &s3c_device_iis,
630 &mini2440_audio,
631 /* &s3c_device_timer[0],*/ /* buzzer pwm, no API for it */
632 /* remaining devices are optional */
635 static void __init mini2440_map_io(void)
637 s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
638 s3c24xx_init_clocks(12000000);
639 s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
641 s3c_device_nand.dev.platform_data = &mini2440_nand_info;
642 s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg;
646 * mini2440_features string
648 * t = Touchscreen present
649 * b = backlight control
650 * c = camera [TODO]
651 * 0-9 LCD configuration
654 static char mini2440_features_str[12] __initdata = "0tb";
656 static int __init mini2440_features_setup(char *str)
658 if (str)
659 strlcpy(mini2440_features_str, str, sizeof(mini2440_features_str));
660 return 1;
663 __setup("mini2440=", mini2440_features_setup);
665 #define FEATURE_SCREEN (1 << 0)
666 #define FEATURE_BACKLIGHT (1 << 1)
667 #define FEATURE_TOUCH (1 << 2)
668 #define FEATURE_CAMERA (1 << 3)
670 struct mini2440_features_t {
671 int count;
672 int done;
673 int lcd_index;
674 struct platform_device *optional[8];
677 static void mini2440_parse_features(
678 struct mini2440_features_t * features,
679 const char * features_str )
681 const char * fp = features_str;
683 features->count = 0;
684 features->done = 0;
685 features->lcd_index = -1;
687 while (*fp) {
688 char f = *fp++;
690 switch (f) {
691 case '0'...'9': /* tft screen */
692 if (features->done & FEATURE_SCREEN) {
693 printk(KERN_INFO "MINI2440: '%c' ignored, "
694 "screen type already set\n", f);
695 } else {
696 int li = f - '0';
697 if (li >= ARRAY_SIZE(mini2440_lcd_cfg))
698 printk(KERN_INFO "MINI2440: "
699 "'%c' out of range LCD mode\n", f);
700 else {
701 features->optional[features->count++] =
702 &s3c_device_lcd;
703 features->lcd_index = li;
706 features->done |= FEATURE_SCREEN;
707 break;
708 case 'b':
709 if (features->done & FEATURE_BACKLIGHT)
710 printk(KERN_INFO "MINI2440: '%c' ignored, "
711 "backlight already set\n", f);
712 else {
713 features->optional[features->count++] =
714 &mini2440_led_backlight;
716 features->done |= FEATURE_BACKLIGHT;
717 break;
718 case 't':
719 #ifdef CONFIG_TOUCHSCREEN_S3C2410
720 if (features->done & FEATURE_TOUCH)
721 printk(KERN_INFO "MINI2440: '%c' ignored, "
722 "touchscreen already set\n", f);
723 else
724 features->optional[features->count++] =
725 &s3c_device_ts;
726 features->done |= FEATURE_TOUCH;
727 #else
728 printk(KERN_INFO "MINI2440: '%c' ignored, "
729 "touchscreen not compiled in\n", f);
730 #endif
731 break;
732 case 'c':
733 if (features->done & FEATURE_CAMERA)
734 printk(KERN_INFO "MINI2440: '%c' ignored, "
735 "camera already registered\n", f);
736 else
737 features->optional[features->count++] =
738 &s3c_device_camif;
739 features->done |= FEATURE_CAMERA;
740 break;
745 static void __init mini2440_init(void)
747 struct mini2440_features_t features = { 0 };
748 int i;
750 printk(KERN_INFO "MINI2440: Option string mini2440=%s\n",
751 mini2440_features_str);
753 /* Parse the feature string */
754 mini2440_parse_features(&features, mini2440_features_str);
756 /* turn LCD on */
757 s3c2410_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
759 /* Turn the backlight early on */
760 s3c2410_gpio_setpin(S3C2410_GPG(4), 1);
761 s3c2410_gpio_cfgpin(S3C2410_GPG(4), S3C2410_GPIO_OUTPUT);
763 /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */
764 s3c2410_gpio_pullup(S3C2410_GPB(1), 0);
765 s3c2410_gpio_setpin(S3C2410_GPB(1), 0);
766 s3c2410_gpio_cfgpin(S3C2410_GPB(1), S3C2410_GPIO_INPUT);
768 /* Make sure the D+ pullup pin is output */
769 s3c2410_gpio_cfgpin(S3C2410_GPC(5), S3C2410_GPIO_OUTPUT);
771 /* mark the key as input, without pullups (there is one on the board) */
772 for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) {
773 s3c2410_gpio_pullup(mini2440_buttons[i].gpio, 0);
774 s3c2410_gpio_cfgpin(mini2440_buttons[i].gpio,
775 S3C2410_GPIO_INPUT);
777 if (features.lcd_index != -1) {
778 int li;
780 mini2440_fb_info.displays =
781 &mini2440_lcd_cfg[features.lcd_index];
783 printk(KERN_INFO "MINI2440: LCD");
784 for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++)
785 if (li == features.lcd_index)
786 printk(" [%d:%dx%d]", li,
787 mini2440_lcd_cfg[li].width,
788 mini2440_lcd_cfg[li].height);
789 else
790 printk(" %d:%dx%d", li,
791 mini2440_lcd_cfg[li].width,
792 mini2440_lcd_cfg[li].height);
793 printk("\n");
794 s3c24xx_fb_set_platdata(&mini2440_fb_info);
796 s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
797 s3c_i2c0_set_platdata(NULL);
798 i2c_register_board_info(0, mini2440_i2c_devs,
799 ARRAY_SIZE(mini2440_i2c_devs));
801 #ifdef CONFIG_TOUCHSCREEN_S3C2410
802 if (features.done & FEATURE_TOUCH)
803 set_s3c2410ts_info(&mini2440_ts_cfg);
804 #endif
806 platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
808 if (features.count) /* the optional features */
809 platform_add_devices(features.optional, features.count);
814 MACHINE_START(MINI2440, "MINI2440")
815 /* Maintainer: Michel Pollet <buserror@gmail.com> */
816 .phys_io = S3C2410_PA_UART,
817 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
818 .boot_params = S3C2410_SDRAM_PA + 0x100,
819 .map_io = mini2440_map_io,
820 .init_machine = mini2440_init,
821 .init_irq = s3c24xx_init_irq,
822 .timer = &s3c24xx_timer,
823 MACHINE_END