Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jul 2022 14:57:50 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 39cd7aa134df - stable/13 - USB: add quirks to XHCI
Message-ID:  <202207011457.261Evouw058020@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=39cd7aa134dfde52c2e6936142d976b8de0499b7

commit 39cd7aa134dfde52c2e6936142d976b8de0499b7
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-06-14 16:39:31 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-07-01 13:50:10 +0000

    USB: add quirks to XHCI
    
    While XHCI is very generic some revisions of chipsets have problems.
    On dwc3 <= 3.00a Port Disable does not seem to work so we need to not
    enable it.
    For that introduce quirks to xhci so that controllers can steer
    certain features.  I would hope that this is and remains the only one.
    
    Obtained from:  an old patch mainly debugging other problems
    Reviewed by:    hselasky
    Differential Revision: https://reviews.freebsd.org/D35482
    
    (cherry picked from commit 447c418da03454a2a00bc115a69c62055a6d5272)
---
 sys/dev/usb/controller/xhci.c | 3 ++-
 sys/dev/usb/controller/xhci.h | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c
index c173d780217f..2d7894264860 100644
--- a/sys/dev/usb/controller/xhci.c
+++ b/sys/dev/usb/controller/xhci.c
@@ -3443,7 +3443,8 @@ xhci_roothub_exec(struct usb_device *udev,
 			XWRITE4(sc, oper, port, v | XHCI_PS_PRC);
 			break;
 		case UHF_PORT_ENABLE:
-			XWRITE4(sc, oper, port, v | XHCI_PS_PED);
+			if ((sc->sc_quirks & XHCI_QUIRK_DISABLE_PORT_PED) == 0)
+				XWRITE4(sc, oper, port, v | XHCI_PS_PED);
 			break;
 		case UHF_PORT_POWER:
 			XWRITE4(sc, oper, port, v & ~XHCI_PS_PP);
diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h
index 08f4e42b5fcd..d98df2bdf512 100644
--- a/sys/dev/usb/controller/xhci.h
+++ b/sys/dev/usb/controller/xhci.h
@@ -461,6 +461,10 @@ union xhci_hub_desc {
 
 typedef int (xhci_port_route_t)(device_t, uint32_t, uint32_t);
 
+enum xhci_quirks {
+	XHCI_QUIRK_DISABLE_PORT_PED			= 0x00000001,
+};
+
 struct xhci_softc {
 	struct xhci_hw_softc	sc_hw;
 	/* base device */
@@ -537,6 +541,9 @@ struct xhci_softc {
 
 	/* vendor string for root HUB */
 	char			sc_vendor[16];
+
+	/* XHCI quirks. */
+	uint32_t		sc_quirks;
 };
 
 #define	XHCI_CMD_LOCK(sc)	sx_xlock(&(sc)->sc_cmd_sx)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207011457.261Evouw058020>