1 diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
2 index 2f18a15..7a4f34b 100644
5 @@ -2174,6 +2174,12 @@ config GEOS
7 This option enables system support for the Traverse Technologies GEOS.
10 + bool "Soekris Engineering net5501 System Support (LEDS, GPIO, etc)"
13 + This option enables system support for the Soekris Engineering net5501.
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
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
28 index 0000000..66d377e
30 +++ b/arch/x86/platform/geode/net5501.c
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.
38 + * Copyright (C) 2008-2009 Tower Technologies
39 + * Written by Alessandro Zummo <a.zummo@towertech.it>
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>
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.
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>
61 +#include <asm/geode.h>
63 +#define BIOS_REGION_BASE 0xffff0000
64 +#define BIOS_REGION_SIZE 0x00010000
66 +static struct gpio_keys_button net5501_gpio_buttons[] = {
68 + .code = KEY_RESTART,
71 + .desc = "Reset button",
74 + .debounce_interval = 100,
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,
84 +static struct platform_device net5501_buttons_dev = {
85 + .name = "gpio-keys-polled",
88 + .platform_data = &net5501_buttons_data,
92 +static struct gpio_led net5501_leds[] = {
94 + .name = "net5501:1",
96 + .default_trigger = "default-on",
101 +static struct gpio_led_platform_data net5501_leds_data = {
102 + .num_leds = ARRAY_SIZE(net5501_leds),
103 + .leds = net5501_leds,
106 +static struct platform_device net5501_leds_dev = {
107 + .name = "leds-gpio",
109 + .dev.platform_data = &net5501_leds_data,
112 +static struct __initdata platform_device *net5501_devs[] = {
113 + &net5501_buttons_dev,
117 +static void __init register_net5501(void)
119 + /* Setup LED control through leds-gpio driver */
120 + platform_add_devices(net5501_devs, ARRAY_SIZE(net5501_devs));
123 +struct net5501_board {
129 +static struct net5501_board __initdata boards[] = {
130 + { 0xb7b, 7, "net5501" }, /* net5501 v1.33/1.33c */
131 + { 0xb1f, 7, "net5501" }, /* net5501 v1.32i */
134 +static bool __init net5501_present(void)
137 + unsigned char *rombase, *bios;
138 + bool found = false;
140 + rombase = ioremap(BIOS_REGION_BASE, BIOS_REGION_SIZE - 1);
142 + printk(KERN_ERR "%s: failed to get rombase\n", KBUILD_MODNAME);
146 + bios = rombase + 0x20; /* null terminated */
148 + if (memcmp(bios, "comBIOS", 7))
151 + for (i = 0; i < ARRAY_SIZE(boards); i++) {
152 + unsigned char *model = rombase + boards[i].offset;
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);
168 +static int __init net5501_init(void)
173 + if (!net5501_present())
176 + register_net5501();
181 +module_init(net5501_init);
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
193 - * Soekris board support code
195 - * Copyright (C) 2008-2009 Tower Technologies
196 - * Written by Alessandro Zummo <a.zummo@towertech.it>
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.
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>
212 -#include <asm/geode.h>
214 -static const struct gpio_led net5501_leds[] = {
218 - .default_trigger = "default-on",
222 -static struct gpio_led_platform_data net5501_leds_data = {
223 - .num_leds = ARRAY_SIZE(net5501_leds),
224 - .leds = net5501_leds,
227 -static struct platform_device net5501_leds_dev = {
228 - .name = "leds-gpio",
230 - .dev.platform_data = &net5501_leds_data,
233 -static void __init init_net5501(void)
235 - platform_device_register(&net5501_leds_dev);
238 -struct soekris_board {
242 - void (*init)(void);
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 */
250 -static int __init soekris_init(void)
253 - unsigned char *rombase, *bios;
258 - rombase = ioremap(0xffff0000, 0xffff);
260 - printk(KERN_INFO "Soekris net5501 LED driver failed to get rombase");
264 - bios = rombase + 0x20; /* null terminated */
266 - if (strncmp(bios, "comBIOS", 7))
269 - for (i = 0; i < ARRAY_SIZE(boards); i++) {
270 - unsigned char *model = rombase + boards[i].offset;
272 - if (strncmp(model, boards[i].sig, boards[i].len) == 0) {
273 - printk(KERN_INFO "Soekris %s: %s\n", model, bios);
275 - if (boards[i].init)
286 -arch_initcall(soekris_init);
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
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
302 - Add support for the Soekris net5501 board (detection, error led
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