diff options
| author | Peter Chen <peter.chen@nxp.com> | 2019-02-12 03:57:27 -0500 |
|---|---|---|
| committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2019-02-13 06:03:23 -0500 |
| commit | 0d1ec194721f844a6b20f7f4854332adcebc6fb9 (patch) | |
| tree | a052954f6bfb0d862f137147a96759933664ea56 /drivers/usb/misc | |
| parent | c7152763f02e05567da27462b2277a554e507c89 (diff) | |
usb: misc: usbtest: add super-speed isoc support
The calculation of packet number within microframe is different between
high-speed and super-speed endpoint, we add support for super-speed
in this patch.
Cc: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/misc')
| -rw-r--r-- | drivers/usb/misc/usbtest.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index c7f82310e73e..98ada1a3425c 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
| @@ -347,6 +347,14 @@ static unsigned get_maxpacket(struct usb_device *udev, int pipe) | |||
| 347 | return le16_to_cpup(&ep->desc.wMaxPacketSize); | 347 | return le16_to_cpup(&ep->desc.wMaxPacketSize); |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | static int ss_isoc_get_packet_num(struct usb_device *udev, int pipe) | ||
| 351 | { | ||
| 352 | struct usb_host_endpoint *ep = usb_pipe_endpoint(udev, pipe); | ||
| 353 | |||
| 354 | return USB_SS_MULT(ep->ss_ep_comp.bmAttributes) | ||
| 355 | * (1 + ep->ss_ep_comp.bMaxBurst); | ||
| 356 | } | ||
| 357 | |||
| 350 | static void simple_fill_buf(struct urb *urb) | 358 | static void simple_fill_buf(struct urb *urb) |
| 351 | { | 359 | { |
| 352 | unsigned i; | 360 | unsigned i; |
| @@ -1976,8 +1984,13 @@ static struct urb *iso_alloc_urb( | |||
| 1976 | 1984 | ||
| 1977 | if (bytes < 0 || !desc) | 1985 | if (bytes < 0 || !desc) |
| 1978 | return NULL; | 1986 | return NULL; |
| 1987 | |||
| 1979 | maxp = usb_endpoint_maxp(desc); | 1988 | maxp = usb_endpoint_maxp(desc); |
| 1980 | maxp *= usb_endpoint_maxp_mult(desc); | 1989 | if (udev->speed >= USB_SPEED_SUPER) |
| 1990 | maxp *= ss_isoc_get_packet_num(udev, pipe); | ||
| 1991 | else | ||
| 1992 | maxp *= usb_endpoint_maxp_mult(desc); | ||
| 1993 | |||
| 1981 | packets = DIV_ROUND_UP(bytes, maxp); | 1994 | packets = DIV_ROUND_UP(bytes, maxp); |
| 1982 | 1995 | ||
| 1983 | urb = usb_alloc_urb(packets, GFP_KERNEL); | 1996 | urb = usb_alloc_urb(packets, GFP_KERNEL); |
| @@ -2065,17 +2078,24 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param, | |||
| 2065 | packets *= param->iterations; | 2078 | packets *= param->iterations; |
| 2066 | 2079 | ||
| 2067 | if (context.is_iso) { | 2080 | if (context.is_iso) { |
| 2081 | int transaction_num; | ||
| 2082 | |||
| 2083 | if (udev->speed >= USB_SPEED_SUPER) | ||
| 2084 | transaction_num = ss_isoc_get_packet_num(udev, pipe); | ||
| 2085 | else | ||
| 2086 | transaction_num = usb_endpoint_maxp_mult(desc); | ||
| 2087 | |||
| 2068 | dev_info(&dev->intf->dev, | 2088 | dev_info(&dev->intf->dev, |
| 2069 | "iso period %d %sframes, wMaxPacket %d, transactions: %d\n", | 2089 | "iso period %d %sframes, wMaxPacket %d, transactions: %d\n", |
| 2070 | 1 << (desc->bInterval - 1), | 2090 | 1 << (desc->bInterval - 1), |
| 2071 | (udev->speed == USB_SPEED_HIGH) ? "micro" : "", | 2091 | (udev->speed >= USB_SPEED_HIGH) ? "micro" : "", |
| 2072 | usb_endpoint_maxp(desc), | 2092 | usb_endpoint_maxp(desc), |
| 2073 | usb_endpoint_maxp_mult(desc)); | 2093 | transaction_num); |
| 2074 | 2094 | ||
| 2075 | dev_info(&dev->intf->dev, | 2095 | dev_info(&dev->intf->dev, |
| 2076 | "total %lu msec (%lu packets)\n", | 2096 | "total %lu msec (%lu packets)\n", |
| 2077 | (packets * (1 << (desc->bInterval - 1))) | 2097 | (packets * (1 << (desc->bInterval - 1))) |
| 2078 | / ((udev->speed == USB_SPEED_HIGH) ? 8 : 1), | 2098 | / ((udev->speed >= USB_SPEED_HIGH) ? 8 : 1), |
| 2079 | packets); | 2099 | packets); |
| 2080 | } | 2100 | } |
| 2081 | 2101 | ||
