Changeset 129b821f in mainline
- Timestamp:
- 2018-01-20T12:34:50Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 682c9354
- Parents:
- 60d3f35
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-20 12:33:42)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-20 12:34:50)
- Location:
- uspace
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/hc.c
r60d3f35 r129b821f 473 473 } 474 474 475 /** 476 * Setup roothub as a virtual hub. 477 */ 478 int hc_setup_roothub(hc_device_t *hcd) 479 { 480 return hc_setup_virtual_root_hub(hcd, USB_SPEED_HIGH); 481 } 482 475 483 /** Initialize memory structures used by the EHCI hcd. 476 484 * -
uspace/drv/bus/usb/ehci/hc.h
r60d3f35 r129b821f 102 102 int hc_add(hc_device_t *, const hw_res_list_parsed_t *); 103 103 int hc_start(hc_device_t *); 104 int hc_setup_roothub(hc_device_t *); 104 105 int hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *); 105 106 int hc_gone(hc_device_t *); -
uspace/drv/bus/usb/ehci/hw_struct/queue_head.c
r60d3f35 r129b821f 46 46 [USB_SPEED_FULL] = QH_EP_CHAR_EPS_FS, 47 47 [USB_SPEED_HIGH] = QH_EP_CHAR_EPS_HS, 48 49 /* Solely for the roothub */50 [USB_SPEED_MAX] = 0,51 48 }; 52 49 -
uspace/drv/bus/usb/ehci/main.c
r60d3f35 r129b821f 37 37 #include <io/logctl.h> 38 38 #include <usb/host/hcd.h> 39 #include <usb/host/utility.h>40 39 41 40 #include "res.h" … … 52 51 .claim = disable_legacy, 53 52 .start = hc_start, 54 .setup_root_hub = hc_setup_ virtual_root_hub,53 .setup_root_hub = hc_setup_roothub, 55 54 .hc_gone = hc_gone, 56 55 }; -
uspace/drv/bus/usb/ohci/hc.c
r60d3f35 r129b821f 540 540 } 541 541 542 /** 543 * Setup roothub as a virtual hub. 544 */ 545 int hc_setup_roothub(hc_device_t *hcd) 546 { 547 return hc_setup_virtual_root_hub(hcd, USB_SPEED_FULL); 548 } 549 542 550 /** Initialize schedule queues 543 551 * -
uspace/drv/bus/usb/ohci/hc.h
r60d3f35 r129b821f 93 93 extern int hc_gain_control(hc_device_t *); 94 94 extern int hc_start(hc_device_t *); 95 extern int hc_setup_roothub(hc_device_t *); 95 96 extern int hc_gone(hc_device_t *); 96 97 -
uspace/drv/bus/usb/ohci/main.c
r60d3f35 r129b821f 43 43 44 44 #include <usb/debug.h> 45 #include <usb/host/utility.h>46 45 47 46 #include "hc.h" … … 58 57 .claim = hc_gain_control, 59 58 .start = hc_start, 60 .setup_root_hub = hc_setup_ virtual_root_hub,59 .setup_root_hub = hc_setup_roothub, 61 60 .hc_gone = hc_gone, 62 61 }; -
uspace/drv/bus/usb/uhci/hc.c
r60d3f35 r129b821f 51 51 #include <usb/host/utils/malloc32.h> 52 52 #include <usb/host/bandwidth.h> 53 #include <usb/host/utility.h> 53 54 54 55 #include "uhci_batch.h" … … 258 259 } 259 260 261 int hc_setup_roothub(hc_device_t *hcd) 262 { 263 return hc_setup_virtual_root_hub(hcd, USB_SPEED_FULL); 264 } 265 260 266 /** Safely dispose host controller internal structures 261 267 * … … 330 336 331 337 // Check for the roothub, as it does not schedule into lists 332 if (ep->device-> speed == USB_SPEED_MAX) {338 if (ep->device->address == uhci_rh_get_address(&hc->rh)) { 333 339 // FIXME: We shall check the roothub for active transfer. But 334 340 // as it is polling, there is no way to make it stop doing so. -
uspace/drv/bus/usb/uhci/hc.h
r60d3f35 r129b821f 150 150 extern int hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *); 151 151 extern int hc_start(hc_device_t *); 152 extern int hc_setup_roothub(hc_device_t *); 152 153 extern int hc_gone(hc_device_t *); 153 154 -
uspace/drv/bus/usb/uhci/main.c
r60d3f35 r129b821f 58 58 .hc_add = hc_add, 59 59 .start = hc_start, 60 .setup_root_hub = hc_setup_ virtual_root_hub,60 .setup_root_hub = hc_setup_roothub, 61 61 .hc_gone = hc_gone, 62 62 }; -
uspace/drv/bus/usb/usbhub/port.c
r60d3f35 r129b821f 89 89 } 90 90 91 92 static usb_speed_t get_port_speed(usb_hub_port_t *port, uint32_t status) 93 { 94 assert(port); 95 assert(port->hub); 96 97 return usb_port_speed(port->hub->speed, status); 98 } 99 91 100 /** 92 101 * Routine for adding a new device. … … 203 212 // The connecting fibril do not touch speed until the port is enabled, 204 213 // so we do not have to lock 205 port->speed = usb_port_speed(status);214 port->speed = get_port_speed(port, status); 206 215 usb_port_enabled(&port->base); 207 216 } else -
uspace/drv/bus/usb/usbhub/status.h
r60d3f35 r129b821f 97 97 (uint32_usb2host(1 << (16 + USB_HUB_FEATURE_C_HUB_LOCAL_POWER))) 98 98 99 100 /** 101 * speed getter for port status 102 * 103 * @param status 104 * @return speed of usb device (for more see usb specification) 105 */ 106 static inline usb_speed_t usb_port_speed(usb_port_status_t status) 99 static inline usb_speed_t usb_port_speed(usb_speed_t hub_speed, uint32_t status) 107 100 { 101 if (hub_speed == USB_SPEED_SUPER) 102 return USB_SPEED_SUPER; 103 if (hub_speed == USB_SPEED_HIGH && (status & USB_HUB_PORT_STATUS_HIGH_SPEED)) 104 return USB_SPEED_HIGH; 108 105 if ((status & USB_HUB_PORT_STATUS_LOW_SPEED) != 0) 109 106 return USB_SPEED_LOW; 110 if ((status & USB_HUB_PORT_STATUS_HIGH_SPEED) != 0)111 return USB_SPEED_HIGH;112 /* TODO: add super speed */113 107 return USB_SPEED_FULL; 114 108 } -
uspace/drv/bus/usb/usbhub/usbhub.c
r60d3f35 r129b821f 116 116 } 117 117 hub_dev->usb_device = usb_dev; 118 hub_dev->speed = usb_device_get_speed(usb_dev); 118 119 119 120 fibril_mutex_initialize(&hub_dev->default_address_guard); … … 187 188 } 188 189 189 usb_log_info("Controlling hub '%s' (%p: %zu ports).", 190 usb_log_info("Controlling %s-speed hub '%s' (%p: %zu ports).", 191 usb_str_speed(hub_dev->speed), 190 192 usb_device_get_name(hub_dev->usb_device), hub_dev, 191 193 hub_dev->port_count); -
uspace/drv/bus/usb/usbhub/usbhub.h
r60d3f35 r129b821f 58 58 /** Port structures, one for each port */ 59 59 usb_hub_port_t *ports; 60 /** Speed of the hub */ 61 usb_speed_t speed; 60 62 /** Generic usb device data*/ 61 63 usb_device_t *usb_device; -
uspace/drv/bus/usb/vhc/main.c
r60d3f35 r129b821f 107 107 * needs to be ready at this time. 108 108 */ 109 ret = hc_setup_virtual_root_hub(&vhc->base );109 ret = hc_setup_virtual_root_hub(&vhc->base, USB_SPEED_HIGH); 110 110 if (ret != EOK) { 111 111 usb_log_error("Failed to init VHC root hub: %s", -
uspace/lib/usbdev/include/usb/dev/device.h
r60d3f35 r129b821f 90 90 int usb_device_unmap_ep(usb_endpoint_mapping_t *); 91 91 92 usb_speed_t usb_device_get_speed(usb_device_t *); 92 93 int usb_device_get_iface_number(usb_device_t *); 93 94 devman_handle_t usb_device_get_devman_handle(usb_device_t *); -
uspace/lib/usbdev/src/devdrv.c
r60d3f35 r129b821f 364 364 } 365 365 366 usb_speed_t usb_device_get_speed(usb_device_t *usb_dev) 367 { 368 assert(usb_dev); 369 return usb_dev->speed; 370 } 371 366 372 int usb_device_get_iface_number(usb_device_t *usb_dev) 367 373 { -
uspace/lib/usbhost/include/usb/host/utility.h
r60d3f35 r129b821f 48 48 int hc_get_ep0_max_packet_size(uint16_t *, bus_t *, device_t *); 49 49 void hc_reset_toggles(const usb_transfer_batch_t *batch, endpoint_reset_toggle_t); 50 int hc_setup_virtual_root_hub(hc_device_t * );50 int hc_setup_virtual_root_hub(hc_device_t *, usb_speed_t); 51 51 int hc_get_device_desc(device_t *, usb_standard_device_descriptor_t *); 52 52 int hc_get_hub_desc(device_t *, usb_hub_descriptor_header_t *); -
uspace/lib/usbhost/src/utility.c
r60d3f35 r129b821f 177 177 * @return Error code 178 178 */ 179 int hc_setup_virtual_root_hub(hc_device_t *hcd )179 int hc_setup_virtual_root_hub(hc_device_t *hcd, usb_speed_t rh_speed) 180 180 { 181 181 int err; … … 183 183 assert(hcd); 184 184 185 device_t *dev = hcd_ddf_fun_create(hcd, USB_SPEED_MAX);185 device_t *dev = hcd_ddf_fun_create(hcd, rh_speed); 186 186 if (!dev) { 187 187 usb_log_error("Failed to create function for the root hub.");
Note:
See TracChangeset
for help on using the changeset viewer.