Changeset f668d60 in mainline


Ignore:
Timestamp:
2017-10-25T14:36:20Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2cf28b9
Parents:
47ab89e
Message:

xhci: moved speed back to HC, keeping usb speed → port speed mapping

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

Legend:

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

    r47ab89e rf668d60  
    5353 */
    5454#define PSI_TO_BPS(psie, psim) (((uint64_t) psim) << (10 * psie))
    55 #define PORT_SPEED(mjr, psie, psim) { \
     55#define PORT_SPEED(usb, mjr, psie, psim) { \
    5656        .name = "USB ", \
    5757        .major = mjr, \
    5858        .minor = 0, \
     59        .usb_speed = USB_SPEED_##usb, \
    5960        .rx_bps = PSI_TO_BPS(psie, psim), \
    6061        .tx_bps = PSI_TO_BPS(psie, psim) \
    6162}
    62 static const xhci_port_speed_t ps_default_full  = PORT_SPEED(2, 2, 12);
    63 static const xhci_port_speed_t ps_default_low   = PORT_SPEED(2, 1, 1500);
    64 static const xhci_port_speed_t ps_default_high  = PORT_SPEED(2, 2, 480);
    65 static const xhci_port_speed_t ps_default_super = PORT_SPEED(3, 3, 5);
     63static const xhci_port_speed_t ps_default_full  = PORT_SPEED(FULL, 2, 2, 12);
     64static const xhci_port_speed_t ps_default_low   = PORT_SPEED(LOW, 2, 1, 1500);
     65static const xhci_port_speed_t ps_default_high  = PORT_SPEED(HIGH, 2, 2, 480);
     66static const xhci_port_speed_t ps_default_super = PORT_SPEED(SUPER, 3, 3, 5);
    6667
    6768/**
     
    7374        xhci_sp_name_t name;
    7475
    75         xhci_port_speed_t *speeds = hc->rh.speeds;
     76        xhci_port_speed_t *speeds = hc->speeds;
    7677
    7778        for (xhci_extcap_t *ec = hc->xecp; ec; ec = xhci_extcap_next(ec)) {
     
    106107                                        speeds[2] = ps_default_low;
    107108                                        speeds[3] = ps_default_high;
     109
     110                                        hc->speed_to_psiv[USB_SPEED_FULL] = 1;
     111                                        hc->speed_to_psiv[USB_SPEED_LOW] = 2;
     112                                        hc->speed_to_psiv[USB_SPEED_HIGH] = 3;
    108113                                } else if (major == 3) {
    109114                                        speeds[4] = ps_default_super;
     115                                        hc->speed_to_psiv[USB_SPEED_SUPER] = 4;
    110116                                } else {
    111117                                        return EINVAL;
     
    124130                                        speeds[psiv].minor = minor;
    125131                                        str_ncpy(speeds[psiv].name, 4, name.str, 4);
     132                                        speeds[psiv].usb_speed = USB_SPEED_MAX;
    126133
    127134                                        uint64_t bps = PSI_TO_BPS(psie, psim);
  • uspace/drv/bus/usb/xhci/hc.h

    r47ab89e rf668d60  
    7575        bool ac64;
    7676
     77        /** Port speed mapping */
     78        xhci_port_speed_t speeds [16];
     79        uint8_t speed_to_psiv [USB_SPEED_MAX];
     80
    7781        /* Command list */
    7882        list_t commands;
  • uspace/drv/bus/usb/xhci/rh.c

    r47ab89e rf668d60  
    7474}
    7575
    76 static usb_speed_t port_speed_to_usb_speed(const xhci_port_speed_t *port_speed)
    77 {
    78         assert(port_speed->major > 0 && port_speed->major <= USB_SPEED_SUPER);
    79 
    80         switch (port_speed->major) {
    81                 case 3: return USB_SPEED_SUPER;
    82                 case 2: return USB_SPEED_HIGH;
    83                 case 1: return port_speed->minor ? USB_SPEED_FULL : USB_SPEED_LOW;
    84         }
    85 
    86         assert(false);
    87 }
    88 
    8976/** Create a device node for device directly connected to RH.
    9077 */
     
    11097        dev->hub = &rh->device;
    11198        dev->port = port_id;
    112         dev->speed = port_speed_to_usb_speed(port_speed);
     99        dev->speed = port_speed->usb_speed;
    113100
    114101        if ((err = xhci_bus_enumerate_device(bus, rh->hc, dev))) {
     
    404391
    405392        unsigned psiv = XHCI_REG_RD(port_regs, XHCI_PORT_PS);
    406         return &rh->speeds[psiv];
     393        return &rh->hc->speeds[psiv];
    407394}
    408395
  • uspace/drv/bus/usb/xhci/rh.h

    r47ab89e rf668d60  
    5151        uint8_t major, minor;
    5252        uint64_t rx_bps, tx_bps;
     53        usb_speed_t usb_speed;
    5354} xhci_port_speed_t;
    5455
     
    6768        /* We need this to attach children to */
    6869        ddf_dev_t *hc_device;
    69 
    70         /** Port speeds reported from HC */
    71         xhci_port_speed_t speeds [16];
    7270
    7371        /** Interrupt transfer waiting for an actual interrupt to occur */
Note: See TracChangeset for help on using the changeset viewer.