summaryrefslogtreecommitdiff
path: root/packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch
diff options
context:
space:
mode:
Diffstat (limited to 'packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch')
-rw-r--r--packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch439
1 files changed, 373 insertions, 66 deletions
diff --git a/packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch b/packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch
index c5b513c5e1..c0c8d51731 100644
--- a/packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch
+++ b/packages/linux/nslu2-kernel/2.6.14/50-nslu2-general.patch
@@ -1,15 +1,18 @@
---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/Makefile 2005-09-17 12:42:02.000000000 +0200
-+++ test6/arch/arm/mach-ixp4xx/Makefile 2005-09-28 21:58:36.000000000 +0200
-@@ -8,4 +8,6 @@
+--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/Makefile 2005-09-17 12:42:02.000000000 +0200
++++ test14/arch/arm/mach-ixp4xx/Makefile 2005-10-06 21:29:53.000000000 +0200
+@@ -8,4 +8,9 @@
obj-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o coyote-setup.o
obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o
obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o gtwx5715-setup.o
+obj-$(CONFIG_MACH_NSLU2) += nslu2-pci.o nslu2-setup.o nslu2-power.o nslu2-rtc.o nslu2-io.o
+
++leds-$(CONFIG_MACH_NSLU2) += nslu2-leds.o
++obj-$(CONFIG_LEDS) += $(leds-y)
++
---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/nslu2-rtc.c 1970-01-01 01:00:00.000000000 +0100
-+++ test6/arch/arm/mach-ixp4xx/nslu2-rtc.c 2005-09-28 03:02:42.000000000 +0200
-@@ -0,0 +1,108 @@
+--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-rtc.c 1970-01-01 01:00:00.000000000 +0100
++++ test14/arch/arm/mach-ixp4xx/nslu2-rtc.c 2005-10-06 21:29:53.000000000 +0200
+@@ -0,0 +1,113 @@
+/*
+ * arch/arm/mach-ixp4xx/nslu2-rtc.c
+ *
@@ -37,7 +40,7 @@
+#include <linux/x1205.h>
+
+#include <asm/rtc.h>
-+
++#include <asm/mach-types.h>
+
+extern int (*set_rtc)(void);
+
@@ -99,9 +102,14 @@
+
+static int __init nslu2_rtc_init(void)
+{
-+ int ret = register_rtc(&rtc_ops);
++ int ret;
+
-+ if (ret)
++ if (!(machine_is_nslu2()))
++ return 0;
++
++ printk(KERN_INFO "NSLU2: rtc\n");
++
++ if ((ret = register_rtc(&rtc_ops)) != 0)
+ return ret;
+
+ set_rtc = nslu2_set_rtc;
@@ -118,9 +126,9 @@
+
+module_init(nslu2_rtc_init);
+module_exit(nslu2_rtc_exit);
---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/nslu2-io.c 1970-01-01 01:00:00.000000000 +0100
-+++ test6/arch/arm/mach-ixp4xx/nslu2-io.c 2005-09-28 22:02:12.000000000 +0200
-@@ -0,0 +1,540 @@
+--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-io.c 1970-01-01 01:00:00.000000000 +0100
++++ test14/arch/arm/mach-ixp4xx/nslu2-io.c 2005-10-06 21:29:53.000000000 +0200
+@@ -0,0 +1,548 @@
+//=============================================================================
+//
+// n2-io.c version 0.1.7
@@ -172,6 +180,7 @@
+#define NSLU2BZ_MAJOR 62 //buzzer
+#define NSLU2LM_MAJOR 126
+
++
+#define NSLU2_BEEP_DUR_LONG 2000
+#define NSLU2_BEEP_DUR_MED 400
+#define NSLU2_BEEP_DUR_SHORT 100
@@ -180,7 +189,7 @@
+#define NSLU2_BEEP_PITCH_LOW 1000
+#define NSLU2_LONG_DELAY 30000
+
-+
++#define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ)
+
+// ioctls -- 'M" is used for sound cards...we don't got one so it seems safe
+
@@ -241,7 +250,6 @@
+#define LED_DISK2 3
+#define LED_ALL 4
+
-+static unsigned long init_jiffy = 0; /* jiffies at init time */
+static unsigned long ontime = 50;
+static unsigned long offtime = 450;
+static unsigned long bz_repeatcnt = 10;
@@ -264,6 +272,7 @@
+//
+//==================================================================================================
+// this blinks rs green or green/yellow if rs red is on
++#ifndef CONFIG_LEDS
+static void n2lm_rsg_handler(unsigned long data)
+{
+ *IXP4XX_GPIO_GPOUTR ^= RS_GRN_TGL; //flip the led
@@ -475,6 +484,7 @@
+ .owner = THIS_MODULE,
+ .ioctl = n2lm_ioctl,
+};
++#endif
+//==================================================================================================
+// We can't do anything fancy here since the system tick rate is far below that required to
+// generate a desirable tone. Therefore we haven't much choice but to use a busy loop until
@@ -577,29 +587,34 @@
+
+static void n2iom_initarch(void)
+{
-+ printk(KERN_DEBUG "setup_interrupts - jiffies=%ld init_jiffy=%ld\n", jiffies, init_jiffy);
-+
++#ifndef CONFIG_LEDS
+ init_timer(&n2lm_rsg_timer);
+ init_timer(&n2lm_rsr_timer);
+ init_timer(&n2lm_d1_timer);
+ init_timer(&n2lm_d2_timer);
-+ init_timer(&n2bz_timer);
+
+ n2lm_rsr_timer.function = n2lm_rsr_handler;
+ n2lm_rsg_timer.function = n2lm_rsg_handler;
+ n2lm_d2_timer.function = n2lm_d2_handler;
+ n2lm_d1_timer.function = n2lm_d1_handler;
++#endif
++
++ init_timer(&n2bz_timer);
+ n2bz_timer.function = n2bz_handler;
++
+ n2lm_rsr_timer.data = n2lm_rsg_timer.data = n2lm_d1_timer.data = n2lm_d2_timer.data = n2bz_timer.data = 0;
+
++#ifndef CONFIG_LEDS
+ *IXP4XX_GPIO_GPOER &= 0xfffffff0; //enable gpio 0-3
+ *IXP4XX_GPIO_GPOUTR |= 0x00000003; //turn off the leds
+ *IXP4XX_GPIO_GPOUTR &= 0xfffffffc;
+ n2lm_ledon(LED_ALL);
+ n2_buzz(NSLU2_BEEP_PITCH_MED, NSLU2_BEEP_DUR_SHORT);
+ n2lm_ledoff(LED_ALL);
-+// Default the Ready/Status to Red during kernel boot, Turn Green at the end of sysvinit
++
++ // Default the Ready/Status to Red during kernel boot, Turn Green at the end of sysvinit
+ n2lm_ledon(LED_RS_RED);
++#endif
+
+ return;
+}
@@ -608,14 +623,13 @@
+
+static int __init n2iom_init(void)
+{
-+ printk(KERN_INFO "NSLU2 I/O driver %s\n", VERSION);
++ printk(KERN_INFO "NSLU2: i/o, %s\n", VERSION);
+
-+ init_jiffy = jiffies;
-+ printk(KERN_DEBUG "init_jiffy=%ld\n",init_jiffy);
+ n2iom_initarch();
+
+ n2lm_class = class_create(THIS_MODULE, "nslu2");
+
++#ifndef CONFIG_LEDS
+ if (register_chrdev(NSLU2LM_MAJOR, "n2_ledm", &n2lm_fops) < 0) {
+ printk(KERN_DEBUG "Led Manager Major %d not available\n", NSLU2LM_MAJOR);
+ return -EBUSY;
@@ -623,6 +637,8 @@
+ else {
+ class_device_create(n2lm_class, MKDEV(NSLU2LM_MAJOR, 0), NULL, "leds");
+ }
++#endif
++
+ if (register_chrdev(NSLU2BZ_MAJOR, "n2_bzm", &n2bz_fops) < 0) {
+ printk(KERN_DEBUG "Buzzer Major %d not available\n", NSLU2BZ_MAJOR);
+ return -EBUSY;
@@ -638,6 +654,8 @@
+
+static void __exit n2iom_exit(void)
+{
++
++#ifndef CONFIG_LEDS
+ del_timer(&n2lm_rsg_timer);
+ del_timer(&n2lm_rsr_timer);
+ del_timer(&n2lm_d1_timer);
@@ -645,6 +663,7 @@
+
+ unregister_chrdev(NSLU2LM_MAJOR, "n2lm" );
+ class_device_destroy(n2lm_class, MKDEV(NSLU2LM_MAJOR, 0));
++#endif
+
+ unregister_chrdev(NSLU2BZ_MAJOR, "n2bz");
+ class_device_destroy(n2lm_class, MKDEV(NSLU2BZ_MAJOR, 0));
@@ -652,18 +671,15 @@
+ class_destroy(n2lm_class);
+}
+
-+module_init (n2iom_init);
-+module_exit (n2iom_exit);
++module_init(n2iom_init);
++module_exit(n2iom_exit);
+
+MODULE_AUTHOR("Karen Spearel <kas11@tampabay.rr.com>");
+MODULE_DESCRIPTION("NSLU2 I/O driver");
+MODULE_LICENSE("GPL");
-+static int debug = 7;
-+module_param(debug, int, 0644);
-+MODULE_PARM_DESC(debug, "Debugging enabled = 8");
---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/nslu2-setup.c 1970-01-01 01:00:00.000000000 +0100
-+++ test6/arch/arm/mach-ixp4xx/nslu2-setup.c 2005-09-27 20:19:14.000000000 +0200
-@@ -0,0 +1,131 @@
+--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-setup.c 1970-01-01 01:00:00.000000000 +0100
++++ test14/arch/arm/mach-ixp4xx/nslu2-setup.c 2005-10-06 21:29:53.000000000 +0200
+@@ -0,0 +1,134 @@
+/*
+ * arch/arm/mach-ixp4xx/nslu2-setup.c
+ *
@@ -771,8 +787,11 @@
+{
+ /* This causes the box to drop the power and go dead. */
+
-+ *IXP4XX_GPIO_GPOER &= ~NSLU2_PO_BM; /* enable the pwr cntl gpio */
-+ *IXP4XX_GPIO_GPOUTR |= NSLU2_PO_BM; /* do the deed */
++ /* enable the pwr cntl gpio */
++ gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT);
++
++ /* do the deed */
++ gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
+}
+
+static void __init nslu2_init(void)
@@ -795,8 +814,8 @@
+ .timer = &ixp4xx_timer,
+ .init_machine = nslu2_init,
+MACHINE_END
---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/nslu2-pci.c 1970-01-01 01:00:00.000000000 +0100
-+++ test6/arch/arm/mach-ixp4xx/nslu2-pci.c 2005-09-27 20:19:14.000000000 +0200
+--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-pci.c 1970-01-01 01:00:00.000000000 +0100
++++ test14/arch/arm/mach-ixp4xx/nslu2-pci.c 2005-10-06 21:29:53.000000000 +0200
@@ -0,0 +1,78 @@
+/*
+ * arch/arm/mach-ixp4xx/nslu2-pci.c
@@ -876,9 +895,9 @@
+}
+
+subsys_initcall(nslu2_pci_init);
---- linux-2.6.14-rc2/arch/arm/mach-ixp4xx/nslu2-power.c 1970-01-01 01:00:00.000000000 +0100
-+++ test6/arch/arm/mach-ixp4xx/nslu2-power.c 2005-09-28 03:03:11.000000000 +0200
-@@ -0,0 +1,98 @@
+--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-power.c 1970-01-01 01:00:00.000000000 +0100
++++ test14/arch/arm/mach-ixp4xx/nslu2-power.c 2005-10-06 21:39:43.000000000 +0200
+@@ -0,0 +1,92 @@
+/*
+ * arch/arm/mach-ixp4xx/nslu2-power.c
+ *
@@ -902,17 +921,12 @@
+#include <linux/reboot.h>
+#include <linux/interrupt.h>
+
-+static int nslu2_shutdown_in_progress = 0;
++#include <asm/mach-types.h>
+
+static irqreturn_t nslu2_power_handler(int irq, void *dev_id, struct pt_regs *regs)
+{
-+ /* FIXME init will start a shutdown but the machine
-+ * will actually reboot at the end
-+ */
-+
-+ if (!nslu2_shutdown_in_progress++) {
-+ kill_proc(1, SIGINT, 1); /* Signal init to shut down */
-+ }
++ /* Signal init to do the ctrlaltdel action */
++ kill_proc(1, SIGINT, 1);
+
+ return IRQ_HANDLED;
+}
@@ -930,7 +944,10 @@
+
+static int __init nslu2_power_init(void)
+{
-+ printk(KERN_INFO "NSLU2 Power/Reset\n");
++ if (!(machine_is_nslu2()))
++ return 0;
++
++ printk(KERN_INFO "NSLU2: power/reset\n");
+
+ *IXP4XX_GPIO_GPISR = 0x20400000; /* read the 2 irqs to clr */
+
@@ -940,9 +957,8 @@
+ gpio_line_isr_clear(NSLU2_RB_GPIO);
+ gpio_line_isr_clear(NSLU2_PB_GPIO);
+
-+
+ if (request_irq(NSLU2_RB_IRQ, &nslu2_reset_handler,
-+ SA_INTERRUPT, "NSLU2 reset button", NULL) < 0) {
++ SA_INTERRUPT, "NSLU2 reset button", NULL) < 0) {
+
+ printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
+ NSLU2_RB_IRQ);
@@ -951,16 +967,13 @@
+ }
+
+ if (request_irq(NSLU2_PB_IRQ, &nslu2_power_handler,
-+ SA_INTERRUPT, "NSLU2 power button", NULL) < 0) {
++ SA_INTERRUPT, "NSLU2 power button", NULL) < 0) {
+
+ printk(KERN_DEBUG "Power Button IRQ %d not available\n",
+ NSLU2_PB_IRQ);
+
+ return -EIO;
+ }
-+
-+ enable_irq(NSLU2_PB_IRQ);
-+ enable_irq(NSLU2_RB_IRQ);
+
+ return 0;
+}
@@ -971,15 +984,15 @@
+ free_irq(NSLU2_PB_IRQ, NULL);
+}
+
-+module_init (nslu2_power_init);
-+module_exit (nslu2_power_exit);
++module_init(nslu2_power_init);
++module_exit(nslu2_power_exit);
+
+MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
+MODULE_DESCRIPTION("NSLU2 Power/Reset driver");
+MODULE_LICENSE("GPL");
---- linux-2.6.14-rc2/include/asm-arm/arch-ixp4xx/nslu2.h 1970-01-01 01:00:00.000000000 +0100
-+++ test6/include/asm-arm/arch-ixp4xx/nslu2.h 2005-09-27 20:39:35.000000000 +0200
-@@ -0,0 +1,59 @@
+--- linux-2.6.14-rc3/include/asm-arm/arch-ixp4xx/nslu2.h 1970-01-01 01:00:00.000000000 +0100
++++ test14/include/asm-arm/arch-ixp4xx/nslu2.h 2005-10-06 21:29:53.000000000 +0200
+@@ -0,0 +1,96 @@
+/*
+ * include/asm-arm/arch-ixp4xx/nslu2.h
+ *
@@ -1027,15 +1040,309 @@
+
+/* GPIO */
+
-+#define NSLU2_BZ_GPIO 4
-+#define NSLU2_PB_GPIO 5
-+#define NSLU2_PO_GPIO 8 /* power off */
-+#define NSLU2_RB_GPIO 12
++#define NSLU2_GPIO0 0
++#define NSLU2_GPIO1 1
++#define NSLU2_GPIO2 2
++#define NSLU2_GPIO3 3
++#define NSLU2_GPIO4 4
++#define NSLU2_GPIO5 5
++#define NSLU2_GPIO6 6
++#define NSLU2_GPIO7 7
++#define NSLU2_GPIO8 8
++#define NSLU2_GPIO9 9
++#define NSLU2_GPIO10 10
++#define NSLU2_GPIO11 11
++#define NSLU2_GPIO12 12
++#define NSLU2_GPIO13 13
++#define NSLU2_GPIO14 14
++#define NSLU2_GPIO15 15
++
++/* Buttons */
++
++#define NSLU2_PB_GPIO NSLU2_GPIO5
++#define NSLU2_PO_GPIO NSLU2_GPIO8 /* power off */
++#define NSLU2_RB_GPIO NSLU2_GPIO12
++
++#define NSLU2_PB_IRQ IRQ_IXP4XX_GPIO5
++#define NSLU2_RB_IRQ IRQ_IXP4XX_GPIO12
++
++#define NSLU2_PB_BM (1L << NSLU2_PB_GPIO)
++#define NSLU2_PO_BM (1L << NSLU2_PO_GPIO)
++#define NSLU2_RB_BM (1L << NSLU2_RB_GPIO)
++
++/* Buzzer */
++
++#define NSLU2_GPIO_BUZZ 4
++#define NSLU2_BZ_BM (1L << NSLU2_GPIO_BUZZ)
++/* LEDs */
++
++#define NSLU2_LED_RED NSLU2_GPIO0
++#define NSLU2_LED_GRN NSLU2_GPIO1
++
++#define NSLU2_LED_RED_BM (1L << NSLU2_LED_RED)
++#define NSLU2_LED_GRN_BM (1L << NSLU2_LED_GRN)
++
++#define NSLU2_LED_DISK1 NSLU2_GPIO2
++#define NSLU2_LED_DISK2 NSLU2_GPIO3
++
++#define NSLU2_LED_DISK1_BM (1L << NSLU2_GPIO2)
++#define NSLU2_LED_DISK2_BM (1L << NSLU2_GPIO3)
++
++
+--- linux-2.6.14-rc3/arch/arm/Kconfig 2005-10-01 13:46:47.000000000 +0200
++++ test14/arch/arm/Kconfig 2005-10-06 21:29:53.000000000 +0200
+@@ -389,7 +389,8 @@
+ ARCH_EBSA285 || ARCH_IMX || ARCH_INTEGRATOR || \
+ ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \
+ ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \
+- ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE
++ ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE || \
++ MACH_NSLU2
+ help
+ If you say Y here, the LEDs on your machine will be used
+ to provide useful information about your current system status.
+@@ -403,7 +404,7 @@
+
+ config LEDS_TIMER
+ bool "Timer LED" if (!ARCH_CDB89712 && !ARCH_OMAP) || \
+- MACH_OMAP_H2 || MACH_OMAP_PERSEUS2
++ MACH_OMAP_H2 || MACH_OMAP_PERSEUS2 || MACH_NSLU2
+ depends on LEDS
+ default y if ARCH_EBSA110
+ help
+@@ -419,7 +420,8 @@
+
+ config LEDS_CPU
+ bool "CPU usage LED" if (!ARCH_CDB89712 && !ARCH_EBSA110 && \
+- !ARCH_OMAP) || MACH_OMAP_H2 || MACH_OMAP_PERSEUS2
++ !ARCH_OMAP) || MACH_OMAP_H2 || MACH_OMAP_PERSEUS2 \
++ || MACH_NSLU2
+ depends on LEDS
+ help
+ If you say Y here, the red LED will be used to give a good real
+--- linux-2.6.14-rc3/arch/arm/mach-ixp4xx/nslu2-leds.c 1970-01-01 01:00:00.000000000 +0100
++++ test14/arch/arm/mach-ixp4xx/nslu2-leds.c 2005-10-06 21:29:53.000000000 +0200
+@@ -0,0 +1,223 @@
++/*
++ * arch/arm/mach-ixp4xx/nslu2-leds.c
++ *
++ * NSLU2 LEDs driver
++ *
++ * Copyright (C) 2005 Tower Technologies
++ *
++ * based on nslu2-io.c
++ * Copyright (C) 2004 Karen Spearel
++ * and arch/arm/mach-footbridge/netwinder-leds.c
++ * Copyright (C) 1998-1999 Russell King
++ *
++ * Author: Alessandro Zummo <a.zummo@towertech.it>
++ * Maintainers: http://www.nslu2-linux.org/
++ *
++ * 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/config.h>
++#include <linux/module.h>
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/spinlock.h>
++#include <linux/notifier.h>
++
++#include <asm/hardware.h>
++#include <asm/leds.h>
++#include <asm/mach-types.h>
++#include <asm/system.h>
++
++#define LED_STATE_ENABLED 0x01
++#define LED_STATE_CLAIMED 0x02
++#define LED_STATE_IDLE 0x04
++
++static unsigned char led_state;
++static unsigned int hw_led_state;
++
++static const unsigned long idle_seq[4] = {
++
++ NSLU2_LED_GRN_BM, 0,
++ NSLU2_LED_GRN_BM, 0,
++};
++
++static const unsigned long busy_seq[4] = {
++
++ NSLU2_LED_GRN_BM, 0,
++ NSLU2_LED_GRN_BM | NSLU2_LED_RED_BM, 0,
++};
++
++static unsigned char led_count = 0;
++
++static DEFINE_SPINLOCK(leds_lock);
++extern spinlock_t gpio_lock;
++
++static void nslu2_leds_event(led_event_t evt)
++{
++ unsigned long flags;
++
++ spin_lock_irqsave(&leds_lock, flags);
++
++ switch (evt) {
++ case led_start:
++ /* Let's rock! Red led on, all others off. Remember
++ * that disk1/disk2 works inverted. On the NSLU2, the
++ * interface starts in a claimed state. XXX
++ */
++ led_state = LED_STATE_ENABLED | LED_STATE_CLAIMED;
++ hw_led_state = NSLU2_LED_DISK1_BM | NSLU2_LED_DISK2_BM
++ | NSLU2_LED_RED_BM;
++ break;
++
++ case led_stop:
++ led_state &= ~LED_STATE_ENABLED;
++ break;
++
++ case led_claim:
++ /* The user claimed the interface, red and green off */
++ led_state |= LED_STATE_CLAIMED;
++ hw_led_state &= ~(NSLU2_LED_RED_BM | NSLU2_LED_GRN_BM);
++ break;
++
++ case led_release:
++ /* The user released the interface, preserve the last
++ * status of the leds, except red/green.
++ */
++ led_state &= ~LED_STATE_CLAIMED;
++ hw_led_state = *IXP4XX_GPIO_GPOUTR & 0x0000000C;
++ break;
++
++#ifdef CONFIG_LEDS_TIMER
++ case led_timer:
++ /* Pulse green led */
++ if (!(led_state & LED_STATE_CLAIMED))
++ {
++ /* clear red and green bits */
++ hw_led_state &= ~(NSLU2_LED_RED_BM | NSLU2_LED_GRN_BM);
++
++ /* copy the right sequence in */
++ if (led_state & LED_STATE_IDLE)
++ hw_led_state |= idle_seq[led_count % 4];
++ else
++ hw_led_state |= busy_seq[led_count % 4];
++
++ led_count++;
++ }
++ break;
++#endif
++
++#ifdef CONFIG_LEDS_CPU
++
++ case led_idle_start:
++ led_state |= LED_STATE_IDLE;
++#ifndef CONFIG_LEDS_TIMER
++ /* green on, red off */
++ hw_led_state |= NSLU2_LED_GRN_BM;
++ hw_led_state &= ~NSLU2_LED_RED_BM;
++#endif
++ break;
++
++ case led_idle_end:
++ led_state &= ~LED_STATE_IDLE;
++#ifndef CONFIG_LEDS_TIMER
++ /* green on, red on -> amber on */
++ hw_led_state |= NSLU2_LED_GRN_BM | NSLU2_LED_RED_BM;
++#endif
++ break;
++#endif
++
++ case led_halted:
++ if (!(led_state & LED_STATE_CLAIMED))
++ hw_led_state |= NSLU2_LED_RED_BM;
++ break;
++
++ /* leds */
++
++ case led_green_on:
++ if (led_state & LED_STATE_CLAIMED)
++ hw_led_state |= NSLU2_LED_GRN_BM;
++ break;
++
++ case led_green_off:
++ if (led_state & LED_STATE_CLAIMED)
++ hw_led_state &= ~NSLU2_LED_GRN_BM;
++ break;
++
++ case led_amber_on:
++ if (led_state & LED_STATE_CLAIMED)
++ hw_led_state |= (NSLU2_LED_RED_BM | NSLU2_LED_GRN_BM);
++ break;
++
++ case led_amber_off:
++ if (led_state & LED_STATE_CLAIMED)
++ hw_led_state &= ~(NSLU2_LED_RED_BM | NSLU2_LED_GRN_BM);
++ break;
++
++ case led_red_on:
++ if (led_state & LED_STATE_CLAIMED)
++ hw_led_state |= NSLU2_LED_RED_BM;
++ break;
++
++ case led_red_off:
++ if (led_state & LED_STATE_CLAIMED)
++ hw_led_state &= ~NSLU2_LED_RED_BM;
++ break;
++
++ default:
++ break;
++ }
++
++ spin_unlock_irqrestore(&leds_lock, flags);
++
++ if (led_state & LED_STATE_ENABLED) {
++ spin_lock_irqsave(&gpio_lock, flags);
++ *IXP4XX_GPIO_GPOUTR = (*IXP4XX_GPIO_GPOUTR & 0xFFFFFFF0) | hw_led_state;
++ spin_unlock_irqrestore(&gpio_lock, flags);
++ }
++}
++
++static int nslu2_leds_panic_event(struct notifier_block *this, unsigned long event,
++ void *ptr)
++{
++ leds_event(led_green_off);
++ leds_event(led_red_on);
++
++ return NOTIFY_DONE;
++}
++
++static struct notifier_block nslu2_leds_panic_block = {
++ .notifier_call = nslu2_leds_panic_event,
++};
++
++static int __init nslu2_leds_init(void)
++{
++ if (!(machine_is_nslu2()))
++ return 0;
++
++ printk(KERN_INFO "NSLU2: leds\n");
++
++ /* register panic notifier */
++ notifier_chain_register(&panic_notifier_list, &nslu2_leds_panic_block);
++
++ /* enable gpio 0-3 */
++ gpio_line_config(NSLU2_LED_GRN, IXP4XX_GPIO_OUT);
++ gpio_line_config(NSLU2_LED_RED, IXP4XX_GPIO_OUT);
++ gpio_line_config(NSLU2_LED_DISK1, IXP4XX_GPIO_OUT);
++ gpio_line_config(NSLU2_LED_DISK2, IXP4XX_GPIO_OUT);
++
++ leds_event = nslu2_leds_event;
++
++ /* this will also initialize the leds to the
++ * default state.
++ */
++
++ leds_event(led_start);
++
++ return 0;
++}
+
-+#define NSLU2_PB_IRQ 22 /* gpio5 */
-+#define NSLU2_RB_IRQ 29 /* gpio12 */
++module_init(nslu2_leds_init);
+
-+#define NSLU2_BZ_BM 0x0010 /* b0000 0000 0001 0000 */
-+#define NSLU2_PB_BM 0x0020 /* b0000 0000 0010 0000 */
-+#define NSLU2_PO_BM 0x0100 /* b0000 0001 0000 0000 */
-+#define NSLU2_RB_BM 0x1000 /* b0001 0000 0000 0000 */