Changeset 129b821f in mainline for uspace/drv/bus/usb/usbhub


Ignore:
Timestamp:
2018-01-20T12:34:50Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
682c9354
Parents:
60d3f35
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-20 12:33:42)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-20 12:34:50)
Message:

usbhub: be aware of its own speed

This resulted in a bunch of changes just because the roothubs in older
HC's are virtual, and need to be aware of their own speed too.

Location:
uspace/drv/bus/usb/usbhub
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/port.c

    r60d3f35 r129b821f  
    8989}
    9090
     91
     92static usb_speed_t get_port_speed(usb_hub_port_t *port, uint32_t status)
     93{
     94        assert(port);
     95        assert(port->hub);
     96
     97        return usb_port_speed(port->hub->speed, status);
     98}
     99
    91100/**
    92101 * Routine for adding a new device.
     
    203212                // The connecting fibril do not touch speed until the port is enabled,
    204213                // so we do not have to lock
    205                 port->speed = usb_port_speed(status);
     214                port->speed = get_port_speed(port, status);
    206215                usb_port_enabled(&port->base);
    207216        } else
  • uspace/drv/bus/usb/usbhub/status.h

    r60d3f35 r129b821f  
    9797    (uint32_usb2host(1 << (16 + USB_HUB_FEATURE_C_HUB_LOCAL_POWER)))
    9898
    99 
    100 /**
    101  * speed getter for port status
    102  *
    103  * @param status
    104  * @return speed of usb device (for more see usb specification)
    105  */
    106 static inline usb_speed_t usb_port_speed(usb_port_status_t status)
     99static inline usb_speed_t usb_port_speed(usb_speed_t hub_speed, uint32_t status)
    107100{
     101        if (hub_speed == USB_SPEED_SUPER)
     102                return USB_SPEED_SUPER;
     103        if (hub_speed == USB_SPEED_HIGH && (status & USB_HUB_PORT_STATUS_HIGH_SPEED))
     104                return USB_SPEED_HIGH;
    108105        if ((status & USB_HUB_PORT_STATUS_LOW_SPEED) != 0)
    109106                return USB_SPEED_LOW;
    110         if ((status & USB_HUB_PORT_STATUS_HIGH_SPEED) != 0)
    111                 return USB_SPEED_HIGH;
    112         /* TODO: add super speed */
    113107        return USB_SPEED_FULL;
    114108}
  • uspace/drv/bus/usb/usbhub/usbhub.c

    r60d3f35 r129b821f  
    116116        }
    117117        hub_dev->usb_device = usb_dev;
     118        hub_dev->speed = usb_device_get_speed(usb_dev);
    118119
    119120        fibril_mutex_initialize(&hub_dev->default_address_guard);
     
    187188        }
    188189
    189         usb_log_info("Controlling hub '%s' (%p: %zu ports).",
     190        usb_log_info("Controlling %s-speed hub '%s' (%p: %zu ports).",
     191            usb_str_speed(hub_dev->speed),
    190192            usb_device_get_name(hub_dev->usb_device), hub_dev,
    191193            hub_dev->port_count);
  • uspace/drv/bus/usb/usbhub/usbhub.h

    r60d3f35 r129b821f  
    5858        /** Port structures, one for each port */
    5959        usb_hub_port_t *ports;
     60        /** Speed of the hub */
     61        usb_speed_t speed;
    6062        /** Generic usb device data*/
    6163        usb_device_t *usb_device;
Note: See TracChangeset for help on using the changeset viewer.