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