73f326eb732e2e970035df22191e5d914849f9ff
[librecmc/librecmc.git] / target / linux / adm5120-2.6 / patches-2.6.22 / 005-adm5120_usb.patch
1 Index: linux-2.6.22.1/drivers/usb/core/hub.c
2 ===================================================================
3 --- linux-2.6.22.1.orig/drivers/usb/core/hub.c
4 +++ linux-2.6.22.1/drivers/usb/core/hub.c
5 @@ -464,7 +464,7 @@ void usb_hub_tt_clear_buffer (struct usb
6                         : (USB_ENDPOINT_XFER_BULK << 11);
7         if (usb_pipein (pipe))
8                 clear->devinfo |= 1 << 15;
9 -       
10 +
11         /* tell keventd to clear state for this TT */
12         spin_lock_irqsave (&tt->lock, flags);
13         list_add_tail (&clear->clear_list, &tt->clear_list);
14 @@ -540,7 +540,7 @@ static int hub_hub_status(struct usb_hub
15                         "%s failed (err = %d)\n", __FUNCTION__, ret);
16         else {
17                 *status = le16_to_cpu(hub->status->hub.wHubStatus);
18 -               *change = le16_to_cpu(hub->status->hub.wHubChange); 
19 +               *change = le16_to_cpu(hub->status->hub.wHubChange);
20                 ret = 0;
21         }
22         mutex_unlock(&hub->status_mutex);
23 @@ -1424,7 +1424,7 @@ static int hub_port_status(struct usb_hu
24                         ret = -EIO;
25         } else {
26                 *status = le16_to_cpu(hub->status->port.wPortStatus);
27 -               *change = le16_to_cpu(hub->status->port.wPortChange); 
28 +               *change = le16_to_cpu(hub->status->port.wPortChange);
29                 ret = 0;
30         }
31         mutex_unlock(&hub->status_mutex);
32 @@ -2007,7 +2007,7 @@ static inline int remote_wakeup(struct u
33   * Between connect detection and reset signaling there must be a delay
34   * of 100ms at least for debounce and power-settling.  The corresponding
35   * timer shall restart whenever the downstream port detects a disconnect.
36 - * 
37 + *
38   * Apparently there are some bluetooth and irda-dongles and a number of
39   * low-speed devices for which this debounce period may last over a second.
40   * Not covered by the spec - but easy to deal with.
41 @@ -2142,7 +2142,7 @@ hub_port_init (struct usb_hub *hub, stru
42                 goto fail;
43         }
44         oldspeed = udev->speed;
45 -  
46 +
47         /* USB 2.0 section 5.5.3 talks about ep0 maxpacket ...
48          * it's fixed size except for full speed devices.
49          * For Wireless USB devices, ep0 max packet is always 512 (tho
50 @@ -2168,7 +2168,7 @@ hub_port_init (struct usb_hub *hub, stru
51         default:
52                 goto fail;
53         }
54
55 +
56         type = "";
57         switch (udev->speed) {
58         case USB_SPEED_LOW:     speed = "low";  break;
59 @@ -2194,7 +2194,7 @@ hub_port_init (struct usb_hub *hub, stru
60                 udev->tt = &hub->tt;
61                 udev->ttport = port1;
62         }
63
64 +
65         /* Why interleave GET_DESCRIPTOR and SET_ADDRESS this way?
66          * Because device hardware and firmware is sometimes buggy in
67          * this area, and this is how Linux has done it for ages.
68 @@ -2230,6 +2230,8 @@ hub_port_init (struct usb_hub *hub, stru
69                                         USB_DT_DEVICE << 8, 0,
70                                         buf, GET_DESCRIPTOR_BUFSIZE,
71                                         USB_CTRL_GET_TIMEOUT);
72 +printk(KERN_CRIT "usb_control_msg: %d %d %d (%d)\n", r, buf->bMaxPacketSize0,
73 +buf->bDescriptorType, USB_DT_DEVICE);
74                                 switch (buf->bMaxPacketSize0) {
75                                 case 8: case 16: case 32: case 64: case 255:
76                                         if (buf->bDescriptorType ==
77 @@ -2281,7 +2283,7 @@ hub_port_init (struct usb_hub *hub, stru
78                                 udev->devnum, retval);
79                         goto fail;
80                 }
81
82 +
83                 /* cope with hardware quirkiness:
84                  *  - let SET_ADDRESS settle, some device hardware wants it
85                  *  - read ep0 maxpacket even for high and low speed,
86 @@ -2318,7 +2320,7 @@ hub_port_init (struct usb_hub *hub, stru
87                 udev->ep0.desc.wMaxPacketSize = cpu_to_le16(i);
88                 ep0_reinit(udev);
89         }
90 -  
91 +
92         retval = usb_get_device_descriptor(udev, USB_DT_DEVICE_SIZE);
93         if (retval < (signed)sizeof(udev->descriptor)) {
94                 dev_err(&udev->dev, "device descriptor read/%s, error %d\n",
95 @@ -2416,7 +2418,7 @@ static void hub_port_connect_change(stru
96         struct device *hub_dev = hub->intfdev;
97         u16 wHubCharacteristics = le16_to_cpu(hub->descriptor->wHubCharacteristics);
98         int status, i;
99
100 +
101         dev_dbg (hub_dev,
102                 "port %d, status %04x, change %04x, %s\n",
103                 port1, portstatus, portchange, portspeed (portstatus));
104 @@ -2425,7 +2427,7 @@ static void hub_port_connect_change(stru
105                 set_port_led(hub, port1, HUB_LED_AUTO);
106                 hub->indicator[port1-1] = INDICATOR_AUTO;
107         }
108
109 +
110         /* Disconnect any existing devices under this port */
111         if (hdev->children[port1-1])
112                 usb_disconnect(&hdev->children[port1-1]);
113 @@ -2455,7 +2457,7 @@ static void hub_port_connect_change(stru
114                 if ((wHubCharacteristics & HUB_CHAR_LPSM) < 2
115                                 && !(portstatus & (1 << USB_PORT_FEAT_POWER)))
116                         set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
117
118 +
119                 if (portstatus & USB_PORT_STAT_ENABLE)
120                         goto done;
121                 return;
122 @@ -2535,7 +2537,7 @@ static void hub_port_connect_change(stru
123                                 goto loop_disable;
124                         }
125                 }
126
127 +
128                 /* check for devices running slower than they could */
129                 if (le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0200
130                                 && udev->speed == USB_SPEED_FULL
131 @@ -2587,7 +2589,7 @@ loop:
132                 if (status == -ENOTCONN)
133                         break;
134         }
135
136 +
137  done:
138         hub_port_disable(hub, port1, 1);
139  }
140 @@ -2720,7 +2722,7 @@ static void hub_events(void)
141                                  * EM interference sometimes causes badly
142                                  * shielded USB devices to be shutdown by
143                                  * the hub, this hack enables them again.
144 -                                * Works at least with mouse driver. 
145 +                                * Works at least with mouse driver.
146                                  */
147                                 if (!(portstatus & USB_PORT_STAT_ENABLE)
148                                     && !connect_change
149 @@ -2750,7 +2752,7 @@ static void hub_events(void)
150                                         "resume on port %d, status %d\n",
151                                         i, ret);
152                         }
153 -                       
154 +
155                         if (portchange & USB_PORT_STAT_C_OVERCURRENT) {
156                                 dev_err (hub_dev,
157                                         "over-current change on port %d\n",
158 @@ -2985,7 +2987,7 @@ int usb_reset_device(struct usb_device *
159  
160         if (ret < 0)
161                 goto re_enumerate;
162
163 +
164         /* Device might have changed firmware (DFU or similar) */
165         if (memcmp(&udev->descriptor, &descriptor, sizeof descriptor)
166                         || config_descriptors_changed (udev)) {
167 @@ -2993,7 +2995,7 @@ int usb_reset_device(struct usb_device *
168                 udev->descriptor = descriptor;  /* for disconnect() calls */
169                 goto re_enumerate;
170         }
171 -  
172 +
173         if (!udev->actconfig)
174                 goto done;
175  
176 @@ -3031,7 +3033,7 @@ int usb_reset_device(struct usb_device *
177  
178  done:
179         return 0;
180
181 +
182  re_enumerate:
183         hub_port_logical_disconnect(parent_hub, port1);
184         return -ENODEV;
185 Index: linux-2.6.22.1/drivers/usb/host/Kconfig
186 ===================================================================
187 --- linux-2.6.22.1.orig/drivers/usb/host/Kconfig
188 +++ linux-2.6.22.1/drivers/usb/host/Kconfig
189 @@ -237,3 +237,6 @@ config USB_SL811_CS
190           To compile this driver as a module, choose M here: the
191           module will be called "sl811_cs".
192  
193 +config USB_ADM5120_HCD
194 +       tristate "ADM5120 HCD support"
195 +       depends on USB && MIPS_ADM5120
196 Index: linux-2.6.22.1/drivers/usb/host/Makefile
197 ===================================================================
198 --- linux-2.6.22.1.orig/drivers/usb/host/Makefile
199 +++ linux-2.6.22.1/drivers/usb/host/Makefile
200 @@ -8,6 +8,7 @@ endif
201  
202  obj-$(CONFIG_PCI)              += pci-quirks.o
203  
204 +obj-$(CONFIG_USB_ADM5120_HCD)  += adm5120-hcd.o
205  obj-$(CONFIG_USB_EHCI_HCD)     += ehci-hcd.o
206  obj-$(CONFIG_USB_ISP116X_HCD)  += isp116x-hcd.o
207  obj-$(CONFIG_USB_OHCI_HCD)     += ohci-hcd.o
208 Index: linux-2.6.22.1/drivers/usb/Kconfig
209 ===================================================================
210 --- linux-2.6.22.1.orig/drivers/usb/Kconfig
211 +++ linux-2.6.22.1/drivers/usb/Kconfig
212 @@ -88,8 +88,6 @@ source "drivers/usb/storage/Kconfig"
213  
214  source "drivers/usb/image/Kconfig"
215  
216 -source "drivers/usb/mon/Kconfig"
217 -
218  comment "USB port drivers"
219         depends on USB
220  
221 Index: linux-2.6.22.1/drivers/usb/Makefile
222 ===================================================================
223 --- linux-2.6.22.1.orig/drivers/usb/Makefile
224 +++ linux-2.6.22.1/drivers/usb/Makefile
225 @@ -16,6 +16,7 @@ obj-$(CONFIG_USB_UHCI_HCD)    += host/
226  obj-$(CONFIG_USB_SL811_HCD)    += host/
227  obj-$(CONFIG_USB_U132_HCD)     += host/
228  obj-$(CONFIG_USB_OHCI_AT91)    += host/
229 +obj-$(CONFIG_USB_ADM5120_HCD)          += host/
230  
231  obj-$(CONFIG_USB_ACM)          += class/
232  obj-$(CONFIG_USB_PRINTER)      += class/