Changeset 2cf28b9 in mainline for uspace/drv/bus/usb/xhci/rh.c


Ignore:
Timestamp:
2017-10-25T15:22:45Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
Children:
62558202
Parents:
f668d60
Message:

xhci: connecting devices deeper than to roothub

It still does not work, because the address command fails, but there should not be any fundamental problem.

File:
1 edited

Legend:

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

    rf668d60 r2cf28b9  
    6969        rh->max_ports = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PORTS);
    7070        rh->devices = (xhci_device_t **) calloc(rh->max_ports, sizeof(xhci_device_t *));
    71         hc->rh.hc_device = device;
    72 
    73         return device_init(&hc->rh.device);
     71        rh->hc_device = device;
     72
     73        const int err = device_init(&rh->device.base);
     74        if (err)
     75                return err;
     76
     77        /* Initialize route string */
     78        rh->device.route_str = 0;
     79        rh->device.tier = 0;
     80
     81        return EOK;
    7482}
    7583
     
    8189        assert(rh);
    8290        assert(rh->hc_device);
     91
     92        assert(rh->devices[port_id - 1] == NULL);
    8393
    8494        xhci_bus_t *bus = &rh->hc->bus;
     
    94104        xhci_dev->hc = rh->hc;
    95105        xhci_dev->usb3 = port_speed->major == 3;
    96 
    97         dev->hub = &rh->device;
     106        xhci_dev->rh_port = port_id;
     107
     108        dev->hub = &rh->device.base;
    98109        dev->port = port_id;
    99110        dev->speed = port_speed->usb_speed;
     
    113124        }
    114125
    115         fibril_mutex_lock(&rh->device.guard);
    116         list_append(&dev->link, &rh->device.devices);
    117         if (!rh->devices[port_id - 1]) {
    118                 /* Only save the device if it's the first one connected to this port. */
    119                 rh->devices[port_id - 1] = xhci_dev;
    120         }
    121         fibril_mutex_unlock(&rh->device.guard);
     126        fibril_mutex_lock(&rh->device.base.guard);
     127        list_append(&dev->link, &rh->device.base.devices);
     128        rh->devices[port_id - 1] = xhci_dev;
     129        fibril_mutex_unlock(&rh->device.base.guard);
    122130
    123131        return EOK;
     
    185193        fibril_mutex_unlock(&dev->base.guard);
    186194
    187         fibril_mutex_lock(&rh->device.guard);
     195        fibril_mutex_lock(&rh->device.base.guard);
    188196        list_remove(&dev->base.link);
    189         fibril_mutex_unlock(&rh->device.guard);
    190 
    191197        rh->devices[port_id - 1] = NULL;
     198        fibril_mutex_unlock(&rh->device.base.guard);
     199
    192200        usb_log_debug2("Aborting all active transfers to '%s'.", ddf_fun_get_name(dev->base.fun));
    193201
Note: See TracChangeset for help on using the changeset viewer.