From 3a107018e54d285208885a5b69995382b5afa999 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 21 May 2022 19:57:15 +0100 Subject: [PATCH] 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. --- system/ehci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/system/ehci.c b/system/ehci.c index 79a5770..9b62452 100644 --- a/system/ehci.c +++ b/system/ehci.c @@ -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));