Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance EHCI #2179

Merged
merged 4 commits into from
Jul 27, 2023
Merged

Enhance EHCI #2179

merged 4 commits into from
Jul 27, 2023

Conversation

hathach
Copy link
Owner

@hathach hathach commented Jul 25, 2023

Describe the PR

  • Fix issue with hub status_change is not aligned
  • EHCI use standard USB complete interrupt instead of custom chipidea async/period interrupt to be more compatible with other ehci implementation
  • refactor usb complete & error isr processing, merge, update. Should probably fix EHCI QHD reuses QTD on wrong endpoint #2166 . @tannewt please try it out when you have time.

@tannewt
Copy link
Collaborator

tannewt commented Jul 25, 2023

I think this is needed to write the detach values back to RAM:

// Remove an attached TD from queue head
static void qhd_remove_qtd(ehci_qhd_t *qhd) {
  ehci_qtd_t * volatile qtd = qhd->attached_qtd;

  qhd->attached_qtd = NULL;
  qhd->attached_buffer = 0;
  hcd_dcache_clean(qhd, sizeof(ehci_qhd_t));

  qtd->used = 0; // free QTD
  hcd_dcache_clean(qtd, sizeof(ehci_qtd_t));
}

@hathach
Copy link
Owner Author

hathach commented Jul 26, 2023

I think this is needed to write the detach values back to RAM:

It may not be needed, since these are all software only field for managing driver accessed by CPU only. EHCI controller does know/need to access these values at all. Let me know ifthis PR help with your issue

@tannewt
Copy link
Collaborator

tannewt commented Jul 26, 2023

I think this is needed to write the detach values back to RAM:

It may not be needed, since these are all software only field for managing driver accessed by CPU only. EHCI controller does know/need to access these values at all. Let me know ifthis PR help with your issue

They are software only but you invalidate the cache for QHD and QTD because there is data on the same cache line that the EHCI controller needs. That drops any values written to the cache but not RAM. So, you need to clean when writing QTD or QHD because you may invalidate it later.

@hathach
Copy link
Owner Author

hathach commented Jul 27, 2023

Indeed, you are right, I am updating PR with suggested changes :)

@hathach hathach merged commit db59494 into master Jul 27, 2023
@hathach hathach deleted the enhance-ehci branch July 27, 2023 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EHCI QHD reuses QTD on wrong endpoint
2 participants