aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2010-06-08 09:48:16 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-07-05 18:14:30 -0400
commita19e3da5bc5fc6c10ab73f310bea80f3845b4531 (patch)
tree49b6e952f48e56d9701f92e0c24044a14b676a34 /include/asm-generic
parentcedb1881ba32f7e9cd49250bd79debccbe52b094 (diff)
of/gpio: Kill of_gpio_chip and add members directly to gpio_chip
The OF gpio infrastructure is great for describing GPIO connections within the device tree. However, using a GPIO binding still requires changes to the gpio controller just to add an of_gpio structure. In most cases, the gpio controller doesn't actually need any special support and the simple OF gpio mapping function is more than sufficient. Additional, the current scheme of using of_gpio_chip requires a convoluted scheme to maintain 1:1 mappings between of_gpio_chip and gpio_chip instances. If the struct of_gpio_chip data members were moved into struct gpio_chip, then it would simplify the processing of OF gpio bindings, and it would make it trivial to use device tree OF connections on existing gpiolib controller drivers. This patch eliminates the of_gpio_chip structure and moves the relevant fields into struct gpio_chip (conditional on CONFIG_OF_GPIO). This move simplifies the existing code and prepares for adding automatic device tree support to existing drivers. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Anton Vorontsov <avorontsov@ru.mvista.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: David Brownell <dbrownell@users.sourceforge.net> Cc: Bill Gatliff <bgat@billgatliff.com> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/gpio.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 4f3d75e1ad3..af2544ef0b5 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -31,6 +31,7 @@ static inline int gpio_is_valid(int number)
31struct device; 31struct device;
32struct seq_file; 32struct seq_file;
33struct module; 33struct module;
34struct device_node;
34 35
35/** 36/**
36 * struct gpio_chip - abstract a GPIO controller 37 * struct gpio_chip - abstract a GPIO controller
@@ -106,6 +107,17 @@ struct gpio_chip {
106 const char *const *names; 107 const char *const *names;
107 unsigned can_sleep:1; 108 unsigned can_sleep:1;
108 unsigned exported:1; 109 unsigned exported:1;
110
111#if defined(CONFIG_OF_GPIO)
112 /*
113 * If CONFIG_OF is enabled, then all GPIO controllers described in the
114 * device tree automatically may have an OF translation
115 */
116 struct device_node *of_node;
117 int of_gpio_n_cells;
118 int (*of_xlate)(struct gpio_chip *gc, struct device_node *np,
119 const void *gpio_spec, u32 *flags);
120#endif
109}; 121};
110 122
111extern const char *gpiochip_is_requested(struct gpio_chip *chip, 123extern const char *gpiochip_is_requested(struct gpio_chip *chip,