diff options
author | eric miao <eric.miao@marvell.com> | 2008-03-04 01:19:58 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-19 06:29:04 -0400 |
commit | b9e25aced33eeb7279ccbaef198f28370cfb4e93 (patch) | |
tree | 149cac52a08fd81dbfbf611f96332f2e5341c58a /arch/arm/mach-pxa/gpio.c | |
parent | f6fb7af4768bc1ddc2349f6eaefedd746c8e4913 (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/gpio.c')
-rw-r--r-- | arch/arm/mach-pxa/gpio.c | 34 |
1 files changed, 12 insertions, 22 deletions
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 | ||
156 | void __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 | ||
312 | void __init pxa_init_irq_gpio(int gpio_nr) | 298 | void __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 | ||
346 | void __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 | } |