[kernel] kmod-usb-core is buildin on etrax target
[openwrt.git] / target / linux / ifxmips / patches-2.6.30 / 600-ebu-gpio.patch
1 Index: linux-2.6.30.10/drivers/gpio/Kconfig
2 ===================================================================
3 --- linux-2.6.30.10.orig/drivers/gpio/Kconfig 2010-03-24 21:55:56.000000000 +0100
4 +++ linux-2.6.30.10/drivers/gpio/Kconfig 2010-03-24 21:56:36.000000000 +0100
5 @@ -176,4 +176,12 @@
6 SPI driver for Microchip MCP23S08 I/O expander. This provides
7 a GPIO interface supporting inputs and outputs.
8
9 +comment "EBU GPIO expanders:"
10 +
11 +config GPIO_IFXMIPS_EBU
12 + boolean "IFXMIPS EBU attached I/O expander"
13 + depends on IFXMIPS
14 + help
15 + This driver allows you to drive latches attached to the SoCc External Bus Unit
16 +
17 endif
18 Index: linux-2.6.30.10/drivers/gpio/Makefile
19 ===================================================================
20 --- linux-2.6.30.10.orig/drivers/gpio/Makefile 2010-03-24 21:55:56.000000000 +0100
21 +++ linux-2.6.30.10/drivers/gpio/Makefile 2010-03-24 21:56:36.000000000 +0100
22 @@ -12,3 +12,4 @@
23 obj-$(CONFIG_GPIO_TWL4030) += twl4030-gpio.o
24 obj-$(CONFIG_GPIO_XILINX) += xilinx_gpio.o
25 obj-$(CONFIG_GPIO_BT8XX) += bt8xxgpio.o
26 +obj-$(CONFIG_GPIO_IFXMIPS_EBU) += ifxmips_ebu_gpio.o
27 Index: linux-2.6.30.10/arch/mips/ifxmips/board.c
28 ===================================================================
29 --- linux-2.6.30.10.orig/arch/mips/ifxmips/board.c 2010-03-25 10:43:06.000000000 +0100
30 +++ linux-2.6.30.10/arch/mips/ifxmips/board.c 2010-03-25 12:40:54.000000000 +0100
31 @@ -111,6 +111,11 @@
32 .name = "ifxmips_wdt",
33 };
34
35 +static struct platform_device ifxmips_ebu = {
36 + .id = 0,
37 + .name = "ifxmips_ebu",
38 +};
39 +
40 static struct resource ifxmips_mtd_resource = {
41 .start = IFXMIPS_FLASH_START,
42 .end = IFXMIPS_FLASH_START + IFXMIPS_FLASH_MAX - 1,
43 @@ -145,10 +150,18 @@
44 static struct gpio_led arv452_gpio_leds[] = {
45 { .name = "ifx:blue:power", .gpio = 3, .active_low = 1, },
46 { .name = "ifx:blue:adsl", .gpio = 4, .active_low = 1, },
47 - { .name = "ifx:pink:internet", .gpio = 5, .active_low = 1, },
48 + { .name = "ifx:blue:internet", .gpio = 5, .active_low = 1, },
49 { .name = "ifx:red:power", .gpio = 6, .active_low = 1, },
50 { .name = "ifx:yello:wps", .gpio = 7, .active_low = 1, },
51 { .name = "ifx:red:wps", .gpio = 9, .active_low = 1, },
52 + { .name = "ifx:blue:voip", .gpio = 32, .active_low = 1, },
53 + { .name = "ifx:blue:fxs1", .gpio = 33, .active_low = 1, },
54 + { .name = "ifx:blue:fxs2", .gpio = 34, .active_low = 1, },
55 + { .name = "ifx:blue:fxo", .gpio = 35, .active_low = 1, },
56 + { .name = "ifx:blue:voice", .gpio = 36, .active_low = 1, },
57 + { .name = "ifx:blue:usb", .gpio = 37, .active_low = 1, },
58 + { .name = "ifx:blue:wlan", .gpio = 38, .active_low = 1, },
59 + { .name = "ifx:red:internet", .gpio = 41, .active_low = 1, },
60 };
61
62 static struct gpio_led_platform_data ifxmips_gpio_led_data;
63 @@ -205,6 +218,7 @@
64 struct platform_device *arv452_devs[] = {
65 &ifxmips_gpio, &ifxmips_mii, &ifxmips_mtd,
66 &ifxmips_gpio_dev, &ifxmips_wdt, &dwc_usb,
67 + &ifxmips_ebu,
68 #ifdef CONFIG_LEDS_GPIO
69 &ifxmips_gpio_leds,
70 #endif
71 Index: linux-2.6.30.10/drivers/gpio/ifxmips_ebu_gpio.c
72 ===================================================================
73 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
74 +++ linux-2.6.30.10/drivers/gpio/ifxmips_ebu_gpio.c 2010-03-25 12:47:07.000000000 +0100
75 @@ -0,0 +1,121 @@
76 +/*
77 + * This program is free software; you can redistribute it and/or modify
78 + * it under the terms of the GNU General Public License as published by
79 + * the Free Software Foundation; either version 2 of the License, or
80 + * (at your option) any later version.
81 + *
82 + * This program is distributed in the hope that it will be useful,
83 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
84 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
85 + * GNU General Public License for more details.
86 + *
87 + * You should have received a copy of the GNU General Public License
88 + * along with this program; if not, write to the Free Software
89 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
90 + *
91 + * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
92 + */
93 +
94 +#include <linux/init.h>
95 +#include <linux/platform_device.h>
96 +#include <linux/mutex.h>
97 +#include <linux/gpio.h>
98 +#include <ifxmips.h>
99 +
100 +#define IFXMIPS_EBU_START 0x14000000
101 +#define IFXMIPS_EBU_MAX 0x00001000
102 +#define IFXMIPS_EBU_BUSCON 0x1e7ff
103 +#define IFXMIPS_EBU_WP 0x80000000
104 +
105 +static int shadow = (1 << 10) | (1 << 8);
106 +static void __iomem *virt;
107 +
108 +static int
109 +ifxmips_ebu_direction_input(struct gpio_chip *chip, unsigned offset)
110 +{
111 + return -EINVAL;
112 +}
113 +
114 +static int
115 +ifxmips_ebu_direction_output(struct gpio_chip *chip, unsigned offset, int value)
116 +{
117 + return 0;
118 +}
119 +
120 +static int
121 +ifxmips_ebu_get(struct gpio_chip *chip, unsigned offset)
122 +{
123 + return -EINVAL;
124 +}
125 +
126 +static void
127 +ifxmips_ebu_set(struct gpio_chip *chip, unsigned offset, int value)
128 +{
129 + if(value)
130 + shadow |= (1 << offset);
131 + else
132 + shadow &= ~(1 << offset);
133 + ifxmips_w32(IFXMIPS_EBU_BUSCON, IFXMIPS_EBU_BUSCON1);
134 + *((__u16*)virt) = shadow;
135 + ifxmips_w32(IFXMIPS_EBU_BUSCON | IFXMIPS_EBU_WP, IFXMIPS_EBU_BUSCON1);
136 +}
137 +
138 +static struct gpio_chip
139 +ifxmips_ebu_chip =
140 +{
141 + .label = "ifxmips_ebu",
142 + .direction_input = ifxmips_ebu_direction_input,
143 + .direction_output = ifxmips_ebu_direction_output,
144 + .set = ifxmips_ebu_set,
145 + .get = ifxmips_ebu_get,
146 + .base = 32,
147 + .ngpio = 16,
148 + .can_sleep = 1,
149 + .owner = THIS_MODULE,
150 +};
151 +
152 +static int __devinit
153 +ifxmips_ebu_probe(struct platform_device *dev)
154 +{
155 + ifxmips_w32(IFXMIPS_EBU_START | 0x1, IFXMIPS_EBU_ADDRSEL1);
156 + ifxmips_w32(IFXMIPS_EBU_BUSCON | IFXMIPS_EBU_WP, IFXMIPS_EBU_BUSCON1);
157 + virt = ioremap_nocache(IFXMIPS_EBU_START, IFXMIPS_EBU_MAX);
158 + if(gpiochip_add(&ifxmips_ebu_chip))
159 + return -EINVAL;
160 + return 0;
161 +}
162 +
163 +static int
164 +ifxmips_ebu_remove(struct platform_device *dev)
165 +{
166 + return gpiochip_remove(&ifxmips_ebu_chip);
167 +}
168 +
169 +static struct platform_driver
170 +ifxmips_ebu_driver = {
171 + .probe = ifxmips_ebu_probe,
172 + .remove = ifxmips_ebu_remove,
173 + .driver = {
174 + .name = "ifxmips_ebu",
175 + .owner = THIS_MODULE,
176 + },
177 +};
178 +
179 +static int __init
180 +ifxmips_ebu_init(void)
181 +{
182 + return platform_driver_register(&ifxmips_ebu_driver);
183 +}
184 +
185 +static void __exit
186 +ifxmips_ebu_exit(void)
187 +{
188 + platform_driver_unregister(&ifxmips_ebu_driver);
189 +}
190 +
191 +module_init(ifxmips_ebu_init);
192 +module_exit(ifxmips_ebu_exit);
193 +
194 +MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
195 +MODULE_LICENSE("GPL v2");
196 +MODULE_DESCRIPTION("ifxmips - EBU Latch GPIO-Expander");
This page took 0.050881 seconds and 5 git commands to generate.