ixp4xx: remove 2.6.36 support
[openwrt.git] / target / linux / ixp4xx / patches-2.6.37 / 402-ixp4xx_gpiolib.patch
1 --- a/arch/arm/mach-ixp4xx/common.c
2 +++ b/arch/arm/mach-ixp4xx/common.c
3 @@ -35,6 +35,7 @@
4 #include <asm/pgtable.h>
5 #include <asm/page.h>
6 #include <asm/irq.h>
7 +#include <asm/gpio.h>
8
9 #include <asm/mach/map.h>
10 #include <asm/mach/irq.h>
11 @@ -374,12 +375,50 @@ static struct platform_device *ixp46x_de
12 unsigned long ixp4xx_exp_bus_size;
13 EXPORT_SYMBOL(ixp4xx_exp_bus_size);
14
15 +static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
16 +{
17 + gpio_line_config(gpio, IXP4XX_GPIO_IN);
18 + return 0;
19 +}
20 +
21 +static int ixp4xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level)
22 +{
23 + gpio_line_set(gpio, level);
24 + gpio_line_config(gpio, IXP4XX_GPIO_OUT);
25 + return 0;
26 +}
27 +
28 +static int ixp4xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
29 +{
30 + int value;
31 +
32 + gpio_line_get(gpio, &value);
33 + return value;
34 +}
35 +
36 +static void ixp4xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
37 +{
38 + gpio_line_set(gpio, value);
39 +}
40 +
41 +static struct gpio_chip ixp4xx_gpio_chip = {
42 + .label = "IXP4XX_GPIO_CHIP",
43 + .direction_input = ixp4xx_gpio_direction_input,
44 + .direction_output = ixp4xx_gpio_direction_output,
45 + .get = ixp4xx_gpio_get_value,
46 + .set = ixp4xx_gpio_set_value,
47 + .base = 0,
48 + .ngpio = 16,
49 +};
50 +
51 void __init ixp4xx_sys_init(void)
52 {
53 ixp4xx_exp_bus_size = SZ_16M;
54
55 platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices));
56
57 + gpiochip_add(&ixp4xx_gpio_chip);
58 +
59 if (cpu_is_ixp46x()) {
60 int region;
61
62 --- a/arch/arm/Kconfig
63 +++ b/arch/arm/Kconfig
64 @@ -431,7 +431,7 @@ config ARCH_IXP4XX
65 bool "IXP4xx-based"
66 depends on MMU
67 select CPU_XSCALE
68 - select GENERIC_GPIO
69 + select ARCH_REQUIRE_GPIOLIB
70 select GENERIC_CLOCKEVENTS
71 select DMABOUNCE if PCI
72 help
73 --- a/arch/arm/mach-ixp4xx/include/mach/gpio.h
74 +++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h
75 @@ -27,47 +27,31 @@
76
77 #include <linux/kernel.h>
78 #include <mach/hardware.h>
79 +#include <asm-generic/gpio.h> /* cansleep wrappers */
80
81 -static inline int gpio_request(unsigned gpio, const char *label)
82 -{
83 - return 0;
84 -}
85 -
86 -static inline void gpio_free(unsigned gpio)
87 -{
88 - might_sleep();
89 -
90 - return;
91 -}
92 -
93 -static inline int gpio_direction_input(unsigned gpio)
94 -{
95 - gpio_line_config(gpio, IXP4XX_GPIO_IN);
96 - return 0;
97 -}
98 -
99 -static inline int gpio_direction_output(unsigned gpio, int level)
100 -{
101 - gpio_line_set(gpio, level);
102 - gpio_line_config(gpio, IXP4XX_GPIO_OUT);
103 - return 0;
104 -}
105 +#define NR_BUILTIN_GPIO 16
106
107 static inline int gpio_get_value(unsigned gpio)
108 {
109 - int value;
110 -
111 - gpio_line_get(gpio, &value);
112 -
113 - return value;
114 + if (gpio < NR_BUILTIN_GPIO)
115 + {
116 + int value;
117 + gpio_line_get(gpio, &value);
118 + return value;
119 + }
120 + else
121 + return __gpio_get_value(gpio);
122 }
123
124 static inline void gpio_set_value(unsigned gpio, int value)
125 {
126 - gpio_line_set(gpio, value);
127 + if (gpio < NR_BUILTIN_GPIO)
128 + gpio_line_set(gpio, value);
129 + else
130 + __gpio_set_value(gpio, value);
131 }
132
133 -#include <asm-generic/gpio.h> /* cansleep wrappers */
134 +#define gpio_cansleep __gpio_cansleep
135
136 extern int gpio_to_irq(int gpio);
137 extern int irq_to_gpio(unsigned int irq);
This page took 0.05461 seconds and 5 git commands to generate.