From a9874386a8926f7d1c3779a5945877d24d7f795b Mon Sep 17 00:00:00 2001 From: Oyvind Repvik Date: Tue, 20 Sep 2005 00:25:14 +0000 Subject: nslu2-kernel: Add "disk_led_blinking.patch", to enable disk1/disk2 leds. --- .../nslu2-kernel/2.6.12/disk_led_blinking.patch | 127 +++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 packages/linux/nslu2-kernel/2.6.12/disk_led_blinking.patch (limited to 'packages/linux/nslu2-kernel/2.6.12') diff --git a/packages/linux/nslu2-kernel/2.6.12/disk_led_blinking.patch b/packages/linux/nslu2-kernel/2.6.12/disk_led_blinking.patch new file mode 100644 index 0000000000..7487cf3ee8 --- /dev/null +++ b/packages/linux/nslu2-kernel/2.6.12/disk_led_blinking.patch @@ -0,0 +1,127 @@ +--- linux-2.6.12.2/drivers/usb/core/hub.c.bak 2005-09-19 20:29:14.000000000 +0000 ++++ linux-2.6.12.2/drivers/usb/core/hub.c 2005-09-19 20:30:44.000000000 +0000 +@@ -1026,6 +1026,19 @@ + + dev_info (&udev->dev, "USB disconnect, address %d\n", udev->devnum); + ++ // --- Forward-Ported Linksys Disk 1 & Disk 2 LED Control (Port done 16.Sept.05 by Philipp Kirchhofer) --- ++ // Copy & paste from nslu2-io.c ++ #define DISK1_OFF 0x00000008 //0b0000 0000 0000 1000 ++ #define DISK2_OFF 0x00000004 //0b0000 0000 0000 0100 ++ // Copy & Paste end ++ ++ if (*udev->devpath == 0x31) { ++ *IXP4XX_GPIO_GPOUTR |= DISK1_OFF; ++ } else if (*udev->devpath == 0x32) { ++ *IXP4XX_GPIO_GPOUTR |= DISK2_OFF; ++ } ++ // --- End LED Control --- ++ + /* Free up all the children before we remove this device */ + for (i = 0; i < USB_MAXCHILDREN; i++) { + if (udev->children[i]) +@@ -2175,6 +2188,19 @@ + udev->bus->controller->driver->name, + udev->devnum); + ++ // --- Start LED Control --- ++ // Copy & paste from nslu2-io.c ++ #define DISK1_ON 0xfffffff7 //0b1111 1111 1111 0111 ++ #define DISK2_ON 0xfffffffb //0b1111 1111 1111 1011 ++ // Copy & Paste end ++ ++ if (*udev->devpath == 0x31) { ++ *IXP4XX_GPIO_GPOUTR &= DISK1_ON; ++ } else if (*udev->devpath == 0x32) { ++ *IXP4XX_GPIO_GPOUTR &= DISK2_ON; ++ } ++ // --- End LED Control --- ++ + /* Set up TT records, if needed */ + if (hdev->tt) { + udev->tt = hdev->tt; +--- linux-2.6.12.2/drivers/usb/storage/transport.c.bak 2005-09-19 20:29:25.000000000 +0000 ++++ linux-2.6.12.2/drivers/usb/storage/transport.c 2005-09-19 20:29:55.000000000 +0000 +@@ -60,6 +60,60 @@ + #include "scsiglue.h" + #include "debug.h" + ++// --- Forward-Ported Linksys Disk 1 & Disk 2 LED Activity Blinking Part 1 (Port done 16.Sept.05 by Philipp Kirchhofer) --- ++// Copy & Paste from nslu2-io.c ++#define DISK1_ON 0xfffffff7 //0b1111 1111 1111 0111 ++#define DISK2_ON 0xfffffffb //0b1111 1111 1111 1011 ++ ++#define DISK1_OFF 0x00000008 //0b0000 0000 0000 1000 ++#define DISK2_OFF 0x00000004 //0b0000 0000 0000 0100 ++// Copy & Paste End ++ ++#define JIFFIES_BLINKING_TIME 6 ++#define ON_LED_INTERVAL 3 ++unsigned long turn_on_time; ++ ++static struct timer_list usb1_led_timer; /* ide led switch */ ++static struct timer_list usb2_led_timer; /* ide led switch */ ++ ++// Turns on Disk 1 LED ++static void turn_on_led_usb1(unsigned long ptr) { ++ *IXP4XX_GPIO_GPOUTR &= DISK1_ON; // 0xfff7 ++ return; ++} ++ ++// Turns on Disk 2 LED ++static void turn_on_led_usb2(unsigned long ptr) { ++ *IXP4XX_GPIO_GPOUTR &= DISK2_ON; // 0xfffb ++ return; ++} ++ ++// Turns on Disk 1 LED after ON_LED_INTERVAL jiffies ++static void usb_1_led_timer(void) { ++ usb1_led_timer.expires = jiffies + ON_LED_INTERVAL; ++ add_timer(&usb1_led_timer); ++ return; ++} ++ ++// Turns on Disk 2 LED after ON_LED_INTERVAL jiffies ++static void usb_2_led_timer(void) { ++ usb2_led_timer.expires = jiffies + ON_LED_INTERVAL; ++ add_timer(&usb2_led_timer); ++ return; ++} ++ ++// Initializes Timers ++unsigned long initialized_timers = 0; ++static void initializeTimers() { ++ if (initialized_timers != 1) { ++ init_timer(&usb1_led_timer); ++ usb1_led_timer.function = turn_on_led_usb1; ++ init_timer(&usb2_led_timer); ++ usb2_led_timer.function = turn_on_led_usb2; ++ initialized_timers = 1; ++ } ++} ++// --- End Disk LED Activity Blinking Part 1 --- + + /*********************************************************************** + * Data transfer routines +@@ -499,6 +553,21 @@ + + /* are we scatter-gathering? */ + if (use_sg) { ++ // --- Disk LED Activity Blinking Part 2 --- ++ initializeTimers(); ++ if ((jiffies - turn_on_time) >= JIFFIES_BLINKING_TIME) { ++ if (*us->pusb_dev->devpath == 0x31) { ++ del_timer_sync(&usb1_led_timer); ++ *IXP4XX_GPIO_GPOUTR |= DISK1_OFF; ++ usb_1_led_timer(); ++ } else if (*us->pusb_dev->devpath == 0x32) { ++ del_timer_sync(&usb2_led_timer); ++ *IXP4XX_GPIO_GPOUTR |= DISK2_OFF; ++ usb_2_led_timer(); ++ } ++ turn_on_time = jiffies; ++ } ++ // --- End Disk LED Activity Blinking Part 2 --- + /* use the usb core scatter-gather primitives */ + result = usb_stor_bulk_transfer_sglist(us, pipe, + (struct scatterlist *) buf, use_sg, -- cgit v1.2.3