]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux/nslu2-kernel/2.6.12/disk_led_blinking.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux / nslu2-kernel / 2.6.12 / disk_led_blinking.patch
1 --- linux-2.6.12.2/drivers/usb/core/hub.c.bak   2005-09-19 20:29:14.000000000 +0000
2 +++ linux-2.6.12.2/drivers/usb/core/hub.c       2005-09-19 20:30:44.000000000 +0000
3 @@ -1026,6 +1026,19 @@
4  
5         dev_info (&udev->dev, "USB disconnect, address %d\n", udev->devnum);
6  
7 +       // --- Forward-Ported Linksys Disk 1 & Disk 2 LED Control (Port done 16.Sept.05 by Philipp Kirchhofer) ---
8 +       // Copy & paste from nslu2-io.c
9 +       #define DISK1_OFF       0x00000008      //0b0000 0000 0000 1000
10 +       #define DISK2_OFF       0x00000004      //0b0000 0000 0000 0100
11 +       // Copy & Paste end
12 +
13 +       if (*udev->devpath == 0x31) {
14 +               *IXP4XX_GPIO_GPOUTR |= DISK1_OFF;
15 +       } else if (*udev->devpath == 0x32) {
16 +               *IXP4XX_GPIO_GPOUTR |= DISK2_OFF;
17 +       }
18 +       // --- End LED Control ---
19 +
20         /* Free up all the children before we remove this device */
21         for (i = 0; i < USB_MAXCHILDREN; i++) {
22                 if (udev->children[i])
23 @@ -2175,6 +2188,19 @@
24                         udev->bus->controller->driver->name,
25                         udev->devnum);
26  
27 +       // --- Start LED Control ---
28 +       // Copy & paste from nslu2-io.c
29 +       #define DISK1_ON        0xfffffff7      //0b1111 1111 1111 0111
30 +       #define DISK2_ON        0xfffffffb      //0b1111 1111 1111 1011
31 +       // Copy & Paste end
32 +
33 +       if (*udev->devpath == 0x31) {
34 +               *IXP4XX_GPIO_GPOUTR &= DISK1_ON;
35 +       } else if (*udev->devpath == 0x32) {
36 +               *IXP4XX_GPIO_GPOUTR &= DISK2_ON;
37 +       }
38 +       // --- End LED Control ---
39 +
40         /* Set up TT records, if needed  */
41         if (hdev->tt) {
42                 udev->tt = hdev->tt;
43 --- linux-2.6.12.2/drivers/usb/storage/transport.c.bak  2005-09-19 20:29:25.000000000 +0000
44 +++ linux-2.6.12.2/drivers/usb/storage/transport.c      2005-09-19 20:29:55.000000000 +0000
45 @@ -60,6 +60,60 @@
46  #include "scsiglue.h"
47  #include "debug.h"
48  
49 +// --- Forward-Ported Linksys Disk 1 & Disk 2 LED Activity Blinking Part 1 (Port done 16.Sept.05 by Philipp Kirchhofer) ---
50 +// Copy & Paste from nslu2-io.c
51 +#define DISK1_ON       0xfffffff7      //0b1111 1111 1111 0111
52 +#define DISK2_ON       0xfffffffb      //0b1111 1111 1111 1011
53 +
54 +#define DISK1_OFF      0x00000008      //0b0000 0000 0000 1000
55 +#define DISK2_OFF      0x00000004      //0b0000 0000 0000 0100
56 +// Copy & Paste End
57 +
58 +#define JIFFIES_BLINKING_TIME 6
59 +#define ON_LED_INTERVAL 3
60 +unsigned long turn_on_time;
61 +
62 +static struct timer_list usb1_led_timer;    /* ide led switch */
63 +static struct timer_list usb2_led_timer;    /* ide led switch */
64 +
65 +// Turns on Disk 1 LED
66 +static void turn_on_led_usb1(unsigned long ptr) {
67 +       *IXP4XX_GPIO_GPOUTR &= DISK1_ON; // 0xfff7
68 +       return;
69 +}
70 +
71 +// Turns on Disk 2 LED
72 +static void turn_on_led_usb2(unsigned long ptr) {
73 +       *IXP4XX_GPIO_GPOUTR &= DISK2_ON; // 0xfffb
74 +        return;
75 +}
76 +
77 +// Turns on Disk 1 LED after ON_LED_INTERVAL jiffies
78 +static void usb_1_led_timer(void) {
79 +       usb1_led_timer.expires = jiffies + ON_LED_INTERVAL;
80 +       add_timer(&usb1_led_timer);
81 +       return;
82 +}
83 +
84 +// Turns on Disk 2 LED after ON_LED_INTERVAL jiffies
85 +static void usb_2_led_timer(void) {
86 +        usb2_led_timer.expires = jiffies + ON_LED_INTERVAL;
87 +        add_timer(&usb2_led_timer);
88 +        return;
89 +}
90 +
91 +// Initializes Timers
92 +unsigned long initialized_timers = 0;
93 +static void initializeTimers() {
94 +       if (initialized_timers != 1) {
95 +               init_timer(&usb1_led_timer);
96 +               usb1_led_timer.function = turn_on_led_usb1;
97 +               init_timer(&usb2_led_timer);
98 +               usb2_led_timer.function = turn_on_led_usb2;
99 +               initialized_timers = 1;
100 +       }
101 +}
102 +// --- End Disk LED Activity Blinking Part 1 ---
103  
104  /***********************************************************************
105   * Data transfer routines
106 @@ -499,6 +553,21 @@
107  
108         /* are we scatter-gathering? */
109         if (use_sg) {
110 +               // --- Disk LED Activity Blinking Part 2 ---
111 +               initializeTimers();
112 +               if ((jiffies - turn_on_time) >= JIFFIES_BLINKING_TIME) {
113 +                       if (*us->pusb_dev->devpath == 0x31) {
114 +                               del_timer_sync(&usb1_led_timer);
115 +                               *IXP4XX_GPIO_GPOUTR |= DISK1_OFF;
116 +                               usb_1_led_timer();
117 +                       } else if (*us->pusb_dev->devpath == 0x32) {
118 +                               del_timer_sync(&usb2_led_timer);
119 +                               *IXP4XX_GPIO_GPOUTR |= DISK2_OFF;
120 +                               usb_2_led_timer();
121 +                       }
122 +                       turn_on_time = jiffies;
123 +               }
124 +               // --- End Disk LED Activity Blinking Part 2 ---
125                 /* use the usb core scatter-gather primitives */
126                 result = usb_stor_bulk_transfer_sglist(us, pipe,
127                                 (struct scatterlist *) buf, use_sg,