aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/core/devio.c17
-rw-r--r--drivers/usb/host/xhci.c2
-rw-r--r--include/linux/usb.h5
-rw-r--r--include/linux/usbdevice_fs.h7
4 files changed, 31 insertions, 0 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 62679bc031fb..0b387c1a8b7e 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1824,6 +1824,20 @@ static int proc_release_port(struct dev_state *ps, void __user *arg)
1824 return usb_hub_release_port(ps->dev, portnum, ps); 1824 return usb_hub_release_port(ps->dev, portnum, ps);
1825} 1825}
1826 1826
1827static int proc_get_capabilities(struct dev_state *ps, void __user *arg)
1828{
1829 __u32 caps;
1830
1831 caps = USBDEVFS_CAP_ZERO_PACKET | USBDEVFS_CAP_NO_PACKET_SIZE_LIM;
1832 if (!ps->dev->bus->no_stop_on_short)
1833 caps |= USBDEVFS_CAP_BULK_CONTINUATION;
1834
1835 if (put_user(caps, (__u32 __user *)arg))
1836 return -EFAULT;
1837
1838 return 0;
1839}
1840
1827/* 1841/*
1828 * NOTE: All requests here that have interface numbers as parameters 1842 * NOTE: All requests here that have interface numbers as parameters
1829 * are assuming that somehow the configuration has been prevented from 1843 * are assuming that somehow the configuration has been prevented from
@@ -1994,6 +2008,9 @@ static long usbdev_do_ioctl(struct file *file, unsigned int cmd,
1994 snoop(&dev->dev, "%s: RELEASE_PORT\n", __func__); 2008 snoop(&dev->dev, "%s: RELEASE_PORT\n", __func__);
1995 ret = proc_release_port(ps, p); 2009 ret = proc_release_port(ps, p);
1996 break; 2010 break;
2011 case USBDEVFS_GET_CAPABILITIES:
2012 ret = proc_get_capabilities(ps, p);
2013 break;
1997 } 2014 }
1998 usb_unlock_device(dev); 2015 usb_unlock_device(dev);
1999 if (ret >= 0) 2016 if (ret >= 0)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index a979cd0dbe0f..7648b2d4b268 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4450,6 +4450,8 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
4450 4450
4451 /* Accept arbitrarily long scatter-gather lists */ 4451 /* Accept arbitrarily long scatter-gather lists */
4452 hcd->self.sg_tablesize = ~0; 4452 hcd->self.sg_tablesize = ~0;
4453 /* XHCI controllers don't stop the ep queue on short packets :| */
4454 hcd->self.no_stop_on_short = 1;
4453 4455
4454 if (usb_hcd_is_primary_hcd(hcd)) { 4456 if (usb_hcd_is_primary_hcd(hcd)) {
4455 xhci = kzalloc(sizeof(struct xhci_hcd), GFP_KERNEL); 4457 xhci = kzalloc(sizeof(struct xhci_hcd), GFP_KERNEL);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index f717fbdaee8e..d4f9de1acd45 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -331,6 +331,11 @@ struct usb_bus {
331 u8 otg_port; /* 0, or number of OTG/HNP port */ 331 u8 otg_port; /* 0, or number of OTG/HNP port */
332 unsigned is_b_host:1; /* true during some HNP roleswitches */ 332 unsigned is_b_host:1; /* true during some HNP roleswitches */
333 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */ 333 unsigned b_hnp_enable:1; /* OTG: did A-Host enable HNP? */
334 unsigned no_stop_on_short:1; /*
335 * Quirk: some controllers don't stop
336 * the ep queue on a short transfer
337 * with the URB_SHORT_NOT_OK flag set.
338 */
334 unsigned sg_tablesize; /* 0 or largest number of sg list entries */ 339 unsigned sg_tablesize; /* 0 or largest number of sg list entries */
335 340
336 int devnum_next; /* Next open device number in 341 int devnum_next; /* Next open device number in
diff --git a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
index 15591d2ea400..07b2ceaaad70 100644
--- a/include/linux/usbdevice_fs.h
+++ b/include/linux/usbdevice_fs.h
@@ -125,6 +125,11 @@ struct usbdevfs_hub_portinfo {
125 char port [127]; /* e.g. port 3 connects to device 27 */ 125 char port [127]; /* e.g. port 3 connects to device 27 */
126}; 126};
127 127
128/* Device capability flags */
129#define USBDEVFS_CAP_ZERO_PACKET 0x01
130#define USBDEVFS_CAP_BULK_CONTINUATION 0x02
131#define USBDEVFS_CAP_NO_PACKET_SIZE_LIM 0x04
132
128#ifdef __KERNEL__ 133#ifdef __KERNEL__
129#ifdef CONFIG_COMPAT 134#ifdef CONFIG_COMPAT
130#include <linux/compat.h> 135#include <linux/compat.h>
@@ -204,4 +209,6 @@ struct usbdevfs_ioctl32 {
204#define USBDEVFS_CONNECT _IO('U', 23) 209#define USBDEVFS_CONNECT _IO('U', 23)
205#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int) 210#define USBDEVFS_CLAIM_PORT _IOR('U', 24, unsigned int)
206#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int) 211#define USBDEVFS_RELEASE_PORT _IOR('U', 25, unsigned int)
212#define USBDEVFS_GET_CAPABILITIES _IOR('U', 26, __u32)
213
207#endif /* _LINUX_USBDEVICE_FS_H */ 214#endif /* _LINUX_USBDEVICE_FS_H */