Changeset 306a36d in mainline for uspace/drv/bus/usb/xhci/bus.c
- Timestamp:
- 2017-11-19T23:43:31Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ff14aede
- Parents:
- e76c0ea
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/bus.c
re76c0ea r306a36d 50 50 51 51 52 /* FIXME Are these really static? Older HCs fetch it from descriptor. */ 53 /* FIXME Add USB3 options, if applicable. */ 54 static const usb_endpoint_desc_t ep0_desc = { 52 static const usb_endpoint_desc_t ep0_initial_desc = { 55 53 .endpoint_no = 0, 56 54 .direction = USB_DIRECTION_BOTH, … … 97 95 xhci_endpoint_t *ep0 = xhci_endpoint_get(ep0_base); 98 96 99 if ((err = prepare_endpoint(ep0, &ep0_ desc)))97 if ((err = prepare_endpoint(ep0, &ep0_initial_desc))) 100 98 goto err_ep; 101 99 … … 124 122 } 125 123 124 static int setup_ep0_packet_size(xhci_hc_t *hc, xhci_device_t *dev) 125 { 126 int err; 127 128 uint16_t max_packet_size; 129 if ((err = hcd_get_ep0_max_packet_size(&max_packet_size, hc->hcd, &dev->base))) 130 return err; 131 132 xhci_endpoint_t *ep0 = dev->endpoints[0]; 133 assert(ep0); 134 135 if (ep0->base.max_packet_size == max_packet_size) 136 return EOK; 137 138 ep0->base.max_packet_size = max_packet_size; 139 140 xhci_ep_ctx_t ep_ctx; 141 xhci_setup_endpoint_context(ep0, &ep_ctx); 142 143 if ((err = hc_update_endpoint(hc, dev->slot_id, 0, &ep_ctx))) 144 return err; 145 146 return EOK; 147 } 148 126 149 int xhci_bus_enumerate_device(xhci_bus_t *bus, xhci_hc_t *hc, device_t *dev) 127 150 { … … 160 183 } 161 184 162 // TODO: Fetch descriptor of EP0 and reconfigure it accordingly 163 assert(xhci_dev->endpoints[0]); 185 if ((err = setup_ep0_packet_size(hc, xhci_dev))) { 186 usb_log_error("Failed to setup control endpoint of the new device: %s", str_error(err)); 187 goto err_address; 188 } 164 189 165 190 assert(bus->devices_by_slot[xhci_dev->slot_id] == NULL);
Note:
See TracChangeset
for help on using the changeset viewer.