12972146412b55cb75648c5051830a1aa7452686
[openwrt.git] / target / linux / x86 / patches-3.2 / 005-net5501_platform.patch
1 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
2 index 2f18a15..7a4f34b 100644
3 --- a/arch/x86/Kconfig
4 +++ b/arch/x86/Kconfig
5 @@ -2174,6 +2174,12 @@ config GEOS
6 ---help---
7 This option enables system support for the Traverse Technologies GEOS.
8
9 +config NET5501
10 + bool "Soekris Engineering net5501 System Support (LEDS, GPIO, etc)"
11 + select GPIOLIB
12 + ---help---
13 + This option enables system support for the Soekris Engineering net5501.
14 +
15 endif # X86_32
16
17 config AMD_NB
18 diff --git a/arch/x86/platform/geode/Makefile b/arch/x86/platform/geode/Makefile
19 index d8ba564..5b51194 100644
20 --- a/arch/x86/platform/geode/Makefile
21 +++ b/arch/x86/platform/geode/Makefile
22 @@ -1,2 +1,3 @@
23 obj-$(CONFIG_ALIX) += alix.o
24 +obj-$(CONFIG_NET5501) += net5501.o
25 obj-$(CONFIG_GEOS) += geos.o
26 diff --git a/arch/x86/platform/geode/net5501.c b/arch/x86/platform/geode/net5501.c
27 new file mode 100644
28 index 0000000..66d377e
29 --- /dev/null
30 +++ b/arch/x86/platform/geode/net5501.c
31 @@ -0,0 +1,154 @@
32 +/*
33 + * System Specific setup for Soekris net5501
34 + * At the moment this means setup of GPIO control of LEDs and buttons
35 + * on net5501 boards.
36 + *
37 + *
38 + * Copyright (C) 2008-2009 Tower Technologies
39 + * Written by Alessandro Zummo <a.zummo@towertech.it>
40 + *
41 + * Copyright (C) 2008 Constantin Baranov <const@mimas.ru>
42 + * Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com>
43 + * and Philip Prindeville <philipp@redfish-solutions.com>
44 + *
45 + * This program is free software; you can redistribute it and/or modify
46 + * it under the terms of the GNU General Public License version 2
47 + * as published by the Free Software Foundation.
48 + */
49 +
50 +#include <linux/kernel.h>
51 +#include <linux/init.h>
52 +#include <linux/io.h>
53 +#include <linux/string.h>
54 +#include <linux/module.h>
55 +#include <linux/leds.h>
56 +#include <linux/platform_device.h>
57 +#include <linux/gpio.h>
58 +#include <linux/input.h>
59 +#include <linux/gpio_keys.h>
60 +
61 +#include <asm/geode.h>
62 +
63 +#define BIOS_REGION_BASE 0xffff0000
64 +#define BIOS_REGION_SIZE 0x00010000
65 +
66 +static struct gpio_keys_button net5501_gpio_buttons[] = {
67 + {
68 + .code = KEY_RESTART,
69 + .gpio = 24,
70 + .active_low = 1,
71 + .desc = "Reset button",
72 + .type = EV_KEY,
73 + .wakeup = 0,
74 + .debounce_interval = 100,
75 + .can_disable = 0,
76 + }
77 +};
78 +static struct gpio_keys_platform_data net5501_buttons_data = {
79 + .buttons = net5501_gpio_buttons,
80 + .nbuttons = ARRAY_SIZE(net5501_gpio_buttons),
81 + .poll_interval = 20,
82 +};
83 +
84 +static struct platform_device net5501_buttons_dev = {
85 + .name = "gpio-keys-polled",
86 + .id = 1,
87 + .dev = {
88 + .platform_data = &net5501_buttons_data,
89 + }
90 +};
91 +
92 +static struct gpio_led net5501_leds[] = {
93 + {
94 + .name = "net5501:1",
95 + .gpio = 6,
96 + .default_trigger = "default-on",
97 + .active_low = 1,
98 + },
99 +};
100 +
101 +static struct gpio_led_platform_data net5501_leds_data = {
102 + .num_leds = ARRAY_SIZE(net5501_leds),
103 + .leds = net5501_leds,
104 +};
105 +
106 +static struct platform_device net5501_leds_dev = {
107 + .name = "leds-gpio",
108 + .id = -1,
109 + .dev.platform_data = &net5501_leds_data,
110 +};
111 +
112 +static struct __initdata platform_device *net5501_devs[] = {
113 + &net5501_buttons_dev,
114 + &net5501_leds_dev,
115 +};
116 +
117 +static void __init register_net5501(void)
118 +{
119 + /* Setup LED control through leds-gpio driver */
120 + platform_add_devices(net5501_devs, ARRAY_SIZE(net5501_devs));
121 +}
122 +
123 +struct net5501_board {
124 + u16 offset;
125 + u16 len;
126 + char *sig;
127 +};
128 +
129 +static struct net5501_board __initdata boards[] = {
130 + { 0xb7b, 7, "net5501" }, /* net5501 v1.33/1.33c */
131 + { 0xb1f, 7, "net5501" }, /* net5501 v1.32i */
132 +};
133 +
134 +static bool __init net5501_present(void)
135 +{
136 + int i;
137 + unsigned char *rombase, *bios;
138 + bool found = false;
139 +
140 + rombase = ioremap(BIOS_REGION_BASE, BIOS_REGION_SIZE - 1);
141 + if (!rombase) {
142 + printk(KERN_ERR "%s: failed to get rombase\n", KBUILD_MODNAME);
143 + return found;
144 + }
145 +
146 + bios = rombase + 0x20; /* null terminated */
147 +
148 + if (memcmp(bios, "comBIOS", 7))
149 + goto unmap;
150 +
151 + for (i = 0; i < ARRAY_SIZE(boards); i++) {
152 + unsigned char *model = rombase + boards[i].offset;
153 +
154 + if (!memcmp(model, boards[i].sig, boards[i].len)) {
155 + printk(KERN_INFO "%s: system is recognized as \"%s\"\n",
156 + KBUILD_MODNAME, model);
157 +
158 + found = true;
159 + break;
160 + }
161 + }
162 +
163 +unmap:
164 + iounmap(rombase);
165 + return found;
166 +}
167 +
168 +static int __init net5501_init(void)
169 +{
170 + if (!is_geode())
171 + return 0;
172 +
173 + if (!net5501_present())
174 + return 0;
175 +
176 + register_net5501();
177 +
178 + return 0;
179 +}
180 +
181 +module_init(net5501_init);
182 +
183 +MODULE_AUTHOR("Philip Prindeville <philipp@redfish-solutions.com>");
184 +MODULE_DESCRIPTION("Soekris net5501 System Setup");
185 +MODULE_LICENSE("GPL");
186 diff --git a/drivers/leds/leds-net5501.c b/drivers/leds/leds-net5501.c
187 deleted file mode 100644
188 index 0555d47..0000000
189 --- a/drivers/leds/leds-net5501.c
190 +++ /dev/null
191 @@ -1,97 +0,0 @@
192 -/*
193 - * Soekris board support code
194 - *
195 - * Copyright (C) 2008-2009 Tower Technologies
196 - * Written by Alessandro Zummo <a.zummo@towertech.it>
197 - *
198 - * This program is free software; you can redistribute it and/or modify
199 - * it under the terms of the GNU General Public License version 2
200 - * as published by the Free Software Foundation.
201 - */
202 -
203 -#include <linux/kernel.h>
204 -#include <linux/init.h>
205 -#include <linux/io.h>
206 -#include <linux/string.h>
207 -#include <linux/leds.h>
208 -#include <linux/platform_device.h>
209 -#include <linux/gpio.h>
210 -#include <linux/module.h>
211 -
212 -#include <asm/geode.h>
213 -
214 -static const struct gpio_led net5501_leds[] = {
215 - {
216 - .name = "error",
217 - .gpio = 6,
218 - .default_trigger = "default-on",
219 - },
220 -};
221 -
222 -static struct gpio_led_platform_data net5501_leds_data = {
223 - .num_leds = ARRAY_SIZE(net5501_leds),
224 - .leds = net5501_leds,
225 -};
226 -
227 -static struct platform_device net5501_leds_dev = {
228 - .name = "leds-gpio",
229 - .id = -1,
230 - .dev.platform_data = &net5501_leds_data,
231 -};
232 -
233 -static void __init init_net5501(void)
234 -{
235 - platform_device_register(&net5501_leds_dev);
236 -}
237 -
238 -struct soekris_board {
239 - u16 offset;
240 - char *sig;
241 - u8 len;
242 - void (*init)(void);
243 -};
244 -
245 -static struct soekris_board __initdata boards[] = {
246 - { 0xb7b, "net5501", 7, init_net5501 }, /* net5501 v1.33/1.33c */
247 - { 0xb1f, "net5501", 7, init_net5501 }, /* net5501 v1.32i */
248 -};
249 -
250 -static int __init soekris_init(void)
251 -{
252 - int i;
253 - unsigned char *rombase, *bios;
254 -
255 - if (!is_geode())
256 - return 0;
257 -
258 - rombase = ioremap(0xffff0000, 0xffff);
259 - if (!rombase) {
260 - printk(KERN_INFO "Soekris net5501 LED driver failed to get rombase");
261 - return 0;
262 - }
263 -
264 - bios = rombase + 0x20; /* null terminated */
265 -
266 - if (strncmp(bios, "comBIOS", 7))
267 - goto unmap;
268 -
269 - for (i = 0; i < ARRAY_SIZE(boards); i++) {
270 - unsigned char *model = rombase + boards[i].offset;
271 -
272 - if (strncmp(model, boards[i].sig, boards[i].len) == 0) {
273 - printk(KERN_INFO "Soekris %s: %s\n", model, bios);
274 -
275 - if (boards[i].init)
276 - boards[i].init();
277 - break;
278 - }
279 - }
280 -
281 -unmap:
282 - iounmap(rombase);
283 - return 0;
284 -}
285 -
286 -arch_initcall(soekris_init);
287 -
288 -MODULE_LICENSE("GPL");
289 --- a/drivers/leds/Kconfig 2012-01-29 23:22:59.487891522 -0700
290 +++ b/drivers/leds/Kconfig 2012-02-03 10:33:39.650202054 -0700
291 @@ -89,16 +89,6 @@ config LEDS_NET48XX
292 This option enables support for the Soekris net4801 and net4826 error
293 LED.
294
295 -config LEDS_NET5501
296 - tristate "LED Support for Soekris net5501 series Error LED"
297 - depends on LEDS_TRIGGERS
298 - depends on X86 && GPIO_CS5535
299 - select LEDS_TRIGGER_DEFAULT_ON
300 - default n
301 - help
302 - Add support for the Soekris net5501 board (detection, error led
303 - and GPIO).
304 -
305 config LEDS_FSG
306 tristate "LED Support for the Freecom FSG-3"
307 depends on LEDS_CLASS
308 --- a/drivers/leds/Makefile 2012-01-29 23:22:59.487891522 -0700
309 +++ b/drivers/leds/Makefile 2012-02-03 10:33:24.468430696 -0700
310 @@ -14,7 +14,6 @@ obj-$(CONFIG_LEDS_MIKROTIK_RB532) += led
311 obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o
312 obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o
313 obj-$(CONFIG_LEDS_NET48XX) += leds-net48xx.o
314 -obj-$(CONFIG_LEDS_NET5501) += leds-net5501.o
315 obj-$(CONFIG_LEDS_WRAP) += leds-wrap.o
316 obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o
317 obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o
This page took 0.05316 seconds and 3 git commands to generate.