Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Apr 2022 21:47:03 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        Mahesh Vardhamanaiah <maheshmv@juniper.net>, "freebsd-usb@freebsd.org" <freebsd-usb@freebsd.org>
Cc:        Steve Kiernan <stevek@juniper.net>, Justin Hibbits <jhibbits@juniper.net>, Kumara N Babu <bkumara@juniper.net>, Kamal Prasad <krprasad@juniper.net>, Kristof Provost <kp@FreeBSD.org>, "Bjoern A. Zeeb" <bz@FreeBSD.org>
Subject:   Re: xhci data toggle out of sync
Message-ID:  <8f51424d-7d1a-9f0a-a0ba-27b02cab0942@selasky.org>
In-Reply-To: <PH0PR05MB7782707B34F020611B7FA6C3D5F39@PH0PR05MB7782.namprd05.prod.outlook.com>
References:  <PH0PR05MB778212B54B636F87C246F62AD5F39@PH0PR05MB7782.namprd05.prod.outlook.com> <61bc4594-f2d3-17c4-42b5-0297ffd78fa3@selasky.org> <PH0PR05MB7782707B34F020611B7FA6C3D5F39@PH0PR05MB7782.namprd05.prod.outlook.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Hi,

I think I see what is going on there. I believe this commit is a 
regression after r365239, that the XHCI driver only resets the data 
toggle when a STALL PID or USB error is received! But that is not the 
case for the BULK OUT endpoint, in your traces, because USB mass storage 
has two endpoints.

https://svnweb.freebsd.org/changeset/base/365239

Can you try the attached patch instead of reverting that commit and see 
if the XHCI now sends a DATA0, as expected?

Bjoern and Kristof, can you also test this patch?

--HPS
[-- Attachment #2 --]
diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c
index f95996b7ab3..eb88140cf55 100644
--- a/sys/dev/usb/controller/xhci.c
+++ b/sys/dev/usb/controller/xhci.c
@@ -3825,6 +3825,13 @@ xhci_configure_reset_endpoint(struct usb_xfer *xfer)
 		err = xhci_cmd_stop_ep(sc, 0, epno, index);
 		if (err != 0)
 			DPRINTF("Could not stop endpoint %u\n", epno);
+		/*
+		 * Need to reset the data toggle, because stop
+		 * endpoint doesn't do that:
+		 */
+		err = xhci_cmd_reset_ep(sc, 0, epno, index);
+		if (err != 0)
+			DPRINTF("Could not reset endpoint %u\n", epno);
 		break;
 	}
 
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8f51424d-7d1a-9f0a-a0ba-27b02cab0942>