From nobody Thu Feb 02 11:20:23 2023 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 4P6xCq6vgzz3cx2S; Thu, 2 Feb 2023 11:20:23 +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 4P6xCq3WPxz47m8; Thu, 2 Feb 2023 11:20:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675336823; 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=fkLTEhjEiyn9ue81mn2zTueXbkEV+XqUIc8ilJRmMQ0=; b=TjjDElgL1Fsg19PCzCh/od9QxIb2ZcQPVs8kq7zoMxFaXw3CfNyNy8EOm72UeCfBq+TsdG qcMBaOBjDoUWoRyUIqTB9YpsoE2AyhAWccEzOZcKDJA+pHSqgYAUU0IdamCfbc+i8jEADq c4CV5mkYrCB+NaP3ZKxIBQhe0K/sN21/bIdsFqCPOqqzRVTa7zPAkxi2uG/1BGpf3Xf8DQ 9g4n2RiolQBVeNPIVKKCGLT00WvCjPBsecpRWnuJFavV4OVExygwx2/fDnn4DdqSyqsYLu 8tMWrFZ7Fs4ivTRa+Ly6wRhFW6YrD6SMEJY7MqfuFFtkYHa8dBELlZW0548T8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675336823; 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=fkLTEhjEiyn9ue81mn2zTueXbkEV+XqUIc8ilJRmMQ0=; b=Y1vK4jwLz/K6fqk3zPl82nkKK6rMVdvlGIdkVZWwww4eXcgdE8x2dd+RMqDbdXyTe0NVFm qpuVdaKt2vJqEaDw/Xb7ANlmZvs8VjEujD0+f6VKdObgchUa+KfGXRi7P3/gMaKu510AF9 q7501smPSGyBAtOLx9YHWFl7dnXr3z2nj0n06K1XVA3Hg1BhjyLW2Llz3uahPon00/9HFc lbZ6R5WnKyX+KPvQZElhHKm8KYuP7xKHlCNcx5H3g2ZYkJxIebCgTrHKogc3P2XqBkHA2f rAdMtUH0F6iJpZKfcUjjUUdcFJl9+KwsfG4xWEPhGsfkI5upxBPn2TIqpBLZiQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675336823; a=rsa-sha256; cv=none; b=SGmfgqj0NyfKbGvTUPADltrNBIC8L7GrTXd9SJWVFmpdJY2IcJIMi9OrQuYI9imipA9a8F 9jHPR7lYRNipD2i4OaQrwMmqLx1UxTBRbabA/FK0l/w1ULrz+pc2rWNrhGfJ70sltegCgo +Z8Y/hv9VkVLEvrvEPNGH5z8MwW89x9Xb5pB4+o0PrS/LzbHi1wnBUo0pwRGA77prm6aQC vlS2LP/zq6GBDk09PSLgrl1aPLMBPftmmn95qYHyH+YyA3+Imyv88EWFoXFMV2sHhfGeIH Xl/RVMNWC+SBmJkd1Fi1Rwz/gFbjn6UP65evJzWNBdSzXp78mvhXMtQ64Gzp2A== 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 4P6xCq2d9YzsLG; Thu, 2 Feb 2023 11:20:23 +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 312BKNuS085883; Thu, 2 Feb 2023 11:20:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 312BKNnK085882; Thu, 2 Feb 2023 11:20:23 GMT (envelope-from git) Date: Thu, 2 Feb 2023 11:20:23 GMT Message-Id: <202302021120.312BKNnK085882@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 2b42f2138fe4 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2b42f2138fe42212235ac972464c9d989b614d55 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=2b42f2138fe42212235ac972464c9d989b614d55 commit 2b42f2138fe42212235ac972464c9d989b614d55 Author: Emmanuel Vadot AuthorDate: 2022-11-15 10:22:23 +0000 Commit: Emmanuel Vadot CommitDate: 2023-02-02 11:17:26 +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 (cherry picked from commit 0e87f58bd7e566d2b7d50cf0ab636e745af591fc) --- 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)