aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/mfp-pxa2xx.c
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2008-11-26 04:06:42 -0500
committerEric Miao <eric.miao@marvell.com>2008-12-02 01:42:36 -0500
commitddd244dd814ee3e5ef1e4872705cbec0dfced541 (patch)
tree6966184be36d2ba68fc6254182c9dc6574f16b4b /arch/arm/mach-pxa/mfp-pxa2xx.c
parent9968711468570c5dc5f96c415e73cb3282e857fc (diff)
[ARM] pxa: use 'pxa_last_gpio' instead of 'gpio_nr' in mfp-pxa2xx.c
The 'gpio_nr' can really be inferred by 'pxa_last_gpio', and since we already have that variable, remove the unnecessary 'gpio_nr' now. Also, fix the incorrect GPIO number passed in pxa27x_init_irq(). Note: pxa_last_gpio should be initialized earlier, and this is true since it's been assigned in machine_desc->init_irq(). Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'arch/arm/mach-pxa/mfp-pxa2xx.c')
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index 28d10679e225..1f2298759077 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -44,7 +44,6 @@ struct gpio_desc {
44}; 44};
45 45
46static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1]; 46static struct gpio_desc gpio_desc[MFP_PIN_GPIO127 + 1];
47static int gpio_nr;
48 47
49static unsigned long gpdr_lpm[4]; 48static unsigned long gpdr_lpm[4];
50 49
@@ -215,15 +214,13 @@ static void __init pxa25x_mfp_init(void)
215{ 214{
216 int i; 215 int i;
217 216
218 for (i = 0; i <= 84; i++) 217 for (i = 0; i <= pxa_last_gpio; i++)
219 gpio_desc[i].valid = 1; 218 gpio_desc[i].valid = 1;
220 219
221 for (i = 0; i <= 15; i++) { 220 for (i = 0; i <= 15; i++) {
222 gpio_desc[i].can_wakeup = 1; 221 gpio_desc[i].can_wakeup = 1;
223 gpio_desc[i].mask = GPIO_bit(i); 222 gpio_desc[i].mask = GPIO_bit(i);
224 } 223 }
225
226 gpio_nr = 85;
227} 224}
228#else 225#else
229static inline void pxa25x_mfp_init(void) {} 226static inline void pxa25x_mfp_init(void) {}
@@ -276,7 +273,7 @@ static void __init pxa27x_mfp_init(void)
276{ 273{
277 int i, gpio; 274 int i, gpio;
278 275
279 for (i = 0; i <= 120; i++) { 276 for (i = 0; i <= pxa_last_gpio; i++) {
280 /* skip GPIO2, 5, 6, 7, 8, they are not 277 /* skip GPIO2, 5, 6, 7, 8, they are not
281 * valid pins allow configuration 278 * valid pins allow configuration
282 */ 279 */
@@ -313,7 +310,6 @@ static void __init pxa27x_mfp_init(void)
313 INIT_GPIO_DESC_MUXED(WEMUX2, 53); 310 INIT_GPIO_DESC_MUXED(WEMUX2, 53);
314 INIT_GPIO_DESC_MUXED(WEMUX2, 40); 311 INIT_GPIO_DESC_MUXED(WEMUX2, 40);
315 INIT_GPIO_DESC_MUXED(WEMUX2, 36); 312 INIT_GPIO_DESC_MUXED(WEMUX2, 36);
316 gpio_nr = 121;
317} 313}
318#else 314#else
319static inline void pxa27x_mfp_init(void) {} 315static inline void pxa27x_mfp_init(void) {}
@@ -327,7 +323,7 @@ static int pxa2xx_mfp_suspend(struct sys_device *d, pm_message_t state)
327{ 323{
328 int i; 324 int i;
329 325
330 for (i = 0; i <= gpio_to_bank(gpio_nr); i++) { 326 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) {
331 327
332 saved_gafr[0][i] = GAFR_L(i); 328 saved_gafr[0][i] = GAFR_L(i);
333 saved_gafr[1][i] = GAFR_U(i); 329 saved_gafr[1][i] = GAFR_U(i);
@@ -342,7 +338,7 @@ static int pxa2xx_mfp_resume(struct sys_device *d)
342{ 338{
343 int i; 339 int i;
344 340
345 for (i = 0; i <= gpio_to_bank(gpio_nr); i++) { 341 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++) {
346 GAFR_L(i) = saved_gafr[0][i]; 342 GAFR_L(i) = saved_gafr[0][i];
347 GAFR_U(i) = saved_gafr[1][i]; 343 GAFR_U(i) = saved_gafr[1][i];
348 GPDR(i * 32) = saved_gpdr[i]; 344 GPDR(i * 32) = saved_gpdr[i];
@@ -375,7 +371,7 @@ static int __init pxa2xx_mfp_init(void)
375 pxa27x_mfp_init(); 371 pxa27x_mfp_init();
376 372
377 /* initialize gafr_run[], pgsr_lpm[] from existing values */ 373 /* initialize gafr_run[], pgsr_lpm[] from existing values */
378 for (i = 0; i <= gpio_to_bank(gpio_nr); i++) 374 for (i = 0; i <= gpio_to_bank(pxa_last_gpio); i++)
379 gpdr_lpm[i] = GPDR(i * 32); 375 gpdr_lpm[i] = GPDR(i * 32);
380 376
381 return sysdev_class_register(&pxa2xx_mfp_sysclass); 377 return sysdev_class_register(&pxa2xx_mfp_sysclass);