Changeset f668d60 in mainline
- Timestamp:
- 2017-10-25T14:36:20Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2cf28b9
- Parents:
- 47ab89e
- Location:
- uspace/drv/bus/usb/xhci
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/hc.c
r47ab89e rf668d60 53 53 */ 54 54 #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) { \ 56 56 .name = "USB ", \ 57 57 .major = mjr, \ 58 58 .minor = 0, \ 59 .usb_speed = USB_SPEED_##usb, \ 59 60 .rx_bps = PSI_TO_BPS(psie, psim), \ 60 61 .tx_bps = PSI_TO_BPS(psie, psim) \ 61 62 } 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);63 static const xhci_port_speed_t ps_default_full = PORT_SPEED(FULL, 2, 2, 12); 64 static const xhci_port_speed_t ps_default_low = PORT_SPEED(LOW, 2, 1, 1500); 65 static const xhci_port_speed_t ps_default_high = PORT_SPEED(HIGH, 2, 2, 480); 66 static const xhci_port_speed_t ps_default_super = PORT_SPEED(SUPER, 3, 3, 5); 66 67 67 68 /** … … 73 74 xhci_sp_name_t name; 74 75 75 xhci_port_speed_t *speeds = hc-> rh.speeds;76 xhci_port_speed_t *speeds = hc->speeds; 76 77 77 78 for (xhci_extcap_t *ec = hc->xecp; ec; ec = xhci_extcap_next(ec)) { … … 106 107 speeds[2] = ps_default_low; 107 108 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; 108 113 } else if (major == 3) { 109 114 speeds[4] = ps_default_super; 115 hc->speed_to_psiv[USB_SPEED_SUPER] = 4; 110 116 } else { 111 117 return EINVAL; … … 124 130 speeds[psiv].minor = minor; 125 131 str_ncpy(speeds[psiv].name, 4, name.str, 4); 132 speeds[psiv].usb_speed = USB_SPEED_MAX; 126 133 127 134 uint64_t bps = PSI_TO_BPS(psie, psim); -
uspace/drv/bus/usb/xhci/hc.h
r47ab89e rf668d60 75 75 bool ac64; 76 76 77 /** Port speed mapping */ 78 xhci_port_speed_t speeds [16]; 79 uint8_t speed_to_psiv [USB_SPEED_MAX]; 80 77 81 /* Command list */ 78 82 list_t commands; -
uspace/drv/bus/usb/xhci/rh.c
r47ab89e rf668d60 74 74 } 75 75 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 89 76 /** Create a device node for device directly connected to RH. 90 77 */ … … 110 97 dev->hub = &rh->device; 111 98 dev->port = port_id; 112 dev->speed = port_speed _to_usb_speed(port_speed);99 dev->speed = port_speed->usb_speed; 113 100 114 101 if ((err = xhci_bus_enumerate_device(bus, rh->hc, dev))) { … … 404 391 405 392 unsigned psiv = XHCI_REG_RD(port_regs, XHCI_PORT_PS); 406 return &rh-> speeds[psiv];393 return &rh->hc->speeds[psiv]; 407 394 } 408 395 -
uspace/drv/bus/usb/xhci/rh.h
r47ab89e rf668d60 51 51 uint8_t major, minor; 52 52 uint64_t rx_bps, tx_bps; 53 usb_speed_t usb_speed; 53 54 } xhci_port_speed_t; 54 55 … … 67 68 /* We need this to attach children to */ 68 69 ddf_dev_t *hc_device; 69 70 /** Port speeds reported from HC */71 xhci_port_speed_t speeds [16];72 70 73 71 /** Interrupt transfer waiting for an actual interrupt to occur */
Note:
See TracChangeset
for help on using the changeset viewer.