diff options
Diffstat (limited to 'arch/arm/mach-pxa/magician.c')
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 486 |
1 files changed, 475 insertions, 11 deletions
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index d98ef7ada2f8..d70be75bd199 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -16,24 +16,106 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/delay.h> | ||
19 | #include <linux/gpio_keys.h> | 20 | #include <linux/gpio_keys.h> |
20 | #include <linux/input.h> | 21 | #include <linux/input.h> |
22 | #include <linux/mfd/htc-egpio.h> | ||
23 | #include <linux/mfd/htc-pasic3.h> | ||
21 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
22 | #include <linux/mtd/map.h> | 25 | #include <linux/mtd/map.h> |
23 | #include <linux/mtd/physmap.h> | 26 | #include <linux/mtd/physmap.h> |
27 | #include <linux/pda_power.h> | ||
24 | 28 | ||
25 | #include <asm/gpio.h> | 29 | #include <asm/gpio.h> |
26 | #include <asm/hardware.h> | 30 | #include <asm/hardware.h> |
27 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
28 | #include <asm/mach/arch.h> | 32 | #include <asm/mach/arch.h> |
29 | #include <asm/arch/magician.h> | 33 | #include <asm/arch/magician.h> |
34 | #include <asm/arch/mfp-pxa27x.h> | ||
30 | #include <asm/arch/pxa-regs.h> | 35 | #include <asm/arch/pxa-regs.h> |
31 | #include <asm/arch/pxafb.h> | 36 | #include <asm/arch/pxafb.h> |
37 | #include <asm/arch/i2c.h> | ||
38 | #include <asm/arch/mmc.h> | ||
32 | #include <asm/arch/irda.h> | 39 | #include <asm/arch/irda.h> |
33 | #include <asm/arch/ohci.h> | 40 | #include <asm/arch/ohci.h> |
34 | 41 | ||
35 | #include "generic.h" | 42 | #include "generic.h" |
36 | 43 | ||
44 | static unsigned long magician_pin_config[] = { | ||
45 | |||
46 | /* SDRAM and Static Memory I/O Signals */ | ||
47 | GPIO20_nSDCS_2, | ||
48 | GPIO21_nSDCS_3, | ||
49 | GPIO15_nCS_1, | ||
50 | GPIO78_nCS_2, /* PASIC3 */ | ||
51 | GPIO79_nCS_3, /* EGPIO CPLD */ | ||
52 | GPIO80_nCS_4, | ||
53 | GPIO33_nCS_5, | ||
54 | |||
55 | /* I2C */ | ||
56 | GPIO117_I2C_SCL, | ||
57 | GPIO118_I2C_SDA, | ||
58 | |||
59 | /* PWM 0 */ | ||
60 | GPIO16_PWM0_OUT, | ||
61 | |||
62 | /* I2S */ | ||
63 | GPIO28_I2S_BITCLK_OUT, | ||
64 | GPIO29_I2S_SDATA_IN, | ||
65 | GPIO31_I2S_SYNC, | ||
66 | GPIO113_I2S_SYSCLK, | ||
67 | |||
68 | /* SSP 2 */ | ||
69 | GPIO19_SSP2_SCLK, | ||
70 | GPIO14_SSP2_SFRM, | ||
71 | GPIO89_SSP2_TXD, | ||
72 | GPIO88_SSP2_RXD, | ||
73 | |||
74 | /* MMC */ | ||
75 | GPIO32_MMC_CLK, | ||
76 | GPIO92_MMC_DAT_0, | ||
77 | GPIO109_MMC_DAT_1, | ||
78 | GPIO110_MMC_DAT_2, | ||
79 | GPIO111_MMC_DAT_3, | ||
80 | GPIO112_MMC_CMD, | ||
81 | |||
82 | /* LCD */ | ||
83 | GPIO58_LCD_LDD_0, | ||
84 | GPIO59_LCD_LDD_1, | ||
85 | GPIO60_LCD_LDD_2, | ||
86 | GPIO61_LCD_LDD_3, | ||
87 | GPIO62_LCD_LDD_4, | ||
88 | GPIO63_LCD_LDD_5, | ||
89 | GPIO64_LCD_LDD_6, | ||
90 | GPIO65_LCD_LDD_7, | ||
91 | GPIO66_LCD_LDD_8, | ||
92 | GPIO67_LCD_LDD_9, | ||
93 | GPIO68_LCD_LDD_10, | ||
94 | GPIO69_LCD_LDD_11, | ||
95 | GPIO70_LCD_LDD_12, | ||
96 | GPIO71_LCD_LDD_13, | ||
97 | GPIO72_LCD_LDD_14, | ||
98 | GPIO73_LCD_LDD_15, | ||
99 | GPIO74_LCD_FCLK, | ||
100 | GPIO75_LCD_LCLK, | ||
101 | GPIO76_LCD_PCLK, | ||
102 | GPIO77_LCD_BIAS, | ||
103 | |||
104 | /* QCI */ | ||
105 | GPIO12_CIF_DD_7, | ||
106 | GPIO17_CIF_DD_6, | ||
107 | GPIO50_CIF_DD_3, | ||
108 | GPIO51_CIF_DD_2, | ||
109 | GPIO52_CIF_DD_4, | ||
110 | GPIO53_CIF_MCLK, | ||
111 | GPIO54_CIF_PCLK, | ||
112 | GPIO55_CIF_DD_1, | ||
113 | GPIO81_CIF_DD_0, | ||
114 | GPIO82_CIF_DD_5, | ||
115 | GPIO84_CIF_FV, | ||
116 | GPIO85_CIF_LV, | ||
117 | }; | ||
118 | |||
37 | /* | 119 | /* |
38 | * IRDA | 120 | * IRDA |
39 | */ | 121 | */ |
@@ -83,8 +165,64 @@ static struct platform_device gpio_keys = { | |||
83 | .id = -1, | 165 | .id = -1, |
84 | }; | 166 | }; |
85 | 167 | ||
168 | |||
169 | /* | ||
170 | * EGPIO (Xilinx CPLD) | ||
171 | * | ||
172 | * 7 32-bit aligned 8-bit registers: 3x output, 1x irq, 3x input | ||
173 | */ | ||
174 | |||
175 | static struct resource egpio_resources[] = { | ||
176 | [0] = { | ||
177 | .start = PXA_CS3_PHYS, | ||
178 | .end = PXA_CS3_PHYS + 0x20, | ||
179 | .flags = IORESOURCE_MEM, | ||
180 | }, | ||
181 | [1] = { | ||
182 | .start = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), | ||
183 | .end = gpio_to_irq(GPIO13_MAGICIAN_CPLD_IRQ), | ||
184 | .flags = IORESOURCE_IRQ, | ||
185 | }, | ||
186 | }; | ||
187 | |||
188 | static struct htc_egpio_chip egpio_chips[] = { | ||
189 | [0] = { | ||
190 | .reg_start = 0, | ||
191 | .gpio_base = MAGICIAN_EGPIO(0, 0), | ||
192 | .num_gpios = 24, | ||
193 | .direction = HTC_EGPIO_OUTPUT, | ||
194 | .initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */ | ||
195 | }, | ||
196 | [1] = { | ||
197 | .reg_start = 4, | ||
198 | .gpio_base = MAGICIAN_EGPIO(4, 0), | ||
199 | .num_gpios = 24, | ||
200 | .direction = HTC_EGPIO_INPUT, | ||
201 | }, | ||
202 | }; | ||
203 | |||
204 | static struct htc_egpio_platform_data egpio_info = { | ||
205 | .reg_width = 8, | ||
206 | .bus_width = 32, | ||
207 | .irq_base = IRQ_BOARD_START, | ||
208 | .num_irqs = 4, | ||
209 | .ack_register = 3, | ||
210 | .chip = egpio_chips, | ||
211 | .num_chips = ARRAY_SIZE(egpio_chips), | ||
212 | }; | ||
213 | |||
214 | static struct platform_device egpio = { | ||
215 | .name = "htc-egpio", | ||
216 | .id = -1, | ||
217 | .resource = egpio_resources, | ||
218 | .num_resources = ARRAY_SIZE(egpio_resources), | ||
219 | .dev = { | ||
220 | .platform_data = &egpio_info, | ||
221 | }, | ||
222 | }; | ||
223 | |||
86 | /* | 224 | /* |
87 | * LCD - Toppoly TD028STEB1 | 225 | * LCD - Toppoly TD028STEB1 or Samsung LTP280QV |
88 | */ | 226 | */ |
89 | 227 | ||
90 | static struct pxafb_mode_info toppoly_modes[] = { | 228 | static struct pxafb_mode_info toppoly_modes[] = { |
@@ -103,12 +241,99 @@ static struct pxafb_mode_info toppoly_modes[] = { | |||
103 | }, | 241 | }, |
104 | }; | 242 | }; |
105 | 243 | ||
244 | static struct pxafb_mode_info samsung_modes[] = { | ||
245 | { | ||
246 | .pixclock = 96153, | ||
247 | .bpp = 16, | ||
248 | .xres = 240, | ||
249 | .yres = 320, | ||
250 | .hsync_len = 8, | ||
251 | .vsync_len = 4, | ||
252 | .left_margin = 9, | ||
253 | .upper_margin = 4, | ||
254 | .right_margin = 9, | ||
255 | .lower_margin = 4, | ||
256 | .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, | ||
257 | }, | ||
258 | }; | ||
259 | |||
260 | static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si) | ||
261 | { | ||
262 | pr_debug("Toppoly LCD power\n"); | ||
263 | |||
264 | if (on) { | ||
265 | pr_debug("on\n"); | ||
266 | gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1); | ||
267 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); | ||
268 | udelay(2000); | ||
269 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); | ||
270 | udelay(2000); | ||
271 | /* FIXME: enable LCDC here */ | ||
272 | udelay(2000); | ||
273 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); | ||
274 | udelay(2000); | ||
275 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); | ||
276 | } else { | ||
277 | pr_debug("off\n"); | ||
278 | msleep(15); | ||
279 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); | ||
280 | udelay(500); | ||
281 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); | ||
282 | udelay(1000); | ||
283 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); | ||
284 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); | ||
285 | } | ||
286 | } | ||
287 | |||
288 | static void samsung_lcd_power(int on, struct fb_var_screeninfo *si) | ||
289 | { | ||
290 | pr_debug("Samsung LCD power\n"); | ||
291 | |||
292 | if (on) { | ||
293 | pr_debug("on\n"); | ||
294 | if (system_rev < 3) | ||
295 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1); | ||
296 | else | ||
297 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1); | ||
298 | mdelay(10); | ||
299 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 1); | ||
300 | mdelay(10); | ||
301 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 1); | ||
302 | mdelay(30); | ||
303 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 1); | ||
304 | mdelay(10); | ||
305 | } else { | ||
306 | pr_debug("off\n"); | ||
307 | mdelay(10); | ||
308 | gpio_set_value(GPIO105_MAGICIAN_LCD_POWER_2, 0); | ||
309 | mdelay(30); | ||
310 | gpio_set_value(GPIO104_MAGICIAN_LCD_POWER_1, 0); | ||
311 | mdelay(10); | ||
312 | gpio_set_value(GPIO106_MAGICIAN_LCD_POWER_3, 0); | ||
313 | mdelay(10); | ||
314 | if (system_rev < 3) | ||
315 | gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); | ||
316 | else | ||
317 | gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0); | ||
318 | } | ||
319 | } | ||
320 | |||
106 | static struct pxafb_mach_info toppoly_info = { | 321 | static struct pxafb_mach_info toppoly_info = { |
107 | .modes = toppoly_modes, | 322 | .modes = toppoly_modes, |
108 | .num_modes = 1, | 323 | .num_modes = 1, |
109 | .fixed_modes = 1, | 324 | .fixed_modes = 1, |
110 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | 325 | .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, |
111 | .lccr3 = LCCR3_PixRsEdg, | 326 | .lccr3 = LCCR3_PixRsEdg, |
327 | .pxafb_lcd_power = toppoly_lcd_power, | ||
328 | }; | ||
329 | |||
330 | static struct pxafb_mach_info samsung_info = { | ||
331 | .modes = samsung_modes, | ||
332 | .num_modes = 1, | ||
333 | .fixed_modes = 1, | ||
334 | .lccr0 = LCCR0_LDDALT | LCCR0_Color | LCCR0_Sngl | LCCR0_Act, | ||
335 | .lccr3 = LCCR3_PixFlEdg, | ||
336 | .pxafb_lcd_power = samsung_lcd_power, | ||
112 | }; | 337 | }; |
113 | 338 | ||
114 | /* | 339 | /* |
@@ -120,9 +345,18 @@ static void magician_set_bl_intensity(int intensity) | |||
120 | if (intensity) { | 345 | if (intensity) { |
121 | PWM_CTRL0 = 1; | 346 | PWM_CTRL0 = 1; |
122 | PWM_PERVAL0 = 0xc8; | 347 | PWM_PERVAL0 = 0xc8; |
123 | PWM_PWDUTY0 = intensity; | 348 | if (intensity > 0xc7) { |
349 | PWM_PWDUTY0 = intensity - 0x48; | ||
350 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1); | ||
351 | } else { | ||
352 | PWM_PWDUTY0 = intensity; | ||
353 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0); | ||
354 | } | ||
355 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 1); | ||
124 | pxa_set_cken(CKEN_PWM0, 1); | 356 | pxa_set_cken(CKEN_PWM0, 1); |
125 | } else { | 357 | } else { |
358 | /* PWM_PWDUTY0 = intensity; */ | ||
359 | gpio_set_value(EGPIO_MAGICIAN_BL_POWER, 0); | ||
126 | pxa_set_cken(CKEN_PWM0, 0); | 360 | pxa_set_cken(CKEN_PWM0, 0); |
127 | } | 361 | } |
128 | } | 362 | } |
@@ -130,18 +364,215 @@ static void magician_set_bl_intensity(int intensity) | |||
130 | static struct generic_bl_info backlight_info = { | 364 | static struct generic_bl_info backlight_info = { |
131 | .default_intensity = 0x64, | 365 | .default_intensity = 0x64, |
132 | .limit_mask = 0x0b, | 366 | .limit_mask = 0x0b, |
133 | .max_intensity = 0xc7, | 367 | .max_intensity = 0xc7+0x48, |
134 | .set_bl_intensity = magician_set_bl_intensity, | 368 | .set_bl_intensity = magician_set_bl_intensity, |
135 | }; | 369 | }; |
136 | 370 | ||
137 | static struct platform_device backlight = { | 371 | static struct platform_device backlight = { |
138 | .name = "corgi-bl", | 372 | .name = "generic-bl", |
139 | .dev = { | 373 | .dev = { |
140 | .platform_data = &backlight_info, | 374 | .platform_data = &backlight_info, |
141 | }, | 375 | }, |
142 | .id = -1, | 376 | .id = -1, |
143 | }; | 377 | }; |
144 | 378 | ||
379 | /* | ||
380 | * LEDs | ||
381 | */ | ||
382 | |||
383 | struct gpio_led gpio_leds[] = { | ||
384 | { | ||
385 | .name = "magician::vibra", | ||
386 | .default_trigger = "none", | ||
387 | .gpio = GPIO22_MAGICIAN_VIBRA_EN, | ||
388 | }, | ||
389 | { | ||
390 | .name = "magician::phone_bl", | ||
391 | .default_trigger = "none", | ||
392 | .gpio = GPIO103_MAGICIAN_LED_KP, | ||
393 | }, | ||
394 | }; | ||
395 | |||
396 | static struct gpio_led_platform_data gpio_led_info = { | ||
397 | .leds = gpio_leds, | ||
398 | .num_leds = ARRAY_SIZE(gpio_leds), | ||
399 | }; | ||
400 | |||
401 | static struct platform_device leds_gpio = { | ||
402 | .name = "leds-gpio", | ||
403 | .id = -1, | ||
404 | .dev = { | ||
405 | .platform_data = &gpio_led_info, | ||
406 | }, | ||
407 | }; | ||
408 | |||
409 | static struct pasic3_led pasic3_leds[] = { | ||
410 | { | ||
411 | .led = { | ||
412 | .name = "magician:red", | ||
413 | .default_trigger = "ds2760-battery.0-charging", | ||
414 | }, | ||
415 | .hw_num = 0, | ||
416 | .bit2 = PASIC3_BIT2_LED0, | ||
417 | .mask = PASIC3_MASK_LED0, | ||
418 | }, | ||
419 | { | ||
420 | .led = { | ||
421 | .name = "magician:green", | ||
422 | .default_trigger = "ds2760-battery.0-charging-or-full", | ||
423 | }, | ||
424 | .hw_num = 1, | ||
425 | .bit2 = PASIC3_BIT2_LED1, | ||
426 | .mask = PASIC3_MASK_LED1, | ||
427 | }, | ||
428 | { | ||
429 | .led = { | ||
430 | .name = "magician:blue", | ||
431 | .default_trigger = "bluetooth", | ||
432 | }, | ||
433 | .hw_num = 2, | ||
434 | .bit2 = PASIC3_BIT2_LED2, | ||
435 | .mask = PASIC3_MASK_LED2, | ||
436 | }, | ||
437 | }; | ||
438 | |||
439 | static struct platform_device pasic3; | ||
440 | |||
441 | static struct pasic3_leds_machinfo __devinit pasic3_leds_info = { | ||
442 | .num_leds = ARRAY_SIZE(pasic3_leds), | ||
443 | .power_gpio = EGPIO_MAGICIAN_LED_POWER, | ||
444 | .leds = pasic3_leds, | ||
445 | }; | ||
446 | |||
447 | /* | ||
448 | * PASIC3 with DS1WM | ||
449 | */ | ||
450 | |||
451 | static struct resource pasic3_resources[] = { | ||
452 | [0] = { | ||
453 | .start = PXA_CS2_PHYS, | ||
454 | .end = PXA_CS2_PHYS + 0x1b, | ||
455 | .flags = IORESOURCE_MEM, | ||
456 | }, | ||
457 | /* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */ | ||
458 | [1] = { | ||
459 | .start = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), | ||
460 | .end = gpio_to_irq(GPIO107_MAGICIAN_DS1WM_IRQ), | ||
461 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, | ||
462 | } | ||
463 | }; | ||
464 | |||
465 | static struct pasic3_platform_data pasic3_platform_data = { | ||
466 | .bus_shift = 2, | ||
467 | .led_pdata = &pasic3_leds_info, | ||
468 | .clock_rate = 4000000, | ||
469 | }; | ||
470 | |||
471 | static struct platform_device pasic3 = { | ||
472 | .name = "pasic3", | ||
473 | .id = -1, | ||
474 | .num_resources = ARRAY_SIZE(pasic3_resources), | ||
475 | .resource = pasic3_resources, | ||
476 | .dev = { | ||
477 | .platform_data = &pasic3_platform_data, | ||
478 | }, | ||
479 | }; | ||
480 | |||
481 | /* | ||
482 | * External power | ||
483 | */ | ||
484 | |||
485 | static int magician_is_ac_online(void) | ||
486 | { | ||
487 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); | ||
488 | } | ||
489 | |||
490 | static int magician_is_usb_online(void) | ||
491 | { | ||
492 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_USB); | ||
493 | } | ||
494 | |||
495 | static void magician_set_charge(int flags) | ||
496 | { | ||
497 | gpio_set_value(GPIO30_MAGICIAN_nCHARGE_EN, !flags); | ||
498 | gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); | ||
499 | } | ||
500 | |||
501 | static char *magician_supplicants[] = { | ||
502 | "ds2760-battery.0", "backup-battery" | ||
503 | }; | ||
504 | |||
505 | static struct pda_power_pdata power_supply_info = { | ||
506 | .is_ac_online = magician_is_ac_online, | ||
507 | .is_usb_online = magician_is_usb_online, | ||
508 | .set_charge = magician_set_charge, | ||
509 | .supplied_to = magician_supplicants, | ||
510 | .num_supplicants = ARRAY_SIZE(magician_supplicants), | ||
511 | }; | ||
512 | |||
513 | static struct resource power_supply_resources[] = { | ||
514 | [0] = { | ||
515 | .name = "ac", | ||
516 | .flags = IORESOURCE_IRQ, | ||
517 | .start = IRQ_MAGICIAN_AC, | ||
518 | .end = IRQ_MAGICIAN_AC, | ||
519 | }, | ||
520 | [1] = { | ||
521 | .name = "usb", | ||
522 | .flags = IORESOURCE_IRQ, | ||
523 | .start = IRQ_MAGICIAN_AC, | ||
524 | .end = IRQ_MAGICIAN_AC, | ||
525 | }, | ||
526 | }; | ||
527 | |||
528 | static struct platform_device power_supply = { | ||
529 | .name = "pda-power", | ||
530 | .id = -1, | ||
531 | .dev = { | ||
532 | .platform_data = &power_supply_info, | ||
533 | }, | ||
534 | .resource = power_supply_resources, | ||
535 | .num_resources = ARRAY_SIZE(power_supply_resources), | ||
536 | }; | ||
537 | |||
538 | |||
539 | /* | ||
540 | * MMC/SD | ||
541 | */ | ||
542 | |||
543 | static int magician_mci_init(struct device *dev, | ||
544 | irq_handler_t detect_irq, void *data) | ||
545 | { | ||
546 | return request_irq(IRQ_MAGICIAN_SD, detect_irq, | ||
547 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, | ||
548 | "MMC card detect", data); | ||
549 | } | ||
550 | |||
551 | static void magician_mci_setpower(struct device *dev, unsigned int vdd) | ||
552 | { | ||
553 | struct pxamci_platform_data *pdata = dev->platform_data; | ||
554 | |||
555 | gpio_set_value(EGPIO_MAGICIAN_SD_POWER, (1 << vdd) & pdata->ocr_mask); | ||
556 | } | ||
557 | |||
558 | static int magician_mci_get_ro(struct device *dev) | ||
559 | { | ||
560 | return (!gpio_get_value(EGPIO_MAGICIAN_nSD_READONLY)); | ||
561 | } | ||
562 | |||
563 | static void magician_mci_exit(struct device *dev, void *data) | ||
564 | { | ||
565 | free_irq(IRQ_MAGICIAN_SD, data); | ||
566 | } | ||
567 | |||
568 | static struct pxamci_platform_data magician_mci_info = { | ||
569 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | ||
570 | .init = magician_mci_init, | ||
571 | .get_ro = magician_mci_get_ro, | ||
572 | .setpower = magician_mci_setpower, | ||
573 | .exit = magician_mci_exit, | ||
574 | }; | ||
575 | |||
145 | 576 | ||
146 | /* | 577 | /* |
147 | * USB OHCI | 578 | * USB OHCI |
@@ -166,6 +597,11 @@ static struct pxaohci_platform_data magician_ohci_info = { | |||
166 | * StrataFlash | 597 | * StrataFlash |
167 | */ | 598 | */ |
168 | 599 | ||
600 | static void magician_set_vpp(struct map_info *map, int vpp) | ||
601 | { | ||
602 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); | ||
603 | } | ||
604 | |||
169 | #define PXA_CS_SIZE 0x04000000 | 605 | #define PXA_CS_SIZE 0x04000000 |
170 | 606 | ||
171 | static struct resource strataflash_resource = { | 607 | static struct resource strataflash_resource = { |
@@ -176,13 +612,14 @@ static struct resource strataflash_resource = { | |||
176 | 612 | ||
177 | static struct physmap_flash_data strataflash_data = { | 613 | static struct physmap_flash_data strataflash_data = { |
178 | .width = 4, | 614 | .width = 4, |
615 | .set_vpp = magician_set_vpp, | ||
179 | }; | 616 | }; |
180 | 617 | ||
181 | static struct platform_device strataflash = { | 618 | static struct platform_device strataflash = { |
182 | .name = "physmap-flash", | 619 | .name = "physmap-flash", |
183 | .id = -1, | 620 | .id = -1, |
184 | .num_resources = 1, | ||
185 | .resource = &strataflash_resource, | 621 | .resource = &strataflash_resource, |
622 | .num_resources = 1, | ||
186 | .dev = { | 623 | .dev = { |
187 | .platform_data = &strataflash_data, | 624 | .platform_data = &strataflash_data, |
188 | }, | 625 | }, |
@@ -194,16 +631,43 @@ static struct platform_device strataflash = { | |||
194 | 631 | ||
195 | static struct platform_device *devices[] __initdata = { | 632 | static struct platform_device *devices[] __initdata = { |
196 | &gpio_keys, | 633 | &gpio_keys, |
634 | &egpio, | ||
197 | &backlight, | 635 | &backlight, |
636 | &pasic3, | ||
637 | &power_supply, | ||
198 | &strataflash, | 638 | &strataflash, |
639 | &leds_gpio, | ||
199 | }; | 640 | }; |
200 | 641 | ||
201 | static void __init magician_init(void) | 642 | static void __init magician_init(void) |
202 | { | 643 | { |
644 | void __iomem *cpld; | ||
645 | int lcd_select; | ||
646 | |||
647 | pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); | ||
648 | |||
203 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 649 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
650 | pxa_set_i2c_info(NULL); | ||
651 | pxa_set_mci_info(&magician_mci_info); | ||
204 | pxa_set_ohci_info(&magician_ohci_info); | 652 | pxa_set_ohci_info(&magician_ohci_info); |
205 | pxa_set_ficp_info(&magician_ficp_info); | 653 | pxa_set_ficp_info(&magician_ficp_info); |
206 | set_pxa_fb_info(&toppoly_info); | 654 | |
655 | /* Check LCD type we have */ | ||
656 | cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); | ||
657 | if (cpld) { | ||
658 | u8 board_id = __raw_readb(cpld+0x14); | ||
659 | system_rev = board_id & 0x7; | ||
660 | lcd_select = board_id & 0x8; | ||
661 | iounmap(cpld); | ||
662 | pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); | ||
663 | if (lcd_select && (system_rev < 3)) | ||
664 | pxa_gpio_mode(GPIO75_MAGICIAN_SAMSUNG_POWER_MD); | ||
665 | pxa_gpio_mode(GPIO104_MAGICIAN_LCD_POWER_1_MD); | ||
666 | pxa_gpio_mode(GPIO105_MAGICIAN_LCD_POWER_2_MD); | ||
667 | pxa_gpio_mode(GPIO106_MAGICIAN_LCD_POWER_3_MD); | ||
668 | set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info); | ||
669 | } else | ||
670 | pr_err("LCD detection: CPLD mapping failed\n"); | ||
207 | } | 671 | } |
208 | 672 | ||
209 | 673 | ||