Edward O'Callaghan submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Edward O'Callaghan: Looks good to me, approved
raiden_debug_spi.c: Enables USB retry for invalid write count

Enables the USB SPI transfer retry mechanism when the error code
USB_SPI_WRITE_COUNT_INVALID is returned. This error code can
indicate a recoverable USB transfer failure.

BUG=b:153887087
BRANCH=none
TEST=Manual testing of ServoMicro and Flashrom when performing
reads, writes, and verification of the EC firmware on Nami.
TEST=Modified ServoMicro to randomly corrupt USB packets when
reading the packet length to replicate bad packets and the
verify recovery is successful.

Change-Id: I9e6b2ccec0b06aab0d6920f1bddf108058e5d6b1
Signed-off-by: Brian J. Nemec <bnemec@chromium.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/41152
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M raiden_debug_spi.c
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/raiden_debug_spi.c b/raiden_debug_spi.c
index 2127f69..ac74c0b 100644
--- a/raiden_debug_spi.c
+++ b/raiden_debug_spi.c
@@ -188,9 +188,13 @@
static bool retry_recovery(int error_code)
{
if (error_code < 0x10000) {
- /* Handle error codes returned from the device. */
- if (USB_SPI_WRITE_COUNT_INVALID <= error_code &&
- error_code <= USB_SPI_DISABLED) {
+ /*
+ * Handle error codes returned from the device. USB_SPI_TIMEOUT,
+ * USB_SPI_BUSY, and USB_SPI_WRITE_COUNT_INVALID have been observed
+ * during transfer errors to the device and can be recovered.
+ */
+ if (USB_SPI_READ_COUNT_INVALID <= error_code &&
+ error_code <= USB_SPI_DISABLED) {
return false;
}
} else if (usb_device_is_libusb_error(error_code)) {

To view, visit change 41152. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I9e6b2ccec0b06aab0d6920f1bddf108058e5d6b1
Gerrit-Change-Number: 41152
Gerrit-PatchSet: 4
Gerrit-Owner: Brian Nemec <bnemec@google.com>
Gerrit-Reviewer: Brian Nemec <bnemec@chromium.org>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter@users.sourceforge.net>
Gerrit-MessageType: merged