aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-12-05 11:50:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-12-05 11:50:04 -0500
commit6b0b3bda3d77c35fa9cf20067c0b62daff98c042 (patch)
tree8676c3a42edd187a25c8678a0ce8a9e611bdb158
parent54b9937082cda4b80ff8772807d31b30f6e74fcc (diff)
parent80e457699a8dbdd70f2d26911e46f538645c55fc (diff)
Merge tag 'usb-4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH: "Here are a few minor USB fixes for 4.15-rc3. The largest here is the Kconfig text and configuration changes for the USB TypeC build options that you reported during the -rc1 merge window. The others are all just small fixes for reported issues, as well as some new device ids. The most "interesting" of anything here is the usbip fixes as it seems lots of people are starting to pay attention to that driver at the moment. These fixes should resolve all of the reported problems as of now. Of course there are the usual xhci and gadget fixes as well, can't go a pull request without those... All of these have been in linux-next for a while with no reported issues" * tag 'usb-4.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (22 commits) usb: xhci: fix panic in xhci_free_virt_devices_depth_first xhci: Don't show incorrect WARN message about events for empty rings usbip: fix usbip attach to find a port that matches the requested speed usbip: Fix USB device hang due to wrong enabling of scatter-gather uas: Always apply US_FL_NO_ATA_1X quirk to Seagate devices usb: quirks: Add no-lpm quirk for KY-688 USB 3.1 Type-C Hub usb: build drivers/usb/common/ when USB_SUPPORT is set usb: hub: Cycle HUB power when initialization fails USB: core: Add type-specific length check of BOS descriptors usb: host: fix incorrect updating of offset USB: ulpi: fix bus-node lookup USB: usbfs: Filter flags passed in from user space usb: add user selectable option for the whole USB Type-C Support usb: f_fs: Force Reserved1=1 in OS_DESC_EXT_COMPAT usb: gadget: core: Fix ->udc_set_speed() speed handling usb: gadget: allow to enable legacy drivers without USB_ETH usb: gadget: udc: renesas_usb3: fix number of the pipes usb: gadget: don't dereference g until after it has been null checked USB: serial: usb_debug: add new USB device id usb: bdc: fix platform_no_drv_owner.cocci warnings ...
-rw-r--r--drivers/Makefile1
-rw-r--r--drivers/usb/common/ulpi.c4
-rw-r--r--drivers/usb/core/config.c28
-rw-r--r--drivers/usb/core/devio.c14
-rw-r--r--drivers/usb/core/hub.c9
-rw-r--r--drivers/usb/core/quirks.c3
-rw-r--r--drivers/usb/gadget/Kconfig4
-rw-r--r--drivers/usb/gadget/composite.c7
-rw-r--r--drivers/usb/gadget/function/f_fs.c15
-rw-r--r--drivers/usb/gadget/legacy/Kconfig10
-rw-r--r--drivers/usb/gadget/udc/bdc/bdc_core.c1
-rw-r--r--drivers/usb/gadget/udc/core.c8
-rw-r--r--drivers/usb/gadget/udc/renesas_usb3.c2
-rw-r--r--drivers/usb/host/ehci-dbg.c2
-rw-r--r--drivers/usb/host/xhci-mem.c7
-rw-r--r--drivers/usb/host/xhci-ring.c12
-rw-r--r--drivers/usb/serial/option.c3
-rw-r--r--drivers/usb/serial/usb_debug.c2
-rw-r--r--drivers/usb/storage/uas-detect.h4
-rw-r--r--drivers/usb/typec/Kconfig54
-rw-r--r--drivers/usb/typec/ucsi/Kconfig1
-rw-r--r--drivers/usb/usbip/vhci_hcd.c1
-rw-r--r--include/uapi/linux/usb/ch9.h3
-rw-r--r--tools/usb/usbip/libsrc/vhci_driver.c14
24 files changed, 169 insertions, 40 deletions
diff --git a/drivers/Makefile b/drivers/Makefile
index 1d034b680431..e06f7f633f73 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -105,6 +105,7 @@ obj-$(CONFIG_TC) += tc/
105obj-$(CONFIG_UWB) += uwb/ 105obj-$(CONFIG_UWB) += uwb/
106obj-$(CONFIG_USB_PHY) += usb/ 106obj-$(CONFIG_USB_PHY) += usb/
107obj-$(CONFIG_USB) += usb/ 107obj-$(CONFIG_USB) += usb/
108obj-$(CONFIG_USB_SUPPORT) += usb/
108obj-$(CONFIG_PCI) += usb/ 109obj-$(CONFIG_PCI) += usb/
109obj-$(CONFIG_USB_GADGET) += usb/ 110obj-$(CONFIG_USB_GADGET) += usb/
110obj-$(CONFIG_OF) += usb/ 111obj-$(CONFIG_OF) += usb/
diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index 8b351444cc40..9a2ab6751a23 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -180,9 +180,9 @@ static int ulpi_of_register(struct ulpi *ulpi)
180 /* Find a ulpi bus underneath the parent or the grandparent */ 180 /* Find a ulpi bus underneath the parent or the grandparent */
181 parent = ulpi->dev.parent; 181 parent = ulpi->dev.parent;
182 if (parent->of_node) 182 if (parent->of_node)
183 np = of_find_node_by_name(parent->of_node, "ulpi"); 183 np = of_get_child_by_name(parent->of_node, "ulpi");
184 else if (parent->parent && parent->parent->of_node) 184 else if (parent->parent && parent->parent->of_node)
185 np = of_find_node_by_name(parent->parent->of_node, "ulpi"); 185 np = of_get_child_by_name(parent->parent->of_node, "ulpi");
186 if (!np) 186 if (!np)
187 return 0; 187 return 0;
188 188
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index da8acd980fc6..55b198ba629b 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -905,14 +905,25 @@ void usb_release_bos_descriptor(struct usb_device *dev)
905 } 905 }
906} 906}
907 907
908static const __u8 bos_desc_len[256] = {
909 [USB_CAP_TYPE_WIRELESS_USB] = USB_DT_USB_WIRELESS_CAP_SIZE,
910 [USB_CAP_TYPE_EXT] = USB_DT_USB_EXT_CAP_SIZE,
911 [USB_SS_CAP_TYPE] = USB_DT_USB_SS_CAP_SIZE,
912 [USB_SSP_CAP_TYPE] = USB_DT_USB_SSP_CAP_SIZE(1),
913 [CONTAINER_ID_TYPE] = USB_DT_USB_SS_CONTN_ID_SIZE,
914 [USB_PTM_CAP_TYPE] = USB_DT_USB_PTM_ID_SIZE,
915};
916
908/* Get BOS descriptor set */ 917/* Get BOS descriptor set */
909int usb_get_bos_descriptor(struct usb_device *dev) 918int usb_get_bos_descriptor(struct usb_device *dev)
910{ 919{
911 struct device *ddev = &dev->dev; 920 struct device *ddev = &dev->dev;
912 struct usb_bos_descriptor *bos; 921 struct usb_bos_descriptor *bos;
913 struct usb_dev_cap_header *cap; 922 struct usb_dev_cap_header *cap;
923 struct usb_ssp_cap_descriptor *ssp_cap;
914 unsigned char *buffer; 924 unsigned char *buffer;
915 int length, total_len, num, i; 925 int length, total_len, num, i, ssac;
926 __u8 cap_type;
916 int ret; 927 int ret;
917 928
918 bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL); 929 bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);
@@ -965,7 +976,13 @@ int usb_get_bos_descriptor(struct usb_device *dev)
965 dev->bos->desc->bNumDeviceCaps = i; 976 dev->bos->desc->bNumDeviceCaps = i;
966 break; 977 break;
967 } 978 }
979 cap_type = cap->bDevCapabilityType;
968 length = cap->bLength; 980 length = cap->bLength;
981 if (bos_desc_len[cap_type] && length < bos_desc_len[cap_type]) {
982 dev->bos->desc->bNumDeviceCaps = i;
983 break;
984 }
985
969 total_len -= length; 986 total_len -= length;
970 987
971 if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) { 988 if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) {
@@ -973,7 +990,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
973 continue; 990 continue;
974 } 991 }
975 992
976 switch (cap->bDevCapabilityType) { 993 switch (cap_type) {
977 case USB_CAP_TYPE_WIRELESS_USB: 994 case USB_CAP_TYPE_WIRELESS_USB:
978 /* Wireless USB cap descriptor is handled by wusb */ 995 /* Wireless USB cap descriptor is handled by wusb */
979 break; 996 break;
@@ -986,8 +1003,11 @@ int usb_get_bos_descriptor(struct usb_device *dev)
986 (struct usb_ss_cap_descriptor *)buffer; 1003 (struct usb_ss_cap_descriptor *)buffer;
987 break; 1004 break;
988 case USB_SSP_CAP_TYPE: 1005 case USB_SSP_CAP_TYPE:
989 dev->bos->ssp_cap = 1006 ssp_cap = (struct usb_ssp_cap_descriptor *)buffer;
990 (struct usb_ssp_cap_descriptor *)buffer; 1007 ssac = (le32_to_cpu(ssp_cap->bmAttributes) &
1008 USB_SSP_SUBLINK_SPEED_ATTRIBS) + 1;
1009 if (length >= USB_DT_USB_SSP_CAP_SIZE(ssac))
1010 dev->bos->ssp_cap = ssp_cap;
991 break; 1011 break;
992 case CONTAINER_ID_TYPE: 1012 case CONTAINER_ID_TYPE:
993 dev->bos->ss_id = 1013 dev->bos->ss_id =
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 705c573d0257..a3fad4ec9870 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1442,14 +1442,18 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
1442 int number_of_packets = 0; 1442 int number_of_packets = 0;
1443 unsigned int stream_id = 0; 1443 unsigned int stream_id = 0;
1444 void *buf; 1444 void *buf;
1445 1445 unsigned long mask = USBDEVFS_URB_SHORT_NOT_OK |
1446 if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP |
1447 USBDEVFS_URB_SHORT_NOT_OK |
1448 USBDEVFS_URB_BULK_CONTINUATION | 1446 USBDEVFS_URB_BULK_CONTINUATION |
1449 USBDEVFS_URB_NO_FSBR | 1447 USBDEVFS_URB_NO_FSBR |
1450 USBDEVFS_URB_ZERO_PACKET | 1448 USBDEVFS_URB_ZERO_PACKET |
1451 USBDEVFS_URB_NO_INTERRUPT)) 1449 USBDEVFS_URB_NO_INTERRUPT;
1452 return -EINVAL; 1450 /* USBDEVFS_URB_ISO_ASAP is a special case */
1451 if (uurb->type == USBDEVFS_URB_TYPE_ISO)
1452 mask |= USBDEVFS_URB_ISO_ASAP;
1453
1454 if (uurb->flags & ~mask)
1455 return -EINVAL;
1456
1453 if ((unsigned int)uurb->buffer_length >= USBFS_XFER_MAX) 1457 if ((unsigned int)uurb->buffer_length >= USBFS_XFER_MAX)
1454 return -EINVAL; 1458 return -EINVAL;
1455 if (uurb->buffer_length > 0 && !uurb->buffer) 1459 if (uurb->buffer_length > 0 && !uurb->buffer)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 7ccdd3d4db84..cf7bbcb9a63c 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4948,6 +4948,15 @@ loop:
4948 usb_put_dev(udev); 4948 usb_put_dev(udev);
4949 if ((status == -ENOTCONN) || (status == -ENOTSUPP)) 4949 if ((status == -ENOTCONN) || (status == -ENOTSUPP))
4950 break; 4950 break;
4951
4952 /* When halfway through our retry count, power-cycle the port */
4953 if (i == (SET_CONFIG_TRIES / 2) - 1) {
4954 dev_info(&port_dev->dev, "attempt power cycle\n");
4955 usb_hub_set_port_power(hdev, hub, port1, false);
4956 msleep(2 * hub_power_on_good_delay(hub));
4957 usb_hub_set_port_power(hdev, hub, port1, true);
4958 msleep(hub_power_on_good_delay(hub));
4959 }
4951 } 4960 }
4952 if (hub->hdev->parent || 4961 if (hub->hdev->parent ||
4953 !hcd->driver->port_handed_over || 4962 !hcd->driver->port_handed_over ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index f1dbab6f798f..a10b346b9777 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -146,6 +146,9 @@ static const struct usb_device_id usb_quirk_list[] = {
146 /* appletouch */ 146 /* appletouch */
147 { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME }, 147 { USB_DEVICE(0x05ac, 0x021a), .driver_info = USB_QUIRK_RESET_RESUME },
148 148
149 /* Genesys Logic hub, internally used by KY-688 USB 3.1 Type-C Hub */
150 { USB_DEVICE(0x05e3, 0x0612), .driver_info = USB_QUIRK_NO_LPM },
151
149 /* Genesys Logic hub, internally used by Moshi USB to Ethernet Adapter */ 152 /* Genesys Logic hub, internally used by Moshi USB to Ethernet Adapter */
150 { USB_DEVICE(0x05e3, 0x0616), .driver_info = USB_QUIRK_NO_LPM }, 153 { USB_DEVICE(0x05e3, 0x0616), .driver_info = USB_QUIRK_NO_LPM },
151 154
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 31cce7805eb2..0a19a76645ad 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -508,8 +508,8 @@ choice
508 controller, and the relevant drivers for each function declared 508 controller, and the relevant drivers for each function declared
509 by the device. 509 by the device.
510 510
511source "drivers/usb/gadget/legacy/Kconfig"
512
513endchoice 511endchoice
514 512
513source "drivers/usb/gadget/legacy/Kconfig"
514
515endif # USB_GADGET 515endif # USB_GADGET
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index eec14e6ed20b..77c7ecca816a 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -146,7 +146,6 @@ int config_ep_by_speed(struct usb_gadget *g,
146 struct usb_function *f, 146 struct usb_function *f,
147 struct usb_ep *_ep) 147 struct usb_ep *_ep)
148{ 148{
149 struct usb_composite_dev *cdev = get_gadget_data(g);
150 struct usb_endpoint_descriptor *chosen_desc = NULL; 149 struct usb_endpoint_descriptor *chosen_desc = NULL;
151 struct usb_descriptor_header **speed_desc = NULL; 150 struct usb_descriptor_header **speed_desc = NULL;
152 151
@@ -226,8 +225,12 @@ ep_found:
226 _ep->maxburst = comp_desc->bMaxBurst + 1; 225 _ep->maxburst = comp_desc->bMaxBurst + 1;
227 break; 226 break;
228 default: 227 default:
229 if (comp_desc->bMaxBurst != 0) 228 if (comp_desc->bMaxBurst != 0) {
229 struct usb_composite_dev *cdev;
230
231 cdev = get_gadget_data(g);
230 ERROR(cdev, "ep0 bMaxBurst must be 0\n"); 232 ERROR(cdev, "ep0 bMaxBurst must be 0\n");
233 }
231 _ep->maxburst = 1; 234 _ep->maxburst = 1;
232 break; 235 break;
233 } 236 }
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 97ea059a7aa4..b6cf5ab5a0a1 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -1012,7 +1012,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
1012 else 1012 else
1013 ret = ep->status; 1013 ret = ep->status;
1014 goto error_mutex; 1014 goto error_mutex;
1015 } else if (!(req = usb_ep_alloc_request(ep->ep, GFP_KERNEL))) { 1015 } else if (!(req = usb_ep_alloc_request(ep->ep, GFP_ATOMIC))) {
1016 ret = -ENOMEM; 1016 ret = -ENOMEM;
1017 } else { 1017 } else {
1018 req->buf = data; 1018 req->buf = data;
@@ -2282,9 +2282,18 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type,
2282 int i; 2282 int i;
2283 2283
2284 if (len < sizeof(*d) || 2284 if (len < sizeof(*d) ||
2285 d->bFirstInterfaceNumber >= ffs->interfaces_count || 2285 d->bFirstInterfaceNumber >= ffs->interfaces_count)
2286 !d->Reserved1)
2287 return -EINVAL; 2286 return -EINVAL;
2287 if (d->Reserved1 != 1) {
2288 /*
2289 * According to the spec, Reserved1 must be set to 1
2290 * but older kernels incorrectly rejected non-zero
2291 * values. We fix it here to avoid returning EINVAL
2292 * in response to values we used to accept.
2293 */
2294 pr_debug("usb_ext_compat_desc::Reserved1 forced to 1\n");
2295 d->Reserved1 = 1;
2296 }
2288 for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) 2297 for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)
2289 if (d->Reserved2[i]) 2298 if (d->Reserved2[i])
2290 return -EINVAL; 2299 return -EINVAL;
diff --git a/drivers/usb/gadget/legacy/Kconfig b/drivers/usb/gadget/legacy/Kconfig
index a12fb459dbd9..9570bbeced4f 100644
--- a/drivers/usb/gadget/legacy/Kconfig
+++ b/drivers/usb/gadget/legacy/Kconfig
@@ -13,6 +13,14 @@
13# both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG). 13# both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG).
14# 14#
15 15
16menuconfig USB_GADGET_LEGACY
17 bool "Legacy USB Gadget Support"
18 help
19 Legacy USB gadgets are USB gadgets that do not use the USB gadget
20 configfs interface.
21
22if USB_GADGET_LEGACY
23
16config USB_ZERO 24config USB_ZERO
17 tristate "Gadget Zero (DEVELOPMENT)" 25 tristate "Gadget Zero (DEVELOPMENT)"
18 select USB_LIBCOMPOSITE 26 select USB_LIBCOMPOSITE
@@ -490,3 +498,5 @@ config USB_G_WEBCAM
490 498
491 Say "y" to link the driver statically, or "m" to build a 499 Say "y" to link the driver statically, or "m" to build a
492 dynamically linked module called "g_webcam". 500 dynamically linked module called "g_webcam".
501
502endif
diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c
index d39f070acbd7..01b44e159623 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_core.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_core.c
@@ -642,7 +642,6 @@ static const struct of_device_id bdc_of_match[] = {
642static struct platform_driver bdc_driver = { 642static struct platform_driver bdc_driver = {
643 .driver = { 643 .driver = {
644 .name = BRCM_BDC_NAME, 644 .name = BRCM_BDC_NAME,
645 .owner = THIS_MODULE,
646 .pm = &bdc_pm_ops, 645 .pm = &bdc_pm_ops,
647 .of_match_table = bdc_of_match, 646 .of_match_table = bdc_of_match,
648 }, 647 },
diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
index 61422d624ad0..93eff7dec2f5 100644
--- a/drivers/usb/gadget/udc/core.c
+++ b/drivers/usb/gadget/udc/core.c
@@ -1069,8 +1069,12 @@ static inline void usb_gadget_udc_stop(struct usb_udc *udc)
1069static inline void usb_gadget_udc_set_speed(struct usb_udc *udc, 1069static inline void usb_gadget_udc_set_speed(struct usb_udc *udc,
1070 enum usb_device_speed speed) 1070 enum usb_device_speed speed)
1071{ 1071{
1072 if (udc->gadget->ops->udc_set_speed) 1072 if (udc->gadget->ops->udc_set_speed) {
1073 udc->gadget->ops->udc_set_speed(udc->gadget, speed); 1073 enum usb_device_speed s;
1074
1075 s = min(speed, udc->gadget->max_speed);
1076 udc->gadget->ops->udc_set_speed(udc->gadget, s);
1077 }
1074} 1078}
1075 1079
1076/** 1080/**
diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
index bc37f40baacf..6e87af248367 100644
--- a/drivers/usb/gadget/udc/renesas_usb3.c
+++ b/drivers/usb/gadget/udc/renesas_usb3.c
@@ -252,7 +252,7 @@
252#define USB3_EP0_SS_MAX_PACKET_SIZE 512 252#define USB3_EP0_SS_MAX_PACKET_SIZE 512
253#define USB3_EP0_HSFS_MAX_PACKET_SIZE 64 253#define USB3_EP0_HSFS_MAX_PACKET_SIZE 64
254#define USB3_EP0_BUF_SIZE 8 254#define USB3_EP0_BUF_SIZE 8
255#define USB3_MAX_NUM_PIPES 30 255#define USB3_MAX_NUM_PIPES 6 /* This includes PIPE 0 */
256#define USB3_WAIT_US 3 256#define USB3_WAIT_US 3
257#define USB3_DMA_NUM_SETTING_AREA 4 257#define USB3_DMA_NUM_SETTING_AREA 4
258/* 258/*
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 19f00424f53e..3ed75aaa09d9 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -827,7 +827,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
827 default: /* unknown */ 827 default: /* unknown */
828 break; 828 break;
829 } 829 }
830 temp = (cap >> 8) & 0xff; 830 offset = (cap >> 8) & 0xff;
831 } 831 }
832 } 832 }
833#endif 833#endif
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index e1fba4688509..15f7d422885f 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -934,6 +934,12 @@ void xhci_free_virt_devices_depth_first(struct xhci_hcd *xhci, int slot_id)
934 if (!vdev) 934 if (!vdev)
935 return; 935 return;
936 936
937 if (vdev->real_port == 0 ||
938 vdev->real_port > HCS_MAX_PORTS(xhci->hcs_params1)) {
939 xhci_dbg(xhci, "Bad vdev->real_port.\n");
940 goto out;
941 }
942
937 tt_list_head = &(xhci->rh_bw[vdev->real_port - 1].tts); 943 tt_list_head = &(xhci->rh_bw[vdev->real_port - 1].tts);
938 list_for_each_entry_safe(tt_info, next, tt_list_head, tt_list) { 944 list_for_each_entry_safe(tt_info, next, tt_list_head, tt_list) {
939 /* is this a hub device that added a tt_info to the tts list */ 945 /* is this a hub device that added a tt_info to the tts list */
@@ -947,6 +953,7 @@ void xhci_free_virt_devices_depth_first(struct xhci_hcd *xhci, int slot_id)
947 } 953 }
948 } 954 }
949 } 955 }
956out:
950 /* we are now at a leaf device */ 957 /* we are now at a leaf device */
951 xhci_debugfs_remove_slot(xhci, slot_id); 958 xhci_debugfs_remove_slot(xhci, slot_id);
952 xhci_free_virt_device(xhci, slot_id); 959 xhci_free_virt_device(xhci, slot_id);
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index c239c688076c..6eb87c6e4d24 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -2477,12 +2477,16 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2477 */ 2477 */
2478 if (list_empty(&ep_ring->td_list)) { 2478 if (list_empty(&ep_ring->td_list)) {
2479 /* 2479 /*
2480 * A stopped endpoint may generate an extra completion 2480 * Don't print wanings if it's due to a stopped endpoint
2481 * event if the device was suspended. Don't print 2481 * generating an extra completion event if the device
2482 * warnings. 2482 * was suspended. Or, a event for the last TRB of a
2483 * short TD we already got a short event for.
2484 * The short TD is already removed from the TD list.
2483 */ 2485 */
2486
2484 if (!(trb_comp_code == COMP_STOPPED || 2487 if (!(trb_comp_code == COMP_STOPPED ||
2485 trb_comp_code == COMP_STOPPED_LENGTH_INVALID)) { 2488 trb_comp_code == COMP_STOPPED_LENGTH_INVALID ||
2489 ep_ring->last_td_was_short)) {
2486 xhci_warn(xhci, "WARN Event TRB for slot %d ep %d with no TDs queued?\n", 2490 xhci_warn(xhci, "WARN Event TRB for slot %d ep %d with no TDs queued?\n",
2487 TRB_TO_SLOT_ID(le32_to_cpu(event->flags)), 2491 TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
2488 ep_index); 2492 ep_index);
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index aaa7d901a06d..3b3513874cfd 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -238,6 +238,7 @@ static void option_instat_callback(struct urb *urb);
238/* These Quectel products use Quectel's vendor ID */ 238/* These Quectel products use Quectel's vendor ID */
239#define QUECTEL_PRODUCT_EC21 0x0121 239#define QUECTEL_PRODUCT_EC21 0x0121
240#define QUECTEL_PRODUCT_EC25 0x0125 240#define QUECTEL_PRODUCT_EC25 0x0125
241#define QUECTEL_PRODUCT_BG96 0x0296
241 242
242#define CMOTECH_VENDOR_ID 0x16d8 243#define CMOTECH_VENDOR_ID 0x16d8
243#define CMOTECH_PRODUCT_6001 0x6001 244#define CMOTECH_PRODUCT_6001 0x6001
@@ -1182,6 +1183,8 @@ static const struct usb_device_id option_ids[] = {
1182 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 1183 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1183 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25), 1184 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
1184 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 1185 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1186 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96),
1187 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1185 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, 1188 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
1186 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, 1189 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
1187 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), 1190 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003),
diff --git a/drivers/usb/serial/usb_debug.c b/drivers/usb/serial/usb_debug.c
index ab5a2ac4993a..aaf4813e4971 100644
--- a/drivers/usb/serial/usb_debug.c
+++ b/drivers/usb/serial/usb_debug.c
@@ -31,12 +31,14 @@ static const struct usb_device_id id_table[] = {
31}; 31};
32 32
33static const struct usb_device_id dbc_id_table[] = { 33static const struct usb_device_id dbc_id_table[] = {
34 { USB_DEVICE(0x1d6b, 0x0010) },
34 { USB_DEVICE(0x1d6b, 0x0011) }, 35 { USB_DEVICE(0x1d6b, 0x0011) },
35 { }, 36 { },
36}; 37};
37 38
38static const struct usb_device_id id_table_combined[] = { 39static const struct usb_device_id id_table_combined[] = {
39 { USB_DEVICE(0x0525, 0x127a) }, 40 { USB_DEVICE(0x0525, 0x127a) },
41 { USB_DEVICE(0x1d6b, 0x0010) },
40 { USB_DEVICE(0x1d6b, 0x0011) }, 42 { USB_DEVICE(0x1d6b, 0x0011) },
41 { }, 43 { },
42}; 44};
diff --git a/drivers/usb/storage/uas-detect.h b/drivers/usb/storage/uas-detect.h
index 1fcd758a961f..3734a25e09e5 100644
--- a/drivers/usb/storage/uas-detect.h
+++ b/drivers/usb/storage/uas-detect.h
@@ -112,6 +112,10 @@ static int uas_use_uas_driver(struct usb_interface *intf,
112 } 112 }
113 } 113 }
114 114
115 /* All Seagate disk enclosures have broken ATA pass-through support */
116 if (le16_to_cpu(udev->descriptor.idVendor) == 0x0bc2)
117 flags |= US_FL_NO_ATA_1X;
118
115 usb_stor_adjust_quirks(udev, &flags); 119 usb_stor_adjust_quirks(udev, &flags);
116 120
117 if (flags & US_FL_IGNORE_UAS) { 121 if (flags & US_FL_IGNORE_UAS) {
diff --git a/drivers/usb/typec/Kconfig b/drivers/usb/typec/Kconfig
index 465d7da849c3..bcb2744c5977 100644
--- a/drivers/usb/typec/Kconfig
+++ b/drivers/usb/typec/Kconfig
@@ -1,13 +1,53 @@
1 1
2menu "USB Power Delivery and Type-C drivers" 2menuconfig TYPEC
3 tristate "USB Type-C Support"
4 help
5 USB Type-C Specification defines a cable and connector for USB where
6 only one type of plug is supported on both ends, i.e. there will not
7 be Type-A plug on one end of the cable and Type-B plug on the other.
8 Determination of the host-to-device relationship happens through a
9 specific Configuration Channel (CC) which goes through the USB Type-C
10 cable. The Configuration Channel may also be used to detect optional
11 Accessory Modes - Analog Audio and Debug - and if USB Power Delivery
12 is supported, the Alternate Modes, where the connector is used for
13 something else then USB communication.
14
15 USB Power Delivery Specification defines a protocol that can be used
16 to negotiate the voltage and current levels with the connected
17 partners. USB Power Delivery allows higher voltages then the normal
18 5V, up to 20V, and current up to 5A over the cable. The USB Power
19 Delivery protocol is also used to negotiate the optional Alternate
20 Modes when they are supported. USB Power Delivery does not depend on
21 USB Type-C connector, however it is mostly used together with USB
22 Type-C connectors.
23
24 USB Type-C and USB Power Delivery Specifications define a set of state
25 machines that need to be implemented in either software or firmware.
26 Simple USB Type-C PHYs, for example USB Type-C Port Controller
27 Interface Specification compliant "Port Controllers" need the state
28 machines to be handled in the OS, but stand-alone USB Type-C and Power
29 Delivery controllers handle the state machines inside their firmware.
30 The USB Type-C and Power Delivery controllers usually function
31 autonomously, and do not necessarily require drivers.
32
33 Enable this configurations option if you have USB Type-C connectors on
34 your system and 1) you know your USB Type-C hardware requires OS
35 control (a driver) to function, or 2) if you need to be able to read
36 the status of the USB Type-C ports in your system, or 3) if you need
37 to be able to swap the power role (decide are you supplying or
38 consuming power over the cable) or data role (host or device) when
39 both roles are supported.
40
41 For more information, see the kernel documentation for USB Type-C
42 Connector Class API (Documentation/driver-api/usb/typec.rst)
43 <https://www.kernel.org/doc/html/latest/driver-api/usb/typec.html>
44 and ABI (Documentation/ABI/testing/sysfs-class-typec).
3 45
4config TYPEC 46if TYPEC
5 tristate
6 47
7config TYPEC_TCPM 48config TYPEC_TCPM
8 tristate "USB Type-C Port Controller Manager" 49 tristate "USB Type-C Port Controller Manager"
9 depends on USB 50 depends on USB
10 select TYPEC
11 help 51 help
12 The Type-C Port Controller Manager provides a USB PD and USB Type-C 52 The Type-C Port Controller Manager provides a USB PD and USB Type-C
13 state machine for use with Type-C Port Controllers. 53 state machine for use with Type-C Port Controllers.
@@ -22,7 +62,6 @@ config TYPEC_WCOVE
22 depends on INTEL_SOC_PMIC 62 depends on INTEL_SOC_PMIC
23 depends on INTEL_PMC_IPC 63 depends on INTEL_PMC_IPC
24 depends on BXT_WC_PMIC_OPREGION 64 depends on BXT_WC_PMIC_OPREGION
25 select TYPEC
26 help 65 help
27 This driver adds support for USB Type-C detection on Intel Broxton 66 This driver adds support for USB Type-C detection on Intel Broxton
28 platforms that have Intel Whiskey Cove PMIC. The driver can detect the 67 platforms that have Intel Whiskey Cove PMIC. The driver can detect the
@@ -31,14 +70,13 @@ config TYPEC_WCOVE
31 To compile this driver as module, choose M here: the module will be 70 To compile this driver as module, choose M here: the module will be
32 called typec_wcove 71 called typec_wcove
33 72
34endif 73endif # TYPEC_TCPM
35 74
36source "drivers/usb/typec/ucsi/Kconfig" 75source "drivers/usb/typec/ucsi/Kconfig"
37 76
38config TYPEC_TPS6598X 77config TYPEC_TPS6598X
39 tristate "TI TPS6598x USB Power Delivery controller driver" 78 tristate "TI TPS6598x USB Power Delivery controller driver"
40 depends on I2C 79 depends on I2C
41 select TYPEC
42 help 80 help
43 Say Y or M here if your system has TI TPS65982 or TPS65983 USB Power 81 Say Y or M here if your system has TI TPS65982 or TPS65983 USB Power
44 Delivery controller. 82 Delivery controller.
@@ -46,4 +84,4 @@ config TYPEC_TPS6598X
46 If you choose to build this driver as a dynamically linked module, the 84 If you choose to build this driver as a dynamically linked module, the
47 module will be called tps6598x.ko. 85 module will be called tps6598x.ko.
48 86
49endmenu 87endif # TYPEC
diff --git a/drivers/usb/typec/ucsi/Kconfig b/drivers/usb/typec/ucsi/Kconfig
index d0c31cee4720..e36d6c73c4a4 100644
--- a/drivers/usb/typec/ucsi/Kconfig
+++ b/drivers/usb/typec/ucsi/Kconfig
@@ -1,7 +1,6 @@
1config TYPEC_UCSI 1config TYPEC_UCSI
2 tristate "USB Type-C Connector System Software Interface driver" 2 tristate "USB Type-C Connector System Software Interface driver"
3 depends on !CPU_BIG_ENDIAN 3 depends on !CPU_BIG_ENDIAN
4 select TYPEC
5 help 4 help
6 USB Type-C Connector System Software Interface (UCSI) is a 5 USB Type-C Connector System Software Interface (UCSI) is a
7 specification for an interface that allows the operating system to 6 specification for an interface that allows the operating system to
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
index 713e94170963..6b3278c4b72a 100644
--- a/drivers/usb/usbip/vhci_hcd.c
+++ b/drivers/usb/usbip/vhci_hcd.c
@@ -1098,7 +1098,6 @@ static int hcd_name_to_id(const char *name)
1098static int vhci_setup(struct usb_hcd *hcd) 1098static int vhci_setup(struct usb_hcd *hcd)
1099{ 1099{
1100 struct vhci *vhci = *((void **)dev_get_platdata(hcd->self.controller)); 1100 struct vhci *vhci = *((void **)dev_get_platdata(hcd->self.controller));
1101 hcd->self.sg_tablesize = ~0;
1102 if (usb_hcd_is_primary_hcd(hcd)) { 1101 if (usb_hcd_is_primary_hcd(hcd)) {
1103 vhci->vhci_hcd_hs = hcd_to_vhci_hcd(hcd); 1102 vhci->vhci_hcd_hs = hcd_to_vhci_hcd(hcd);
1104 vhci->vhci_hcd_hs->vhci = vhci; 1103 vhci->vhci_hcd_hs->vhci = vhci;
diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
index 41a0a81b01e6..c4c79aa331bd 100644
--- a/include/uapi/linux/usb/ch9.h
+++ b/include/uapi/linux/usb/ch9.h
@@ -880,6 +880,8 @@ struct usb_wireless_cap_descriptor { /* Ultra Wide Band */
880 __u8 bReserved; 880 __u8 bReserved;
881} __attribute__((packed)); 881} __attribute__((packed));
882 882
883#define USB_DT_USB_WIRELESS_CAP_SIZE 11
884
883/* USB 2.0 Extension descriptor */ 885/* USB 2.0 Extension descriptor */
884#define USB_CAP_TYPE_EXT 2 886#define USB_CAP_TYPE_EXT 2
885 887
@@ -1072,6 +1074,7 @@ struct usb_ptm_cap_descriptor {
1072 __u8 bDevCapabilityType; 1074 __u8 bDevCapabilityType;
1073} __attribute__((packed)); 1075} __attribute__((packed));
1074 1076
1077#define USB_DT_USB_PTM_ID_SIZE 3
1075/* 1078/*
1076 * The size of the descriptor for the Sublink Speed Attribute Count 1079 * The size of the descriptor for the Sublink Speed Attribute Count
1077 * (SSAC) specified in bmAttributes[4:0]. 1080 * (SSAC) specified in bmAttributes[4:0].
diff --git a/tools/usb/usbip/libsrc/vhci_driver.c b/tools/usb/usbip/libsrc/vhci_driver.c
index 5727dfb15a83..8a1cd1616de4 100644
--- a/tools/usb/usbip/libsrc/vhci_driver.c
+++ b/tools/usb/usbip/libsrc/vhci_driver.c
@@ -329,9 +329,17 @@ err:
329int usbip_vhci_get_free_port(uint32_t speed) 329int usbip_vhci_get_free_port(uint32_t speed)
330{ 330{
331 for (int i = 0; i < vhci_driver->nports; i++) { 331 for (int i = 0; i < vhci_driver->nports; i++) {
332 if (speed == USB_SPEED_SUPER && 332
333 vhci_driver->idev[i].hub != HUB_SPEED_SUPER) 333 switch (speed) {
334 continue; 334 case USB_SPEED_SUPER:
335 if (vhci_driver->idev[i].hub != HUB_SPEED_SUPER)
336 continue;
337 break;
338 default:
339 if (vhci_driver->idev[i].hub != HUB_SPEED_HIGH)
340 continue;
341 break;
342 }
335 343
336 if (vhci_driver->idev[i].status == VDEV_ST_NULL) 344 if (vhci_driver->idev[i].status == VDEV_ST_NULL)
337 return vhci_driver->idev[i].port; 345 return vhci_driver->idev[i].port;