diff options
-rw-r--r-- | drivers/usb/core/config.c | 36 | ||||
-rw-r--r-- | drivers/usb/host/xhci-mem.c | 2 | ||||
-rw-r--r-- | include/linux/usb.h | 14 | ||||
-rw-r--r-- | include/linux/usb/ch9.h | 4 |
4 files changed, 29 insertions, 27 deletions
diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 7103758bb486..24dfb33f90cb 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c | |||
@@ -69,30 +69,31 @@ static int find_next_descriptor(unsigned char *buffer, int size, | |||
69 | return buffer - buffer0; | 69 | return buffer - buffer0; |
70 | } | 70 | } |
71 | 71 | ||
72 | static int usb_parse_endpoint_companion(struct device *ddev, int cfgno, | 72 | static int usb_parse_ss_endpoint_companion(struct device *ddev, int cfgno, |
73 | int inum, int asnum, struct usb_host_endpoint *ep, | 73 | int inum, int asnum, struct usb_host_endpoint *ep, |
74 | int num_ep, unsigned char *buffer, int size) | 74 | int num_ep, unsigned char *buffer, int size) |
75 | { | 75 | { |
76 | unsigned char *buffer_start = buffer; | 76 | unsigned char *buffer_start = buffer; |
77 | struct usb_ep_comp_descriptor *desc; | 77 | struct usb_ss_ep_comp_descriptor *desc; |
78 | int retval; | 78 | int retval; |
79 | int num_skipped; | 79 | int num_skipped; |
80 | int max_tx; | 80 | int max_tx; |
81 | int i; | 81 | int i; |
82 | 82 | ||
83 | /* Allocate space for the companion descriptor */ | 83 | /* Allocate space for the SS endpoint companion descriptor */ |
84 | ep->ep_comp = kzalloc(sizeof(struct usb_host_ep_comp), GFP_KERNEL); | 84 | ep->ss_ep_comp = kzalloc(sizeof(struct usb_host_ss_ep_comp), |
85 | if (!ep->ep_comp) | 85 | GFP_KERNEL); |
86 | if (!ep->ss_ep_comp) | ||
86 | return -ENOMEM; | 87 | return -ENOMEM; |
87 | desc = (struct usb_ep_comp_descriptor *) buffer; | 88 | desc = (struct usb_ss_ep_comp_descriptor *) buffer; |
88 | if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP) { | 89 | if (desc->bDescriptorType != USB_DT_SS_ENDPOINT_COMP) { |
89 | dev_warn(ddev, "No SuperSpeed endpoint companion for config %d " | 90 | dev_warn(ddev, "No SuperSpeed endpoint companion for config %d " |
90 | " interface %d altsetting %d ep %d: " | 91 | " interface %d altsetting %d ep %d: " |
91 | "using minimum values\n", | 92 | "using minimum values\n", |
92 | cfgno, inum, asnum, ep->desc.bEndpointAddress); | 93 | cfgno, inum, asnum, ep->desc.bEndpointAddress); |
93 | ep->ep_comp->desc.bLength = USB_DT_EP_COMP_SIZE; | 94 | ep->ss_ep_comp->desc.bLength = USB_DT_SS_EP_COMP_SIZE; |
94 | ep->ep_comp->desc.bDescriptorType = USB_DT_SS_ENDPOINT_COMP; | 95 | ep->ss_ep_comp->desc.bDescriptorType = USB_DT_SS_ENDPOINT_COMP; |
95 | ep->ep_comp->desc.bMaxBurst = 0; | 96 | ep->ss_ep_comp->desc.bMaxBurst = 0; |
96 | /* | 97 | /* |
97 | * Leave bmAttributes as zero, which will mean no streams for | 98 | * Leave bmAttributes as zero, which will mean no streams for |
98 | * bulk, and isoc won't support multiple bursts of packets. | 99 | * bulk, and isoc won't support multiple bursts of packets. |
@@ -102,7 +103,7 @@ static int usb_parse_endpoint_companion(struct device *ddev, int cfgno, | |||
102 | */ | 103 | */ |
103 | if (usb_endpoint_xfer_isoc(&ep->desc) || | 104 | if (usb_endpoint_xfer_isoc(&ep->desc) || |
104 | usb_endpoint_xfer_int(&ep->desc)) | 105 | usb_endpoint_xfer_int(&ep->desc)) |
105 | ep->ep_comp->desc.wBytesPerInterval = | 106 | ep->ss_ep_comp->desc.wBytesPerInterval = |
106 | ep->desc.wMaxPacketSize; | 107 | ep->desc.wMaxPacketSize; |
107 | /* | 108 | /* |
108 | * The next descriptor is for an Endpoint or Interface, | 109 | * The next descriptor is for an Endpoint or Interface, |
@@ -112,16 +113,16 @@ static int usb_parse_endpoint_companion(struct device *ddev, int cfgno, | |||
112 | retval = 0; | 113 | retval = 0; |
113 | goto valid; | 114 | goto valid; |
114 | } | 115 | } |
115 | memcpy(&ep->ep_comp->desc, desc, USB_DT_EP_COMP_SIZE); | 116 | memcpy(&ep->ss_ep_comp->desc, desc, USB_DT_SS_EP_COMP_SIZE); |
116 | desc = &ep->ep_comp->desc; | 117 | desc = &ep->ss_ep_comp->desc; |
117 | buffer += desc->bLength; | 118 | buffer += desc->bLength; |
118 | size -= desc->bLength; | 119 | size -= desc->bLength; |
119 | 120 | ||
120 | /* Eat up the other descriptors we don't care about */ | 121 | /* Eat up the other descriptors we don't care about */ |
121 | ep->ep_comp->extra = buffer; | 122 | ep->ss_ep_comp->extra = buffer; |
122 | i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT, | 123 | i = find_next_descriptor(buffer, size, USB_DT_ENDPOINT, |
123 | USB_DT_INTERFACE, &num_skipped); | 124 | USB_DT_INTERFACE, &num_skipped); |
124 | ep->ep_comp->extralen = i; | 125 | ep->ss_ep_comp->extralen = i; |
125 | buffer += i; | 126 | buffer += i; |
126 | size -= i; | 127 | size -= i; |
127 | retval = buffer - buffer_start + i; | 128 | retval = buffer - buffer_start + i; |
@@ -310,7 +311,7 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
310 | cfgno, inum, asnum, d->bEndpointAddress, | 311 | cfgno, inum, asnum, d->bEndpointAddress, |
311 | maxp); | 312 | maxp); |
312 | } | 313 | } |
313 | /* Allocate room for and parse any endpoint companion descriptors */ | 314 | /* Allocate room for and parse any SS endpoint companion descriptors */ |
314 | if (to_usb_device(ddev)->speed == USB_SPEED_SUPER) { | 315 | if (to_usb_device(ddev)->speed == USB_SPEED_SUPER) { |
315 | endpoint->extra = buffer; | 316 | endpoint->extra = buffer; |
316 | i = find_next_descriptor_more(buffer, size, USB_DT_SS_ENDPOINT_COMP, | 317 | i = find_next_descriptor_more(buffer, size, USB_DT_SS_ENDPOINT_COMP, |
@@ -320,8 +321,9 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum, | |||
320 | size -= i; | 321 | size -= i; |
321 | 322 | ||
322 | if (size > 0) { | 323 | if (size > 0) { |
323 | retval = usb_parse_endpoint_companion(ddev, cfgno, inum, asnum, | 324 | retval = usb_parse_ss_endpoint_companion(ddev, cfgno, |
324 | endpoint, num_ep, buffer, size); | 325 | inum, asnum, endpoint, num_ep, buffer, |
326 | size); | ||
325 | if (retval >= 0) { | 327 | if (retval >= 0) { |
326 | buffer += retval; | 328 | buffer += retval; |
327 | retval = buffer - buffer0; | 329 | retval = buffer - buffer0; |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index f49f280cfd43..a7fbd6c10add 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -496,7 +496,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, | |||
496 | max_packet = ep->desc.wMaxPacketSize; | 496 | max_packet = ep->desc.wMaxPacketSize; |
497 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); | 497 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); |
498 | /* dig out max burst from ep companion desc */ | 498 | /* dig out max burst from ep companion desc */ |
499 | max_packet = ep->ep_comp->desc.bMaxBurst; | 499 | max_packet = ep->ss_ep_comp->desc.bMaxBurst; |
500 | ep_ctx->ep_info2 |= MAX_BURST(max_packet); | 500 | ep_ctx->ep_info2 |= MAX_BURST(max_packet); |
501 | break; | 501 | break; |
502 | case USB_SPEED_HIGH: | 502 | case USB_SPEED_HIGH: |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 0a1819a64974..7e6b5259ea35 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -47,15 +47,15 @@ struct ep_device; | |||
47 | 47 | ||
48 | /* For SS devices */ | 48 | /* For SS devices */ |
49 | /** | 49 | /** |
50 | * struct usb_host_ep_comp - Valid for SuperSpeed devices only | 50 | * struct usb_host_ss_ep_comp - Valid for SuperSpeed devices only |
51 | * @desc: endpoint companion descriptor, wMaxPacketSize in native byteorder | 51 | * @desc: endpoint companion descriptor, wMaxPacketSize in native byteorder |
52 | * @extra: descriptors following this endpoint companion descriptor | 52 | * @extra: descriptors following this endpoint companion descriptor |
53 | * @extralen: how many bytes of "extra" are valid | 53 | * @extralen: how many bytes of "extra" are valid |
54 | */ | 54 | */ |
55 | struct usb_host_ep_comp { | 55 | struct usb_host_ss_ep_comp { |
56 | struct usb_ep_comp_descriptor desc; | 56 | struct usb_ss_ep_comp_descriptor desc; |
57 | unsigned char *extra; /* Extra descriptors */ | 57 | unsigned char *extra; /* Extra descriptors */ |
58 | int extralen; | 58 | int extralen; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | /** | 61 | /** |
@@ -65,7 +65,7 @@ struct usb_host_ep_comp { | |||
65 | * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) | 65 | * @hcpriv: for use by HCD; typically holds hardware dma queue head (QH) |
66 | * with one or more transfer descriptors (TDs) per urb | 66 | * with one or more transfer descriptors (TDs) per urb |
67 | * @ep_dev: ep_device for sysfs info | 67 | * @ep_dev: ep_device for sysfs info |
68 | * @ep_comp: companion descriptor information for this endpoint | 68 | * @ss_ep_comp: companion descriptor information for this endpoint |
69 | * @extra: descriptors following this endpoint in the configuration | 69 | * @extra: descriptors following this endpoint in the configuration |
70 | * @extralen: how many bytes of "extra" are valid | 70 | * @extralen: how many bytes of "extra" are valid |
71 | * @enabled: URBs may be submitted to this endpoint | 71 | * @enabled: URBs may be submitted to this endpoint |
@@ -78,7 +78,7 @@ struct usb_host_endpoint { | |||
78 | struct list_head urb_list; | 78 | struct list_head urb_list; |
79 | void *hcpriv; | 79 | void *hcpriv; |
80 | struct ep_device *ep_dev; /* For sysfs info */ | 80 | struct ep_device *ep_dev; /* For sysfs info */ |
81 | struct usb_host_ep_comp *ep_comp; /* For SS devices */ | 81 | struct usb_host_ss_ep_comp *ss_ep_comp; /* For SS devices */ |
82 | 82 | ||
83 | unsigned char *extra; /* Extra descriptors */ | 83 | unsigned char *extra; /* Extra descriptors */ |
84 | int extralen; | 84 | int extralen; |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 9e9c5c0a3d72..93223638f702 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -538,7 +538,7 @@ static inline int usb_endpoint_is_isoc_out( | |||
538 | /*-------------------------------------------------------------------------*/ | 538 | /*-------------------------------------------------------------------------*/ |
539 | 539 | ||
540 | /* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ | 540 | /* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */ |
541 | struct usb_ep_comp_descriptor { | 541 | struct usb_ss_ep_comp_descriptor { |
542 | __u8 bLength; | 542 | __u8 bLength; |
543 | __u8 bDescriptorType; | 543 | __u8 bDescriptorType; |
544 | 544 | ||
@@ -547,7 +547,7 @@ struct usb_ep_comp_descriptor { | |||
547 | __u16 wBytesPerInterval; | 547 | __u16 wBytesPerInterval; |
548 | } __attribute__ ((packed)); | 548 | } __attribute__ ((packed)); |
549 | 549 | ||
550 | #define USB_DT_EP_COMP_SIZE 6 | 550 | #define USB_DT_SS_EP_COMP_SIZE 6 |
551 | 551 | ||
552 | /*-------------------------------------------------------------------------*/ | 552 | /*-------------------------------------------------------------------------*/ |
553 | 553 | ||