diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:50:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:50:49 -0400 |
commit | 9a64388d83f6ef08dfff405a9d122e3dbcb6bf38 (patch) | |
tree | a77532ce4d6d56be6c6c7f405cd901a0184250fb /include/linux/of_gpio.h | |
parent | e80ab411e589e00550e2e6e5a6a02d59cc730357 (diff) | |
parent | 14b3ca4022f050f8622ed282b734ddf445464583 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (202 commits)
[POWERPC] Fix compile breakage for 64-bit UP configs
[POWERPC] Define copy_siginfo_from_user32
[POWERPC] Add compat handler for PTRACE_GETSIGINFO
[POWERPC] i2c: Fix build breakage introduced by OF helpers
[POWERPC] Optimize fls64() on 64-bit processors
[POWERPC] irqtrace support for 64-bit powerpc
[POWERPC] Stacktrace support for lockdep
[POWERPC] Move stackframe definitions to common header
[POWERPC] Fix device-tree locking vs. interrupts
[POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const
[POWERPC] Remove unused __max_memory variable
[POWERPC] Simplify xics direct/lpar irq_host setup
[POWERPC] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ()
[POWERPC] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade()
[POWERPC] Move xics_setup_8259_cascade() into platforms/pseries/setup.c
[POWERPC] Use asm-generic/bitops/find.h in bitops.h
[POWERPC] 83xx: mpc8315 - fix USB UTMI Host setup
[POWERPC] 85xx: Fix the size of qe muram for MPC8568E
[POWERPC] 86xx: mpc86xx_hpcn - Temporarily accept old dts node identifier.
[POWERPC] 86xx: mark functions static, other minor cleanups
...
Diffstat (limited to 'include/linux/of_gpio.h')
-rw-r--r-- | include/linux/of_gpio.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/include/linux/of_gpio.h b/include/linux/of_gpio.h new file mode 100644 index 000000000000..2ee97e9877a7 --- /dev/null +++ b/include/linux/of_gpio.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * OF helpers for the GPIO API | ||
3 | * | ||
4 | * Copyright (c) 2007-2008 MontaVista Software, Inc. | ||
5 | * | ||
6 | * Author: Anton Vorontsov <avorontsov@ru.mvista.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #ifndef __LINUX_OF_GPIO_H | ||
15 | #define __LINUX_OF_GPIO_H | ||
16 | |||
17 | #include <linux/errno.h> | ||
18 | #include <asm/gpio.h> | ||
19 | |||
20 | #ifdef CONFIG_OF_GPIO | ||
21 | |||
22 | /* | ||
23 | * Generic OF GPIO chip | ||
24 | */ | ||
25 | struct of_gpio_chip { | ||
26 | struct gpio_chip gc; | ||
27 | int gpio_cells; | ||
28 | int (*xlate)(struct of_gpio_chip *of_gc, struct device_node *np, | ||
29 | const void *gpio_spec); | ||
30 | }; | ||
31 | |||
32 | static inline struct of_gpio_chip *to_of_gpio_chip(struct gpio_chip *gc) | ||
33 | { | ||
34 | return container_of(gc, struct of_gpio_chip, gc); | ||
35 | } | ||
36 | |||
37 | /* | ||
38 | * OF GPIO chip for memory mapped banks | ||
39 | */ | ||
40 | struct of_mm_gpio_chip { | ||
41 | struct of_gpio_chip of_gc; | ||
42 | void (*save_regs)(struct of_mm_gpio_chip *mm_gc); | ||
43 | void __iomem *regs; | ||
44 | }; | ||
45 | |||
46 | static inline struct of_mm_gpio_chip *to_of_mm_gpio_chip(struct gpio_chip *gc) | ||
47 | { | ||
48 | struct of_gpio_chip *of_gc = to_of_gpio_chip(gc); | ||
49 | |||
50 | return container_of(of_gc, struct of_mm_gpio_chip, of_gc); | ||
51 | } | ||
52 | |||
53 | extern int of_get_gpio(struct device_node *np, int index); | ||
54 | extern int of_mm_gpiochip_add(struct device_node *np, | ||
55 | struct of_mm_gpio_chip *mm_gc); | ||
56 | extern int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, | ||
57 | struct device_node *np, | ||
58 | const void *gpio_spec); | ||
59 | #else | ||
60 | |||
61 | /* Drivers may not strictly depend on the GPIO support, so let them link. */ | ||
62 | static inline int of_get_gpio(struct device_node *np, int index) | ||
63 | { | ||
64 | return -ENOSYS; | ||
65 | } | ||
66 | |||
67 | #endif /* CONFIG_OF_GPIO */ | ||
68 | |||
69 | #endif /* __LINUX_OF_GPIO_H */ | ||