aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authoreric miao <eric.miao@marvell.com>2008-03-04 01:19:58 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-19 06:29:04 -0400
commitb9e25aced33eeb7279ccbaef198f28370cfb4e93 (patch)
tree149cac52a08fd81dbfbf611f96332f2e5341c58a /arch/arm/mach-pxa
parentf6fb7af4768bc1ddc2349f6eaefedd746c8e4913 (diff)
[ARM] pxa: merge assignment of set_wake into pxa_init_{irq,gpio}()
To further clean up the GPIO and IRQ structure: 1. pxa_init_irq_gpio() and pxa_init_gpio() combines into a single function pxa_init_gpio() 2. assignment of set_wake merged into pxa_init_{irq,gpio}() as an argument Signed-off-by: eric miao <eric.miao@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/generic.h9
-rw-r--r--arch/arm/mach-pxa/gpio.c34
-rw-r--r--arch/arm/mach-pxa/irq.c8
-rw-r--r--arch/arm/mach-pxa/pxa25x.c5
-rw-r--r--arch/arm/mach-pxa/pxa27x.c5
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c13
6 files changed, 25 insertions, 49 deletions
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index 0e3e058296fa..bd2a2356d976 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -9,14 +9,13 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12typedef int (*set_wake_t)(unsigned int, unsigned int);
13
12struct sys_timer; 14struct sys_timer;
13 15
14extern struct sys_timer pxa_timer; 16extern struct sys_timer pxa_timer;
15extern void __init pxa_init_irq(int irq_nr); 17extern void __init pxa_init_irq(int irq_nr, set_wake_t fn);
16extern void __init pxa_init_irq_gpio(int gpio_nr); 18extern void __init pxa_init_gpio(int gpio_nr, set_wake_t fn);
17extern void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int));
18extern void __init pxa_init_gpio_set_wake(int (*set_wake)(unsigned int, unsigned int));
19extern void __init pxa_init_gpio(int gpio_nr);
20extern void __init pxa25x_init_irq(void); 19extern void __init pxa25x_init_irq(void);
21extern void __init pxa27x_init_irq(void); 20extern void __init pxa27x_init_irq(void);
22extern void __init pxa3xx_init_irq(void); 21extern void __init pxa3xx_init_irq(void);
diff --git a/arch/arm/mach-pxa/gpio.c b/arch/arm/mach-pxa/gpio.c
index a64227254151..bf4c08408f2e 100644
--- a/arch/arm/mach-pxa/gpio.c
+++ b/arch/arm/mach-pxa/gpio.c
@@ -153,20 +153,6 @@ static struct pxa_gpio_chip pxa_gpio_chip[] = {
153#endif 153#endif
154}; 154};
155 155
156void __init pxa_init_gpio(int gpio_nr)
157{
158 int i;
159
160 /* add a GPIO chip for each register bank.
161 * the last PXA25x register only contains 21 GPIOs
162 */
163 for (i = 0; i < gpio_nr; i += 32) {
164 if (i+32 > gpio_nr)
165 pxa_gpio_chip[i/32].chip.ngpio = gpio_nr - i;
166 gpiochip_add(&pxa_gpio_chip[i/32].chip);
167 }
168}
169
170/* 156/*
171 * PXA GPIO edge detection for IRQs: 157 * PXA GPIO edge detection for IRQs:
172 * IRQs are generated on Falling-Edge, Rising-Edge, or both. 158 * IRQs are generated on Falling-Edge, Rising-Edge, or both.
@@ -309,9 +295,9 @@ static struct irq_chip pxa_muxed_gpio_chip = {
309 .set_type = pxa_gpio_irq_type, 295 .set_type = pxa_gpio_irq_type,
310}; 296};
311 297
312void __init pxa_init_irq_gpio(int gpio_nr) 298void __init pxa_init_gpio(int gpio_nr, set_wake_t fn)
313{ 299{
314 int irq, i; 300 int irq, i, gpio;
315 301
316 pxa_last_gpio = gpio_nr - 1; 302 pxa_last_gpio = gpio_nr - 1;
317 303
@@ -340,11 +326,15 @@ void __init pxa_init_irq_gpio(int gpio_nr)
340 /* Install handler for GPIO>=2 edge detect interrupts */ 326 /* Install handler for GPIO>=2 edge detect interrupts */
341 set_irq_chained_handler(IRQ_GPIO_2_x, pxa_gpio_demux_handler); 327 set_irq_chained_handler(IRQ_GPIO_2_x, pxa_gpio_demux_handler);
342 328
343 pxa_init_gpio(gpio_nr); 329 pxa_low_gpio_chip.set_wake = fn;
344} 330 pxa_muxed_gpio_chip.set_wake = fn;
345 331
346void __init pxa_init_gpio_set_wake(int (*set_wake)(unsigned int, unsigned int)) 332 /* add a GPIO chip for each register bank.
347{ 333 * the last PXA25x register only contains 21 GPIOs
348 pxa_low_gpio_chip.set_wake = set_wake; 334 */
349 pxa_muxed_gpio_chip.set_wake = set_wake; 335 for (gpio = 0, i = 0; gpio < gpio_nr; gpio += 32, i++) {
336 if (gpio + 32 > gpio_nr)
337 pxa_gpio_chip[i].chip.ngpio = gpio_nr - gpio;
338 gpiochip_add(&pxa_gpio_chip[i].chip);
339 }
350} 340}
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index cccc3ed3c679..fbff557bb225 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -51,7 +51,7 @@ static struct irq_chip pxa_internal_irq_chip = {
51 .unmask = pxa_unmask_irq, 51 .unmask = pxa_unmask_irq,
52}; 52};
53 53
54void __init pxa_init_irq(int irq_nr) 54void __init pxa_init_irq(int irq_nr, set_wake_t fn)
55{ 55{
56 int irq; 56 int irq;
57 57
@@ -70,12 +70,8 @@ void __init pxa_init_irq(int irq_nr)
70 set_irq_handler(irq, handle_level_irq); 70 set_irq_handler(irq, handle_level_irq);
71 set_irq_flags(irq, IRQF_VALID); 71 set_irq_flags(irq, IRQF_VALID);
72 } 72 }
73}
74 73
75void __init pxa_init_irq_set_wake(int (*set_wake)(unsigned int, unsigned int)) 74 pxa_internal_irq_chip.set_wake = fn;
76{
77 pxa_internal_irq_chip.set_wake = set_wake;
78 pxa_init_gpio_set_wake(set_wake);
79} 75}
80 76
81#ifdef CONFIG_PM 77#ifdef CONFIG_PM
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index bb0bf51f5039..653a3b63d073 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -267,9 +267,8 @@ set_pwer:
267 267
268void __init pxa25x_init_irq(void) 268void __init pxa25x_init_irq(void)
269{ 269{
270 pxa_init_irq(32); 270 pxa_init_irq(32, pxa25x_set_wake);
271 pxa_init_irq_gpio(85); 271 pxa_init_gpio(85, pxa25x_set_wake);
272 pxa_init_irq_set_wake(pxa25x_set_wake);
273} 272}
274 273
275static struct platform_device *pxa25x_devices[] __initdata = { 274static struct platform_device *pxa25x_devices[] __initdata = {
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 54d8448cad7b..87ade40865f1 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -340,9 +340,8 @@ set_pwer:
340 340
341void __init pxa27x_init_irq(void) 341void __init pxa27x_init_irq(void)
342{ 342{
343 pxa_init_irq(34); 343 pxa_init_irq(34, pxa27x_set_wake);
344 pxa_init_irq_gpio(128); 344 pxa_init_gpio(128, pxa27x_set_wake);
345 pxa_init_irq_set_wake(pxa27x_set_wake);
346} 345}
347 346
348/* 347/*
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index 8f8179b2fc38..eedcec0bf3f0 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -494,15 +494,9 @@ static int pxa3xx_set_wake(unsigned int irq, unsigned int on)
494 494
495 return 0; 495 return 0;
496} 496}
497
498static void pxa3xx_init_irq_pm(void)
499{
500 pxa_init_irq_set_wake(pxa3xx_set_wake);
501}
502
503#else 497#else
504static inline void pxa3xx_init_pm(void) {} 498static inline void pxa3xx_init_pm(void) {}
505static inline void pxa3xx_init_irq_pm(void) {} 499#define pxa3xx_set_wake NULL
506#endif 500#endif
507 501
508void __init pxa3xx_init_irq(void) 502void __init pxa3xx_init_irq(void)
@@ -513,9 +507,8 @@ void __init pxa3xx_init_irq(void)
513 value |= (1 << 6); 507 value |= (1 << 6);
514 __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); 508 __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value));
515 509
516 pxa_init_irq(56); 510 pxa_init_irq(56, pxa3xx_set_wake);
517 pxa_init_irq_gpio(128); 511 pxa_init_gpio(128, NULL);
518 pxa3xx_init_irq_pm();
519} 512}
520 513
521/* 514/*