diff options
Diffstat (limited to 'arch/arm/mach-pxa/palmtc.c')
-rw-r--r-- | arch/arm/mach-pxa/palmtc.c | 190 |
1 files changed, 158 insertions, 32 deletions
diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c index 2131d5860919..a09a2374697b 100644 --- a/arch/arm/mach-pxa/palmtc.c +++ b/arch/arm/mach-pxa/palmtc.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/power_supply.h> | 25 | #include <linux/power_supply.h> |
26 | #include <linux/gpio_keys.h> | 26 | #include <linux/gpio_keys.h> |
27 | #include <linux/mtd/physmap.h> | 27 | #include <linux/mtd/physmap.h> |
28 | #include <linux/usb/gpio_vbus.h> | ||
28 | 29 | ||
29 | #include <asm/mach-types.h> | 30 | #include <asm/mach-types.h> |
30 | #include <asm/mach/arch.h> | 31 | #include <asm/mach/arch.h> |
@@ -116,6 +117,7 @@ static unsigned long palmtc_pin_config[] __initdata = { | |||
116 | /****************************************************************************** | 117 | /****************************************************************************** |
117 | * SD/MMC card controller | 118 | * SD/MMC card controller |
118 | ******************************************************************************/ | 119 | ******************************************************************************/ |
120 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | ||
119 | static struct pxamci_platform_data palmtc_mci_platform_data = { | 121 | static struct pxamci_platform_data palmtc_mci_platform_data = { |
120 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | 122 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
121 | .gpio_power = GPIO_NR_PALMTC_SD_POWER, | 123 | .gpio_power = GPIO_NR_PALMTC_SD_POWER, |
@@ -124,9 +126,18 @@ static struct pxamci_platform_data palmtc_mci_platform_data = { | |||
124 | .detect_delay_ms = 200, | 126 | .detect_delay_ms = 200, |
125 | }; | 127 | }; |
126 | 128 | ||
129 | static void __init palmtc_mmc_init(void) | ||
130 | { | ||
131 | pxa_set_mci_info(&palmtc_mci_platform_data); | ||
132 | } | ||
133 | #else | ||
134 | static inline void palmtc_mmc_init(void) {} | ||
135 | #endif | ||
136 | |||
127 | /****************************************************************************** | 137 | /****************************************************************************** |
128 | * GPIO keys | 138 | * GPIO keys |
129 | ******************************************************************************/ | 139 | ******************************************************************************/ |
140 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
130 | static struct gpio_keys_button palmtc_pxa_buttons[] = { | 141 | static struct gpio_keys_button palmtc_pxa_buttons[] = { |
131 | {KEY_F8, GPIO_NR_PALMTC_HOTSYNC_BUTTON, 1, "HotSync Button", EV_KEY, 1}, | 142 | {KEY_F8, GPIO_NR_PALMTC_HOTSYNC_BUTTON, 1, "HotSync Button", EV_KEY, 1}, |
132 | }; | 143 | }; |
@@ -144,9 +155,18 @@ static struct platform_device palmtc_pxa_keys = { | |||
144 | }, | 155 | }, |
145 | }; | 156 | }; |
146 | 157 | ||
158 | static void __init palmtc_keys_init(void) | ||
159 | { | ||
160 | platform_device_register(&palmtc_pxa_keys); | ||
161 | } | ||
162 | #else | ||
163 | static inline void palmtc_keys_init(void) {} | ||
164 | #endif | ||
165 | |||
147 | /****************************************************************************** | 166 | /****************************************************************************** |
148 | * Backlight | 167 | * Backlight |
149 | ******************************************************************************/ | 168 | ******************************************************************************/ |
169 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) | ||
150 | static int palmtc_backlight_init(struct device *dev) | 170 | static int palmtc_backlight_init(struct device *dev) |
151 | { | 171 | { |
152 | int ret; | 172 | int ret; |
@@ -196,17 +216,35 @@ static struct platform_device palmtc_backlight = { | |||
196 | }, | 216 | }, |
197 | }; | 217 | }; |
198 | 218 | ||
219 | static void __init palmtc_pwm_init(void) | ||
220 | { | ||
221 | platform_device_register(&palmtc_backlight); | ||
222 | } | ||
223 | #else | ||
224 | static inline void palmtc_pwm_init(void) {} | ||
225 | #endif | ||
226 | |||
199 | /****************************************************************************** | 227 | /****************************************************************************** |
200 | * IrDA | 228 | * IrDA |
201 | ******************************************************************************/ | 229 | ******************************************************************************/ |
230 | #if defined(CONFIG_IRDA) || defined(CONFIG_IRDA_MODULE) | ||
202 | static struct pxaficp_platform_data palmtc_ficp_platform_data = { | 231 | static struct pxaficp_platform_data palmtc_ficp_platform_data = { |
203 | .gpio_pwdown = GPIO_NR_PALMTC_IR_DISABLE, | 232 | .gpio_pwdown = GPIO_NR_PALMTC_IR_DISABLE, |
204 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 233 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
205 | }; | 234 | }; |
206 | 235 | ||
236 | static void __init palmtc_irda_init(void) | ||
237 | { | ||
238 | pxa_set_ficp_info(&palmtc_ficp_platform_data); | ||
239 | } | ||
240 | #else | ||
241 | static inline void palmtc_irda_init(void) {} | ||
242 | #endif | ||
243 | |||
207 | /****************************************************************************** | 244 | /****************************************************************************** |
208 | * Keyboard | 245 | * Keyboard |
209 | ******************************************************************************/ | 246 | ******************************************************************************/ |
247 | #if defined(CONFIG_KEYBOARD_MATRIX) || defined(CONFIG_KEYBOARD_MATRIX_MODULE) | ||
210 | static const uint32_t palmtc_matrix_keys[] = { | 248 | static const uint32_t palmtc_matrix_keys[] = { |
211 | KEY(0, 0, KEY_F1), | 249 | KEY(0, 0, KEY_F1), |
212 | KEY(0, 1, KEY_X), | 250 | KEY(0, 1, KEY_X), |
@@ -290,27 +328,103 @@ static struct platform_device palmtc_keyboard = { | |||
290 | .platform_data = &palmtc_keypad_platform_data, | 328 | .platform_data = &palmtc_keypad_platform_data, |
291 | }, | 329 | }, |
292 | }; | 330 | }; |
331 | static void __init palmtc_mkp_init(void) | ||
332 | { | ||
333 | platform_device_register(&palmtc_keyboard); | ||
334 | } | ||
335 | #else | ||
336 | static inline void palmtc_mkp_init(void) {} | ||
337 | #endif | ||
293 | 338 | ||
294 | /****************************************************************************** | 339 | /****************************************************************************** |
295 | * UDC | 340 | * UDC |
296 | ******************************************************************************/ | 341 | ******************************************************************************/ |
297 | static struct pxa2xx_udc_mach_info palmtc_udc_info __initdata = { | 342 | #if defined(CONFIG_USB_GADGET_PXA25X)||defined(CONFIG_USB_GADGET_PXA25X_MODULE) |
343 | static struct gpio_vbus_mach_info palmtc_udc_info = { | ||
298 | .gpio_vbus = GPIO_NR_PALMTC_USB_DETECT_N, | 344 | .gpio_vbus = GPIO_NR_PALMTC_USB_DETECT_N, |
299 | .gpio_vbus_inverted = 1, | 345 | .gpio_vbus_inverted = 1, |
300 | .gpio_pullup = GPIO_NR_PALMTC_USB_POWER, | 346 | .gpio_pullup = GPIO_NR_PALMTC_USB_POWER, |
301 | }; | 347 | }; |
302 | 348 | ||
349 | static struct platform_device palmtc_gpio_vbus = { | ||
350 | .name = "gpio-vbus", | ||
351 | .id = -1, | ||
352 | .dev = { | ||
353 | .platform_data = &palmtc_udc_info, | ||
354 | }, | ||
355 | }; | ||
356 | |||
357 | static void __init palmtc_udc_init(void) | ||
358 | { | ||
359 | platform_device_register(&palmtc_gpio_vbus); | ||
360 | }; | ||
361 | #else | ||
362 | static inline void palmtc_udc_init(void) {} | ||
363 | #endif | ||
364 | |||
303 | /****************************************************************************** | 365 | /****************************************************************************** |
304 | * Touchscreen / Battery / GPIO-extender | 366 | * Touchscreen / Battery / GPIO-extender |
305 | ******************************************************************************/ | 367 | ******************************************************************************/ |
306 | static struct platform_device palmtc_ucb1400_core = { | 368 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \ |
369 | defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) | ||
370 | static struct platform_device palmtc_ucb1400_device = { | ||
307 | .name = "ucb1400_core", | 371 | .name = "ucb1400_core", |
308 | .id = -1, | 372 | .id = -1, |
309 | }; | 373 | }; |
310 | 374 | ||
375 | static void __init palmtc_ts_init(void) | ||
376 | { | ||
377 | pxa_set_ac97_info(NULL); | ||
378 | platform_device_register(&palmtc_ucb1400_device); | ||
379 | } | ||
380 | #else | ||
381 | static inline void palmtc_ts_init(void) {} | ||
382 | #endif | ||
383 | |||
384 | /****************************************************************************** | ||
385 | * LEDs | ||
386 | ******************************************************************************/ | ||
387 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | ||
388 | struct gpio_led palmtc_gpio_leds[] = { | ||
389 | { | ||
390 | .name = "palmtc:green:user", | ||
391 | .default_trigger = "none", | ||
392 | .gpio = GPIO_NR_PALMTC_LED_POWER, | ||
393 | .active_low = 1, | ||
394 | }, { | ||
395 | .name = "palmtc:vibra:vibra", | ||
396 | .default_trigger = "none", | ||
397 | .gpio = GPIO_NR_PALMTC_VIBRA_POWER, | ||
398 | .active_low = 1, | ||
399 | } | ||
400 | |||
401 | }; | ||
402 | |||
403 | static struct gpio_led_platform_data palmtc_gpio_led_info = { | ||
404 | .leds = palmtc_gpio_leds, | ||
405 | .num_leds = ARRAY_SIZE(palmtc_gpio_leds), | ||
406 | }; | ||
407 | |||
408 | static struct platform_device palmtc_leds = { | ||
409 | .name = "leds-gpio", | ||
410 | .id = -1, | ||
411 | .dev = { | ||
412 | .platform_data = &palmtc_gpio_led_info, | ||
413 | } | ||
414 | }; | ||
415 | |||
416 | static void __init palmtc_leds_init(void) | ||
417 | { | ||
418 | platform_device_register(&palmtc_leds); | ||
419 | } | ||
420 | #else | ||
421 | static inline void palmtc_leds_init(void) {} | ||
422 | #endif | ||
423 | |||
311 | /****************************************************************************** | 424 | /****************************************************************************** |
312 | * NOR Flash | 425 | * NOR Flash |
313 | ******************************************************************************/ | 426 | ******************************************************************************/ |
427 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | ||
314 | static struct resource palmtc_flash_resource = { | 428 | static struct resource palmtc_flash_resource = { |
315 | .start = PXA_CS0_PHYS, | 429 | .start = PXA_CS0_PHYS, |
316 | .end = PXA_CS0_PHYS + SZ_16M - 1, | 430 | .end = PXA_CS0_PHYS + SZ_16M - 1, |
@@ -356,24 +470,33 @@ static struct platform_device palmtc_flash = { | |||
356 | }, | 470 | }, |
357 | }; | 471 | }; |
358 | 472 | ||
473 | static void __init palmtc_nor_init(void) | ||
474 | { | ||
475 | platform_device_register(&palmtc_flash); | ||
476 | } | ||
477 | #else | ||
478 | static inline void palmtc_nor_init(void) {} | ||
479 | #endif | ||
480 | |||
359 | /****************************************************************************** | 481 | /****************************************************************************** |
360 | * Framebuffer | 482 | * Framebuffer |
361 | ******************************************************************************/ | 483 | ******************************************************************************/ |
484 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
362 | static struct pxafb_mode_info palmtc_lcd_modes[] = { | 485 | static struct pxafb_mode_info palmtc_lcd_modes[] = { |
363 | { | 486 | { |
364 | .pixclock = 115384, | 487 | .pixclock = 115384, |
365 | .xres = 320, | 488 | .xres = 320, |
366 | .yres = 320, | 489 | .yres = 320, |
367 | .bpp = 16, | 490 | .bpp = 16, |
368 | 491 | ||
369 | .left_margin = 27, | 492 | .left_margin = 27, |
370 | .right_margin = 7, | 493 | .right_margin = 7, |
371 | .upper_margin = 7, | 494 | .upper_margin = 7, |
372 | .lower_margin = 8, | 495 | .lower_margin = 8, |
373 | 496 | ||
374 | .hsync_len = 6, | 497 | .hsync_len = 6, |
375 | .vsync_len = 1, | 498 | .vsync_len = 1, |
376 | }, | 499 | }, |
377 | }; | 500 | }; |
378 | 501 | ||
379 | static struct pxafb_mach_info palmtc_lcd_screen = { | 502 | static struct pxafb_mach_info palmtc_lcd_screen = { |
@@ -382,17 +505,17 @@ static struct pxafb_mach_info palmtc_lcd_screen = { | |||
382 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, | 505 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
383 | }; | 506 | }; |
384 | 507 | ||
508 | static void __init palmtc_lcd_init(void) | ||
509 | { | ||
510 | set_pxa_fb_info(&palmtc_lcd_screen); | ||
511 | } | ||
512 | #else | ||
513 | static inline void palmtc_lcd_init(void) {} | ||
514 | #endif | ||
515 | |||
385 | /****************************************************************************** | 516 | /****************************************************************************** |
386 | * Machine init | 517 | * Machine init |
387 | ******************************************************************************/ | 518 | ******************************************************************************/ |
388 | static struct platform_device *devices[] __initdata = { | ||
389 | &palmtc_backlight, | ||
390 | &palmtc_ucb1400_core, | ||
391 | &palmtc_keyboard, | ||
392 | &palmtc_pxa_keys, | ||
393 | &palmtc_flash, | ||
394 | }; | ||
395 | |||
396 | static void __init palmtc_init(void) | 519 | static void __init palmtc_init(void) |
397 | { | 520 | { |
398 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtc_pin_config)); | 521 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtc_pin_config)); |
@@ -402,18 +525,21 @@ static void __init palmtc_init(void) | |||
402 | pxa_set_stuart_info(NULL); | 525 | pxa_set_stuart_info(NULL); |
403 | pxa_set_hwuart_info(NULL); | 526 | pxa_set_hwuart_info(NULL); |
404 | 527 | ||
405 | set_pxa_fb_info(&palmtc_lcd_screen); | 528 | palmtc_mmc_init(); |
406 | pxa_set_mci_info(&palmtc_mci_platform_data); | 529 | palmtc_keys_init(); |
407 | pxa_set_udc_info(&palmtc_udc_info); | 530 | palmtc_pwm_init(); |
408 | pxa_set_ac97_info(NULL); | 531 | palmtc_irda_init(); |
409 | pxa_set_ficp_info(&palmtc_ficp_platform_data); | 532 | palmtc_mkp_init(); |
410 | 533 | palmtc_udc_init(); | |
411 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 534 | palmtc_ts_init(); |
535 | palmtc_nor_init(); | ||
536 | palmtc_lcd_init(); | ||
537 | palmtc_leds_init(); | ||
412 | }; | 538 | }; |
413 | 539 | ||
414 | MACHINE_START(PALMTC, "Palm Tungsten|C") | 540 | MACHINE_START(PALMTC, "Palm Tungsten|C") |
415 | .boot_params = 0xa0000100, | 541 | .boot_params = 0xa0000100, |
416 | .map_io = pxa_map_io, | 542 | .map_io = pxa25x_map_io, |
417 | .init_irq = pxa25x_init_irq, | 543 | .init_irq = pxa25x_init_irq, |
418 | .timer = &pxa_timer, | 544 | .timer = &pxa_timer, |
419 | .init_machine = palmtc_init | 545 | .init_machine = palmtc_init |