From nobody Fri Jul 01 14:57:50 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 7C4718A3C7B; Fri, 1 Jul 2022 14:57:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LZJGQ553Sz4dyk; Fri, 1 Jul 2022 14:57:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656687471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6VrbxDkrhrQLF/3uiI4Hm5YCT2nOoJv4ozrsI4pTumQ=; b=ixyi6l5uNtfE0e/REhMVmcO5CvtsOHYnH7/28K50l7VpcQl4jOWpZ4tv2ZLocSvGsqtAgd 7gtVpH1HxFqicEoRzlyVvr3rf5IuMHr3V7GfWnaE6u8L7WeWQeDhS9978UHOoRJT1rGAZT p4CQiNaFKp8jdkieHDZPB3X1NqRc3yFVD+8fnt8hD3UuyfUvt8TqfV1IVFr7h/zjLJE5Dy 2AQVA2IeI4fpDZjX9+VS5/IVn1J0kLfuuO24EEvit89paB9BRoBAabVeTDk9i9To9JACui D3WxQmCQa8q45fz9loFboWXHNBRXWXxKXDijF/wIHJAC1EY/DB4NfFeLcPwXsA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B8601D7B3; Fri, 1 Jul 2022 14:57:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 261EvoUF058021; Fri, 1 Jul 2022 14:57:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 261Evouw058020; Fri, 1 Jul 2022 14:57:50 GMT (envelope-from git) Date: Fri, 1 Jul 2022 14:57:50 GMT Message-Id: <202207011457.261Evouw058020@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 39cd7aa134df - stable/13 - USB: add quirks to XHCI List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 39cd7aa134dfde52c2e6936142d976b8de0499b7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656687471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6VrbxDkrhrQLF/3uiI4Hm5YCT2nOoJv4ozrsI4pTumQ=; b=luicEZXatUB4fpRRwA1WnklkdFyuQkptqpZF3HCoNy3soUa43A7Dxy+/zIZHi/1j4U04kI XpiTTHAyqebl0ZlHTkFsWY776X/Fdc8YkNlIkOnqMyjl+IcBlUF1950e3rupZODuNbzLTi WsQTYpvVDJAMwMEnT3tEfkRDTRHoAtCauVG3TrKbKYIcnUrsVMUIqmMmnQYVlfN3T7JTtM +K9MMJPBWsooDCdCLRkrOan/ABLJhohB9TL9qCHCwA3XjiCrE53Uk1wVX2XTw7iLGYEbWr jYK5W/E5mkLZivLE0JyJHTeBkGAx7krcbOr6vdW5BkyH+NoI5rrecZ7lJnW2CA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656687471; a=rsa-sha256; cv=none; b=BcuhpOnJVDEYb2d5krfev4uq/S7sqXZrUcLPtoQZ/fGOamnV1Bf/QL3Ng1kk6zfolMZ/Z7 Sq1zaaznB7QqAYHNam277M641b/h9+HF+YHWMksAkfeBc/Lc9kLDzYlYV+G5j/PgQAxXUr h+Mxwmxw+Xxi2WCeBLUdL9QjlrVnFQKQ5QghLEz5zX76ODAf+UqGK+WR6fJ0IcCel/Emry eXeoYOhV8tQeXi9FEwxyfGVdmo0Pyx9Sd0i3SbFjyc0wIIRlTEv0BHsg/epRcpNvx4yfMG EVuDNpMAncfC0O9iRWRVf/+nMaHrUBUNA6Ka3HgwAta3DM0/SOCuCS4FksGimg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=39cd7aa134dfde52c2e6936142d976b8de0499b7 commit 39cd7aa134dfde52c2e6936142d976b8de0499b7 Author: Bjoern A. Zeeb AuthorDate: 2022-06-14 16:39:31 +0000 Commit: Bjoern A. Zeeb 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)