diff options
author | Eric Miao <eric.y.miao@gmail.com> | 2010-01-11 08:27:21 -0500 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-05-11 11:25:00 -0400 |
commit | cb432b358dced89bd2af86b3f783a0a99e489421 (patch) | |
tree | 26845531b1b17133e6dd170127a64253287233f5 /arch | |
parent | e63f591a8ce5d3b5214a14d6cebaad7b6c1c4b4c (diff) |
[ARM] pxa/corgi: cleanup GPIO configurations and low power mode settings
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-pxa/corgi.c | 52 | ||||
-rw-r--r-- | arch/arm/mach-pxa/corgi_pm.c | 39 |
2 files changed, 32 insertions, 59 deletions
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index 788343d0ffe1..f8e295900c58 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -106,18 +106,18 @@ static unsigned long corgi_pin_config[] __initdata = { | |||
106 | GPIO8_MMC_CS0, | 106 | GPIO8_MMC_CS0, |
107 | 107 | ||
108 | /* GPIO Matrix Keypad */ | 108 | /* GPIO Matrix Keypad */ |
109 | GPIO66_GPIO, /* column 0 */ | 109 | GPIO66_GPIO | MFP_LPM_DRIVE_HIGH, /* column 0 */ |
110 | GPIO67_GPIO, /* column 1 */ | 110 | GPIO67_GPIO | MFP_LPM_DRIVE_HIGH, /* column 1 */ |
111 | GPIO68_GPIO, /* column 2 */ | 111 | GPIO68_GPIO | MFP_LPM_DRIVE_HIGH, /* column 2 */ |
112 | GPIO69_GPIO, /* column 3 */ | 112 | GPIO69_GPIO | MFP_LPM_DRIVE_HIGH, /* column 3 */ |
113 | GPIO70_GPIO, /* column 4 */ | 113 | GPIO70_GPIO | MFP_LPM_DRIVE_HIGH, /* column 4 */ |
114 | GPIO71_GPIO, /* column 5 */ | 114 | GPIO71_GPIO | MFP_LPM_DRIVE_HIGH, /* column 5 */ |
115 | GPIO72_GPIO, /* column 6 */ | 115 | GPIO72_GPIO | MFP_LPM_DRIVE_HIGH, /* column 6 */ |
116 | GPIO73_GPIO, /* column 7 */ | 116 | GPIO73_GPIO | MFP_LPM_DRIVE_HIGH, /* column 7 */ |
117 | GPIO74_GPIO, /* column 8 */ | 117 | GPIO74_GPIO | MFP_LPM_DRIVE_HIGH, /* column 8 */ |
118 | GPIO75_GPIO, /* column 9 */ | 118 | GPIO75_GPIO | MFP_LPM_DRIVE_HIGH, /* column 9 */ |
119 | GPIO76_GPIO, /* column 10 */ | 119 | GPIO76_GPIO | MFP_LPM_DRIVE_HIGH, /* column 10 */ |
120 | GPIO77_GPIO, /* column 11 */ | 120 | GPIO77_GPIO | MFP_LPM_DRIVE_HIGH, /* column 11 */ |
121 | GPIO58_GPIO, /* row 0 */ | 121 | GPIO58_GPIO, /* row 0 */ |
122 | GPIO59_GPIO, /* row 1 */ | 122 | GPIO59_GPIO, /* row 1 */ |
123 | GPIO60_GPIO, /* row 2 */ | 123 | GPIO60_GPIO, /* row 2 */ |
@@ -128,17 +128,20 @@ static unsigned long corgi_pin_config[] __initdata = { | |||
128 | GPIO65_GPIO, /* row 7 */ | 128 | GPIO65_GPIO, /* row 7 */ |
129 | 129 | ||
130 | /* GPIO */ | 130 | /* GPIO */ |
131 | GPIO9_GPIO, /* CORGI_GPIO_nSD_DETECT */ | 131 | GPIO9_GPIO, /* CORGI_GPIO_nSD_DETECT */ |
132 | GPIO7_GPIO, /* CORGI_GPIO_nSD_WP */ | 132 | GPIO7_GPIO, /* CORGI_GPIO_nSD_WP */ |
133 | GPIO21_GPIO, /* CORGI_GPIO_ADC_TEMP */ | 133 | GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* CORGI_GPIO_MAIN_BAT_{LOW,COVER} */ |
134 | GPIO22_GPIO, /* CORGI_GPIO_IR_ON */ | 134 | GPIO13_GPIO | MFP_LPM_KEEP_OUTPUT, /* CORGI_GPIO_LED_ORANGE */ |
135 | GPIO33_GPIO, /* CORGI_GPIO_SD_PWR */ | 135 | GPIO21_GPIO, /* CORGI_GPIO_ADC_TEMP */ |
136 | GPIO38_GPIO, /* CORGI_GPIO_CHRG_ON */ | 136 | GPIO22_GPIO, /* CORGI_GPIO_IR_ON */ |
137 | GPIO43_GPIO, /* CORGI_GPIO_CHRG_UKN */ | 137 | GPIO33_GPIO, /* CORGI_GPIO_SD_PWR */ |
138 | GPIO44_GPIO, /* CORGI_GPIO_HSYNC */ | 138 | GPIO38_GPIO | MFP_LPM_KEEP_OUTPUT, /* CORGI_GPIO_CHRG_ON */ |
139 | GPIO43_GPIO | MFP_LPM_KEEP_OUTPUT, /* CORGI_GPIO_CHRG_UKN */ | ||
140 | GPIO44_GPIO, /* CORGI_GPIO_HSYNC */ | ||
139 | 141 | ||
140 | GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* CORGI_GPIO_KEY_INT */ | 142 | GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* CORGI_GPIO_KEY_INT */ |
141 | GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* CORGI_GPIO_AC_IN */ | 143 | GPIO1_GPIO | WAKEUP_ON_EDGE_RISE, /* CORGI_GPIO_AC_IN */ |
144 | GPIO3_GPIO | WAKEUP_ON_EDGE_BOTH, /* CORGI_GPIO_WAKEUP */ | ||
142 | }; | 145 | }; |
143 | 146 | ||
144 | /* | 147 | /* |
@@ -676,6 +679,15 @@ static void __init corgi_init(void) | |||
676 | 679 | ||
677 | pxa2xx_mfp_config(ARRAY_AND_SIZE(corgi_pin_config)); | 680 | pxa2xx_mfp_config(ARRAY_AND_SIZE(corgi_pin_config)); |
678 | 681 | ||
682 | /* allow wakeup from various GPIOs */ | ||
683 | gpio_set_wake(CORGI_GPIO_KEY_INT, 1); | ||
684 | gpio_set_wake(CORGI_GPIO_WAKEUP, 1); | ||
685 | gpio_set_wake(CORGI_GPIO_AC_IN, 1); | ||
686 | gpio_set_wake(CORGI_GPIO_CHRG_FULL, 1); | ||
687 | |||
688 | if (!machine_is_corgi()) | ||
689 | gpio_set_wake(CORGI_GPIO_MAIN_BAT_LOW, 1); | ||
690 | |||
679 | pxa_set_ffuart_info(NULL); | 691 | pxa_set_ffuart_info(NULL); |
680 | pxa_set_btuart_info(NULL); | 692 | pxa_set_btuart_info(NULL); |
681 | pxa_set_stuart_info(NULL); | 693 | pxa_set_stuart_info(NULL); |
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c index bb68347d9d70..3f1dc74ac048 100644 --- a/arch/arm/mach-pxa/corgi_pm.c +++ b/arch/arm/mach-pxa/corgi_pm.c | |||
@@ -77,45 +77,6 @@ static void corgi_discharge(int on) | |||
77 | 77 | ||
78 | static void corgi_presuspend(void) | 78 | static void corgi_presuspend(void) |
79 | { | 79 | { |
80 | int i; | ||
81 | unsigned long wakeup_mask; | ||
82 | |||
83 | /* charging , so CHARGE_ON bit is HIGH during OFF. */ | ||
84 | if (READ_GPIO_BIT(CORGI_GPIO_CHRG_ON)) | ||
85 | PGSR1 |= GPIO_bit(CORGI_GPIO_CHRG_ON); | ||
86 | else | ||
87 | PGSR1 &= ~GPIO_bit(CORGI_GPIO_CHRG_ON); | ||
88 | |||
89 | if (READ_GPIO_BIT(CORGI_GPIO_LED_ORANGE)) | ||
90 | PGSR0 |= GPIO_bit(CORGI_GPIO_LED_ORANGE); | ||
91 | else | ||
92 | PGSR0 &= ~GPIO_bit(CORGI_GPIO_LED_ORANGE); | ||
93 | |||
94 | if (READ_GPIO_BIT(CORGI_GPIO_CHRG_UKN)) | ||
95 | PGSR1 |= GPIO_bit(CORGI_GPIO_CHRG_UKN); | ||
96 | else | ||
97 | PGSR1 &= ~GPIO_bit(CORGI_GPIO_CHRG_UKN); | ||
98 | |||
99 | /* Resume on keyboard power key */ | ||
100 | PGSR2 = (PGSR2 & ~CORGI_GPIO_ALL_STROBE_BIT) | CORGI_GPIO_STROBE_BIT(0); | ||
101 | |||
102 | wakeup_mask = GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) | GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_CHRG_FULL); | ||
103 | |||
104 | if (!machine_is_corgi()) | ||
105 | wakeup_mask |= GPIO_bit(CORGI_GPIO_MAIN_BAT_LOW); | ||
106 | |||
107 | PWER = wakeup_mask | PWER_RTC; | ||
108 | PRER = wakeup_mask; | ||
109 | PFER = wakeup_mask; | ||
110 | |||
111 | for (i = 0; i <=15; i++) { | ||
112 | if (PRER & PFER & GPIO_bit(i)) { | ||
113 | if (GPLR0 & GPIO_bit(i) ) | ||
114 | PRER &= ~GPIO_bit(i); | ||
115 | else | ||
116 | PFER &= ~GPIO_bit(i); | ||
117 | } | ||
118 | } | ||
119 | } | 80 | } |
120 | 81 | ||
121 | static void corgi_postsuspend(void) | 82 | static void corgi_postsuspend(void) |