aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/palmtreo.c
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut@gmail.com>2010-07-13 02:16:45 -0400
committerEric Miao <eric.y.miao@gmail.com>2010-08-05 02:32:40 -0400
commit31620e21afc94a20fb59aff13de9268120b5e416 (patch)
treeeba8957fb89a76b0f69141d7bb714e87b306c3fd /arch/arm/mach-pxa/palmtreo.c
parent95045947ab18e412a81ad1fd002a4804eb269d01 (diff)
[ARM] pxa/palm: Flip Palm LD,TX,T5,Z72 to Palm27x
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa/palmtreo.c')
-rw-r--r--arch/arm/mach-pxa/palmtreo.c353
1 files changed, 55 insertions, 298 deletions
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index 4eb0258675fb..da592dcf5eef 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -44,6 +44,7 @@
44#include <mach/pxa2xx-regs.h> 44#include <mach/pxa2xx-regs.h>
45#include <mach/palmasoc.h> 45#include <mach/palmasoc.h>
46#include <mach/camera.h> 46#include <mach/camera.h>
47#include <mach/palm27x.h>
47 48
48#include <sound/pxa2xx-lib.h> 49#include <sound/pxa2xx-lib.h>
49 50
@@ -158,31 +159,9 @@ static unsigned long centro685_pin_config[] __initdata = {
158#endif /* CONFIG_MACH_CENTRO */ 159#endif /* CONFIG_MACH_CENTRO */
159 160
160/****************************************************************************** 161/******************************************************************************
161 * SD/MMC card controller
162 ******************************************************************************/
163#ifdef CONFIG_MACH_TREO680
164static struct pxamci_platform_data treo680_mci_platform_data = {
165 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
166 .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N,
167 .gpio_card_ro = GPIO_NR_TREO680_SD_READONLY,
168 .gpio_power = GPIO_NR_TREO680_SD_POWER,
169};
170#endif /* CONFIG_MACH_TREO680 */
171
172#ifdef CONFIG_MACH_CENTRO
173static struct pxamci_platform_data centro_mci_platform_data = {
174 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
175 .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N,
176 .gpio_card_ro = -1,
177 .gpio_power = GPIO_NR_CENTRO_SD_POWER,
178 .gpio_power_invert = 1,
179};
180#endif /* CONFIG_MACH_CENTRO */
181
182/******************************************************************************
183 * GPIO keyboard 162 * GPIO keyboard
184 ******************************************************************************/ 163 ******************************************************************************/
185#ifdef CONFIG_MACH_TREO680 164#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
186static unsigned int treo680_matrix_keys[] = { 165static unsigned int treo680_matrix_keys[] = {
187 KEY(0, 0, KEY_F8), /* Red/Off/Power */ 166 KEY(0, 0, KEY_F8), /* Red/Off/Power */
188 KEY(0, 1, KEY_LEFT), 167 KEY(0, 1, KEY_LEFT),
@@ -242,19 +221,6 @@ static unsigned int treo680_matrix_keys[] = {
242 KEY(7, 5, KEY_I), 221 KEY(7, 5, KEY_I),
243}; 222};
244 223
245static struct pxa27x_keypad_platform_data treo680_keypad_platform_data = {
246 .matrix_key_rows = 8,
247 .matrix_key_cols = 7,
248 .matrix_key_map = treo680_matrix_keys,
249 .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
250 .direct_key_map = { KEY_CONNECT },
251 .direct_key_num = 1,
252
253 .debounce_interval = 30,
254};
255#endif /* CONFIG_MACH_TREO680 */
256
257#ifdef CONFIG_MACH_CENTRO
258static unsigned int centro_matrix_keys[] = { 224static unsigned int centro_matrix_keys[] = {
259 KEY(0, 0, KEY_F9), /* Home */ 225 KEY(0, 0, KEY_F9), /* Home */
260 KEY(0, 1, KEY_LEFT), 226 KEY(0, 1, KEY_LEFT),
@@ -314,157 +280,50 @@ static unsigned int centro_matrix_keys[] = {
314 KEY(7, 5, KEY_I), 280 KEY(7, 5, KEY_I),
315}; 281};
316 282
317static struct pxa27x_keypad_platform_data centro_keypad_platform_data = { 283static struct pxa27x_keypad_platform_data treo680_keypad_pdata = {
318 .matrix_key_rows = 8, 284 .matrix_key_rows = 8,
319 .matrix_key_cols = 7, 285 .matrix_key_cols = 7,
320 .matrix_key_map = centro_matrix_keys, 286 .matrix_key_map = treo680_matrix_keys,
321 .matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys), 287 .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys),
322 .direct_key_map = { KEY_CONNECT }, 288 .direct_key_map = { KEY_CONNECT },
323 .direct_key_num = 1, 289 .direct_key_num = 1,
324 290
325 .debounce_interval = 30, 291 .debounce_interval = 30,
326}; 292};
327#endif /* CONFIG_MACH_CENTRO */
328 293
329/****************************************************************************** 294static void __init palmtreo_kpc_init(void)
330 * aSoC audio
331 ******************************************************************************/
332
333static pxa2xx_audio_ops_t treo_ac97_pdata = {
334 .reset_gpio = 95,
335};
336
337/******************************************************************************
338 * Backlight
339 ******************************************************************************/
340static int treo_backlight_init(struct device *dev)
341{ 295{
342 int ret; 296 static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata;
343
344 ret = gpio_request(GPIO_NR_TREO_BL_POWER, "BL POWER");
345 if (ret)
346 goto err;
347 ret = gpio_direction_output(GPIO_NR_TREO_BL_POWER, 0);
348 if (ret)
349 goto err2;
350
351 return 0;
352 297
353err2: 298 if (machine_is_centro()) {
354 gpio_free(GPIO_NR_TREO_BL_POWER); 299 data->matrix_key_map = centro_matrix_keys;
355err: 300 data->matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys);
356 return ret; 301 }
357}
358
359static int treo_backlight_notify(struct device *dev, int brightness)
360{
361 gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness);
362 return TREO_MAX_INTENSITY - brightness;
363};
364 302
365static void treo_backlight_exit(struct device *dev) 303 pxa_set_keypad_info(&treo680_keypad_pdata);
366{
367 gpio_free(GPIO_NR_TREO_BL_POWER);
368} 304}
369 305#else
370static struct platform_pwm_backlight_data treo_backlight_data = { 306static inline void palmtreo_kpc_init(void) {}
371 .pwm_id = 0, 307#endif
372 .max_brightness = TREO_MAX_INTENSITY,
373 .dft_brightness = TREO_DEFAULT_INTENSITY,
374 .pwm_period_ns = TREO_PERIOD_NS,
375 .init = treo_backlight_init,
376 .notify = treo_backlight_notify,
377 .exit = treo_backlight_exit,
378};
379
380static struct platform_device treo_backlight = {
381 .name = "pwm-backlight",
382 .dev = {
383 .parent = &pxa27x_device_pwm0.dev,
384 .platform_data = &treo_backlight_data,
385 },
386};
387
388/******************************************************************************
389 * IrDA
390 ******************************************************************************/
391static struct pxaficp_platform_data treo_ficp_info = {
392 .gpio_pwdown = GPIO_NR_TREO_IR_EN,
393 .transceiver_cap = IR_SIRMODE | IR_OFF,
394};
395
396/******************************************************************************
397 * UDC
398 ******************************************************************************/
399static struct pxa2xx_udc_mach_info treo_udc_info __initdata = {
400 .gpio_vbus = GPIO_NR_TREO_USB_DETECT,
401 .gpio_vbus_inverted = 1,
402 .gpio_pullup = GPIO_NR_TREO_USB_PULLUP,
403};
404
405 308
406/****************************************************************************** 309/******************************************************************************
407 * USB host 310 * USB host
408 ******************************************************************************/ 311 ******************************************************************************/
409#ifdef CONFIG_MACH_TREO680 312#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
410static struct pxaohci_platform_data treo680_ohci_info = { 313static struct pxaohci_platform_data treo680_ohci_info = {
411 .port_mode = PMM_PERPORT_MODE, 314 .port_mode = PMM_PERPORT_MODE,
412 .flags = ENABLE_PORT1 | ENABLE_PORT3, 315 .flags = ENABLE_PORT1 | ENABLE_PORT3,
413 .power_budget = 0, 316 .power_budget = 0,
414}; 317};
415#endif /* CONFIG_MACH_TREO680 */
416 318
417/****************************************************************************** 319static void __init palmtreo_uhc_init(void)
418 * Power supply
419 ******************************************************************************/
420static int power_supply_init(struct device *dev)
421{ 320{
422 int ret; 321 if (machine_is_treo680())
423 322 pxa_set_ohci_info(&treo680_ohci_info);
424 ret = gpio_request(GPIO_NR_TREO_POWER_DETECT, "CABLE_STATE_AC");
425 if (ret)
426 goto err1;
427 ret = gpio_direction_input(GPIO_NR_TREO_POWER_DETECT);
428 if (ret)
429 goto err2;
430
431 return 0;
432
433err2:
434 gpio_free(GPIO_NR_TREO_POWER_DETECT);
435err1:
436 return ret;
437}
438
439static int treo_is_ac_online(void)
440{
441 return gpio_get_value(GPIO_NR_TREO_POWER_DETECT);
442} 323}
443 324#else
444static void power_supply_exit(struct device *dev) 325static inline void palmtreo_uhc_init(void) {}
445{ 326#endif
446 gpio_free(GPIO_NR_TREO_POWER_DETECT);
447}
448
449static char *treo_supplicants[] = {
450 "main-battery",
451};
452
453static struct pda_power_pdata power_supply_info = {
454 .init = power_supply_init,
455 .is_ac_online = treo_is_ac_online,
456 .exit = power_supply_exit,
457 .supplied_to = treo_supplicants,
458 .num_supplicants = ARRAY_SIZE(treo_supplicants),
459};
460
461static struct platform_device power_supply = {
462 .name = "pda-power",
463 .id = -1,
464 .dev = {
465 .platform_data = &power_supply_info,
466 },
467};
468 327
469/****************************************************************************** 328/******************************************************************************
470 * Vibra and LEDs 329 * Vibra and LEDs
@@ -493,16 +352,6 @@ static struct gpio_led_platform_data treo680_gpio_led_info = {
493 .num_leds = ARRAY_SIZE(treo680_gpio_leds), 352 .num_leds = ARRAY_SIZE(treo680_gpio_leds),
494}; 353};
495 354
496static struct platform_device treo680_leds = {
497 .name = "leds-gpio",
498 .id = -1,
499 .dev = {
500 .platform_data = &treo680_gpio_led_info,
501 }
502};
503#endif /* CONFIG_MACH_TREO680 */
504
505#ifdef CONFIG_MACH_CENTRO
506static struct gpio_led centro_gpio_leds[] = { 355static struct gpio_led centro_gpio_leds[] = {
507 { 356 {
508 .name = "centro:vibra:vibra", 357 .name = "centro:vibra:vibra",
@@ -527,139 +376,61 @@ static struct gpio_led_platform_data centro_gpio_led_info = {
527 .num_leds = ARRAY_SIZE(centro_gpio_leds), 376 .num_leds = ARRAY_SIZE(centro_gpio_leds),
528}; 377};
529 378
530static struct platform_device centro_leds = { 379static struct platform_device palmtreo_leds = {
531 .name = "leds-gpio", 380 .name = "leds-gpio",
532 .id = -1, 381 .id = -1,
533 .dev = { 382 .dev = {
534 .platform_data = &centro_gpio_led_info, 383 .platform_data = &treo680_gpio_led_info,
535 } 384 }
536}; 385};
537#endif /* CONFIG_MACH_CENTRO */
538
539/******************************************************************************
540 * Framebuffer
541 ******************************************************************************/
542/* TODO: add support for 324x324 */
543static struct pxafb_mode_info treo_lcd_modes[] = {
544{
545 .pixclock = 86538,
546 .xres = 320,
547 .yres = 320,
548 .bpp = 16,
549
550 .left_margin = 20,
551 .right_margin = 8,
552 .upper_margin = 8,
553 .lower_margin = 5,
554
555 .hsync_len = 4,
556 .vsync_len = 1,
557},
558};
559 386
560static void treo_lcd_power(int on, struct fb_var_screeninfo *info) 387static void __init palmtreo_leds_init(void)
561{ 388{
562 gpio_set_value(GPIO_NR_TREO_BL_POWER, on); 389 if (machine_is_centro())
563} 390 palmtreo_leds.dev.platform_data = &centro_gpio_led_info;
564
565static struct pxafb_mach_info treo_lcd_screen = {
566 .modes = treo_lcd_modes,
567 .num_modes = ARRAY_SIZE(treo_lcd_modes),
568 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
569};
570 391
571/****************************************************************************** 392 platform_device_register(&palmtreo_leds);
572 * Power management - standby
573 ******************************************************************************/
574static void __init treo_pm_init(void)
575{
576 static u32 resume[] = {
577 0xe3a00101, /* mov r0, #0x40000000 */
578 0xe380060f, /* orr r0, r0, #0x00f00000 */
579 0xe590f008, /* ldr pc, [r0, #0x08] */
580 };
581
582 /* this is where the bootloader jumps */
583 memcpy(phys_to_virt(TREO_STR_BASE), resume, sizeof(resume));
584} 393}
394#else
395static inline void palmtreo_leds_init(void) {}
396#endif
585 397
586/****************************************************************************** 398/******************************************************************************
587 * Machine init 399 * Machine init
588 ******************************************************************************/ 400 ******************************************************************************/
589static struct platform_device *treo_devices[] __initdata = { 401static void __init palmphone_common_init(void)
590 &treo_backlight,
591 &power_supply,
592};
593
594#ifdef CONFIG_MACH_TREO680
595static struct platform_device *treo680_devices[] __initdata = {
596 &treo680_leds,
597};
598#endif /* CONFIG_MACH_TREO680 */
599
600#ifdef CONFIG_MACH_CENTRO
601static struct platform_device *centro_devices[] __initdata = {
602 &centro_leds,
603};
604#endif /* CONFIG_MACH_CENTRO */
605
606/* setup udc GPIOs initial state */
607static void __init treo_udc_init(void)
608{
609 if (!gpio_request(GPIO_NR_TREO_USB_PULLUP, "UDC Vbus")) {
610 gpio_direction_output(GPIO_NR_TREO_USB_PULLUP, 1);
611 gpio_free(GPIO_NR_TREO_USB_PULLUP);
612 }
613}
614
615static void __init treo_lcd_power_init(void)
616{
617 int ret;
618
619 ret = gpio_request(GPIO_NR_TREO_LCD_POWER, "LCD POWER");
620 if (ret) {
621 pr_err("Treo680: LCD power GPIO request failed!\n");
622 return;
623 }
624
625 ret = gpio_direction_output(GPIO_NR_TREO_LCD_POWER, 0);
626 if (ret) {
627 pr_err("Treo680: setting LCD power GPIO direction failed!\n");
628 gpio_free(GPIO_NR_TREO_LCD_POWER);
629 return;
630 }
631
632 treo_lcd_screen.pxafb_lcd_power = treo_lcd_power;
633}
634
635static void __init treo_init(void)
636{ 402{
403 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config));
637 pxa_set_ffuart_info(NULL); 404 pxa_set_ffuart_info(NULL);
638 pxa_set_btuart_info(NULL); 405 pxa_set_btuart_info(NULL);
639 pxa_set_stuart_info(NULL); 406 pxa_set_stuart_info(NULL);
640 407 palm27x_pm_init(TREO_STR_BASE);
641 treo_pm_init(); 408 palm27x_lcd_init(GPIO_NR_TREO_BL_POWER, &palm_320x320_new_lcd_mode);
642 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config)); 409 palm27x_udc_init(GPIO_NR_TREO_USB_DETECT, GPIO_NR_TREO_USB_PULLUP, 1);
643 treo_lcd_power_init(); 410 palm27x_irda_init(GPIO_NR_TREO_IR_EN);
644 set_pxa_fb_info(&treo_lcd_screen); 411 palm27x_ac97_init(-1, -1, -1, 95);
645 treo_udc_init(); 412 palm27x_pwm_init(GPIO_NR_TREO_BL_POWER, -1);
646 pxa_set_udc_info(&treo_udc_info); 413 palm27x_power_init(GPIO_NR_TREO_POWER_DETECT, -1);
647 pxa_set_ac97_info(&treo_ac97_pdata); 414 palm27x_pmic_init();
648 pxa_set_ficp_info(&treo_ficp_info); 415 palmtreo_kpc_init();
649 416 palmtreo_uhc_init();
650 platform_add_devices(ARRAY_AND_SIZE(treo_devices)); 417 palmtreo_leds_init();
651} 418}
652 419
653#ifdef CONFIG_MACH_TREO680
654static void __init treo680_init(void) 420static void __init treo680_init(void)
655{ 421{
656 treo_init();
657 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); 422 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
658 pxa_set_mci_info(&treo680_mci_platform_data); 423 palmphone_common_init();
659 pxa_set_keypad_info(&treo680_keypad_platform_data); 424 palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY,
660 pxa_set_ohci_info(&treo680_ohci_info); 425 GPIO_NR_TREO680_SD_POWER, 0);
426}
661 427
662 platform_add_devices(ARRAY_AND_SIZE(treo680_devices)); 428static void __init centro_init(void)
429{
430 pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
431 palmphone_common_init();
432 palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, -1,
433 GPIO_NR_CENTRO_SD_POWER, 1);
663} 434}
664 435
665MACHINE_START(TREO680, "Palm Treo 680") 436MACHINE_START(TREO680, "Palm Treo 680")
@@ -671,19 +442,6 @@ MACHINE_START(TREO680, "Palm Treo 680")
671 .timer = &pxa_timer, 442 .timer = &pxa_timer,
672 .init_machine = treo680_init, 443 .init_machine = treo680_init,
673MACHINE_END 444MACHINE_END
674#endif /* CONFIG_MACH_TREO680 */
675
676#ifdef CONFIG_MACH_CENTRO
677static void __init centro_init(void)
678{
679 treo_init();
680 pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
681 pxa_set_mci_info(&centro_mci_platform_data);
682
683 pxa_set_keypad_info(&centro_keypad_platform_data);
684
685 platform_add_devices(ARRAY_AND_SIZE(centro_devices));
686}
687 445
688MACHINE_START(CENTRO, "Palm Centro 685") 446MACHINE_START(CENTRO, "Palm Centro 685")
689 .phys_io = TREO_PHYS_IO_START, 447 .phys_io = TREO_PHYS_IO_START,
@@ -692,6 +450,5 @@ MACHINE_START(CENTRO, "Palm Centro 685")
692 .map_io = pxa_map_io, 450 .map_io = pxa_map_io,
693 .init_irq = pxa27x_init_irq, 451 .init_irq = pxa27x_init_irq,
694 .timer = &pxa_timer, 452 .timer = &pxa_timer,
695 .init_machine = centro_init, 453 .init_machine = centro_init,
696MACHINE_END 454MACHINE_END
697#endif /* CONFIG_MACH_CENTRO */