Reset EHCI controller after port scan if no keyboards are found.

Low and full speed USB devices that are attached directly to an EHCI port
have to be handled by a companion controller (either UHCI or OHCI). We hand
over ports when we detect a low or full speed device is attached by setting
the Port Owner bit in the Port Status and Control register. However some AMD
companion controllers fail to detect the device after this has been done.
Resetting the EHCI controller works around this quirk.

This fixes issue #6 and issue #71.
This commit is contained in:
Martin Whitaker 2022-05-21 19:57:15 +01:00
parent dce2cfb079
commit 3a107018e5
1 changed files with 1 additions and 0 deletions

View File

@ -649,6 +649,7 @@ bool ehci_init(int bus, int dev, int func, uintptr_t base_addr, usb_hcd_t *hcd)
if (num_keyboards == 0) {
// Halt the host controller.
(void)halt_host_controller(op_regs);
(void)reset_host_controller(op_regs);
// Deallocate the workspace for this controller.
pm_map[0].end += num_pages(sizeof(workspace_t));