Changeset 816335c in mainline for uspace/drv/bus/usb/xhci/rh.c
- Timestamp:
- 2017-10-04T10:06:10Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c68c713c
- Parents:
- 5c5c9407
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/rh.c
r5c5c9407 r816335c 51 51 static usbvirt_device_ops_t ops; 52 52 53 int xhci_rh_init(xhci_rh_t *rh, xhci_ op_regs_t *op_regs)53 int xhci_rh_init(xhci_rh_t *rh, xhci_hc_t *hc) 54 54 { 55 55 assert(rh); 56 rh->op_regs = op_regs; 56 assert(hc); 57 58 rh->hc = hc; 57 59 58 60 usb_hub_descriptor_header_t *header = &rh->hub_descriptor.header; … … 172 174 { 173 175 uint8_t link_state = XHCI_REG_RD(regs, XHCI_PORT_PLS); 174 // FIXME: do we have a better way to detect if this is usb2 or usb3 device? 175 if (xhci_is_usb3_port(&hc->rh, port_id)) { 176 const xhci_port_speed_t *speed = xhci_get_port_speed(&hc->rh, port_id); 177 178 usb_log_info("Detected new %.4s%u.%u device on port %u.", speed->name, speed->major, speed->minor, port_id); 179 180 if (speed->major == 3) { 176 181 if(link_state == 0) { 177 182 /* USB3 is automatically advanced to enabled. */ 178 uint8_t port_speed = XHCI_REG_RD(regs, XHCI_PORT_PS);179 usb_log_debug("Detected new device on port %u, port speed id %u.", port_id, port_speed);180 181 183 return alloc_dev(hc, port_id, 0); 182 184 } … … 237 239 238 240 return EOK; 241 } 242 243 const xhci_port_speed_t *xhci_get_port_speed(xhci_rh_t *rh, uint8_t port) 244 { 245 xhci_port_regs_t *port_regs = &rh->hc->op_regs->portrs[port - 1]; 246 247 unsigned psiv = XHCI_REG_RD(port_regs, XHCI_PORT_PS); 248 return &rh->speeds[psiv]; 239 249 } 240 250 … … 343 353 344 354 /* The index is 1-based. */ 345 xhci_port_regs_t* regs = &hub-> op_regs->portrs[setup_packet->index - 1];355 xhci_port_regs_t* regs = &hub->hc->op_regs->portrs[setup_packet->index - 1]; 346 356 347 357 const uint32_t status = uint32_host2usb(
Note:
See TracChangeset
for help on using the changeset viewer.