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