diff options
Diffstat (limited to 'arch/arm/mach-pxa/magician.c')
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 101 |
1 files changed, 70 insertions, 31 deletions
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index 21b821e1a60d..d46b36746be2 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -25,14 +25,14 @@ | |||
25 | #include <linux/mtd/physmap.h> | 25 | #include <linux/mtd/physmap.h> |
26 | #include <linux/pda_power.h> | 26 | #include <linux/pda_power.h> |
27 | #include <linux/pwm_backlight.h> | 27 | #include <linux/pwm_backlight.h> |
28 | #include <linux/usb/gpio_vbus.h> | ||
28 | 29 | ||
29 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
30 | #include <asm/mach-types.h> | 31 | #include <asm/mach-types.h> |
31 | #include <asm/mach/arch.h> | 32 | #include <asm/mach/arch.h> |
33 | |||
34 | #include <mach/pxa27x.h> | ||
32 | #include <mach/magician.h> | 35 | #include <mach/magician.h> |
33 | #include <mach/mfp-pxa27x.h> | ||
34 | #include <mach/pxa-regs.h> | ||
35 | #include <mach/pxa2xx-regs.h> | ||
36 | #include <mach/pxafb.h> | 36 | #include <mach/pxafb.h> |
37 | #include <mach/i2c.h> | 37 | #include <mach/i2c.h> |
38 | #include <mach/mmc.h> | 38 | #include <mach/mmc.h> |
@@ -66,6 +66,11 @@ static unsigned long magician_pin_config[] __initdata = { | |||
66 | GPIO31_I2S_SYNC, | 66 | GPIO31_I2S_SYNC, |
67 | GPIO113_I2S_SYSCLK, | 67 | GPIO113_I2S_SYSCLK, |
68 | 68 | ||
69 | /* SSP 1 */ | ||
70 | GPIO23_SSP1_SCLK, | ||
71 | GPIO24_SSP1_SFRM, | ||
72 | GPIO25_SSP1_TXD, | ||
73 | |||
69 | /* SSP 2 */ | 74 | /* SSP 2 */ |
70 | GPIO19_SSP2_SCLK, | 75 | GPIO19_SSP2_SCLK, |
71 | GPIO14_SSP2_SFRM, | 76 | GPIO14_SSP2_SFRM, |
@@ -148,22 +153,31 @@ static struct pxaficp_platform_data magician_ficp_info = { | |||
148 | * GPIO Keys | 153 | * GPIO Keys |
149 | */ | 154 | */ |
150 | 155 | ||
156 | #define INIT_KEY(_code, _gpio, _desc) \ | ||
157 | { \ | ||
158 | .code = KEY_##_code, \ | ||
159 | .gpio = _gpio, \ | ||
160 | .desc = _desc, \ | ||
161 | .type = EV_KEY, \ | ||
162 | .wakeup = 1, \ | ||
163 | } | ||
164 | |||
151 | static struct gpio_keys_button magician_button_table[] = { | 165 | static struct gpio_keys_button magician_button_table[] = { |
152 | {KEY_POWER, GPIO0_MAGICIAN_KEY_POWER, 0, "Power button"}, | 166 | INIT_KEY(POWER, GPIO0_MAGICIAN_KEY_POWER, "Power button"), |
153 | {KEY_ESC, GPIO37_MAGICIAN_KEY_HANGUP, 0, "Hangup button"}, | 167 | INIT_KEY(ESC, GPIO37_MAGICIAN_KEY_HANGUP, "Hangup button"), |
154 | {KEY_F10, GPIO38_MAGICIAN_KEY_CONTACTS, 0, "Contacts button"}, | 168 | INIT_KEY(F10, GPIO38_MAGICIAN_KEY_CONTACTS, "Contacts button"), |
155 | {KEY_CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, 0, "Calendar button"}, | 169 | INIT_KEY(CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, "Calendar button"), |
156 | {KEY_CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, 0, "Camera button"}, | 170 | INIT_KEY(CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, "Camera button"), |
157 | {KEY_UP, GPIO93_MAGICIAN_KEY_UP, 0, "Up button"}, | 171 | INIT_KEY(UP, GPIO93_MAGICIAN_KEY_UP, "Up button"), |
158 | {KEY_DOWN, GPIO94_MAGICIAN_KEY_DOWN, 0, "Down button"}, | 172 | INIT_KEY(DOWN, GPIO94_MAGICIAN_KEY_DOWN, "Down button"), |
159 | {KEY_LEFT, GPIO95_MAGICIAN_KEY_LEFT, 0, "Left button"}, | 173 | INIT_KEY(LEFT, GPIO95_MAGICIAN_KEY_LEFT, "Left button"), |
160 | {KEY_RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, 0, "Right button"}, | 174 | INIT_KEY(RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, "Right button"), |
161 | {KEY_KPENTER, GPIO97_MAGICIAN_KEY_ENTER, 0, "Action button"}, | 175 | INIT_KEY(KPENTER, GPIO97_MAGICIAN_KEY_ENTER, "Action button"), |
162 | {KEY_RECORD, GPIO98_MAGICIAN_KEY_RECORD, 0, "Record button"}, | 176 | INIT_KEY(RECORD, GPIO98_MAGICIAN_KEY_RECORD, "Record button"), |
163 | {KEY_VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, 0, "Volume up"}, | 177 | INIT_KEY(VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, "Volume up"), |
164 | {KEY_VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, 0, "Volume down"}, | 178 | INIT_KEY(VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, "Volume down"), |
165 | {KEY_PHONE, GPIO102_MAGICIAN_KEY_PHONE, 0, "Phone button"}, | 179 | INIT_KEY(PHONE, GPIO102_MAGICIAN_KEY_PHONE, "Phone button"), |
166 | {KEY_PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, 0, "Headset button"}, | 180 | INIT_KEY(PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, "Headset button"), |
167 | }; | 181 | }; |
168 | 182 | ||
169 | static struct gpio_keys_platform_data gpio_keys_data = { | 183 | static struct gpio_keys_platform_data gpio_keys_data = { |
@@ -189,7 +203,7 @@ static struct platform_device gpio_keys = { | |||
189 | static struct resource egpio_resources[] = { | 203 | static struct resource egpio_resources[] = { |
190 | [0] = { | 204 | [0] = { |
191 | .start = PXA_CS3_PHYS, | 205 | .start = PXA_CS3_PHYS, |
192 | .end = PXA_CS3_PHYS + 0x20, | 206 | .end = PXA_CS3_PHYS + 0x20 - 1, |
193 | .flags = IORESOURCE_MEM, | 207 | .flags = IORESOURCE_MEM, |
194 | }, | 208 | }, |
195 | [1] = { | 209 | [1] = { |
@@ -420,7 +434,7 @@ static struct gpio_led gpio_leds[] = { | |||
420 | }, | 434 | }, |
421 | { | 435 | { |
422 | .name = "magician::phone_bl", | 436 | .name = "magician::phone_bl", |
423 | .default_trigger = "none", | 437 | .default_trigger = "backlight", |
424 | .gpio = GPIO103_MAGICIAN_LED_KP, | 438 | .gpio = GPIO103_MAGICIAN_LED_KP, |
425 | }, | 439 | }, |
426 | }; | 440 | }; |
@@ -468,8 +482,6 @@ static struct pasic3_led pasic3_leds[] = { | |||
468 | }, | 482 | }, |
469 | }; | 483 | }; |
470 | 484 | ||
471 | static struct platform_device pasic3; | ||
472 | |||
473 | static struct pasic3_leds_machinfo pasic3_leds_info = { | 485 | static struct pasic3_leds_machinfo pasic3_leds_info = { |
474 | .num_leds = ARRAY_SIZE(pasic3_leds), | 486 | .num_leds = ARRAY_SIZE(pasic3_leds), |
475 | .power_gpio = EGPIO_MAGICIAN_LED_POWER, | 487 | .power_gpio = EGPIO_MAGICIAN_LED_POWER, |
@@ -511,6 +523,31 @@ static struct platform_device pasic3 = { | |||
511 | }; | 523 | }; |
512 | 524 | ||
513 | /* | 525 | /* |
526 | * USB "Transceiver" | ||
527 | */ | ||
528 | |||
529 | static struct resource gpio_vbus_resource = { | ||
530 | .flags = IORESOURCE_IRQ, | ||
531 | .start = IRQ_MAGICIAN_VBUS, | ||
532 | .end = IRQ_MAGICIAN_VBUS, | ||
533 | }; | ||
534 | |||
535 | static struct gpio_vbus_mach_info gpio_vbus_info = { | ||
536 | .gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN, | ||
537 | .gpio_vbus = EGPIO_MAGICIAN_CABLE_STATE_USB, | ||
538 | }; | ||
539 | |||
540 | static struct platform_device gpio_vbus = { | ||
541 | .name = "gpio-vbus", | ||
542 | .id = -1, | ||
543 | .num_resources = 1, | ||
544 | .resource = &gpio_vbus_resource, | ||
545 | .dev = { | ||
546 | .platform_data = &gpio_vbus_info, | ||
547 | }, | ||
548 | }; | ||
549 | |||
550 | /* | ||
514 | * External power | 551 | * External power |
515 | */ | 552 | */ |
516 | 553 | ||
@@ -586,15 +623,17 @@ static struct pda_power_pdata power_supply_info = { | |||
586 | static struct resource power_supply_resources[] = { | 623 | static struct resource power_supply_resources[] = { |
587 | [0] = { | 624 | [0] = { |
588 | .name = "ac", | 625 | .name = "ac", |
589 | .flags = IORESOURCE_IRQ, | 626 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | |
590 | .start = IRQ_MAGICIAN_AC, | 627 | IORESOURCE_IRQ_LOWEDGE, |
591 | .end = IRQ_MAGICIAN_AC, | 628 | .start = IRQ_MAGICIAN_VBUS, |
629 | .end = IRQ_MAGICIAN_VBUS, | ||
592 | }, | 630 | }, |
593 | [1] = { | 631 | [1] = { |
594 | .name = "usb", | 632 | .name = "usb", |
595 | .flags = IORESOURCE_IRQ, | 633 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | |
596 | .start = IRQ_MAGICIAN_AC, | 634 | IORESOURCE_IRQ_LOWEDGE, |
597 | .end = IRQ_MAGICIAN_AC, | 635 | .start = IRQ_MAGICIAN_VBUS, |
636 | .end = IRQ_MAGICIAN_VBUS, | ||
598 | }, | 637 | }, |
599 | }; | 638 | }; |
600 | 639 | ||
@@ -688,11 +727,9 @@ static void magician_set_vpp(struct map_info *map, int vpp) | |||
688 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); | 727 | gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp); |
689 | } | 728 | } |
690 | 729 | ||
691 | #define PXA_CS_SIZE 0x04000000 | ||
692 | |||
693 | static struct resource strataflash_resource = { | 730 | static struct resource strataflash_resource = { |
694 | .start = PXA_CS0_PHYS, | 731 | .start = PXA_CS0_PHYS, |
695 | .end = PXA_CS0_PHYS + PXA_CS_SIZE - 1, | 732 | .end = PXA_CS0_PHYS + SZ_64M - 1, |
696 | .flags = IORESOURCE_MEM, | 733 | .flags = IORESOURCE_MEM, |
697 | }; | 734 | }; |
698 | 735 | ||
@@ -720,6 +757,7 @@ static struct platform_device *devices[] __initdata = { | |||
720 | &egpio, | 757 | &egpio, |
721 | &backlight, | 758 | &backlight, |
722 | &pasic3, | 759 | &pasic3, |
760 | &gpio_vbus, | ||
723 | &power_supply, | 761 | &power_supply, |
724 | &strataflash, | 762 | &strataflash, |
725 | &leds_gpio, | 763 | &leds_gpio, |
@@ -743,6 +781,7 @@ static void __init magician_init(void) | |||
743 | gpio_direction_output(GPIO83_MAGICIAN_nIR_EN, 1); | 781 | gpio_direction_output(GPIO83_MAGICIAN_nIR_EN, 1); |
744 | pxa_set_ficp_info(&magician_ficp_info); | 782 | pxa_set_ficp_info(&magician_ficp_info); |
745 | } | 783 | } |
784 | pxa27x_set_i2c_power_info(NULL); | ||
746 | pxa_set_i2c_info(NULL); | 785 | pxa_set_i2c_info(NULL); |
747 | pxa_set_mci_info(&magician_mci_info); | 786 | pxa_set_mci_info(&magician_mci_info); |
748 | pxa_set_ohci_info(&magician_ohci_info); | 787 | pxa_set_ohci_info(&magician_ohci_info); |