+Index: linux-2.6.23.12/arch/arm/mach-ixp4xx/fsg-power.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23.12/arch/arm/mach-ixp4xx/fsg-power.c 2008-01-05 13:32:27.000000000 +1030
+@@ -0,0 +1,87 @@
++/*
++ * arch/arm/mach-ixp4xx/fsg-power.c
++ *
++ * FSG Power/Reset driver
++ *
++ * Copyright (C) 2008 Rod Whitby <rod@whitby.id.au>
++ *
++ * based on nslu2-power.c
++ * Copyright (C) 2005 Tower Technologies
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ */
++
++#include <linux/module.h>
++#include <linux/reboot.h>
++#include <linux/irq.h>
++#include <linux/interrupt.h>
++#include <linux/kernel.h>
++
++#include <asm/mach-types.h>
++
++static irqreturn_t fsg_power_handler(int irq, void *dev_id)
++{
++ /* Signal init to do the ctrlaltdel action, this will bypass init if
++ * it hasn't started and do a kernel_restart.
++ */
++ ctrl_alt_del();
++
++ return IRQ_HANDLED;
++}
++
++static irqreturn_t fsg_reset_handler(int irq, void *dev_id)
++{
++ /* This is the paper-clip reset, it shuts the machine down directly.
++ */
++ machine_power_off();
++
++ return IRQ_HANDLED;
++}
++
++static int __init fsg_power_init(void)
++{
++ if (!(machine_is_fsg()))
++ return 0;
++
++ set_irq_type(FSG_RB_IRQ, IRQT_LOW);
++ set_irq_type(FSG_SB_IRQ, IRQT_LOW);
++
++ if (request_irq(FSG_RB_IRQ, &fsg_reset_handler,
++ IRQF_DISABLED, "FSG reset button", NULL) < 0) {
++
++ printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
++ FSG_RB_IRQ);
++
++ return -EIO;
++ }
++
++ if (request_irq(FSG_SB_IRQ, &fsg_power_handler,
++ IRQF_DISABLED, "FSG power button", NULL) < 0) {
++
++ printk(KERN_DEBUG "Power Button IRQ %d not available\n",
++ FSG_SB_IRQ);
++
++ return -EIO;
++ }
++
++ return 0;
++}
++
++static void __exit fsg_power_exit(void)
++{
++ if (!(machine_is_fsg()))
++ return;
++
++ free_irq(FSG_SB_IRQ, NULL);
++ free_irq(FSG_RB_IRQ, NULL);
++}
++
++module_init(fsg_power_init);
++module_exit(fsg_power_exit);
++
++MODULE_AUTHOR("Rod Whitby <rod@whitby.id.au>");
++MODULE_DESCRIPTION("FSG Power/Reset driver");
++MODULE_LICENSE("GPL");
+Index: linux-2.6.23.12/drivers/leds/Kconfig
+===================================================================
+--- linux-2.6.23.12.orig/drivers/leds/Kconfig 2008-01-05 13:31:05.000000000 +1030
++++ linux-2.6.23.12/drivers/leds/Kconfig 2008-01-05 13:33:48.000000000 +1030
+@@ -48,6 +48,12 @@
+ particular board must have LEDs and they must be connected
+ to the GPIO lines. If unsure, say Y.
+
++config LEDS_FSG
++ tristate "LED Support for the Freecom FSG-3"
++ depends on LEDS_CLASS && MACH_FSG
++ help
++ This option enables support for the LEDs on the Freecom FSG-3.
++
+ config LEDS_TOSA
+ tristate "LED Support for the Sharp SL-6000 series"
+ depends on LEDS_CLASS && PXA_SHARPSL
+Index: linux-2.6.23.12/drivers/leds/Makefile
+===================================================================
+--- linux-2.6.23.12.orig/drivers/leds/Makefile 2008-01-05 13:31:04.000000000 +1030
++++ linux-2.6.23.12/drivers/leds/Makefile 2008-01-05 13:33:21.000000000 +1030
+@@ -9,6 +9,7 @@
+ obj-$(CONFIG_LEDS_LOCOMO) += leds-locomo.o
+ obj-$(CONFIG_LEDS_SPITZ) += leds-spitz.o
+ obj-$(CONFIG_LEDS_IXP4XX) += leds-ixp4xx-gpio.o
++obj-$(CONFIG_LEDS_FSG) += leds-fsg.o
+ obj-$(CONFIG_LEDS_TOSA) += leds-tosa.o
+ obj-$(CONFIG_LEDS_S3C24XX) += leds-s3c24xx.o
+ obj-$(CONFIG_LEDS_AMS_DELTA) += leds-ams-delta.o
+Index: linux-2.6.23.12/drivers/leds/leds-fsg.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.23.12/drivers/leds/leds-fsg.c 2008-01-05 13:31:52.000000000 +1030
+@@ -0,0 +1,243 @@
++/*
++ * LED Driver for the Freecom FSG-3
++ *
++ * Copyright (c) 2008 Rod Whitby <rod@whitby.id.au>
++ *
++ * Author: Rod Whitby <rod@whitby.id.au>
++ *
++ * Based on leds-spitz.c
++ * Copyright 2005-2006 Openedhand Ltd.
++ * Author: Richard Purdie <rpurdie@openedhand.com>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ */
++
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/leds.h>
++#include <asm/arch/hardware.h>
++#include <asm/io.h>
++
++static short __iomem *latch_address;
++static unsigned short latch_value;
++
++
++static void fsg_led_wlan_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ if (value) {
++ latch_value &= ~(1 << FSG_LED_WLAN_BIT);
++ *latch_address = latch_value;
++ }
++ else {
++ latch_value |= (1 << FSG_LED_WLAN_BIT);
++ *latch_address = latch_value;
++ }
++}
++
++static void fsg_led_wan_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ if (value) {
++ latch_value &= ~(1 << FSG_LED_WAN_BIT);
++ *latch_address = latch_value;
++ }
++ else {
++ latch_value |= (1 << FSG_LED_WAN_BIT);
++ *latch_address = latch_value;
++ }
++}
++
++static void fsg_led_sata_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ if (value) {
++ latch_value &= ~(1 << FSG_LED_SATA_BIT);
++ *latch_address = latch_value;
++ }
++ else {
++ latch_value |= (1 << FSG_LED_SATA_BIT);
++ *latch_address = latch_value;
++ }
++}
++
++static void fsg_led_usb_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ if (value) {
++ latch_value &= ~(1 << FSG_LED_USB_BIT);
++ *latch_address = latch_value;
++ }
++ else {
++ latch_value |= (1 << FSG_LED_USB_BIT);
++ *latch_address = latch_value;
++ }
++}
++
++static void fsg_led_sync_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ if (value) {
++ latch_value &= ~(1 << FSG_LED_SYNC_BIT);
++ *latch_address = latch_value;
++ }
++ else {
++ latch_value |= (1 << FSG_LED_SYNC_BIT);
++ *latch_address = latch_value;
++ }
++}
++
++static void fsg_led_ring_set(struct led_classdev *led_cdev, enum led_brightness value)
++{
++ if (value) {
++ latch_value &= ~(1 << FSG_LED_RING_BIT);
++ *latch_address = latch_value;
++ }
++ else {
++ latch_value |= (1 << FSG_LED_RING_BIT);
++ *latch_address = latch_value;
++ }
++}
++
++
++
++static struct led_classdev fsg_wlan_led = {
++ .name = "fsg:wlan",
++ .brightness_set = fsg_led_wlan_set,
++};
++
++static struct led_classdev fsg_wan_led = {
++ .name = "fsg:wan",
++ .brightness_set = fsg_led_wan_set,
++};
++
++static struct led_classdev fsg_sata_led = {
++ .name = "fsg:sata",
++ .brightness_set = fsg_led_sata_set,
++};
++
++static struct led_classdev fsg_usb_led = {
++ .name = "fsg:usb",
++ .brightness_set = fsg_led_usb_set,
++};
++
++static struct led_classdev fsg_sync_led = {
++ .name = "fsg:sync",
++ .brightness_set = fsg_led_sync_set,
++};
++
++static struct led_classdev fsg_ring_led = {
++ .name = "fsg:ring",
++ .brightness_set = fsg_led_ring_set,
++};
++
++
++
++#ifdef CONFIG_PM
++static int fsg_led_suspend(struct platform_device *dev, pm_message_t state)
++{
++ led_classdev_suspend(&fsg_wlan_led);
++ led_classdev_suspend(&fsg_wan_led);
++ led_classdev_suspend(&fsg_sata_led);
++ led_classdev_suspend(&fsg_usb_led);
++ led_classdev_suspend(&fsg_sync_led);
++ led_classdev_suspend(&fsg_ring_led);
++ return 0;
++}
++
++static int fsg_led_resume(struct platform_device *dev)
++{
++ led_classdev_resume(&fsg_wlan_led);
++ led_classdev_resume(&fsg_wan_led);
++ led_classdev_resume(&fsg_sata_led);
++ led_classdev_resume(&fsg_usb_led);
++ led_classdev_resume(&fsg_sync_led);
++ led_classdev_resume(&fsg_ring_led);
++ return 0;
++}
++#endif
++
++
++static int fsg_led_probe(struct platform_device *pdev)
++{
++ int ret;
++
++ /* FIXME: Need to work out how to handle failure below */
++
++ ret = led_classdev_register(&pdev->dev, &fsg_wlan_led);
++ if (ret < 0)
++ return ret;
++
++ ret = led_classdev_register(&pdev->dev, &fsg_wan_led);
++ if (ret < 0)
++ return ret;
++
++ ret = led_classdev_register(&pdev->dev, &fsg_sata_led);
++ if (ret < 0)
++ return ret;
++
++ ret = led_classdev_register(&pdev->dev, &fsg_usb_led);
++ if (ret < 0)
++ return ret;
++
++ ret = led_classdev_register(&pdev->dev, &fsg_sync_led);
++ if (ret < 0)
++ return ret;
++
++ ret = led_classdev_register(&pdev->dev, &fsg_ring_led);
++ if (ret < 0)
++ return ret;
++
++ return ret;
++}
++
++static int fsg_led_remove(struct platform_device *pdev)
++{
++ led_classdev_unregister(&fsg_wlan_led);
++ led_classdev_unregister(&fsg_wan_led);
++ led_classdev_unregister(&fsg_sata_led);
++ led_classdev_unregister(&fsg_usb_led);
++ led_classdev_unregister(&fsg_sync_led);
++ led_classdev_unregister(&fsg_ring_led);
++
++ return 0;
++}
++
++
++static struct platform_driver fsg_led_driver = {
++ .probe = fsg_led_probe,
++ .remove = fsg_led_remove,
++#ifdef CONFIG_PM
++ .suspend = fsg_led_suspend,
++ .resume = fsg_led_resume,
++#endif
++ .driver = {
++ .name = "fsg-led",
++ },
++};
++
++
++static int __init fsg_led_init(void)
++{
++ /* Map the LED chip select address space */
++ latch_address = (unsigned short *) ioremap(IXP4XX_EXP_BUS_BASE(2), 512);
++ if (!latch_address)
++ return -ENOMEM;
++ latch_value = 0xffff;
++ *latch_address = latch_value;
++ /* FIXME: We leak memory if the next line fails */
++ return platform_driver_register(&fsg_led_driver);
++}
++
++static void __exit fsg_led_exit(void)
++{
++ platform_driver_unregister(&fsg_led_driver);
++ iounmap(latch_address);
++}
++
++
++module_init(fsg_led_init);
++module_exit(fsg_led_exit);
++
++MODULE_AUTHOR("Rod Whitby <rod@whitby.id.au>");
++MODULE_DESCRIPTION("Freecom FSG-3 LED driver");
++MODULE_LICENSE("GPL");