aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2010-12-07 13:47:56 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-12-07 13:47:56 -0500
commitea3398a1ae54cd3403f3cc0f6aa498c7452c681a (patch)
tree19903cfd3eb11f6cdd84f3b6923e604028178150 /drivers/usb
parent03fa6fc5a68242ddd7cc3ba4255fe6f65b21ce41 (diff)
parentcf7d7e5a1980d1116ee152d25dac382b112b9c17 (diff)
Staging: Merge 2.6.37-rc5 into staging-next
This was done to handle a number of conflicts in the batman-adv and winbond drivers properly. It also now allows us to fix up the sysfs attributes properly that were not in the .37 release due to them being only in this tree at the time. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/atm/ueagle-atm.c7
-rw-r--r--drivers/usb/core/devices.c1
-rw-r--r--drivers/usb/core/devio.c1
-rw-r--r--drivers/usb/core/file.c1
-rw-r--r--drivers/usb/core/hcd.c2
-rw-r--r--drivers/usb/core/inode.c1
-rw-r--r--drivers/usb/gadget/atmel_usba_udc.c2
-rw-r--r--drivers/usb/gadget/f_fs.c1
-rw-r--r--drivers/usb/gadget/f_hid.c1
-rw-r--r--drivers/usb/host/ehci-dbg.c2
-rw-r--r--drivers/usb/host/ehci-hcd.c10
-rw-r--r--drivers/usb/host/ehci-mem.c26
-rw-r--r--drivers/usb/host/ehci-pci.c25
-rw-r--r--drivers/usb/host/ehci-sched.c21
-rw-r--r--drivers/usb/host/ehci.h2
-rw-r--r--drivers/usb/host/isp1362-hcd.c3
-rw-r--r--drivers/usb/host/uhci-debug.c1
-rw-r--r--drivers/usb/host/xhci-hub.c7
-rw-r--r--drivers/usb/host/xhci-mem.c168
-rw-r--r--drivers/usb/host/xhci-ring.c1
-rw-r--r--drivers/usb/host/xhci.c91
-rw-r--r--drivers/usb/host/xhci.h31
-rw-r--r--drivers/usb/image/microtek.c6
-rw-r--r--drivers/usb/misc/cypress_cy7c63.c6
-rw-r--r--drivers/usb/misc/trancevibrator.c2
-rw-r--r--drivers/usb/misc/usbled.c2
-rw-r--r--drivers/usb/misc/usbsevseg.c10
-rw-r--r--drivers/usb/misc/yurex.c1
-rw-r--r--drivers/usb/mon/mon_bin.c1
-rw-r--r--drivers/usb/mon/mon_stat.c1
-rw-r--r--drivers/usb/musb/musb_core.c3
-rw-r--r--drivers/usb/musb/musb_gadget.c124
-rw-r--r--drivers/usb/otg/langwell_otg.c9
-rw-r--r--drivers/usb/serial/ftdi_sio.c2
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h4
-rw-r--r--drivers/usb/serial/usb-serial.c4
-rw-r--r--drivers/usb/storage/scsiglue.c4
-rw-r--r--drivers/usb/storage/sierra_ms.c2
-rw-r--r--drivers/usb/storage/uas.c4
39 files changed, 489 insertions, 101 deletions
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index ea071a5b6eee..44447f54942f 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -2301,7 +2301,7 @@ out:
2301 return ret; 2301 return ret;
2302} 2302}
2303 2303
2304static DEVICE_ATTR(stat_status, S_IWUGO | S_IRUGO, read_status, reboot); 2304static DEVICE_ATTR(stat_status, S_IWUSR | S_IRUGO, read_status, reboot);
2305 2305
2306static ssize_t read_human_status(struct device *dev, 2306static ssize_t read_human_status(struct device *dev,
2307 struct device_attribute *attr, char *buf) 2307 struct device_attribute *attr, char *buf)
@@ -2364,8 +2364,7 @@ out:
2364 return ret; 2364 return ret;
2365} 2365}
2366 2366
2367static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, 2367static DEVICE_ATTR(stat_human_status, S_IRUGO, read_human_status, NULL);
2368 read_human_status, NULL);
2369 2368
2370static ssize_t read_delin(struct device *dev, struct device_attribute *attr, 2369static ssize_t read_delin(struct device *dev, struct device_attribute *attr,
2371 char *buf) 2370 char *buf)
@@ -2397,7 +2396,7 @@ out:
2397 return ret; 2396 return ret;
2398} 2397}
2399 2398
2400static DEVICE_ATTR(stat_delin, S_IWUGO | S_IRUGO, read_delin, NULL); 2399static DEVICE_ATTR(stat_delin, S_IRUGO, read_delin, NULL);
2401 2400
2402#define UEA_ATTR(name, reset) \ 2401#define UEA_ATTR(name, reset) \
2403 \ 2402 \
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
index ddb4dc980923..a3d2e2399655 100644
--- a/drivers/usb/core/devices.c
+++ b/drivers/usb/core/devices.c
@@ -54,7 +54,6 @@
54#include <linux/gfp.h> 54#include <linux/gfp.h>
55#include <linux/poll.h> 55#include <linux/poll.h>
56#include <linux/usb.h> 56#include <linux/usb.h>
57#include <linux/smp_lock.h>
58#include <linux/usbdevice_fs.h> 57#include <linux/usbdevice_fs.h>
59#include <linux/usb/hcd.h> 58#include <linux/usb/hcd.h>
60#include <linux/mutex.h> 59#include <linux/mutex.h>
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 045bb4b823e1..a7131ad630f9 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -37,7 +37,6 @@
37#include <linux/fs.h> 37#include <linux/fs.h>
38#include <linux/mm.h> 38#include <linux/mm.h>
39#include <linux/slab.h> 39#include <linux/slab.h>
40#include <linux/smp_lock.h>
41#include <linux/signal.h> 40#include <linux/signal.h>
42#include <linux/poll.h> 41#include <linux/poll.h>
43#include <linux/module.h> 42#include <linux/module.h>
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c
index 9fe34fb78ef1..cf6a5423de09 100644
--- a/drivers/usb/core/file.c
+++ b/drivers/usb/core/file.c
@@ -19,7 +19,6 @@
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/rwsem.h> 20#include <linux/rwsem.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/smp_lock.h>
23#include <linux/usb.h> 22#include <linux/usb.h>
24 23
25#include "usb.h" 24#include "usb.h"
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 61800f77dac8..ced846ac4141 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1330,6 +1330,8 @@ static int map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
1330 */ 1330 */
1331 1331
1332 if (usb_endpoint_xfer_control(&urb->ep->desc)) { 1332 if (usb_endpoint_xfer_control(&urb->ep->desc)) {
1333 if (hcd->self.uses_pio_for_control)
1334 return ret;
1333 if (hcd->self.uses_dma) { 1335 if (hcd->self.uses_dma) {
1334 urb->setup_dma = dma_map_single( 1336 urb->setup_dma = dma_map_single(
1335 hcd->self.controller, 1337 hcd->self.controller,
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 9819a4cc3b26..b690aa35df9a 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -39,7 +39,6 @@
39#include <linux/parser.h> 39#include <linux/parser.h>
40#include <linux/notifier.h> 40#include <linux/notifier.h>
41#include <linux/seq_file.h> 41#include <linux/seq_file.h>
42#include <linux/smp_lock.h>
43#include <linux/usb/hcd.h> 42#include <linux/usb/hcd.h>
44#include <asm/byteorder.h> 43#include <asm/byteorder.h>
45#include "usb.h" 44#include "usb.h"
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index b5e20e873cba..717ff653fa23 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -2017,7 +2017,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
2017 } 2017 }
2018 } else { 2018 } else {
2019 /* gpio_request fail so use -EINVAL for gpio_is_valid */ 2019 /* gpio_request fail so use -EINVAL for gpio_is_valid */
2020 ubc->vbus_pin = -EINVAL; 2020 udc->vbus_pin = -EINVAL;
2021 } 2021 }
2022 } 2022 }
2023 2023
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 4a830df4fc31..484c5ba5450e 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -30,7 +30,6 @@
30#include <linux/blkdev.h> 30#include <linux/blkdev.h>
31#include <linux/pagemap.h> 31#include <linux/pagemap.h>
32#include <asm/unaligned.h> 32#include <asm/unaligned.h>
33#include <linux/smp_lock.h>
34 33
35#include <linux/usb/composite.h> 34#include <linux/usb/composite.h>
36#include <linux/usb/functionfs.h> 35#include <linux/usb/functionfs.h>
diff --git a/drivers/usb/gadget/f_hid.c b/drivers/usb/gadget/f_hid.c
index 4f891eddd060..598e7e2ab80c 100644
--- a/drivers/usb/gadget/f_hid.c
+++ b/drivers/usb/gadget/f_hid.c
@@ -25,7 +25,6 @@
25#include <linux/cdev.h> 25#include <linux/cdev.h>
26#include <linux/mutex.h> 26#include <linux/mutex.h>
27#include <linux/poll.h> 27#include <linux/poll.h>
28#include <linux/smp_lock.h>
29#include <linux/uaccess.h> 28#include <linux/uaccess.h>
30#include <linux/wait.h> 29#include <linux/wait.h>
31#include <linux/usb/g_hid.h> 30#include <linux/usb/g_hid.h>
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 86afdc73322f..6e2599661b5b 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -1067,7 +1067,7 @@ static inline void create_debug_files (struct ehci_hcd *ehci)
1067 &debug_registers_fops)) 1067 &debug_registers_fops))
1068 goto file_error; 1068 goto file_error;
1069 1069
1070 if (!debugfs_create_file("lpm", S_IRUGO|S_IWUGO, ehci->debug_dir, bus, 1070 if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus,
1071 &debug_lpm_fops)) 1071 &debug_lpm_fops))
1072 goto file_error; 1072 goto file_error;
1073 1073
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 502a7e6fef42..e9062806d4a2 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1063,10 +1063,11 @@ rescan:
1063 tmp && tmp != qh; 1063 tmp && tmp != qh;
1064 tmp = tmp->qh_next.qh) 1064 tmp = tmp->qh_next.qh)
1065 continue; 1065 continue;
1066 /* periodic qh self-unlinks on empty */ 1066 /* periodic qh self-unlinks on empty, and a COMPLETING qh
1067 if (!tmp) 1067 * may already be unlinked.
1068 goto nogood; 1068 */
1069 unlink_async (ehci, qh); 1069 if (tmp)
1070 unlink_async(ehci, qh);
1070 /* FALL THROUGH */ 1071 /* FALL THROUGH */
1071 case QH_STATE_UNLINK: /* wait for hw to finish? */ 1072 case QH_STATE_UNLINK: /* wait for hw to finish? */
1072 case QH_STATE_UNLINK_WAIT: 1073 case QH_STATE_UNLINK_WAIT:
@@ -1083,7 +1084,6 @@ idle_timeout:
1083 } 1084 }
1084 /* else FALL THROUGH */ 1085 /* else FALL THROUGH */
1085 default: 1086 default:
1086nogood:
1087 /* caller was supposed to have unlinked any requests; 1087 /* caller was supposed to have unlinked any requests;
1088 * that's not our job. just leak this memory. 1088 * that's not our job. just leak this memory.
1089 */ 1089 */
diff --git a/drivers/usb/host/ehci-mem.c b/drivers/usb/host/ehci-mem.c
index d36e4e75e08d..12f70c302b0b 100644
--- a/drivers/usb/host/ehci-mem.c
+++ b/drivers/usb/host/ehci-mem.c
@@ -141,6 +141,10 @@ static void ehci_mem_cleanup (struct ehci_hcd *ehci)
141 qh_put (ehci->async); 141 qh_put (ehci->async);
142 ehci->async = NULL; 142 ehci->async = NULL;
143 143
144 if (ehci->dummy)
145 qh_put(ehci->dummy);
146 ehci->dummy = NULL;
147
144 /* DMA consistent memory and pools */ 148 /* DMA consistent memory and pools */
145 if (ehci->qtd_pool) 149 if (ehci->qtd_pool)
146 dma_pool_destroy (ehci->qtd_pool); 150 dma_pool_destroy (ehci->qtd_pool);
@@ -227,8 +231,26 @@ static int ehci_mem_init (struct ehci_hcd *ehci, gfp_t flags)
227 if (ehci->periodic == NULL) { 231 if (ehci->periodic == NULL) {
228 goto fail; 232 goto fail;
229 } 233 }
230 for (i = 0; i < ehci->periodic_size; i++) 234
231 ehci->periodic [i] = EHCI_LIST_END(ehci); 235 if (ehci->use_dummy_qh) {
236 struct ehci_qh_hw *hw;
237 ehci->dummy = ehci_qh_alloc(ehci, flags);
238 if (!ehci->dummy)
239 goto fail;
240
241 hw = ehci->dummy->hw;
242 hw->hw_next = EHCI_LIST_END(ehci);
243 hw->hw_qtd_next = EHCI_LIST_END(ehci);
244 hw->hw_alt_next = EHCI_LIST_END(ehci);
245 hw->hw_token &= ~QTD_STS_ACTIVE;
246 ehci->dummy->hw = hw;
247
248 for (i = 0; i < ehci->periodic_size; i++)
249 ehci->periodic[i] = ehci->dummy->qh_dma;
250 } else {
251 for (i = 0; i < ehci->periodic_size; i++)
252 ehci->periodic[i] = EHCI_LIST_END(ehci);
253 }
232 254
233 /* software shadow of hardware table */ 255 /* software shadow of hardware table */
234 ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags); 256 ehci->pshadow = kcalloc(ehci->periodic_size, sizeof(void *), flags);
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index a1e8d273103f..655f3c9f88bf 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -103,6 +103,19 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
103 if (retval) 103 if (retval)
104 return retval; 104 return retval;
105 105
106 if ((pdev->vendor == PCI_VENDOR_ID_AMD && pdev->device == 0x7808) ||
107 (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x4396)) {
108 /* EHCI controller on AMD SB700/SB800/Hudson-2/3 platforms may
109 * read/write memory space which does not belong to it when
110 * there is NULL pointer with T-bit set to 1 in the frame list
111 * table. To avoid the issue, the frame list link pointer
112 * should always contain a valid pointer to a inactive qh.
113 */
114 ehci->use_dummy_qh = 1;
115 ehci_info(ehci, "applying AMD SB700/SB800/Hudson-2/3 EHCI "
116 "dummy qh workaround\n");
117 }
118
106 /* data structure init */ 119 /* data structure init */
107 retval = ehci_init(hcd); 120 retval = ehci_init(hcd);
108 if (retval) 121 if (retval)
@@ -148,6 +161,18 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
148 if (pdev->revision < 0xa4) 161 if (pdev->revision < 0xa4)
149 ehci->no_selective_suspend = 1; 162 ehci->no_selective_suspend = 1;
150 break; 163 break;
164
165 /* MCP89 chips on the MacBookAir3,1 give EPROTO when
166 * fetching device descriptors unless LPM is disabled.
167 * There are also intermittent problems enumerating
168 * devices with PPCD enabled.
169 */
170 case 0x0d9d:
171 ehci_info(ehci, "disable lpm/ppcd for nvidia mcp89");
172 ehci->has_lpm = 0;
173 ehci->has_ppcd = 0;
174 ehci->command &= ~CMD_PPCEE;
175 break;
151 } 176 }
152 break; 177 break;
153 case PCI_VENDOR_ID_VIA: 178 case PCI_VENDOR_ID_VIA:
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index a92526d6e5ae..d9f78eb26572 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -98,7 +98,14 @@ static void periodic_unlink (struct ehci_hcd *ehci, unsigned frame, void *ptr)
98 */ 98 */
99 *prev_p = *periodic_next_shadow(ehci, &here, 99 *prev_p = *periodic_next_shadow(ehci, &here,
100 Q_NEXT_TYPE(ehci, *hw_p)); 100 Q_NEXT_TYPE(ehci, *hw_p));
101 *hw_p = *shadow_next_periodic(ehci, &here, Q_NEXT_TYPE(ehci, *hw_p)); 101
102 if (!ehci->use_dummy_qh ||
103 *shadow_next_periodic(ehci, &here, Q_NEXT_TYPE(ehci, *hw_p))
104 != EHCI_LIST_END(ehci))
105 *hw_p = *shadow_next_periodic(ehci, &here,
106 Q_NEXT_TYPE(ehci, *hw_p));
107 else
108 *hw_p = ehci->dummy->qh_dma;
102} 109}
103 110
104/* how many of the uframe's 125 usecs are allocated? */ 111/* how many of the uframe's 125 usecs are allocated? */
@@ -2335,7 +2342,11 @@ restart:
2335 * pointer for much longer, if at all. 2342 * pointer for much longer, if at all.
2336 */ 2343 */
2337 *q_p = q.itd->itd_next; 2344 *q_p = q.itd->itd_next;
2338 *hw_p = q.itd->hw_next; 2345 if (!ehci->use_dummy_qh ||
2346 q.itd->hw_next != EHCI_LIST_END(ehci))
2347 *hw_p = q.itd->hw_next;
2348 else
2349 *hw_p = ehci->dummy->qh_dma;
2339 type = Q_NEXT_TYPE(ehci, q.itd->hw_next); 2350 type = Q_NEXT_TYPE(ehci, q.itd->hw_next);
2340 wmb(); 2351 wmb();
2341 modified = itd_complete (ehci, q.itd); 2352 modified = itd_complete (ehci, q.itd);
@@ -2368,7 +2379,11 @@ restart:
2368 * URB completion. 2379 * URB completion.
2369 */ 2380 */
2370 *q_p = q.sitd->sitd_next; 2381 *q_p = q.sitd->sitd_next;
2371 *hw_p = q.sitd->hw_next; 2382 if (!ehci->use_dummy_qh ||
2383 q.sitd->hw_next != EHCI_LIST_END(ehci))
2384 *hw_p = q.sitd->hw_next;
2385 else
2386 *hw_p = ehci->dummy->qh_dma;
2372 type = Q_NEXT_TYPE(ehci, q.sitd->hw_next); 2387 type = Q_NEXT_TYPE(ehci, q.sitd->hw_next);
2373 wmb(); 2388 wmb();
2374 modified = sitd_complete (ehci, q.sitd); 2389 modified = sitd_complete (ehci, q.sitd);
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index bde823f704e9..ba8eab366b82 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -73,6 +73,7 @@ struct ehci_hcd { /* one per controller */
73 73
74 /* async schedule support */ 74 /* async schedule support */
75 struct ehci_qh *async; 75 struct ehci_qh *async;
76 struct ehci_qh *dummy; /* For AMD quirk use */
76 struct ehci_qh *reclaim; 77 struct ehci_qh *reclaim;
77 unsigned scanning : 1; 78 unsigned scanning : 1;
78 79
@@ -131,6 +132,7 @@ struct ehci_hcd { /* one per controller */
131 unsigned need_io_watchdog:1; 132 unsigned need_io_watchdog:1;
132 unsigned broken_periodic:1; 133 unsigned broken_periodic:1;
133 unsigned fs_i_thresh:1; /* Intel iso scheduling */ 134 unsigned fs_i_thresh:1; /* Intel iso scheduling */
135 unsigned use_dummy_qh:1; /* AMD Frame List table quirk*/
134 136
135 /* required for usb32 quirk */ 137 /* required for usb32 quirk */
136 #define OHCI_CTRL_HCFS (3 << 6) 138 #define OHCI_CTRL_HCFS (3 << 6)
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c
index 8196fa11fec4..43a39eb56cc6 100644
--- a/drivers/usb/host/isp1362-hcd.c
+++ b/drivers/usb/host/isp1362-hcd.c
@@ -70,7 +70,6 @@
70#include <linux/ioport.h> 70#include <linux/ioport.h>
71#include <linux/sched.h> 71#include <linux/sched.h>
72#include <linux/slab.h> 72#include <linux/slab.h>
73#include <linux/smp_lock.h>
74#include <linux/errno.h> 73#include <linux/errno.h>
75#include <linux/init.h> 74#include <linux/init.h>
76#include <linux/list.h> 75#include <linux/list.h>
@@ -2684,7 +2683,7 @@ static int __devexit isp1362_remove(struct platform_device *pdev)
2684 return 0; 2683 return 0;
2685} 2684}
2686 2685
2687static int __init isp1362_probe(struct platform_device *pdev) 2686static int __devinit isp1362_probe(struct platform_device *pdev)
2688{ 2687{
2689 struct usb_hcd *hcd; 2688 struct usb_hcd *hcd;
2690 struct isp1362_hcd *isp1362_hcd; 2689 struct isp1362_hcd *isp1362_hcd;
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
index 6e7fb5f38db6..ee60cd3ea642 100644
--- a/drivers/usb/host/uhci-debug.c
+++ b/drivers/usb/host/uhci-debug.c
@@ -12,7 +12,6 @@
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/debugfs.h> 14#include <linux/debugfs.h>
15#include <linux/smp_lock.h>
16#include <asm/io.h> 15#include <asm/io.h>
17 16
18#include "uhci-hcd.h" 17#include "uhci-hcd.h"
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index fef5a1f9d483..5d963e350494 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -229,6 +229,13 @@ void xhci_ring_device(struct xhci_hcd *xhci, int slot_id)
229static void xhci_disable_port(struct xhci_hcd *xhci, u16 wIndex, 229static void xhci_disable_port(struct xhci_hcd *xhci, u16 wIndex,
230 u32 __iomem *addr, u32 port_status) 230 u32 __iomem *addr, u32 port_status)
231{ 231{
232 /* Don't allow the USB core to disable SuperSpeed ports. */
233 if (xhci->port_array[wIndex] == 0x03) {
234 xhci_dbg(xhci, "Ignoring request to disable "
235 "SuperSpeed port.\n");
236 return;
237 }
238
232 /* Write 1 to disable the port */ 239 /* Write 1 to disable the port */
233 xhci_writel(xhci, port_status | PORT_PE, addr); 240 xhci_writel(xhci, port_status | PORT_PE, addr);
234 port_status = xhci_readl(xhci, addr); 241 port_status = xhci_readl(xhci, addr);
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 202770676da3..0fae58ef8afe 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1045,7 +1045,7 @@ static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci,
1045 if (udev->speed == USB_SPEED_SUPER) 1045 if (udev->speed == USB_SPEED_SUPER)
1046 return ep->ss_ep_comp.wBytesPerInterval; 1046 return ep->ss_ep_comp.wBytesPerInterval;
1047 1047
1048 max_packet = ep->desc.wMaxPacketSize & 0x3ff; 1048 max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize);
1049 max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; 1049 max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11;
1050 /* A 0 in max burst means 1 transfer per ESIT */ 1050 /* A 0 in max burst means 1 transfer per ESIT */
1051 return max_packet * (max_burst + 1); 1051 return max_packet * (max_burst + 1);
@@ -1135,7 +1135,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci,
1135 /* Fall through */ 1135 /* Fall through */
1136 case USB_SPEED_FULL: 1136 case USB_SPEED_FULL:
1137 case USB_SPEED_LOW: 1137 case USB_SPEED_LOW:
1138 max_packet = ep->desc.wMaxPacketSize & 0x3ff; 1138 max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize);
1139 ep_ctx->ep_info2 |= MAX_PACKET(max_packet); 1139 ep_ctx->ep_info2 |= MAX_PACKET(max_packet);
1140 break; 1140 break;
1141 default: 1141 default:
@@ -1443,6 +1443,13 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1443 xhci->dcbaa = NULL; 1443 xhci->dcbaa = NULL;
1444 1444
1445 scratchpad_free(xhci); 1445 scratchpad_free(xhci);
1446
1447 xhci->num_usb2_ports = 0;
1448 xhci->num_usb3_ports = 0;
1449 kfree(xhci->usb2_ports);
1450 kfree(xhci->usb3_ports);
1451 kfree(xhci->port_array);
1452
1446 xhci->page_size = 0; 1453 xhci->page_size = 0;
1447 xhci->page_shift = 0; 1454 xhci->page_shift = 0;
1448 xhci->bus_suspended = 0; 1455 xhci->bus_suspended = 0;
@@ -1627,6 +1634,161 @@ static void xhci_set_hc_event_deq(struct xhci_hcd *xhci)
1627 &xhci->ir_set->erst_dequeue); 1634 &xhci->ir_set->erst_dequeue);
1628} 1635}
1629 1636
1637static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
1638 u32 __iomem *addr, u8 major_revision)
1639{
1640 u32 temp, port_offset, port_count;
1641 int i;
1642
1643 if (major_revision > 0x03) {
1644 xhci_warn(xhci, "Ignoring unknown port speed, "
1645 "Ext Cap %p, revision = 0x%x\n",
1646 addr, major_revision);
1647 /* Ignoring port protocol we can't understand. FIXME */
1648 return;
1649 }
1650
1651 /* Port offset and count in the third dword, see section 7.2 */
1652 temp = xhci_readl(xhci, addr + 2);
1653 port_offset = XHCI_EXT_PORT_OFF(temp);
1654 port_count = XHCI_EXT_PORT_COUNT(temp);
1655 xhci_dbg(xhci, "Ext Cap %p, port offset = %u, "
1656 "count = %u, revision = 0x%x\n",
1657 addr, port_offset, port_count, major_revision);
1658 /* Port count includes the current port offset */
1659 if (port_offset == 0 || (port_offset + port_count - 1) > num_ports)
1660 /* WTF? "Valid values are ‘1’ to MaxPorts" */
1661 return;
1662 port_offset--;
1663 for (i = port_offset; i < (port_offset + port_count); i++) {
1664 /* Duplicate entry. Ignore the port if the revisions differ. */
1665 if (xhci->port_array[i] != 0) {
1666 xhci_warn(xhci, "Duplicate port entry, Ext Cap %p,"
1667 " port %u\n", addr, i);
1668 xhci_warn(xhci, "Port was marked as USB %u, "
1669 "duplicated as USB %u\n",
1670 xhci->port_array[i], major_revision);
1671 /* Only adjust the roothub port counts if we haven't
1672 * found a similar duplicate.
1673 */
1674 if (xhci->port_array[i] != major_revision &&
1675 xhci->port_array[i] != (u8) -1) {
1676 if (xhci->port_array[i] == 0x03)
1677 xhci->num_usb3_ports--;
1678 else
1679 xhci->num_usb2_ports--;
1680 xhci->port_array[i] = (u8) -1;
1681 }
1682 /* FIXME: Should we disable the port? */
1683 }
1684 xhci->port_array[i] = major_revision;
1685 if (major_revision == 0x03)
1686 xhci->num_usb3_ports++;
1687 else
1688 xhci->num_usb2_ports++;
1689 }
1690 /* FIXME: Should we disable ports not in the Extended Capabilities? */
1691}
1692
1693/*
1694 * Scan the Extended Capabilities for the "Supported Protocol Capabilities" that
1695 * specify what speeds each port is supposed to be. We can't count on the port
1696 * speed bits in the PORTSC register being correct until a device is connected,
1697 * but we need to set up the two fake roothubs with the correct number of USB
1698 * 3.0 and USB 2.0 ports at host controller initialization time.
1699 */
1700static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags)
1701{
1702 u32 __iomem *addr;
1703 u32 offset;
1704 unsigned int num_ports;
1705 int i, port_index;
1706
1707 addr = &xhci->cap_regs->hcc_params;
1708 offset = XHCI_HCC_EXT_CAPS(xhci_readl(xhci, addr));
1709 if (offset == 0) {
1710 xhci_err(xhci, "No Extended Capability registers, "
1711 "unable to set up roothub.\n");
1712 return -ENODEV;
1713 }
1714
1715 num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
1716 xhci->port_array = kzalloc(sizeof(*xhci->port_array)*num_ports, flags);
1717 if (!xhci->port_array)
1718 return -ENOMEM;
1719
1720 /*
1721 * For whatever reason, the first capability offset is from the
1722 * capability register base, not from the HCCPARAMS register.
1723 * See section 5.3.6 for offset calculation.
1724 */
1725 addr = &xhci->cap_regs->hc_capbase + offset;
1726 while (1) {
1727 u32 cap_id;
1728
1729 cap_id = xhci_readl(xhci, addr);
1730 if (XHCI_EXT_CAPS_ID(cap_id) == XHCI_EXT_CAPS_PROTOCOL)
1731 xhci_add_in_port(xhci, num_ports, addr,
1732 (u8) XHCI_EXT_PORT_MAJOR(cap_id));
1733 offset = XHCI_EXT_CAPS_NEXT(cap_id);
1734 if (!offset || (xhci->num_usb2_ports + xhci->num_usb3_ports)
1735 == num_ports)
1736 break;
1737 /*
1738 * Once you're into the Extended Capabilities, the offset is
1739 * always relative to the register holding the offset.
1740 */
1741 addr += offset;
1742 }
1743
1744 if (xhci->num_usb2_ports == 0 && xhci->num_usb3_ports == 0) {
1745 xhci_warn(xhci, "No ports on the roothubs?\n");
1746 return -ENODEV;
1747 }
1748 xhci_dbg(xhci, "Found %u USB 2.0 ports and %u USB 3.0 ports.\n",
1749 xhci->num_usb2_ports, xhci->num_usb3_ports);
1750 /*
1751 * Note we could have all USB 3.0 ports, or all USB 2.0 ports.
1752 * Not sure how the USB core will handle a hub with no ports...
1753 */
1754 if (xhci->num_usb2_ports) {
1755 xhci->usb2_ports = kmalloc(sizeof(*xhci->usb2_ports)*
1756 xhci->num_usb2_ports, flags);
1757 if (!xhci->usb2_ports)
1758 return -ENOMEM;
1759
1760 port_index = 0;
1761 for (i = 0; i < num_ports; i++)
1762 if (xhci->port_array[i] != 0x03) {
1763 xhci->usb2_ports[port_index] =
1764 &xhci->op_regs->port_status_base +
1765 NUM_PORT_REGS*i;
1766 xhci_dbg(xhci, "USB 2.0 port at index %u, "
1767 "addr = %p\n", i,
1768 xhci->usb2_ports[port_index]);
1769 port_index++;
1770 }
1771 }
1772 if (xhci->num_usb3_ports) {
1773 xhci->usb3_ports = kmalloc(sizeof(*xhci->usb3_ports)*
1774 xhci->num_usb3_ports, flags);
1775 if (!xhci->usb3_ports)
1776 return -ENOMEM;
1777
1778 port_index = 0;
1779 for (i = 0; i < num_ports; i++)
1780 if (xhci->port_array[i] == 0x03) {
1781 xhci->usb3_ports[port_index] =
1782 &xhci->op_regs->port_status_base +
1783 NUM_PORT_REGS*i;
1784 xhci_dbg(xhci, "USB 3.0 port at index %u, "
1785 "addr = %p\n", i,
1786 xhci->usb3_ports[port_index]);
1787 port_index++;
1788 }
1789 }
1790 return 0;
1791}
1630 1792
1631int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) 1793int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
1632{ 1794{
@@ -1809,6 +1971,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
1809 1971
1810 if (scratchpad_alloc(xhci, flags)) 1972 if (scratchpad_alloc(xhci, flags))
1811 goto fail; 1973 goto fail;
1974 if (xhci_setup_port_arrays(xhci, flags))
1975 goto fail;
1812 1976
1813 return 0; 1977 return 0;
1814 1978
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 9f3115e729b1..df558f6f84e3 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2104,7 +2104,6 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd)
2104 2104
2105 if (!(status & STS_EINT)) { 2105 if (!(status & STS_EINT)) {
2106 spin_unlock(&xhci->lock); 2106 spin_unlock(&xhci->lock);
2107 xhci_warn(xhci, "Spurious interrupt.\n");
2108 return IRQ_NONE; 2107 return IRQ_NONE;
2109 } 2108 }
2110 xhci_dbg(xhci, "op reg status = %08x\n", status); 2109 xhci_dbg(xhci, "op reg status = %08x\n", status);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 5d7d4e951ea4..45e4a3108cc3 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -577,6 +577,65 @@ static void xhci_restore_registers(struct xhci_hcd *xhci)
577 xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); 577 xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base);
578} 578}
579 579
580static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci)
581{
582 u64 val_64;
583
584 /* step 2: initialize command ring buffer */
585 val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring);
586 val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) |
587 (xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg,
588 xhci->cmd_ring->dequeue) &
589 (u64) ~CMD_RING_RSVD_BITS) |
590 xhci->cmd_ring->cycle_state;
591 xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n",
592 (long unsigned long) val_64);
593 xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring);
594}
595
596/*
597 * The whole command ring must be cleared to zero when we suspend the host.
598 *
599 * The host doesn't save the command ring pointer in the suspend well, so we
600 * need to re-program it on resume. Unfortunately, the pointer must be 64-byte
601 * aligned, because of the reserved bits in the command ring dequeue pointer
602 * register. Therefore, we can't just set the dequeue pointer back in the
603 * middle of the ring (TRBs are 16-byte aligned).
604 */
605static void xhci_clear_command_ring(struct xhci_hcd *xhci)
606{
607 struct xhci_ring *ring;
608 struct xhci_segment *seg;
609
610 ring = xhci->cmd_ring;
611 seg = ring->deq_seg;
612 do {
613 memset(seg->trbs, 0, SEGMENT_SIZE);
614 seg = seg->next;
615 } while (seg != ring->deq_seg);
616
617 /* Reset the software enqueue and dequeue pointers */
618 ring->deq_seg = ring->first_seg;
619 ring->dequeue = ring->first_seg->trbs;
620 ring->enq_seg = ring->deq_seg;
621 ring->enqueue = ring->dequeue;
622
623 /*
624 * Ring is now zeroed, so the HW should look for change of ownership
625 * when the cycle bit is set to 1.
626 */
627 ring->cycle_state = 1;
628
629 /*
630 * Reset the hardware dequeue pointer.
631 * Yes, this will need to be re-written after resume, but we're paranoid
632 * and want to make sure the hardware doesn't access bogus memory
633 * because, say, the BIOS or an SMI started the host without changing
634 * the command ring pointers.
635 */
636 xhci_set_cmd_ring_deq(xhci);
637}
638
580/* 639/*
581 * Stop HC (not bus-specific) 640 * Stop HC (not bus-specific)
582 * 641 *
@@ -604,6 +663,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
604 spin_unlock_irq(&xhci->lock); 663 spin_unlock_irq(&xhci->lock);
605 return -ETIMEDOUT; 664 return -ETIMEDOUT;
606 } 665 }
666 xhci_clear_command_ring(xhci);
607 667
608 /* step 3: save registers */ 668 /* step 3: save registers */
609 xhci_save_registers(xhci); 669 xhci_save_registers(xhci);
@@ -635,7 +695,6 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
635 u32 command, temp = 0; 695 u32 command, temp = 0;
636 struct usb_hcd *hcd = xhci_to_hcd(xhci); 696 struct usb_hcd *hcd = xhci_to_hcd(xhci);
637 struct pci_dev *pdev = to_pci_dev(hcd->self.controller); 697 struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
638 u64 val_64;
639 int old_state, retval; 698 int old_state, retval;
640 699
641 old_state = hcd->state; 700 old_state = hcd->state;
@@ -648,15 +707,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
648 /* step 1: restore register */ 707 /* step 1: restore register */
649 xhci_restore_registers(xhci); 708 xhci_restore_registers(xhci);
650 /* step 2: initialize command ring buffer */ 709 /* step 2: initialize command ring buffer */
651 val_64 = xhci_read_64(xhci, &xhci->op_regs->cmd_ring); 710 xhci_set_cmd_ring_deq(xhci);
652 val_64 = (val_64 & (u64) CMD_RING_RSVD_BITS) |
653 (xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg,
654 xhci->cmd_ring->dequeue) &
655 (u64) ~CMD_RING_RSVD_BITS) |
656 xhci->cmd_ring->cycle_state;
657 xhci_dbg(xhci, "// Setting command ring address to 0x%llx\n",
658 (long unsigned long) val_64);
659 xhci_write_64(xhci, val_64, &xhci->op_regs->cmd_ring);
660 /* step 3: restore state and start state*/ 711 /* step 3: restore state and start state*/
661 /* step 3: set CRS flag */ 712 /* step 3: set CRS flag */
662 command = xhci_readl(xhci, &xhci->op_regs->command); 713 command = xhci_readl(xhci, &xhci->op_regs->command);
@@ -714,6 +765,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
714 return retval; 765 return retval;
715 } 766 }
716 767
768 spin_unlock_irq(&xhci->lock);
717 /* Re-setup MSI-X */ 769 /* Re-setup MSI-X */
718 if (hcd->irq) 770 if (hcd->irq)
719 free_irq(hcd->irq, hcd); 771 free_irq(hcd->irq, hcd);
@@ -736,6 +788,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
736 hcd->irq = pdev->irq; 788 hcd->irq = pdev->irq;
737 } 789 }
738 790
791 spin_lock_irq(&xhci->lock);
739 /* step 4: set Run/Stop bit */ 792 /* step 4: set Run/Stop bit */
740 command = xhci_readl(xhci, &xhci->op_regs->command); 793 command = xhci_readl(xhci, &xhci->op_regs->command);
741 command |= CMD_RUN; 794 command |= CMD_RUN;
@@ -1496,6 +1549,15 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
1496 cmd_completion = command->completion; 1549 cmd_completion = command->completion;
1497 cmd_status = &command->status; 1550 cmd_status = &command->status;
1498 command->command_trb = xhci->cmd_ring->enqueue; 1551 command->command_trb = xhci->cmd_ring->enqueue;
1552
1553 /* Enqueue pointer can be left pointing to the link TRB,
1554 * we must handle that
1555 */
1556 if ((command->command_trb->link.control & TRB_TYPE_BITMASK)
1557 == TRB_TYPE(TRB_LINK))
1558 command->command_trb =
1559 xhci->cmd_ring->enq_seg->next->trbs;
1560
1499 list_add_tail(&command->cmd_list, &virt_dev->cmd_list); 1561 list_add_tail(&command->cmd_list, &virt_dev->cmd_list);
1500 } else { 1562 } else {
1501 in_ctx = virt_dev->in_ctx; 1563 in_ctx = virt_dev->in_ctx;
@@ -2219,6 +2281,15 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
2219 /* Attempt to submit the Reset Device command to the command ring */ 2281 /* Attempt to submit the Reset Device command to the command ring */
2220 spin_lock_irqsave(&xhci->lock, flags); 2282 spin_lock_irqsave(&xhci->lock, flags);
2221 reset_device_cmd->command_trb = xhci->cmd_ring->enqueue; 2283 reset_device_cmd->command_trb = xhci->cmd_ring->enqueue;
2284
2285 /* Enqueue pointer can be left pointing to the link TRB,
2286 * we must handle that
2287 */
2288 if ((reset_device_cmd->command_trb->link.control & TRB_TYPE_BITMASK)
2289 == TRB_TYPE(TRB_LINK))
2290 reset_device_cmd->command_trb =
2291 xhci->cmd_ring->enq_seg->next->trbs;
2292
2222 list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list); 2293 list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list);
2223 ret = xhci_queue_reset_device(xhci, slot_id); 2294 ret = xhci_queue_reset_device(xhci, slot_id);
2224 if (ret) { 2295 if (ret) {
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 93d3bf4d213c..170c367112d2 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -454,6 +454,24 @@ struct xhci_doorbell_array {
454 454
455 455
456/** 456/**
457 * struct xhci_protocol_caps
458 * @revision: major revision, minor revision, capability ID,
459 * and next capability pointer.
460 * @name_string: Four ASCII characters to say which spec this xHC
461 * follows, typically "USB ".
462 * @port_info: Port offset, count, and protocol-defined information.
463 */
464struct xhci_protocol_caps {
465 u32 revision;
466 u32 name_string;
467 u32 port_info;
468};
469
470#define XHCI_EXT_PORT_MAJOR(x) (((x) >> 24) & 0xff)
471#define XHCI_EXT_PORT_OFF(x) ((x) & 0xff)
472#define XHCI_EXT_PORT_COUNT(x) (((x) >> 8) & 0xff)
473
474/**
457 * struct xhci_container_ctx 475 * struct xhci_container_ctx
458 * @type: Type of context. Used to calculated offsets to contained contexts. 476 * @type: Type of context. Used to calculated offsets to contained contexts.
459 * @size: Size of the context data 477 * @size: Size of the context data
@@ -621,6 +639,11 @@ struct xhci_ep_ctx {
621#define MAX_PACKET_MASK (0xffff << 16) 639#define MAX_PACKET_MASK (0xffff << 16)
622#define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) 640#define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff)
623 641
642/* Get max packet size from ep desc. Bit 10..0 specify the max packet size.
643 * USB2.0 spec 9.6.6.
644 */
645#define GET_MAX_PACKET(p) ((p) & 0x7ff)
646
624/* tx_info bitmasks */ 647/* tx_info bitmasks */
625#define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) 648#define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff)
626#define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) 649#define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16)
@@ -1235,6 +1258,14 @@ struct xhci_hcd {
1235 u32 suspended_ports[8]; /* which ports are 1258 u32 suspended_ports[8]; /* which ports are
1236 suspended */ 1259 suspended */
1237 unsigned long resume_done[MAX_HC_PORTS]; 1260 unsigned long resume_done[MAX_HC_PORTS];
1261 /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */
1262 u8 *port_array;
1263 /* Array of pointers to USB 3.0 PORTSC registers */
1264 u32 __iomem **usb3_ports;
1265 unsigned int num_usb3_ports;
1266 /* Array of pointers to USB 2.0 PORTSC registers */
1267 u32 __iomem **usb2_ports;
1268 unsigned int num_usb2_ports;
1238}; 1269};
1239 1270
1240/* For testing purposes */ 1271/* For testing purposes */
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c
index 5a47805d9580..c90c89dc0003 100644
--- a/drivers/usb/image/microtek.c
+++ b/drivers/usb/image/microtek.c
@@ -364,7 +364,7 @@ static int mts_scsi_host_reset(struct scsi_cmnd *srb)
364} 364}
365 365
366static int 366static int
367mts_scsi_queuecommand(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback); 367mts_scsi_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *srb);
368 368
369static void mts_transfer_cleanup( struct urb *transfer ); 369static void mts_transfer_cleanup( struct urb *transfer );
370static void mts_do_sg(struct urb * transfer); 370static void mts_do_sg(struct urb * transfer);
@@ -573,7 +573,7 @@ mts_build_transfer_context(struct scsi_cmnd *srb, struct mts_desc* desc)
573 573
574 574
575static int 575static int
576mts_scsi_queuecommand(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback) 576mts_scsi_queuecommand_lck(struct scsi_cmnd *srb, mts_scsi_cmnd_callback callback)
577{ 577{
578 struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); 578 struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]);
579 int err = 0; 579 int err = 0;
@@ -626,6 +626,8 @@ out:
626 return err; 626 return err;
627} 627}
628 628
629static DEF_SCSI_QCMD(mts_scsi_queuecommand)
630
629static struct scsi_host_template mts_scsi_host_template = { 631static struct scsi_host_template mts_scsi_host_template = {
630 .module = THIS_MODULE, 632 .module = THIS_MODULE,
631 .name = "microtekX6", 633 .name = "microtekX6",
diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c
index 2f43c57743c9..9251773ecef4 100644
--- a/drivers/usb/misc/cypress_cy7c63.c
+++ b/drivers/usb/misc/cypress_cy7c63.c
@@ -196,11 +196,9 @@ static ssize_t get_port1_handler(struct device *dev,
196 return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); 196 return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1);
197} 197}
198 198
199static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, 199static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler);
200 get_port0_handler, set_port0_handler);
201 200
202static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, 201static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler);
203 get_port1_handler, set_port1_handler);
204 202
205 203
206static int cypress_probe(struct usb_interface *interface, 204static int cypress_probe(struct usb_interface *interface,
diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c
index d77aba46ae85..f63776a48e2a 100644
--- a/drivers/usb/misc/trancevibrator.c
+++ b/drivers/usb/misc/trancevibrator.c
@@ -86,7 +86,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr,
86 return count; 86 return count;
87} 87}
88 88
89static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); 89static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed);
90 90
91static int tv_probe(struct usb_interface *interface, 91static int tv_probe(struct usb_interface *interface,
92 const struct usb_device_id *id) 92 const struct usb_device_id *id)
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c
index 63da2c3c838f..c96f51de1696 100644
--- a/drivers/usb/misc/usbled.c
+++ b/drivers/usb/misc/usbled.c
@@ -94,7 +94,7 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co
94 change_color(led); \ 94 change_color(led); \
95 return count; \ 95 return count; \
96} \ 96} \
97static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); 97static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value);
98show_set(blue); 98show_set(blue);
99show_set(red); 99show_set(red);
100show_set(green); 100show_set(green);
diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c
index de8ef945b536..417b8f207e8b 100644
--- a/drivers/usb/misc/usbsevseg.c
+++ b/drivers/usb/misc/usbsevseg.c
@@ -192,7 +192,7 @@ static ssize_t set_attr_##name(struct device *dev, \
192 \ 192 \
193 return count; \ 193 return count; \
194} \ 194} \
195static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name); 195static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name);
196 196
197static ssize_t show_attr_text(struct device *dev, 197static ssize_t show_attr_text(struct device *dev,
198 struct device_attribute *attr, char *buf) 198 struct device_attribute *attr, char *buf)
@@ -223,7 +223,7 @@ static ssize_t set_attr_text(struct device *dev,
223 return count; 223 return count;
224} 224}
225 225
226static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text); 226static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text);
227 227
228static ssize_t show_attr_decimals(struct device *dev, 228static ssize_t show_attr_decimals(struct device *dev,
229 struct device_attribute *attr, char *buf) 229 struct device_attribute *attr, char *buf)
@@ -272,8 +272,7 @@ static ssize_t set_attr_decimals(struct device *dev,
272 return count; 272 return count;
273} 273}
274 274
275static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO, 275static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals);
276 show_attr_decimals, set_attr_decimals);
277 276
278static ssize_t show_attr_textmode(struct device *dev, 277static ssize_t show_attr_textmode(struct device *dev,
279 struct device_attribute *attr, char *buf) 278 struct device_attribute *attr, char *buf)
@@ -319,8 +318,7 @@ static ssize_t set_attr_textmode(struct device *dev,
319 return -EINVAL; 318 return -EINVAL;
320} 319}
321 320
322static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO, 321static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode);
323 show_attr_textmode, set_attr_textmode);
324 322
325 323
326MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); 324MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered);
diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
index 719c6180b31f..ac5bfd619e62 100644
--- a/drivers/usb/misc/yurex.c
+++ b/drivers/usb/misc/yurex.c
@@ -536,6 +536,7 @@ static const struct file_operations yurex_fops = {
536 .open = yurex_open, 536 .open = yurex_open,
537 .release = yurex_release, 537 .release = yurex_release,
538 .fasync = yurex_fasync, 538 .fasync = yurex_fasync,
539 .llseek = default_llseek,
539}; 540};
540 541
541 542
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index 44cb37b5a4dc..c436e1e2c3b6 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -15,7 +15,6 @@
15#include <linux/poll.h> 15#include <linux/poll.h>
16#include <linux/compat.h> 16#include <linux/compat.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/smp_lock.h>
19#include <linux/scatterlist.h> 18#include <linux/scatterlist.h>
20#include <linux/slab.h> 19#include <linux/slab.h>
21 20
diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c
index 8ec94f15a738..e5ce42bd316e 100644
--- a/drivers/usb/mon/mon_stat.c
+++ b/drivers/usb/mon/mon_stat.c
@@ -11,7 +11,6 @@
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/usb.h> 12#include <linux/usb.h>
13#include <linux/fs.h> 13#include <linux/fs.h>
14#include <linux/smp_lock.h>
15#include <asm/uaccess.h> 14#include <asm/uaccess.h>
16 15
17#include "usb_mon.h" 16#include "usb_mon.h"
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index e6669fc3b804..99beebce8550 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2116,12 +2116,15 @@ bad_config:
2116 * Otherwise, wait till the gadget driver hooks up. 2116 * Otherwise, wait till the gadget driver hooks up.
2117 */ 2117 */
2118 if (!is_otg_enabled(musb) && is_host_enabled(musb)) { 2118 if (!is_otg_enabled(musb) && is_host_enabled(musb)) {
2119 struct usb_hcd *hcd = musb_to_hcd(musb);
2120
2119 MUSB_HST_MODE(musb); 2121 MUSB_HST_MODE(musb);
2120 musb->xceiv->default_a = 1; 2122 musb->xceiv->default_a = 1;
2121 musb->xceiv->state = OTG_STATE_A_IDLE; 2123 musb->xceiv->state = OTG_STATE_A_IDLE;
2122 2124
2123 status = usb_add_hcd(musb_to_hcd(musb), -1, 0); 2125 status = usb_add_hcd(musb_to_hcd(musb), -1, 0);
2124 2126
2127 hcd->self.uses_pio_for_control = 1;
2125 DBG(1, "%s mode, status %d, devctl %02x %c\n", 2128 DBG(1, "%s mode, status %d, devctl %02x %c\n",
2126 "HOST", status, 2129 "HOST", status,
2127 musb_readb(musb->mregs, MUSB_DEVCTL), 2130 musb_readb(musb->mregs, MUSB_DEVCTL),
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 36cfd060dbe5..9d6ade82b9f2 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -92,6 +92,59 @@
92 92
93/* ----------------------------------------------------------------------- */ 93/* ----------------------------------------------------------------------- */
94 94
95/* Maps the buffer to dma */
96
97static inline void map_dma_buffer(struct musb_request *request,
98 struct musb *musb)
99{
100 if (request->request.dma == DMA_ADDR_INVALID) {
101 request->request.dma = dma_map_single(
102 musb->controller,
103 request->request.buf,
104 request->request.length,
105 request->tx
106 ? DMA_TO_DEVICE
107 : DMA_FROM_DEVICE);
108 request->mapped = 1;
109 } else {
110 dma_sync_single_for_device(musb->controller,
111 request->request.dma,
112 request->request.length,
113 request->tx
114 ? DMA_TO_DEVICE
115 : DMA_FROM_DEVICE);
116 request->mapped = 0;
117 }
118}
119
120/* Unmap the buffer from dma and maps it back to cpu */
121static inline void unmap_dma_buffer(struct musb_request *request,
122 struct musb *musb)
123{
124 if (request->request.dma == DMA_ADDR_INVALID) {
125 DBG(20, "not unmapping a never mapped buffer\n");
126 return;
127 }
128 if (request->mapped) {
129 dma_unmap_single(musb->controller,
130 request->request.dma,
131 request->request.length,
132 request->tx
133 ? DMA_TO_DEVICE
134 : DMA_FROM_DEVICE);
135 request->request.dma = DMA_ADDR_INVALID;
136 request->mapped = 0;
137 } else {
138 dma_sync_single_for_cpu(musb->controller,
139 request->request.dma,
140 request->request.length,
141 request->tx
142 ? DMA_TO_DEVICE
143 : DMA_FROM_DEVICE);
144
145 }
146}
147
95/* 148/*
96 * Immediately complete a request. 149 * Immediately complete a request.
97 * 150 *
@@ -119,24 +172,8 @@ __acquires(ep->musb->lock)
119 172
120 ep->busy = 1; 173 ep->busy = 1;
121 spin_unlock(&musb->lock); 174 spin_unlock(&musb->lock);
122 if (is_dma_capable()) { 175 if (is_dma_capable() && ep->dma)
123 if (req->mapped) { 176 unmap_dma_buffer(req, musb);
124 dma_unmap_single(musb->controller,
125 req->request.dma,
126 req->request.length,
127 req->tx
128 ? DMA_TO_DEVICE
129 : DMA_FROM_DEVICE);
130 req->request.dma = DMA_ADDR_INVALID;
131 req->mapped = 0;
132 } else if (req->request.dma != DMA_ADDR_INVALID)
133 dma_sync_single_for_cpu(musb->controller,
134 req->request.dma,
135 req->request.length,
136 req->tx
137 ? DMA_TO_DEVICE
138 : DMA_FROM_DEVICE);
139 }
140 if (request->status == 0) 177 if (request->status == 0)
141 DBG(5, "%s done request %p, %d/%d\n", 178 DBG(5, "%s done request %p, %d/%d\n",
142 ep->end_point.name, request, 179 ep->end_point.name, request,
@@ -395,6 +432,13 @@ static void txstate(struct musb *musb, struct musb_request *req)
395#endif 432#endif
396 433
397 if (!use_dma) { 434 if (!use_dma) {
435 /*
436 * Unmap the dma buffer back to cpu if dma channel
437 * programming fails
438 */
439 if (is_dma_capable() && musb_ep->dma)
440 unmap_dma_buffer(req, musb);
441
398 musb_write_fifo(musb_ep->hw_ep, fifo_count, 442 musb_write_fifo(musb_ep->hw_ep, fifo_count,
399 (u8 *) (request->buf + request->actual)); 443 (u8 *) (request->buf + request->actual));
400 request->actual += fifo_count; 444 request->actual += fifo_count;
@@ -713,6 +757,21 @@ static void rxstate(struct musb *musb, struct musb_request *req)
713 return; 757 return;
714 } 758 }
715#endif 759#endif
760 /*
761 * Unmap the dma buffer back to cpu if dma channel
762 * programming fails. This buffer is mapped if the
763 * channel allocation is successful
764 */
765 if (is_dma_capable() && musb_ep->dma) {
766 unmap_dma_buffer(req, musb);
767
768 /*
769 * Clear DMAENAB and AUTOCLEAR for the
770 * PIO mode transfer
771 */
772 csr &= ~(MUSB_RXCSR_DMAENAB | MUSB_RXCSR_AUTOCLEAR);
773 musb_writew(epio, MUSB_RXCSR, csr);
774 }
716 775
717 musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *) 776 musb_read_fifo(musb_ep->hw_ep, fifo_count, (u8 *)
718 (request->buf + request->actual)); 777 (request->buf + request->actual));
@@ -837,7 +896,9 @@ void musb_g_rx(struct musb *musb, u8 epnum)
837 if (!request) 896 if (!request)
838 return; 897 return;
839 } 898 }
899#if defined(CONFIG_USB_INVENTRA_DMA) || defined(CONFIG_USB_TUSB_OMAP_DMA)
840exit: 900exit:
901#endif
841 /* Analyze request */ 902 /* Analyze request */
842 rxstate(musb, to_musb_request(request)); 903 rxstate(musb, to_musb_request(request));
843} 904}
@@ -1150,26 +1211,9 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req,
1150 request->epnum = musb_ep->current_epnum; 1211 request->epnum = musb_ep->current_epnum;
1151 request->tx = musb_ep->is_in; 1212 request->tx = musb_ep->is_in;
1152 1213
1153 if (is_dma_capable() && musb_ep->dma) { 1214 if (is_dma_capable() && musb_ep->dma)
1154 if (request->request.dma == DMA_ADDR_INVALID) { 1215 map_dma_buffer(request, musb);
1155 request->request.dma = dma_map_single( 1216 else
1156 musb->controller,
1157 request->request.buf,
1158 request->request.length,
1159 request->tx
1160 ? DMA_TO_DEVICE
1161 : DMA_FROM_DEVICE);
1162 request->mapped = 1;
1163 } else {
1164 dma_sync_single_for_device(musb->controller,
1165 request->request.dma,
1166 request->request.length,
1167 request->tx
1168 ? DMA_TO_DEVICE
1169 : DMA_FROM_DEVICE);
1170 request->mapped = 0;
1171 }
1172 } else
1173 request->mapped = 0; 1217 request->mapped = 0;
1174 1218
1175 spin_lock_irqsave(&musb->lock, lockflags); 1219 spin_lock_irqsave(&musb->lock, lockflags);
@@ -1789,6 +1833,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1789 spin_unlock_irqrestore(&musb->lock, flags); 1833 spin_unlock_irqrestore(&musb->lock, flags);
1790 1834
1791 if (is_otg_enabled(musb)) { 1835 if (is_otg_enabled(musb)) {
1836 struct usb_hcd *hcd = musb_to_hcd(musb);
1837
1792 DBG(3, "OTG startup...\n"); 1838 DBG(3, "OTG startup...\n");
1793 1839
1794 /* REVISIT: funcall to other code, which also 1840 /* REVISIT: funcall to other code, which also
@@ -1803,6 +1849,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
1803 musb->gadget_driver = NULL; 1849 musb->gadget_driver = NULL;
1804 musb->g.dev.driver = NULL; 1850 musb->g.dev.driver = NULL;
1805 spin_unlock_irqrestore(&musb->lock, flags); 1851 spin_unlock_irqrestore(&musb->lock, flags);
1852 } else {
1853 hcd->self.uses_pio_for_control = 1;
1806 } 1854 }
1807 } 1855 }
1808 } 1856 }
diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c
index bdc3ea66be69..9fea48264fa2 100644
--- a/drivers/usb/otg/langwell_otg.c
+++ b/drivers/usb/otg/langwell_otg.c
@@ -1896,7 +1896,7 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr,
1896 } 1896 }
1897 return count; 1897 return count;
1898} 1898}
1899static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUGO, get_a_bus_req, set_a_bus_req); 1899static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUSR, get_a_bus_req, set_a_bus_req);
1900 1900
1901static ssize_t 1901static ssize_t
1902get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) 1902get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf)
@@ -1942,8 +1942,7 @@ set_a_bus_drop(struct device *dev, struct device_attribute *attr,
1942 } 1942 }
1943 return count; 1943 return count;
1944} 1944}
1945static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUGO, 1945static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUSR, get_a_bus_drop, set_a_bus_drop);
1946 get_a_bus_drop, set_a_bus_drop);
1947 1946
1948static ssize_t 1947static ssize_t
1949get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) 1948get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf)
@@ -1988,7 +1987,7 @@ set_b_bus_req(struct device *dev, struct device_attribute *attr,
1988 } 1987 }
1989 return count; 1988 return count;
1990} 1989}
1991static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUGO, get_b_bus_req, set_b_bus_req); 1990static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUSR, get_b_bus_req, set_b_bus_req);
1992 1991
1993static ssize_t 1992static ssize_t
1994set_a_clr_err(struct device *dev, struct device_attribute *attr, 1993set_a_clr_err(struct device *dev, struct device_attribute *attr,
@@ -2012,7 +2011,7 @@ set_a_clr_err(struct device *dev, struct device_attribute *attr,
2012 } 2011 }
2013 return count; 2012 return count;
2014} 2013}
2015static DEVICE_ATTR(a_clr_err, S_IWUGO, NULL, set_a_clr_err); 2014static DEVICE_ATTR(a_clr_err, S_IWUSR, NULL, set_a_clr_err);
2016 2015
2017static struct attribute *inputs_attrs[] = { 2016static struct attribute *inputs_attrs[] = {
2018 &dev_attr_a_bus_req.attr, 2017 &dev_attr_a_bus_req.attr,
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 76f8b3556672..6a50965e23f2 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -201,6 +201,7 @@ static struct usb_device_id id_table_combined [] = {
201 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, 201 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) },
202 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, 202 { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) },
203 { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, 203 { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) },
204 { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) },
204 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, 205 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) },
205 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, 206 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) },
206 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, 207 { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) },
@@ -696,6 +697,7 @@ static struct usb_device_id id_table_combined [] = {
696 .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, 697 .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk },
697 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, 698 { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) },
698 { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, 699 { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) },
700 { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) },
699 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, 701 { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) },
700 { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, 702 { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) },
701 { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, 703 { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 263f62551197..1286f1e23d8c 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -114,6 +114,9 @@
114/* Lenz LI-USB Computer Interface. */ 114/* Lenz LI-USB Computer Interface. */
115#define FTDI_LENZ_LIUSB_PID 0xD780 115#define FTDI_LENZ_LIUSB_PID 0xD780
116 116
117/* Vardaan Enterprises Serial Interface VEUSB422R3 */
118#define FTDI_VARDAAN_PID 0xF070
119
117/* 120/*
118 * Xsens Technologies BV products (http://www.xsens.com). 121 * Xsens Technologies BV products (http://www.xsens.com).
119 */ 122 */
@@ -721,6 +724,7 @@
721 */ 724 */
722#define RTSYSTEMS_VID 0x2100 /* Vendor ID */ 725#define RTSYSTEMS_VID 0x2100 /* Vendor ID */
723#define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ 726#define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */
727#define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */
724 728
725/* 729/*
726 * Bayer Ascensia Contour blood glucose meter USB-converter cable. 730 * Bayer Ascensia Contour blood glucose meter USB-converter cable.
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index e64da74bdcc5..6954de50c0ff 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -21,7 +21,6 @@
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/smp_lock.h>
25#include <linux/tty.h> 24#include <linux/tty.h>
26#include <linux/tty_driver.h> 25#include <linux/tty_driver.h>
27#include <linux/tty_flip.h> 26#include <linux/tty_flip.h>
@@ -52,6 +51,7 @@ static struct usb_driver usb_serial_driver = {
52 .suspend = usb_serial_suspend, 51 .suspend = usb_serial_suspend,
53 .resume = usb_serial_resume, 52 .resume = usb_serial_resume,
54 .no_dynamic_id = 1, 53 .no_dynamic_id = 1,
54 .supports_autosuspend = 1,
55}; 55};
56 56
57/* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead 57/* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead
@@ -1344,6 +1344,8 @@ int usb_serial_register(struct usb_serial_driver *driver)
1344 return -ENODEV; 1344 return -ENODEV;
1345 1345
1346 fixup_generic(driver); 1346 fixup_generic(driver);
1347 if (driver->usb_driver)
1348 driver->usb_driver->supports_autosuspend = 1;
1347 1349
1348 if (!driver->description) 1350 if (!driver->description)
1349 driver->description = driver->driver.name; 1351 driver->description = driver->driver.name;
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index a688b1e686ea..689ee1fb702a 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -285,7 +285,7 @@ static int slave_configure(struct scsi_device *sdev)
285 285
286/* queue a command */ 286/* queue a command */
287/* This is always called with scsi_lock(host) held */ 287/* This is always called with scsi_lock(host) held */
288static int queuecommand(struct scsi_cmnd *srb, 288static int queuecommand_lck(struct scsi_cmnd *srb,
289 void (*done)(struct scsi_cmnd *)) 289 void (*done)(struct scsi_cmnd *))
290{ 290{
291 struct us_data *us = host_to_us(srb->device->host); 291 struct us_data *us = host_to_us(srb->device->host);
@@ -315,6 +315,8 @@ static int queuecommand(struct scsi_cmnd *srb,
315 return 0; 315 return 0;
316} 316}
317 317
318static DEF_SCSI_QCMD(queuecommand)
319
318/*********************************************************************** 320/***********************************************************************
319 * Error handling functions 321 * Error handling functions
320 ***********************************************************************/ 322 ***********************************************************************/
diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c
index 57fc2f532cab..ceba512f84d0 100644
--- a/drivers/usb/storage/sierra_ms.c
+++ b/drivers/usb/storage/sierra_ms.c
@@ -121,7 +121,7 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr,
121 } 121 }
122 return result; 122 return result;
123} 123}
124static DEVICE_ATTR(truinst, S_IWUGO | S_IRUGO, show_truinst, NULL); 124static DEVICE_ATTR(truinst, S_IRUGO, show_truinst, NULL);
125 125
126int sierra_ms_init(struct us_data *us) 126int sierra_ms_init(struct us_data *us)
127{ 127{
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index d1268191acbd..339fac3949df 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -430,7 +430,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,
430 return 0; 430 return 0;
431} 431}
432 432
433static int uas_queuecommand(struct scsi_cmnd *cmnd, 433static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
434 void (*done)(struct scsi_cmnd *)) 434 void (*done)(struct scsi_cmnd *))
435{ 435{
436 struct scsi_device *sdev = cmnd->device; 436 struct scsi_device *sdev = cmnd->device;
@@ -488,6 +488,8 @@ static int uas_queuecommand(struct scsi_cmnd *cmnd,
488 return 0; 488 return 0;
489} 489}
490 490
491static DEF_SCSI_QCMD(uas_queuecommand)
492
491static int uas_eh_abort_handler(struct scsi_cmnd *cmnd) 493static int uas_eh_abort_handler(struct scsi_cmnd *cmnd)
492{ 494{
493 struct scsi_device *sdev = cmnd->device; 495 struct scsi_device *sdev = cmnd->device;