Changeset 21885c92 in mainline


Ignore:
Timestamp:
2018-01-20T18:27:53Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
24fcb8b
Parents:
2aaba7e
Message:

usbhost: handle superspeed hubs

Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/device.c

    r2aaba7e r21885c92  
    153153        dev->is_hub = 1;
    154154        dev->num_ports = hub_desc.port_count;
    155         dev->tt_think_time = 8 +
    156                 8  * !!(hub_desc.characteristics & HUB_CHAR_TT_THINK_8) +
    157                 16 * !!(hub_desc.characteristics & HUB_CHAR_TT_THINK_16);
     155
     156        if (dev->base.speed == USB_SPEED_HIGH) {
     157                dev->tt_think_time = 8 +
     158                        8  * !!(hub_desc.characteristics & HUB_CHAR_TT_THINK_8) +
     159                        16 * !!(hub_desc.characteristics & HUB_CHAR_TT_THINK_16);
     160        }
    158161
    159162        usb_log_debug2("Device(%u): recognised USB hub with %u ports", dev->base.address, dev->num_ports);
  • uspace/lib/usb/include/usb/classes/hub.h

    r2aaba7e r21885c92  
    7171        uint8_t length;
    7272
    73         /** Descriptor type (0x29). */
     73        /** Descriptor type (0x29 or 0x2a for superspeed hub). */
    7474        uint8_t descriptor_type;
    7575
     
    116116#define HUB_CHAR_OC_PER_PORT_FLAG       (1 << 3)
    117117#define HUB_CHAR_NO_OC_FLAG             (1 << 4)
     118
     119/* These are invalid for superspeed hub */
    118120#define HUB_CHAR_TT_THINK_16            (1 << 5)
    119121#define HUB_CHAR_TT_THINK_8             (1 << 6)
     
    164166    /** This request sets a value reported in the hub status. */
    165167    USB_HUB_REQ_TYPE_SET_HUB_FEATURE = 0x20,
     168    /** This request sets the value that the hub uses to determine the index into the Route String Index for the hub. */
     169    USB_HUB_REQ_TYPE_SET_HUB_DEPTH = 0x20,
    166170    /** This request sets a value reported in the port status. */
    167     USB_HUB_REQ_TYPE_SET_PORT_FEATURE = 0x23
     171    USB_HUB_REQ_TYPE_SET_PORT_FEATURE = 0x23,
    168172} usb_hub_bm_request_type_t;
    169173
     
    191195    /** */
    192196    USB_HUB_STOP_TT = 11,
     197    /** USB 3+ only */
     198    USB_HUB_REQUEST_SET_HUB_DEPTH = 12,
    193199} usb_hub_request_t;
    194200
  • uspace/lib/usb/include/usb/descriptor.h

    r2aaba7e r21885c92  
    6060        USB_DESCTYPE_HID_PHYSICAL = 0x23,
    6161        USB_DESCTYPE_HUB = 0x29,
     62        USB_DESCTYPE_SSPEED_HUB = 0x2a,
    6263        USB_DESCTYPE_SSPEED_EP_COMPANION = 0x30
    6364        /* USB_DESCTYPE_ = */
  • uspace/lib/usbhost/src/utility.c

    r2aaba7e r21885c92  
    150150        }};
    151151
     152        const usb_descriptor_type_t type = device->speed >= USB_SPEED_SUPER
     153                ? USB_DESCTYPE_SSPEED_HUB : USB_DESCTYPE_HUB;
     154
    152155        const usb_device_request_setup_packet_t get_hub_desc = {
    153156                .request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST
     
    155158                    | USB_REQUEST_RECIPIENT_DEVICE,
    156159                .request = USB_DEVREQ_GET_DESCRIPTOR, \
    157                 .value = uint16_host2usb(USB_DESCTYPE_HUB << 8), \
     160                .value = uint16_host2usb(type << 8), \
    158161                .length = sizeof(*desc),
    159162        };
Note: See TracChangeset for help on using the changeset viewer.