Changeset 05770666 in mainline


Ignore:
Timestamp:
2018-01-18T14:40:20Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e7f21884
Parents:
2c0564c
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-18 14:30:02)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-18 14:40:20)
Message:

xhci rh: try to detect hidden connected devices at startup

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

Legend:

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

    r2c0564c r05770666  
    504504        XHCI_REG_SET(hc->op_regs, XHCI_OP_RS, 1);
    505505
    506         /* The reset changed status of all ports, and SW originated reason does
    507          * not cause an interrupt.
    508          */
    509         for (uint8_t port = 1; port <= hc->rh.max_ports; ++port)
    510                 xhci_rh_handle_port_change(&hc->rh, port);
     506        xhci_rh_startup(&hc->rh);
    511507
    512508        return EOK;
  • uspace/drv/bus/usb/xhci/rh.c

    r2c0564c r05770666  
    224224                        status &= ~XHCI_REG_MASK(XHCI_PORT_CSC);
    225225
    226                         bool connected = !!(status & XHCI_REG_MASK(XHCI_PORT_CCS));
     226                        const bool connected = !!(status & XHCI_REG_MASK(XHCI_PORT_CCS));
    227227                        if (connected) {
    228228                                usb_port_connected(&port->base, &rh_enumerate_device);
     
    234234                if (status & XHCI_REG_MASK(XHCI_PORT_PRC)) {
    235235                        status &= ~XHCI_REG_MASK(XHCI_PORT_PRC);
    236                         bool enabled = !!(status & XHCI_REG_MASK(XHCI_PORT_PED));
    237 
     236
     237                        const bool enabled = !!(status & XHCI_REG_MASK(XHCI_PORT_PED));
    238238                        if (enabled) {
    239239                                usb_port_enabled(&port->base);
     
    258258}
    259259
     260void xhci_rh_startup(xhci_rh_t *rh)
     261{
     262        /* The reset changed status of all ports, and SW originated reason does
     263         * not cause an interrupt.
     264         */
     265        for (uint8_t i = 1; i < rh->max_ports; ++i) {
     266                xhci_rh_handle_port_change(rh, i + 1);
     267
     268                rh_port_t * const port = &rh->ports[i];
     269
     270                /*
     271                 * When xHCI starts, for some reasons USB 3 ports do not have
     272                 * the CSC bit, even though they are connected. Try to find
     273                 * such ports.
     274                 */
     275                if (XHCI_REG_RD(port->regs, XHCI_PORT_CCS) && port->base.state == PORT_DISABLED)
     276                        usb_port_connected(&port->base, &rh_enumerate_device);
     277        }
     278}
     279
    260280/**
    261281 * @}
  • uspace/drv/bus/usb/xhci/rh.h

    r2c0564c r05770666  
    8080void xhci_rh_handle_port_change(xhci_rh_t *, uint8_t);
    8181void xhci_rh_set_ports_protocol(xhci_rh_t *, unsigned, unsigned, unsigned);
     82void xhci_rh_startup(xhci_rh_t *);
    8283
    8384#endif
Note: See TracChangeset for help on using the changeset viewer.