diff options
-rw-r--r-- | drivers/of/gpio.c | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c index 000681e98f2c..1c9cab844f10 100644 --- a/drivers/of/gpio.c +++ b/drivers/of/gpio.c | |||
@@ -137,38 +137,6 @@ int of_gpio_simple_xlate(struct of_gpio_chip *of_gc, struct device_node *np, | |||
137 | } | 137 | } |
138 | EXPORT_SYMBOL(of_gpio_simple_xlate); | 138 | EXPORT_SYMBOL(of_gpio_simple_xlate); |
139 | 139 | ||
140 | /* Should be sufficient for now, later we'll use dynamic bases. */ | ||
141 | #if defined(CONFIG_PPC32) || defined(CONFIG_SPARC32) | ||
142 | #define GPIOS_PER_CHIP 32 | ||
143 | #else | ||
144 | #define GPIOS_PER_CHIP 64 | ||
145 | #endif | ||
146 | |||
147 | static int of_get_gpiochip_base(struct device_node *np) | ||
148 | { | ||
149 | struct device_node *gc = NULL; | ||
150 | int gpiochip_base = 0; | ||
151 | |||
152 | while ((gc = of_find_all_nodes(gc))) { | ||
153 | if (!of_get_property(gc, "gpio-controller", NULL)) | ||
154 | continue; | ||
155 | |||
156 | if (gc != np) { | ||
157 | gpiochip_base += GPIOS_PER_CHIP; | ||
158 | continue; | ||
159 | } | ||
160 | |||
161 | of_node_put(gc); | ||
162 | |||
163 | if (gpiochip_base >= ARCH_NR_GPIOS) | ||
164 | return -ENOSPC; | ||
165 | |||
166 | return gpiochip_base; | ||
167 | } | ||
168 | |||
169 | return -ENOENT; | ||
170 | } | ||
171 | |||
172 | /** | 140 | /** |
173 | * of_mm_gpiochip_add - Add memory mapped GPIO chip (bank) | 141 | * of_mm_gpiochip_add - Add memory mapped GPIO chip (bank) |
174 | * @np: device node of the GPIO chip | 142 | * @np: device node of the GPIO chip |
@@ -205,11 +173,7 @@ int of_mm_gpiochip_add(struct device_node *np, | |||
205 | if (!mm_gc->regs) | 173 | if (!mm_gc->regs) |
206 | goto err1; | 174 | goto err1; |
207 | 175 | ||
208 | gc->base = of_get_gpiochip_base(np); | 176 | gc->base = -1; |
209 | if (gc->base < 0) { | ||
210 | ret = gc->base; | ||
211 | goto err1; | ||
212 | } | ||
213 | 177 | ||
214 | if (!of_gc->xlate) | 178 | if (!of_gc->xlate) |
215 | of_gc->xlate = of_gpio_simple_xlate; | 179 | of_gc->xlate = of_gpio_simple_xlate; |