Changeset d1582b50 in mainline for uspace/drv/bus/usb
- Timestamp:
- 2020-12-14T20:41:53Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 02fe42e
- Parents:
- 1382446
- git-author:
- Jiri Svoboda <jiri@…> (2020-12-14 20:33:54)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-12-14 20:41:53)
- Location:
- uspace/drv/bus/usb
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci_batch.c
r1382446 rd1582b50 138 138 memcpy(ehci_batch->setup_buffer, ehci_batch->base.setup.buffer, setup_size); 139 139 140 /* Generic data already prepared */140 /* Generic data already prepared */ 141 141 ehci_batch->data_buffer = ehci_batch->base.dma_buffer.virt; 142 142 -
uspace/drv/bus/usb/ehci/ehci_rh.c
r1382446 rd1582b50 86 86 instance->hub_descriptor.header.max_current = 0; 87 87 88 /* Device removable and some legacy 1.0 stuff */88 /* Device removable and some legacy 1.0 stuff */ 89 89 instance->hub_descriptor.rempow[0] = 0xff; 90 90 instance->hub_descriptor.rempow[1] = 0xff; … … 410 410 /* Enabled features to clear: see page 269 of USB specs */ 411 411 switch (feature) { 412 case USB_HUB_FEATURE_PORT_POWER: /* 8*/412 case USB_HUB_FEATURE_PORT_POWER: /* 8 */ 413 413 usb_log_debug2("RH(%p-%u): Clear port power.", hub, port); 414 414 EHCI_CLR(hub->registers->portsc[port], … … 416 416 return EOK; 417 417 418 case USB2_HUB_FEATURE_PORT_ENABLE: /* 1*/418 case USB2_HUB_FEATURE_PORT_ENABLE: /* 1 */ 419 419 usb_log_debug2("RH(%p-%u): Clear port enable.", hub, port); 420 420 EHCI_CLR(hub->registers->portsc[port], … … 422 422 return EOK; 423 423 424 case USB2_HUB_FEATURE_PORT_SUSPEND: /* 2*/424 case USB2_HUB_FEATURE_PORT_SUSPEND: /* 2 */ 425 425 usb_log_debug2("RH(%p-%u): Clear port suspend.", hub, port); 426 426 /* If not in suspend it's noop */ … … 434 434 return delayed_job(stop_resume, hub, port); 435 435 436 case USB_HUB_FEATURE_C_PORT_CONNECTION: /* 16*/436 case USB_HUB_FEATURE_C_PORT_CONNECTION: /* 16 */ 437 437 usb_log_debug2("RH(%p-%u): Clear port connection change.", 438 438 hub, port); … … 440 440 USB_PORTSC_CONNECT_CH_FLAG); 441 441 return EOK; 442 case USB2_HUB_FEATURE_C_PORT_ENABLE: /* 17*/442 case USB2_HUB_FEATURE_C_PORT_ENABLE: /* 17 */ 443 443 usb_log_debug2("RH(%p-%u): Clear port enable change.", 444 444 hub, port); … … 446 446 USB_PORTSC_CONNECT_CH_FLAG); 447 447 return EOK; 448 case USB_HUB_FEATURE_C_PORT_OVER_CURRENT: /* 19*/448 case USB_HUB_FEATURE_C_PORT_OVER_CURRENT: /* 19 */ 449 449 usb_log_debug2("RH(%p-%u): Clear port OC change.", 450 450 hub, port); … … 452 452 USB_PORTSC_OC_CHANGE_FLAG); 453 453 return EOK; 454 case USB2_HUB_FEATURE_C_PORT_SUSPEND: /* 18*/454 case USB2_HUB_FEATURE_C_PORT_SUSPEND: /* 18 */ 455 455 usb_log_debug2("RH(%p-%u): Clear port suspend change.", 456 456 hub, port); 457 457 hub->resume_flag[port] = false; 458 458 return EOK; 459 case USB_HUB_FEATURE_C_PORT_RESET: /* 20*/459 case USB_HUB_FEATURE_C_PORT_RESET: /* 20 */ 460 460 usb_log_debug2("RH(%p-%u): Clear port reset change.", 461 461 hub, port); … … 487 487 const unsigned feature = uint16_usb2host(setup_packet->value); 488 488 switch (feature) { 489 case USB2_HUB_FEATURE_PORT_ENABLE: /* 1*/489 case USB2_HUB_FEATURE_PORT_ENABLE: /* 1 */ 490 490 usb_log_debug2("RH(%p-%u): Set port enable.", hub, port); 491 491 EHCI_SET(hub->registers->portsc[port], 492 492 USB_PORTSC_ENABLED_FLAG); 493 493 return EOK; 494 case USB2_HUB_FEATURE_PORT_SUSPEND: /* 2*/494 case USB2_HUB_FEATURE_PORT_SUSPEND: /* 2 */ 495 495 usb_log_debug2("RH(%p-%u): Set port suspend.", hub, port); 496 496 EHCI_SET(hub->registers->portsc[port], 497 497 USB_PORTSC_SUSPEND_FLAG); 498 498 return EOK; 499 case USB_HUB_FEATURE_PORT_RESET: /* 4*/499 case USB_HUB_FEATURE_PORT_RESET: /* 4 */ 500 500 usb_log_debug2("RH(%p-%u): Set port reset.", hub, port); 501 501 EHCI_SET(hub->registers->portsc[port], … … 503 503 //TODO: What if creating the delayed job fails? 504 504 return delayed_job(stop_reset, hub, port); 505 case USB_HUB_FEATURE_PORT_POWER: /* 8*/505 case USB_HUB_FEATURE_PORT_POWER: /* 8 */ 506 506 usb_log_debug2("RH(%p-%u): Set port power.", hub, port); 507 507 EHCI_SET(hub->registers->portsc[port], -
uspace/drv/bus/usb/ehci/endpoint_list.h
r1382446 rd1582b50 42 42 #include "hw_struct/queue_head.h" 43 43 44 /** Structure maintains both EHCI queue and software list of active endpoints. */44 /** Structure maintains both EHCI queue and software list of active endpoints. */ 45 45 typedef struct endpoint_list { 46 46 /** Guard against add/remove races */ -
uspace/drv/bus/usb/ohci/endpoint_list.h
r1382446 rd1582b50 44 44 #include "hw_struct/endpoint_descriptor.h" 45 45 46 /** Structure maintains both OHCI queue and software list of active endpoints. */46 /** Structure maintains both OHCI queue and software list of active endpoints. */ 47 47 typedef struct endpoint_list { 48 48 /** Guard against add/remove races */ -
uspace/drv/bus/usb/ohci/hc.c
r1382446 rd1582b50 192 192 { 193 193 assert(instance); 194 /* TODO: implement */194 /* TODO: implement */ 195 195 return ENOTSUP; 196 196 } … … 595 595 } 596 596 597 /* Init HCCA */597 /* Init HCCA */ 598 598 instance->hcca = hcca_get(); 599 599 if (instance->hcca == NULL) -
uspace/drv/bus/usb/ohci/ohci_bus.h
r1382446 rd1582b50 63 63 dma_buffer_t dma_buffer; 64 64 65 /** Link in endpoint_list */65 /** Link in endpoint_list */ 66 66 link_t eplist_link; 67 67 /** Link in pending_endpoints */ -
uspace/drv/bus/usb/ohci/ohci_regs.h
r1382446 rd1582b50 261 261 /** Number of downstream ports, max 15 */ 262 262 #define RHDA_NDS_MASK (0xff) 263 /** Power switching mode: 0-global, 1-per port */263 /** Power switching mode: 0-global, 1-per port */ 264 264 #define RHDA_PSM_FLAG (1 << 8) 265 /** No power switch: 1-power on, 0-use PSM */265 /** No power switch: 1-power on, 0-use PSM */ 266 266 #define RHDA_NPS_FLAG (1 << 9) 267 267 /** 1-Compound device, must be 0 */ … … 317 317 #define RHS_LPSC_FLAG (1 << 16) 318 318 #define RHS_SET_GLOBAL_POWER RHS_LPSC_FLAG /* synonym for the above */ 319 /** Over-current change indicator */319 /** Over-current change indicator */ 320 320 #define RHS_OCIC_FLAG (1 << 17) 321 321 #define RHS_CLEAR_DRWE (1 << 31) … … 327 327 */ 328 328 329 /** r: current connect status, w: 1-clear port enable, 0-N/S */329 /** r: current connect status, w: 1-clear port enable, 0-N/S */ 330 330 #define RHPS_CCS_FLAG (1 << 0) 331 331 #define RHPS_CLEAR_PORT_ENABLE RHPS_CCS_FLAG -
uspace/drv/bus/usb/ohci/ohci_rh.c
r1382446 rd1582b50 87 87 instance->hub_descriptor.header.max_current = 0; 88 88 89 /* Device Removable and some legacy 1.0 stuff */89 /* Device Removable and some legacy 1.0 stuff */ 90 90 instance->hub_descriptor.rempow[0] = 91 91 (port_desc >> RHDB_DR_SHIFT) & 0xff; … … 139 139 OHCI_CLR(regs->rh_desc_a, RHDA_PSM_FLAG); 140 140 141 /* Turn off power (hub driver will turn this back on) */141 /* Turn off power (hub driver will turn this back on) */ 142 142 OHCI_WR(regs->rh_status, RHS_CLEAR_GLOBAL_POWER); 143 143 … … 348 348 /* Enabled features to clear: see page 269 of USB specs */ 349 349 switch (feature) { 350 case USB_HUB_FEATURE_PORT_POWER: /* 8*/350 case USB_HUB_FEATURE_PORT_POWER: /* 8 */ 351 351 rhda = OHCI_RD(hub->registers->rh_desc_a); 352 352 /* No power switching */ … … 362 362 RHPS_CLEAR_PORT_POWER); 363 363 return EOK; 364 case USB2_HUB_FEATURE_PORT_ENABLE: /* 1*/364 case USB2_HUB_FEATURE_PORT_ENABLE: /* 1 */ 365 365 OHCI_WR(hub->registers->rh_port_status[port], 366 366 RHPS_CLEAR_PORT_ENABLE); 367 367 return EOK; 368 368 369 case USB2_HUB_FEATURE_PORT_SUSPEND: /* 2*/369 case USB2_HUB_FEATURE_PORT_SUSPEND: /* 2 */ 370 370 OHCI_WR(hub->registers->rh_port_status[port], 371 371 RHPS_CLEAR_PORT_SUSPEND); 372 372 return EOK; 373 373 374 case USB_HUB_FEATURE_C_PORT_CONNECTION: /* 16*/375 case USB2_HUB_FEATURE_C_PORT_ENABLE: /* 17*/376 case USB2_HUB_FEATURE_C_PORT_SUSPEND: /* 18*/377 case USB_HUB_FEATURE_C_PORT_OVER_CURRENT: /* 19*/378 case USB_HUB_FEATURE_C_PORT_RESET: /* 20*/374 case USB_HUB_FEATURE_C_PORT_CONNECTION: /* 16 */ 375 case USB2_HUB_FEATURE_C_PORT_ENABLE: /* 17 */ 376 case USB2_HUB_FEATURE_C_PORT_SUSPEND: /* 18 */ 377 case USB_HUB_FEATURE_C_PORT_OVER_CURRENT: /* 19 */ 378 case USB_HUB_FEATURE_C_PORT_RESET: /* 20 */ 379 379 usb_log_debug2("Clearing port C_CONNECTION, C_ENABLE, " 380 380 "C_SUSPEND, C_OC or C_RESET on port %u.", port); … … 408 408 409 409 switch (feature) { 410 case USB_HUB_FEATURE_PORT_POWER: /* 8*/410 case USB_HUB_FEATURE_PORT_POWER: /* 8 */ 411 411 rhda = OHCI_RD(hub->registers->rh_desc_a); 412 412 … … 422 422 /* Fall through, for per port power */ 423 423 /* Fallthrough */ 424 case USB2_HUB_FEATURE_PORT_ENABLE: /* 1*/425 case USB2_HUB_FEATURE_PORT_SUSPEND: /* 2*/426 case USB_HUB_FEATURE_PORT_RESET: /* 4*/424 case USB2_HUB_FEATURE_PORT_ENABLE: /* 1 */ 425 case USB2_HUB_FEATURE_PORT_SUSPEND: /* 2 */ 426 case USB_HUB_FEATURE_PORT_RESET: /* 4 */ 427 427 usb_log_debug2("Setting port POWER, ENABLE, SUSPEND or RESET " 428 428 "on port %u.", port); -
uspace/drv/bus/usb/uhci/hc.c
r1382446 rd1582b50 188 188 189 189 if (instance->hw_failures < UHCI_ALLOWED_HW_FAIL) { 190 /* reinitialize hw, this triggers virtual disconnect */190 /* reinitialize hw, this triggers virtual disconnect */ 191 191 hc_init_hw(instance); 192 192 } else { -
uspace/drv/bus/usb/usbhub/usbhub.h
r1382446 rd1582b50 61 61 /** Speed of the hub */ 62 62 usb_speed_t speed; 63 /** Generic usb device data */63 /** Generic usb device data */ 64 64 usb_device_t *usb_device; 65 65 /** Data polling handle. */ -
uspace/drv/bus/usb/xhci/hc.c
r1382446 rd1582b50 886 886 } 887 887 888 /* Issue configure endpoint command (sec 4.3.5). */888 /* Issue configure endpoint command (sec 4.3.5). */ 889 889 dma_buffer_t ictx_dma_buf; 890 890 if ((err = create_configure_ep_input_ctx(dev, &ictx_dma_buf))) … … 928 928 xhci_cmd_t cmd; 929 929 930 /* Issue configure endpoint command (sec 4.3.5). */930 /* Issue configure endpoint command (sec 4.3.5). */ 931 931 dma_buffer_t ictx_dma_buf; 932 932 errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf); … … 957 957 return EOK; 958 958 959 /* Issue configure endpoint command (sec 4.3.5) with the DC flag. */959 /* Issue configure endpoint command (sec 4.3.5) with the DC flag. */ 960 960 xhci_cmd_init(&cmd, XHCI_CMD_CONFIGURE_ENDPOINT); 961 961 cmd.slot_id = dev->slot_id; … … 981 981 xhci_cmd_t cmd; 982 982 983 /* Issue configure endpoint command (sec 4.3.5). */983 /* Issue configure endpoint command (sec 4.3.5). */ 984 984 dma_buffer_t ictx_dma_buf; 985 985 errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf); … … 1020 1020 return EOK; 1021 1021 1022 /* Issue configure endpoint command (sec 4.3.5). */1022 /* Issue configure endpoint command (sec 4.3.5). */ 1023 1023 dma_buffer_t ictx_dma_buf; 1024 1024 errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
Note:
See TracChangeset
for help on using the changeset viewer.