From nobody Wed Nov 16 10:58:40 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 4NC0Qn2VQdz4hZVk; Wed, 16 Nov 2022 10:58:41 +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 4NC0Qn0ZSVz44Yj; Wed, 16 Nov 2022 10:58:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668596321; 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=Er+tAifSF/Ds/UAgCWzJkWLiFo3GQR0o0Ot0Gn3dzV4=; b=M7JG7y6L6IQ6KGnEuUCyJowZI4+VKJYdN6FyUDQ1FEnX9SEW0fYyP9j+sEhnydX1gCI2b6 9NFN3joPpMB1qjyXdaq1SwDkfq6l15ZrpNKOG0JJp2DfK0ndR0DN0BA3Uo2vgWoxHshmpQ Qw0ebyVw/w89v2TjGIcVqKq+JQnL0lfFwA7f75WiVmSXuuMGlHBOT4ErhVMyo1zCZx4RNq f2F7OEs6w+9mDuBxLKFkUDJ+emOoTPyU+UG9E2fciJgWQjf4ZTHIVGd+D1gywLQtZ/bZ4d Du/q3kEEavkjA6hGmo/sb9P5+cS9haxgVdalHclpX1Mp/yQRgxKJaSYT8TAXsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668596321; 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=Er+tAifSF/Ds/UAgCWzJkWLiFo3GQR0o0Ot0Gn3dzV4=; b=VE171EMiEzHlyw108kmgEZmgNj4NSlQS7G3ACrZ3ChxlY3KM6zcgAv0fgl0XEzJk5Tu2Qu JcMDXH/CG9VKZIa7anZTJlUQVQp6Y25RzJQLAxoJa1R16gU/SrlghDbgI7hnCn7tnjvCDT 04JJrpT1tzbnYHClKSahiGH36JBY9WErZG19Y3Vr8ZoiBZt8l/8Bvt5ZtXUP+P/aqozmJo DrVwNIZieMdglUj1+l8vI8x9jj2rwhZv6etRpEpv8zr653MiAhWbinVtRPtexvU5aywSLI dqYjWcmiFpi/i++2XlCfa6btUcigdkqRhUo5BkBWIebY03PwzzmNKtcY9Uqukg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668596321; a=rsa-sha256; cv=none; b=dPddgnbtDZHc6ela+8aiiQsocaZElVbzU4XCqwH/GuAxUXfrPzXWdO3/uPvjQKprDURRSp s1kbZvHeJwMh5JwuzrhERIRFSZNYunPPWs4hNOqJMTFZAeYY+WPvq1WLL9pIE2WgQFKn/N lNW7eVhWXPPh2OWsbIdrDVf9fSQYzyefBvU88QM0NYXPhnobD2NoD1yB5r1xh/C0PZkbrN aHWPY/OEJViNZQKhE/iJ5/j4rhAAWHJz8PDso4uR6qDJM9Sl3tMURuKPQMiLvS5peYItgs jjnB2REswYKSz5IxbGY1dygcQrTH4HkxjbgeutI3yiYHBvsstLPOV7IIUZy70Q== 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 4NC0Qm6p5dz109l; Wed, 16 Nov 2022 10:58:40 +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 2AGAwepS094721; Wed, 16 Nov 2022 10:58:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AGAweAt094720; Wed, 16 Nov 2022 10:58:40 GMT (envelope-from git) Date: Wed, 16 Nov 2022 10:58:40 GMT Message-Id: <202211161058.2AGAweAt094720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 0e87f58bd7e5 - main - usb/dwc3: Read the full IDs/version 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: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e87f58bd7e566d2b7d50cf0ab636e745af591fc Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=0e87f58bd7e566d2b7d50cf0ab636e745af591fc commit 0e87f58bd7e566d2b7d50cf0ab636e745af591fc Author: Emmanuel Vadot AuthorDate: 2022-11-15 10:22:23 +0000 Commit: Emmanuel Vadot CommitDate: 2022-11-16 10:58:31 +0000 usb/dwc3: Read the full IDs/version We need to enable some quirks based on the version so read it. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D37393 Sponsored by: Beckhoff Automation GmbH & Co. KG --- sys/dev/usb/controller/dwc3.c | 30 ++++++++++++++++++++++++++++-- sys/dev/usb/controller/dwc3.h | 12 ++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/controller/dwc3.c b/sys/dev/usb/controller/dwc3.c index eaea4d57a764..40405927685e 100644 --- a/sys/dev/usb/controller/dwc3.c +++ b/sys/dev/usb/controller/dwc3.c @@ -86,6 +86,9 @@ struct snps_dwc3_softc { bus_space_tag_t bst; bus_space_handle_t bsh; uint32_t snpsid; + uint32_t snpsversion; + uint32_t snpsrevision; + uint32_t snpsversion_type; #ifdef FDT clk_t clk_ref; clk_t clk_suspend; @@ -389,8 +392,31 @@ snps_dwc3_common_attach(device_t dev, bool is_fdt) sc->bsh = rman_get_bushandle(sc->mem_res); sc->snpsid = DWC3_READ(sc, DWC3_GSNPSID); - if (bootverbose) - device_printf(sc->dev, "snps id: %#012x\n", sc->snpsid); + sc->snpsversion = DWC3_VERSION(sc->snpsid); + sc->snpsrevision = DWC3_REVISION(sc->snpsid); + if (sc->snpsversion == DWC3_1_IP_ID || + sc->snpsversion == DWC3_2_IP_ID) { + sc->snpsrevision = DWC3_READ(sc, DWC3_1_VER_NUMBER); + sc->snpsversion_type = DWC3_READ(sc, DWC3_1_VER_TYPE); + } + if (bootverbose) { + switch (sc->snpsversion) { + case DWC3_IP_ID: + device_printf(sc->dev, "SNPS Version: DWC3 (%x %x)\n", + sc->snpsversion, sc->snpsrevision); + break; + case DWC3_1_IP_ID: + device_printf(sc->dev, "SNPS Version: DWC3.1 (%x %x %x)\n", + sc->snpsversion, sc->snpsrevision, + sc->snpsversion_type); + break; + case DWC3_2_IP_ID: + device_printf(sc->dev, "SNPS Version: DWC3.2 (%x %x %x)\n", + sc->snpsversion, sc->snpsrevision, + sc->snpsversion_type); + break; + } + } #ifdef DWC3_DEBUG snps_dwc3_dump_ctrlparams(sc); #endif diff --git a/sys/dev/usb/controller/dwc3.h b/sys/dev/usb/controller/dwc3.h index 21a87a1917ee..c69672072209 100644 --- a/sys/dev/usb/controller/dwc3.h +++ b/sys/dev/usb/controller/dwc3.h @@ -31,6 +31,15 @@ #ifndef _DWC3_H_ #define _DWC3_H_ +#define DWC3_IP_ID 0x5533 +#define DWC3_1_IP_ID 0x3331 +#define DWC3_2_IP_ID 0x3332 + +#define DWC3_VERSION_MASK 0xFFFF0000 +#define DWC3_REVISION_MASK 0xFFFF +#define DWC3_VERSION(x) (((x) & DWC3_VERSION_MASK) >> 16) +#define DWC3_REVISION(x) ((x) & DWC3_REVISION_MASK) + #define DWC3_GSBUSCFG0 0xc100 #define DWC3_GSBUSCFG1 0xc104 #define DWC3_GTXTHRCFG 0xc108 @@ -80,6 +89,9 @@ #define DWC3_GPRTBIMAP_HSLO 0xc180 #define DWC3_GPRTBIMAP_FSLO 0xc188 +#define DWC3_1_VER_NUMBER 0xc1a0 +#define DWC3_1_VER_TYPE 0xc1a4 + #define DWC3_GUSB2PHYCFG0 0xc200 #define DWC3_GUSB2PHYCFG0_PHYSOFTRST (1 << 31) #define DWC3_GUSB2PHYCFG0_U2_FREECLK_EXISTS (1 << 30)