diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-01 21:28:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-01 21:28:06 -0400 |
commit | 2a2bf85f05e42b12ea6bfe821e2d19221cf93555 (patch) | |
tree | 11abcdaef6e4f8307574056998d306d21558b6ed /drivers/gpio/gpio-pxa.c | |
parent | 11801e9de26992d37cb869cc74f389b6a7677e0e (diff) | |
parent | 99261fbad0a16f105b262d7525801697588ba526 (diff) |
Merge tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM soc device tree updates from Olof Johansson:
"Device tree conversion and enablement branch. Mostly a bunch of new
bindings and setup for various platforms, but the Via/Winchip VT8500
platform is also converted over from being 100% legacy to now use
device tree for probing. More of that will come for 3.8."
Trivial conflicts due to removal of vt8500 files, and one documentation
file that was added with slightly different contents both here and in
the USb tree.
* tag 'dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (212 commits)
arm: vt8500: Fixup for missing gpio.h
ARM: LPC32xx: LED fix in PHY3250 DTS file
ARM: dt: mmp-dma: add binding file
arm: vt8500: Update arch-vt8500 to devicetree support.
arm: vt8500: gpio: Devicetree support for arch-vt8500
arm: vt8500: doc: Add device tree bindings for arch-vt8500 devices
arm: vt8500: clk: Add Common Clock Framework support
video: vt8500: Add devicetree support for vt8500-fb and wm8505-fb
serial: vt8500: Add devicetree support for vt8500-serial
rtc: vt8500: Add devicetree support for vt8500-rtc
arm: vt8500: Add device tree files for VIA/Wondermedia SoC's
ARM: tegra: Add Avionic Design Tamonten Evaluation Carrier support
ARM: tegra: Add Avionic Design Medcom-Wide support
ARM: tegra: Add Avionic Design Plutux support
ARM: tegra: Add Avionic Design Tamonten support
ARM: tegra: dts: Add pwm label
ARM: ux500: Fix SSP register address format
ARM: ux500: Apply tc3589x's GPIO/IRQ properties to HREF's DT
ARM: ux500: Remove redundant #gpio-cell properties from Snowball DT
ARM: ux500: Add all encompassing sound node to the HREF Device Tree
...
Diffstat (limited to 'drivers/gpio/gpio-pxa.c')
-rw-r--r-- | drivers/gpio/gpio-pxa.c | 77 |
1 files changed, 23 insertions, 54 deletions
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index 9cac88a65f78..9528779ca463 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c | |||
@@ -26,6 +26,8 @@ | |||
26 | #include <linux/syscore_ops.h> | 26 | #include <linux/syscore_ops.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | 28 | ||
29 | #include <asm/mach/irq.h> | ||
30 | |||
29 | #include <mach/irqs.h> | 31 | #include <mach/irqs.h> |
30 | 32 | ||
31 | /* | 33 | /* |
@@ -59,6 +61,7 @@ | |||
59 | #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) | 61 | #define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2)) |
60 | 62 | ||
61 | int pxa_last_gpio; | 63 | int pxa_last_gpio; |
64 | static int irq_base; | ||
62 | 65 | ||
63 | #ifdef CONFIG_OF | 66 | #ifdef CONFIG_OF |
64 | static struct irq_domain *domain; | 67 | static struct irq_domain *domain; |
@@ -167,63 +170,14 @@ static inline int __gpio_is_occupied(unsigned gpio) | |||
167 | return ret; | 170 | return ret; |
168 | } | 171 | } |
169 | 172 | ||
170 | #ifdef CONFIG_ARCH_PXA | ||
171 | static inline int __pxa_gpio_to_irq(int gpio) | ||
172 | { | ||
173 | if (gpio_is_pxa_type(gpio_type)) | ||
174 | return PXA_GPIO_TO_IRQ(gpio); | ||
175 | return -1; | ||
176 | } | ||
177 | |||
178 | static inline int __pxa_irq_to_gpio(int irq) | ||
179 | { | ||
180 | if (gpio_is_pxa_type(gpio_type)) | ||
181 | return irq - PXA_GPIO_TO_IRQ(0); | ||
182 | return -1; | ||
183 | } | ||
184 | #else | ||
185 | static inline int __pxa_gpio_to_irq(int gpio) { return -1; } | ||
186 | static inline int __pxa_irq_to_gpio(int irq) { return -1; } | ||
187 | #endif | ||
188 | |||
189 | #ifdef CONFIG_ARCH_MMP | ||
190 | static inline int __mmp_gpio_to_irq(int gpio) | ||
191 | { | ||
192 | if (gpio_is_mmp_type(gpio_type)) | ||
193 | return MMP_GPIO_TO_IRQ(gpio); | ||
194 | return -1; | ||
195 | } | ||
196 | |||
197 | static inline int __mmp_irq_to_gpio(int irq) | ||
198 | { | ||
199 | if (gpio_is_mmp_type(gpio_type)) | ||
200 | return irq - MMP_GPIO_TO_IRQ(0); | ||
201 | return -1; | ||
202 | } | ||
203 | #else | ||
204 | static inline int __mmp_gpio_to_irq(int gpio) { return -1; } | ||
205 | static inline int __mmp_irq_to_gpio(int irq) { return -1; } | ||
206 | #endif | ||
207 | |||
208 | static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 173 | static int pxa_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
209 | { | 174 | { |
210 | int gpio, ret; | 175 | return chip->base + offset + irq_base; |
211 | |||
212 | gpio = chip->base + offset; | ||
213 | ret = __pxa_gpio_to_irq(gpio); | ||
214 | if (ret >= 0) | ||
215 | return ret; | ||
216 | return __mmp_gpio_to_irq(gpio); | ||
217 | } | 176 | } |
218 | 177 | ||
219 | int pxa_irq_to_gpio(int irq) | 178 | int pxa_irq_to_gpio(int irq) |
220 | { | 179 | { |
221 | int ret; | 180 | return irq - irq_base; |
222 | |||
223 | ret = __pxa_irq_to_gpio(irq); | ||
224 | if (ret >= 0) | ||
225 | return ret; | ||
226 | return __mmp_irq_to_gpio(irq); | ||
227 | } | 181 | } |
228 | 182 | ||
229 | static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 183 | static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
@@ -403,6 +357,9 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc) | |||
403 | struct pxa_gpio_chip *c; | 357 | struct pxa_gpio_chip *c; |
404 | int loop, gpio, gpio_base, n; | 358 | int loop, gpio, gpio_base, n; |
405 | unsigned long gedr; | 359 | unsigned long gedr; |
360 | struct irq_chip *chip = irq_desc_get_chip(desc); | ||
361 | |||
362 | chained_irq_enter(chip, desc); | ||
406 | 363 | ||
407 | do { | 364 | do { |
408 | loop = 0; | 365 | loop = 0; |
@@ -422,6 +379,8 @@ static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc) | |||
422 | } | 379 | } |
423 | } | 380 | } |
424 | } while (loop); | 381 | } while (loop); |
382 | |||
383 | chained_irq_exit(chip, desc); | ||
425 | } | 384 | } |
426 | 385 | ||
427 | static void pxa_ack_muxed_gpio(struct irq_data *d) | 386 | static void pxa_ack_muxed_gpio(struct irq_data *d) |
@@ -535,7 +494,7 @@ const struct irq_domain_ops pxa_irq_domain_ops = { | |||
535 | 494 | ||
536 | static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev) | 495 | static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev) |
537 | { | 496 | { |
538 | int ret, nr_banks, nr_gpios, irq_base; | 497 | int ret, nr_banks, nr_gpios; |
539 | struct device_node *prev, *next, *np = pdev->dev.of_node; | 498 | struct device_node *prev, *next, *np = pdev->dev.of_node; |
540 | const struct of_device_id *of_id = | 499 | const struct of_device_id *of_id = |
541 | of_match_device(pxa_gpio_dt_ids, &pdev->dev); | 500 | of_match_device(pxa_gpio_dt_ids, &pdev->dev); |
@@ -590,10 +549,20 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) | |||
590 | int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; | 549 | int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; |
591 | 550 | ||
592 | ret = pxa_gpio_probe_dt(pdev); | 551 | ret = pxa_gpio_probe_dt(pdev); |
593 | if (ret < 0) | 552 | if (ret < 0) { |
594 | pxa_last_gpio = pxa_gpio_nums(); | 553 | pxa_last_gpio = pxa_gpio_nums(); |
595 | else | 554 | #ifdef CONFIG_ARCH_PXA |
555 | if (gpio_is_pxa_type(gpio_type)) | ||
556 | irq_base = PXA_GPIO_TO_IRQ(0); | ||
557 | #endif | ||
558 | #ifdef CONFIG_ARCH_MMP | ||
559 | if (gpio_is_mmp_type(gpio_type)) | ||
560 | irq_base = MMP_GPIO_TO_IRQ(0); | ||
561 | #endif | ||
562 | } else { | ||
596 | use_of = 1; | 563 | use_of = 1; |
564 | } | ||
565 | |||
597 | if (!pxa_last_gpio) | 566 | if (!pxa_last_gpio) |
598 | return -EINVAL; | 567 | return -EINVAL; |
599 | 568 | ||