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