1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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,
|