From: Michael Brown <mbr...@fensystems.co.uk> When a timeout occurs, attempt to gracefully disable the channel. Report a final status of EFI_TIMEOUT if the channel was disabled successfully, or EFI_DEVICE_ERROR if we were unable to disable the channel.
Signed-off-by: Michael Brown <mbr...@fensystems.co.uk> Signed-off-by: Pete Batard <p...@akeo.ie> --- Platform/RaspberryPi/RPi3/Drivers/DwUsbHostDxe/DwUsbHostDxe.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Platform/RaspberryPi/RPi3/Drivers/DwUsbHostDxe/DwUsbHostDxe.c b/Platform/RaspberryPi/RPi3/Drivers/DwUsbHostDxe/DwUsbHostDxe.c index c1e1229f858e..22d9bd822f96 100644 --- a/Platform/RaspberryPi/RPi3/Drivers/DwUsbHostDxe/DwUsbHostDxe.c +++ b/Platform/RaspberryPi/RPi3/Drivers/DwUsbHostDxe/DwUsbHostDxe.c @@ -318,13 +318,21 @@ DwHcTransfer ( Ret = Wait4Chhltd (DwHc, Timeout, Channel, &Sub, Pid, IgnoreAck, &Split); if (Ret == XFER_NOT_HALTED) { - /* - * FIXME: do proper channel reset. - */ - MmioWrite32 (DwHc->DwUsbBase + HCCHAR (Channel), DWC2_HCCHAR_CHDIS); - *TransferResult = EFI_USB_ERR_TIMEOUT; - Status = EFI_DEVICE_ERROR; + MmioOr32 (DwHc->DwUsbBase + HCCHAR (Channel), DWC2_HCCHAR_CHDIS); + Status = gBS->SetTimer (Timeout, TimerRelative, + EFI_TIMER_PERIOD_MILLISECONDS (1)); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + break; + } + Status = Wait4Bit (Timeout, DwHc->DwUsbBase + HCINT (Channel), + DWC2_HCINT_CHHLTD, 1); + if (Status == EFI_SUCCESS) { + Status = EFI_TIMEOUT; + } else { + Status = EFI_DEVICE_ERROR; + } break; } else if (Ret == XFER_STALL) { *TransferResult = EFI_USB_ERR_STALL; -- 2.21.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#43879): https://edk2.groups.io/g/devel/message/43879 Mute This Topic: https://groups.io/mt/32502335/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-