nslu2-kernel: Add "disk_led_blinking.patch", to enable disk1/disk2 leds.
authorOyvind Repvik <nail@nslu2-linux.org>
Tue, 20 Sep 2005 00:25:14 +0000 (00:25 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Tue, 20 Sep 2005 00:25:14 +0000 (00:25 +0000)
packages/linux/nslu2-kernel/2.6.12/disk_led_blinking.patch [new file with mode: 0644]
packages/linux/nslu2-kernel_2.6.12.2.bb

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 (file)
index 0000000..7487cf3
--- /dev/null
@@ -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,
index 41f35d7..6f0f400 100644 (file)
@@ -1,5 +1,5 @@
 # Kernel for NSLU2
-PR = "r15"
+PR = "r16"
 include nslu2-kernel.inc
 
 # N2K_EXTRA_PATCHES - list of patches to apply (can include
@@ -24,4 +24,5 @@ N2K_PATCHES = "\
        file://missing-exports.patch;patch=1 \
        file://timer.patch;patch=1 \
        file://nslu2-io_rpbutton.patch;patch=1 \
+       file://disk_led_blinking.patch;patch=1 \
 "