Changeset 9b56e528 in mainline for uspace/drv/bus/usb/xhci/rh.c
- Timestamp:
- 2018-01-13T15:13:44Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 36fb6d7
- Parents:
- 37b13175
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-13 15:11:45)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-13 15:13:44)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/rh.c
r37b13175 r9b56e528 52 52 53 53 /* This mask only lists registers, which imply port change. */ 54 static const uint32_t port_ change_mask =54 static const uint32_t port_events_mask = 55 55 XHCI_REG_MASK(XHCI_PORT_CSC) | 56 56 XHCI_REG_MASK(XHCI_PORT_PEC) | … … 162 162 int err; 163 163 assert(rh); 164 165 164 assert(rh->devices_by_port[port_id - 1] == NULL); 165 166 if (!XHCI_REG_RD(&rh->hc->op_regs->portrs[port_id - 1], XHCI_PORT_PED)) { 167 usb_log_error("Cannot setup RH device: port is disabled."); 168 return EIO; 169 } 166 170 167 171 device_t *dev = hcd_ddf_fun_create(&rh->hc->base); … … 322 326 xhci_port_regs_t * const regs = &rh->hc->op_regs->portrs[port_id - 1]; 323 327 324 uint32_t events = XHCI_REG_RD_FIELD(®s->portsc, 32) & port_ change_mask;328 uint32_t events = XHCI_REG_RD_FIELD(®s->portsc, 32) & port_events_mask; 325 329 326 330 while (events) { 327 XHCI_REG_SET_FIELD(®s->portsc, events, 32); 331 /* 332 * The PED bit in xHCI has RW1C semantics, which means that 333 * writing 1 to it will disable the port. Which means all 334 * standard mechanisms of register handling fails here. 335 */ 336 uint32_t portsc = XHCI_REG_RD_FIELD(®s->portsc, 32); 337 portsc &= ~(port_events_mask | XHCI_REG_MASK(XHCI_PORT_PED)); // Clear events + PED 338 portsc |= events; // Add back events to assert them 339 XHCI_REG_WR_FIELD(®s->portsc, portsc, 32); 328 340 329 341 if (events & XHCI_REG_MASK(XHCI_PORT_CSC)) { … … 346 358 347 359 /* Make sure that PSCEG is 0 before exiting the loop. */ 348 events = XHCI_REG_RD_FIELD(®s->portsc, 32) & port_ change_mask;360 events = XHCI_REG_RD_FIELD(®s->portsc, 32) & port_events_mask; 349 361 } 350 362
Note:
See TracChangeset
for help on using the changeset viewer.