diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/boot/dts/lpc32xx.dtsi | 41 | ||||
-rw-r--r-- | arch/arm/boot/dts/phy3250.dts | 4 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/common.c | 48 | ||||
-rw-r--r-- | arch/arm/mach-ixp4xx/include/mach/gpio.h | 79 |
5 files changed, 52 insertions, 122 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 5e7601301b41..b649c5904a4f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -525,7 +525,7 @@ config ARCH_IXP4XX | |||
525 | select ARCH_HAS_DMA_SET_COHERENT_MASK | 525 | select ARCH_HAS_DMA_SET_COHERENT_MASK |
526 | select CLKSRC_MMIO | 526 | select CLKSRC_MMIO |
527 | select CPU_XSCALE | 527 | select CPU_XSCALE |
528 | select GENERIC_GPIO | 528 | select ARCH_REQUIRE_GPIOLIB |
529 | select GENERIC_CLOCKEVENTS | 529 | select GENERIC_CLOCKEVENTS |
530 | select MIGHT_HAVE_PCI | 530 | select MIGHT_HAVE_PCI |
531 | select NEED_MACH_IO_H | 531 | select NEED_MACH_IO_H |
diff --git a/arch/arm/boot/dts/lpc32xx.dtsi b/arch/arm/boot/dts/lpc32xx.dtsi index 2d696866f71c..3f5dad801a98 100644 --- a/arch/arm/boot/dts/lpc32xx.dtsi +++ b/arch/arm/boot/dts/lpc32xx.dtsi | |||
@@ -215,45 +215,8 @@ | |||
215 | gpio: gpio@40028000 { | 215 | gpio: gpio@40028000 { |
216 | compatible = "nxp,lpc3220-gpio"; | 216 | compatible = "nxp,lpc3220-gpio"; |
217 | reg = <0x40028000 0x1000>; | 217 | reg = <0x40028000 0x1000>; |
218 | /* create a private address space for enumeration */ | 218 | gpio-controller; |
219 | #address-cells = <1>; | 219 | #gpio-cells = <3>; /* bank, pin, flags */ |
220 | #size-cells = <0>; | ||
221 | |||
222 | gpio_p0: gpio-bank@0 { | ||
223 | gpio-controller; | ||
224 | #gpio-cells = <2>; | ||
225 | reg = <0>; | ||
226 | }; | ||
227 | |||
228 | gpio_p1: gpio-bank@1 { | ||
229 | gpio-controller; | ||
230 | #gpio-cells = <2>; | ||
231 | reg = <1>; | ||
232 | }; | ||
233 | |||
234 | gpio_p2: gpio-bank@2 { | ||
235 | gpio-controller; | ||
236 | #gpio-cells = <2>; | ||
237 | reg = <2>; | ||
238 | }; | ||
239 | |||
240 | gpio_p3: gpio-bank@3 { | ||
241 | gpio-controller; | ||
242 | #gpio-cells = <2>; | ||
243 | reg = <3>; | ||
244 | }; | ||
245 | |||
246 | gpi_p3: gpio-bank@4 { | ||
247 | gpio-controller; | ||
248 | #gpio-cells = <2>; | ||
249 | reg = <4>; | ||
250 | }; | ||
251 | |||
252 | gpo_p3: gpio-bank@5 { | ||
253 | gpio-controller; | ||
254 | #gpio-cells = <2>; | ||
255 | reg = <5>; | ||
256 | }; | ||
257 | }; | 220 | }; |
258 | 221 | ||
259 | watchdog@4003C000 { | 222 | watchdog@4003C000 { |
diff --git a/arch/arm/boot/dts/phy3250.dts b/arch/arm/boot/dts/phy3250.dts index 0167e86314c0..c4ff6d1a018b 100644 --- a/arch/arm/boot/dts/phy3250.dts +++ b/arch/arm/boot/dts/phy3250.dts | |||
@@ -131,13 +131,13 @@ | |||
131 | compatible = "gpio-leds"; | 131 | compatible = "gpio-leds"; |
132 | 132 | ||
133 | led0 { | 133 | led0 { |
134 | gpios = <&gpo_p3 1 1>; /* GPO_P3 1, GPIO 80, active low */ | 134 | gpios = <&gpio 5 1 1>; /* GPO_P3 1, GPIO 80, active low */ |
135 | linux,default-trigger = "heartbeat"; | 135 | linux,default-trigger = "heartbeat"; |
136 | default-state = "off"; | 136 | default-state = "off"; |
137 | }; | 137 | }; |
138 | 138 | ||
139 | led1 { | 139 | led1 { |
140 | gpios = <&gpo_p3 14 1>; /* GPO_P3 14, GPIO 93, active low */ | 140 | gpios = <&gpio 5 14 1>; /* GPO_P3 14, GPIO 93, active low */ |
141 | linux,default-trigger = "timer"; | 141 | linux,default-trigger = "timer"; |
142 | default-state = "off"; | 142 | default-state = "off"; |
143 | }; | 143 | }; |
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index ebbd7fc90eb4..a9f80943d01f 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/clockchips.h> | 28 | #include <linux/clockchips.h> |
29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
30 | #include <linux/export.h> | 30 | #include <linux/export.h> |
31 | #include <linux/gpio.h> | ||
31 | 32 | ||
32 | #include <mach/udc.h> | 33 | #include <mach/udc.h> |
33 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
@@ -107,7 +108,7 @@ static signed char irq2gpio[32] = { | |||
107 | 7, 8, 9, 10, 11, 12, -1, -1, | 108 | 7, 8, 9, 10, 11, 12, -1, -1, |
108 | }; | 109 | }; |
109 | 110 | ||
110 | int gpio_to_irq(int gpio) | 111 | static int ixp4xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) |
111 | { | 112 | { |
112 | int irq; | 113 | int irq; |
113 | 114 | ||
@@ -117,7 +118,6 @@ int gpio_to_irq(int gpio) | |||
117 | } | 118 | } |
118 | return -EINVAL; | 119 | return -EINVAL; |
119 | } | 120 | } |
120 | EXPORT_SYMBOL(gpio_to_irq); | ||
121 | 121 | ||
122 | int irq_to_gpio(unsigned int irq) | 122 | int irq_to_gpio(unsigned int irq) |
123 | { | 123 | { |
@@ -383,12 +383,56 @@ static struct platform_device *ixp46x_devices[] __initdata = { | |||
383 | unsigned long ixp4xx_exp_bus_size; | 383 | unsigned long ixp4xx_exp_bus_size; |
384 | EXPORT_SYMBOL(ixp4xx_exp_bus_size); | 384 | EXPORT_SYMBOL(ixp4xx_exp_bus_size); |
385 | 385 | ||
386 | static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | ||
387 | { | ||
388 | gpio_line_config(gpio, IXP4XX_GPIO_IN); | ||
389 | |||
390 | return 0; | ||
391 | } | ||
392 | |||
393 | static int ixp4xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, | ||
394 | int level) | ||
395 | { | ||
396 | gpio_line_set(gpio, level); | ||
397 | gpio_line_config(gpio, IXP4XX_GPIO_OUT); | ||
398 | |||
399 | return 0; | ||
400 | } | ||
401 | |||
402 | static int ixp4xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio) | ||
403 | { | ||
404 | int value; | ||
405 | |||
406 | gpio_line_get(gpio, &value); | ||
407 | |||
408 | return value; | ||
409 | } | ||
410 | |||
411 | static void ixp4xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, | ||
412 | int value) | ||
413 | { | ||
414 | gpio_line_set(gpio, value); | ||
415 | } | ||
416 | |||
417 | static struct gpio_chip ixp4xx_gpio_chip = { | ||
418 | .label = "IXP4XX_GPIO_CHIP", | ||
419 | .direction_input = ixp4xx_gpio_direction_input, | ||
420 | .direction_output = ixp4xx_gpio_direction_output, | ||
421 | .get = ixp4xx_gpio_get_value, | ||
422 | .set = ixp4xx_gpio_set_value, | ||
423 | .to_irq = ixp4xx_gpio_to_irq, | ||
424 | .base = 0, | ||
425 | .ngpio = 16, | ||
426 | }; | ||
427 | |||
386 | void __init ixp4xx_sys_init(void) | 428 | void __init ixp4xx_sys_init(void) |
387 | { | 429 | { |
388 | ixp4xx_exp_bus_size = SZ_16M; | 430 | ixp4xx_exp_bus_size = SZ_16M; |
389 | 431 | ||
390 | platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices)); | 432 | platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices)); |
391 | 433 | ||
434 | gpiochip_add(&ixp4xx_gpio_chip); | ||
435 | |||
392 | if (cpu_is_ixp46x()) { | 436 | if (cpu_is_ixp46x()) { |
393 | int region; | 437 | int region; |
394 | 438 | ||
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h index 83d6b4ed60bb..ef37f2635b0e 100644 --- a/arch/arm/mach-ixp4xx/include/mach/gpio.h +++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h | |||
@@ -1,79 +1,2 @@ | |||
1 | /* | 1 | /* empty */ |
2 | * arch/arm/mach-ixp4xx/include/mach/gpio.h | ||
3 | * | ||
4 | * IXP4XX GPIO wrappers for arch-neutral GPIO calls | ||
5 | * | ||
6 | * Written by Milan Svoboda <msvoboda@ra.rockwell.com> | ||
7 | * Based on PXA implementation by Philipp Zabel <philipp.zabel@gmail.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #ifndef __ASM_ARCH_IXP4XX_GPIO_H | ||
26 | #define __ASM_ARCH_IXP4XX_GPIO_H | ||
27 | |||
28 | #include <linux/kernel.h> | ||
29 | #include <mach/hardware.h> | ||
30 | |||
31 | #define __ARM_GPIOLIB_COMPLEX | ||
32 | |||
33 | static inline int gpio_request(unsigned gpio, const char *label) | ||
34 | { | ||
35 | return 0; | ||
36 | } | ||
37 | |||
38 | static inline void gpio_free(unsigned gpio) | ||
39 | { | ||
40 | might_sleep(); | ||
41 | |||
42 | return; | ||
43 | } | ||
44 | |||
45 | static inline int gpio_direction_input(unsigned gpio) | ||
46 | { | ||
47 | gpio_line_config(gpio, IXP4XX_GPIO_IN); | ||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | static inline int gpio_direction_output(unsigned gpio, int level) | ||
52 | { | ||
53 | gpio_line_set(gpio, level); | ||
54 | gpio_line_config(gpio, IXP4XX_GPIO_OUT); | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static inline int gpio_get_value(unsigned gpio) | ||
59 | { | ||
60 | int value; | ||
61 | |||
62 | gpio_line_get(gpio, &value); | ||
63 | |||
64 | return value; | ||
65 | } | ||
66 | |||
67 | static inline void gpio_set_value(unsigned gpio, int value) | ||
68 | { | ||
69 | gpio_line_set(gpio, value); | ||
70 | } | ||
71 | |||
72 | #include <asm-generic/gpio.h> /* cansleep wrappers */ | ||
73 | |||
74 | extern int gpio_to_irq(int gpio); | ||
75 | #define gpio_to_irq gpio_to_irq | ||
76 | extern int irq_to_gpio(unsigned int irq); | ||
77 | |||
78 | #endif | ||
79 | 2 | ||