diff options
Diffstat (limited to 'arch/arm/mach-pxa/mainstone.c')
-rw-r--r-- | arch/arm/mach-pxa/mainstone.c | 219 |
1 files changed, 163 insertions, 56 deletions
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 72a436fb9a29..18d47cfa2a18 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include <linux/mtd/mtd.h> | 24 | #include <linux/mtd/mtd.h> |
25 | #include <linux/mtd/partitions.h> | 25 | #include <linux/mtd/partitions.h> |
26 | #include <linux/backlight.h> | 26 | #include <linux/backlight.h> |
27 | #include <linux/input.h> | ||
28 | #include <linux/gpio_keys.h> | ||
27 | 29 | ||
28 | #include <asm/types.h> | 30 | #include <asm/types.h> |
29 | #include <asm/setup.h> | 31 | #include <asm/setup.h> |
@@ -40,16 +42,94 @@ | |||
40 | 42 | ||
41 | #include <asm/arch/pxa-regs.h> | 43 | #include <asm/arch/pxa-regs.h> |
42 | #include <asm/arch/pxa2xx-regs.h> | 44 | #include <asm/arch/pxa2xx-regs.h> |
45 | #include <asm/arch/mfp-pxa27x.h> | ||
43 | #include <asm/arch/mainstone.h> | 46 | #include <asm/arch/mainstone.h> |
44 | #include <asm/arch/audio.h> | 47 | #include <asm/arch/audio.h> |
45 | #include <asm/arch/pxafb.h> | 48 | #include <asm/arch/pxafb.h> |
49 | #include <asm/arch/i2c.h> | ||
46 | #include <asm/arch/mmc.h> | 50 | #include <asm/arch/mmc.h> |
47 | #include <asm/arch/irda.h> | 51 | #include <asm/arch/irda.h> |
48 | #include <asm/arch/ohci.h> | 52 | #include <asm/arch/ohci.h> |
53 | #include <asm/arch/pxa27x_keypad.h> | ||
49 | 54 | ||
50 | #include "generic.h" | 55 | #include "generic.h" |
51 | #include "devices.h" | 56 | #include "devices.h" |
52 | 57 | ||
58 | static unsigned long mainstone_pin_config[] = { | ||
59 | /* Chip Select */ | ||
60 | GPIO15_nCS_1, | ||
61 | |||
62 | /* LCD - 16bpp Active TFT */ | ||
63 | GPIO58_LCD_LDD_0, | ||
64 | GPIO59_LCD_LDD_1, | ||
65 | GPIO60_LCD_LDD_2, | ||
66 | GPIO61_LCD_LDD_3, | ||
67 | GPIO62_LCD_LDD_4, | ||
68 | GPIO63_LCD_LDD_5, | ||
69 | GPIO64_LCD_LDD_6, | ||
70 | GPIO65_LCD_LDD_7, | ||
71 | GPIO66_LCD_LDD_8, | ||
72 | GPIO67_LCD_LDD_9, | ||
73 | GPIO68_LCD_LDD_10, | ||
74 | GPIO69_LCD_LDD_11, | ||
75 | GPIO70_LCD_LDD_12, | ||
76 | GPIO71_LCD_LDD_13, | ||
77 | GPIO72_LCD_LDD_14, | ||
78 | GPIO73_LCD_LDD_15, | ||
79 | GPIO74_LCD_FCLK, | ||
80 | GPIO75_LCD_LCLK, | ||
81 | GPIO76_LCD_PCLK, | ||
82 | GPIO77_LCD_BIAS, | ||
83 | GPIO16_PWM0_OUT, /* Backlight */ | ||
84 | |||
85 | /* MMC */ | ||
86 | GPIO32_MMC_CLK, | ||
87 | GPIO112_MMC_CMD, | ||
88 | GPIO92_MMC_DAT_0, | ||
89 | GPIO109_MMC_DAT_1, | ||
90 | GPIO110_MMC_DAT_2, | ||
91 | GPIO111_MMC_DAT_3, | ||
92 | |||
93 | /* USB Host Port 1 */ | ||
94 | GPIO88_USBH1_PWR, | ||
95 | GPIO89_USBH1_PEN, | ||
96 | |||
97 | /* PC Card */ | ||
98 | GPIO48_nPOE, | ||
99 | GPIO49_nPWE, | ||
100 | GPIO50_nPIOR, | ||
101 | GPIO51_nPIOW, | ||
102 | GPIO85_nPCE_1, | ||
103 | GPIO54_nPCE_2, | ||
104 | GPIO79_PSKTSEL, | ||
105 | GPIO55_nPREG, | ||
106 | GPIO56_nPWAIT, | ||
107 | GPIO57_nIOIS16, | ||
108 | |||
109 | /* AC97 */ | ||
110 | GPIO45_AC97_SYSCLK, | ||
111 | |||
112 | /* Keypad */ | ||
113 | GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, | ||
114 | GPIO94_KP_DKIN_1 | WAKEUP_ON_LEVEL_HIGH, | ||
115 | GPIO95_KP_DKIN_2 | WAKEUP_ON_LEVEL_HIGH, | ||
116 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | ||
117 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, | ||
118 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, | ||
119 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, | ||
120 | GPIO98_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, | ||
121 | GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, | ||
122 | GPIO103_KP_MKOUT_0, | ||
123 | GPIO104_KP_MKOUT_1, | ||
124 | GPIO105_KP_MKOUT_2, | ||
125 | GPIO106_KP_MKOUT_3, | ||
126 | GPIO107_KP_MKOUT_4, | ||
127 | GPIO108_KP_MKOUT_5, | ||
128 | GPIO96_KP_MKOUT_6, | ||
129 | |||
130 | /* GPIO */ | ||
131 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, | ||
132 | }; | ||
53 | 133 | ||
54 | static unsigned long mainstone_irq_enabled; | 134 | static unsigned long mainstone_irq_enabled; |
55 | 135 | ||
@@ -278,13 +358,13 @@ static int mainstone_backlight_update_status(struct backlight_device *bl) | |||
278 | bl->props.fb_blank != FB_BLANK_UNBLANK) | 358 | bl->props.fb_blank != FB_BLANK_UNBLANK) |
279 | brightness = 0; | 359 | brightness = 0; |
280 | 360 | ||
281 | if (brightness != 0) { | 361 | if (brightness != 0) |
282 | pxa_gpio_mode(GPIO16_PWM0_MD); | ||
283 | pxa_set_cken(CKEN_PWM0, 1); | 362 | pxa_set_cken(CKEN_PWM0, 1); |
284 | } | 363 | |
285 | PWM_CTRL0 = 0; | 364 | PWM_CTRL0 = 0; |
286 | PWM_PWDUTY0 = brightness; | 365 | PWM_PWDUTY0 = brightness; |
287 | PWM_PERVAL0 = bl->props.max_brightness; | 366 | PWM_PERVAL0 = bl->props.max_brightness; |
367 | |||
288 | if (brightness == 0) | 368 | if (brightness == 0) |
289 | pxa_set_cken(CKEN_PWM0, 0); | 369 | pxa_set_cken(CKEN_PWM0, 0); |
290 | return 0; /* pointless return value */ | 370 | return 0; /* pointless return value */ |
@@ -362,16 +442,6 @@ static int mainstone_mci_init(struct device *dev, irq_handler_t mstone_detect_in | |||
362 | { | 442 | { |
363 | int err; | 443 | int err; |
364 | 444 | ||
365 | /* | ||
366 | * setup GPIO for PXA27x MMC controller | ||
367 | */ | ||
368 | pxa_gpio_mode(GPIO32_MMCCLK_MD); | ||
369 | pxa_gpio_mode(GPIO112_MMCCMD_MD); | ||
370 | pxa_gpio_mode(GPIO92_MMCDAT0_MD); | ||
371 | pxa_gpio_mode(GPIO109_MMCDAT1_MD); | ||
372 | pxa_gpio_mode(GPIO110_MMCDAT2_MD); | ||
373 | pxa_gpio_mode(GPIO111_MMCDAT3_MD); | ||
374 | |||
375 | /* make sure SD/Memory Stick multiplexer's signals | 445 | /* make sure SD/Memory Stick multiplexer's signals |
376 | * are routed to MMC controller | 446 | * are routed to MMC controller |
377 | */ | 447 | */ |
@@ -434,19 +504,39 @@ static struct pxaficp_platform_data mainstone_ficp_platform_data = { | |||
434 | .transceiver_mode = mainstone_irda_transceiver_mode, | 504 | .transceiver_mode = mainstone_irda_transceiver_mode, |
435 | }; | 505 | }; |
436 | 506 | ||
507 | static struct gpio_keys_button gpio_keys_button[] = { | ||
508 | [0] = { | ||
509 | .desc = "wakeup", | ||
510 | .code = KEY_SUSPEND, | ||
511 | .type = EV_KEY, | ||
512 | .gpio = 1, | ||
513 | .wakeup = 1, | ||
514 | }, | ||
515 | }; | ||
516 | |||
517 | static struct gpio_keys_platform_data mainstone_gpio_keys = { | ||
518 | .buttons = gpio_keys_button, | ||
519 | .nbuttons = 1, | ||
520 | }; | ||
521 | |||
522 | static struct platform_device mst_gpio_keys_device = { | ||
523 | .name = "gpio-keys", | ||
524 | .id = -1, | ||
525 | .dev = { | ||
526 | .platform_data = &mainstone_gpio_keys, | ||
527 | }, | ||
528 | }; | ||
529 | |||
437 | static struct platform_device *platform_devices[] __initdata = { | 530 | static struct platform_device *platform_devices[] __initdata = { |
438 | &smc91x_device, | 531 | &smc91x_device, |
439 | &mst_audio_device, | 532 | &mst_audio_device, |
440 | &mst_flash_device[0], | 533 | &mst_flash_device[0], |
441 | &mst_flash_device[1], | 534 | &mst_flash_device[1], |
535 | &mst_gpio_keys_device, | ||
442 | }; | 536 | }; |
443 | 537 | ||
444 | static int mainstone_ohci_init(struct device *dev) | 538 | static int mainstone_ohci_init(struct device *dev) |
445 | { | 539 | { |
446 | /* setup Port1 GPIO pin. */ | ||
447 | pxa_gpio_mode( 88 | GPIO_ALT_FN_1_IN); /* USBHPWR1 */ | ||
448 | pxa_gpio_mode( 89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */ | ||
449 | |||
450 | /* Set the Power Control Polarity Low and Power Sense | 540 | /* Set the Power Control Polarity Low and Power Sense |
451 | Polarity Low to active low. */ | 541 | Polarity Low to active low. */ |
452 | UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) & | 542 | UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) & |
@@ -460,10 +550,63 @@ static struct pxaohci_platform_data mainstone_ohci_platform_data = { | |||
460 | .init = mainstone_ohci_init, | 550 | .init = mainstone_ohci_init, |
461 | }; | 551 | }; |
462 | 552 | ||
553 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES) | ||
554 | static unsigned int mainstone_matrix_keys[] = { | ||
555 | KEY(0, 0, KEY_A), KEY(1, 0, KEY_B), KEY(2, 0, KEY_C), | ||
556 | KEY(3, 0, KEY_D), KEY(4, 0, KEY_E), KEY(5, 0, KEY_F), | ||
557 | KEY(0, 1, KEY_G), KEY(1, 1, KEY_H), KEY(2, 1, KEY_I), | ||
558 | KEY(3, 1, KEY_J), KEY(4, 1, KEY_K), KEY(5, 1, KEY_L), | ||
559 | KEY(0, 2, KEY_M), KEY(1, 2, KEY_N), KEY(2, 2, KEY_O), | ||
560 | KEY(3, 2, KEY_P), KEY(4, 2, KEY_Q), KEY(5, 2, KEY_R), | ||
561 | KEY(0, 3, KEY_S), KEY(1, 3, KEY_T), KEY(2, 3, KEY_U), | ||
562 | KEY(3, 3, KEY_V), KEY(4, 3, KEY_W), KEY(5, 3, KEY_X), | ||
563 | KEY(2, 4, KEY_Y), KEY(3, 4, KEY_Z), | ||
564 | |||
565 | KEY(0, 4, KEY_DOT), /* . */ | ||
566 | KEY(1, 4, KEY_CLOSE), /* @ */ | ||
567 | KEY(4, 4, KEY_SLASH), | ||
568 | KEY(5, 4, KEY_BACKSLASH), | ||
569 | KEY(0, 5, KEY_HOME), | ||
570 | KEY(1, 5, KEY_LEFTSHIFT), | ||
571 | KEY(2, 5, KEY_SPACE), | ||
572 | KEY(3, 5, KEY_SPACE), | ||
573 | KEY(4, 5, KEY_ENTER), | ||
574 | KEY(5, 5, KEY_BACKSPACE), | ||
575 | |||
576 | KEY(0, 6, KEY_UP), | ||
577 | KEY(1, 6, KEY_DOWN), | ||
578 | KEY(2, 6, KEY_LEFT), | ||
579 | KEY(3, 6, KEY_RIGHT), | ||
580 | KEY(4, 6, KEY_SELECT), | ||
581 | }; | ||
582 | |||
583 | struct pxa27x_keypad_platform_data mainstone_keypad_info = { | ||
584 | .matrix_key_rows = 6, | ||
585 | .matrix_key_cols = 7, | ||
586 | .matrix_key_map = mainstone_matrix_keys, | ||
587 | .matrix_key_map_size = ARRAY_SIZE(mainstone_matrix_keys), | ||
588 | |||
589 | .enable_rotary0 = 1, | ||
590 | .rotary0_up_key = KEY_UP, | ||
591 | .rotary0_down_key = KEY_DOWN, | ||
592 | |||
593 | .debounce_interval = 30, | ||
594 | }; | ||
595 | |||
596 | static void __init mainstone_init_keypad(void) | ||
597 | { | ||
598 | pxa_set_keypad_info(&mainstone_keypad_info); | ||
599 | } | ||
600 | #else | ||
601 | static inline void mainstone_init_keypad(void) {} | ||
602 | #endif | ||
603 | |||
463 | static void __init mainstone_init(void) | 604 | static void __init mainstone_init(void) |
464 | { | 605 | { |
465 | int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */ | 606 | int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */ |
466 | 607 | ||
608 | pxa2xx_mfp_config(ARRAY_AND_SIZE(mainstone_pin_config)); | ||
609 | |||
467 | mst_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4; | 610 | mst_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4; |
468 | mst_flash_data[1].width = 4; | 611 | mst_flash_data[1].width = 4; |
469 | 612 | ||
@@ -480,31 +623,6 @@ static void __init mainstone_init(void) | |||
480 | */ | 623 | */ |
481 | ARB_CNTRL = ARB_CORE_PARK | 0x234; | 624 | ARB_CNTRL = ARB_CORE_PARK | 0x234; |
482 | 625 | ||
483 | /* | ||
484 | * On Mainstone, we route AC97_SYSCLK via GPIO45 to | ||
485 | * the audio daughter card | ||
486 | */ | ||
487 | pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD); | ||
488 | |||
489 | GPSR(GPIO48_nPOE) = | ||
490 | GPIO_bit(GPIO48_nPOE) | | ||
491 | GPIO_bit(GPIO49_nPWE) | | ||
492 | GPIO_bit(GPIO50_nPIOR) | | ||
493 | GPIO_bit(GPIO51_nPIOW) | | ||
494 | GPIO_bit(GPIO85_nPCE_1) | | ||
495 | GPIO_bit(GPIO54_nPCE_2); | ||
496 | |||
497 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
498 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
499 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
500 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
501 | pxa_gpio_mode(GPIO85_nPCE_1_MD); | ||
502 | pxa_gpio_mode(GPIO54_nPCE_2_MD); | ||
503 | pxa_gpio_mode(GPIO79_pSKTSEL_MD); | ||
504 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
505 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
506 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
507 | |||
508 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 626 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
509 | 627 | ||
510 | /* reading Mainstone's "Virtual Configuration Register" | 628 | /* reading Mainstone's "Virtual Configuration Register" |
@@ -520,6 +638,9 @@ static void __init mainstone_init(void) | |||
520 | pxa_set_mci_info(&mainstone_mci_platform_data); | 638 | pxa_set_mci_info(&mainstone_mci_platform_data); |
521 | pxa_set_ficp_info(&mainstone_ficp_platform_data); | 639 | pxa_set_ficp_info(&mainstone_ficp_platform_data); |
522 | pxa_set_ohci_info(&mainstone_ohci_platform_data); | 640 | pxa_set_ohci_info(&mainstone_ohci_platform_data); |
641 | pxa_set_i2c_info(NULL); | ||
642 | |||
643 | mainstone_init_keypad(); | ||
523 | } | 644 | } |
524 | 645 | ||
525 | 646 | ||
@@ -537,23 +658,9 @@ static void __init mainstone_map_io(void) | |||
537 | pxa_map_io(); | 658 | pxa_map_io(); |
538 | iotable_init(mainstone_io_desc, ARRAY_SIZE(mainstone_io_desc)); | 659 | iotable_init(mainstone_io_desc, ARRAY_SIZE(mainstone_io_desc)); |
539 | 660 | ||
540 | /* initialize sleep mode regs (wake-up sources, etc) */ | ||
541 | PGSR0 = 0x00008800; | ||
542 | PGSR1 = 0x00000002; | ||
543 | PGSR2 = 0x0001FC00; | ||
544 | PGSR3 = 0x00001F81; | ||
545 | PWER = 0xC0000002; | ||
546 | PRER = 0x00000002; | ||
547 | PFER = 0x00000002; | ||
548 | /* for use I SRAM as framebuffer. */ | 661 | /* for use I SRAM as framebuffer. */ |
549 | PSLR |= 0xF04; | 662 | PSLR |= 0xF04; |
550 | PCFR = 0x66; | 663 | PCFR = 0x66; |
551 | /* For Keypad wakeup. */ | ||
552 | KPC &=~KPC_ASACT; | ||
553 | KPC |=KPC_AS; | ||
554 | PKWR = 0x000FD000; | ||
555 | /* Need read PKWR back after set it. */ | ||
556 | PKWR; | ||
557 | } | 664 | } |
558 | 665 | ||
559 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") | 666 | MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") |