Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96841c5c authored by Tarun Gupta's avatar Tarun Gupta
Browse files

USB: ice40-hcd: Add retry to check if a stall is real



The bridge chip reports the NAK as STALL during mass storage transfers.
If the transfer status is read again, the correct status is reflected. Add
a workaround to read the transfer status register after receiving STALL.
This workaround is added for both IN/OUT endpoints.

CRs-Fixed: 646346
Change-Id: If531474ae1ddc2f19c94bdfdb0bd8f5b25044663
Signed-off-by: default avatarTarun Gupta <tarung@codeaurora.org>
parent e3727e00
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -543,6 +543,7 @@ static int ice40_xfer_in(struct ice40_hcd *ihcd, struct urb *urb)
	ice40_spi_reg_write(ihcd, cmd, HCMD_REG);

	status = ice40_poll_xfer(ihcd, 1000);
check_status:
	switch (XFR_MASK(status)) {
	case XFR_SUCCESS:
		usb_dotoggle(udev, epnum, is_out);
@@ -575,6 +576,10 @@ static int ice40_xfer_in(struct ice40_hcd *ihcd, struct urb *urb)
			ret = -EPROTO;
		break;
	case XFR_STALL:
		status = ice40_poll_xfer(ihcd, 900);
		/* Check if a fake STALL is reported */
		if (XFR_MASK(status) != XFR_STALL)
			goto check_status;
		ret = -EPIPE;
		break;
	case XFR_BADLEN:
@@ -699,6 +704,7 @@ no_data:
	ice40_spi_reg_write(ihcd, cmd, HCMD_REG);

	status = ice40_poll_xfer(ihcd, 1000);
check_status:
	switch (XFR_MASK(status)) {
	case XFR_SUCCESS:
		usb_dotoggle(udev, epnum, is_out);
@@ -724,6 +730,10 @@ no_data:
			ret = -EPROTO;
		break;
	case XFR_STALL:
		status = ice40_poll_xfer(ihcd, 900);
		/* Check if a fake STALL is reported */
		if (XFR_MASK(status) != XFR_STALL)
			goto check_status;
		ret = -EPIPE;
		break;
	case XFR_BADLEN: