Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jul 2022 09:50:11 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: 486d99faa31e - stable/13 - dwc3: uncondinationally enable Host IN Auto Retry
Message-ID:  <202207180950.26I9oBME034564@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=486d99faa31e99ca03115dfb7896b8144823bde7

commit 486d99faa31e99ca03115dfb7896b8144823bde7
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-07-02 19:14:39 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-07-18 01:00:21 +0000

    dwc3: uncondinationally enable Host IN Auto Retry
    
    Enable dwc3's auto retry feature. For IN transfers with crc errors
    or internal overruns this will make the host reply with a
    non-terminating retry ACK.  I believe the hope was to improve
    reliability after seeing occasional hiccups.
    
    Obtained from:  an old debugging patch
    Reviewed by:    mw
    Differential Revision: https://reviews.freebsd.org/D35698
    
    (cherry picked from commit cec0a5ec6b1074d253a7ba30226d1f99e0c18d4e)
---
 sys/dev/usb/controller/dwc3.c | 9 +++++++++
 sys/dev/usb/controller/dwc3.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/sys/dev/usb/controller/dwc3.c b/sys/dev/usb/controller/dwc3.c
index 1e90c5791cf0..b4156903874b 100644
--- a/sys/dev/usb/controller/dwc3.c
+++ b/sys/dev/usb/controller/dwc3.c
@@ -209,6 +209,15 @@ snps_dwc3_configure_host(struct snps_dwc3_softc *sc)
 	reg &= ~DWC3_GCTL_PRTCAPDIR_MASK;
 	reg |= DWC3_GCTL_PRTCAPDIR_HOST;
 	DWC3_WRITE(sc, DWC3_GCTL, reg);
+
+	/*
+	 * Enable the Host IN Auto Retry feature, making the
+	 * host respond with a non-terminating retry ACK.
+	 * XXX If we ever support more than host mode this needs a dr_mode check.
+	 */
+	reg = DWC3_READ(sc, DWC3_GUCTL);
+	reg |= DWC3_GUCTL_HOST_AUTO_RETRY;
+	DWC3_WRITE(sc, DWC3_GUCTL, reg);
 }
 
 static void
diff --git a/sys/dev/usb/controller/dwc3.h b/sys/dev/usb/controller/dwc3.h
index a8b127cda9a8..862e17b1bcd9 100644
--- a/sys/dev/usb/controller/dwc3.h
+++ b/sys/dev/usb/controller/dwc3.h
@@ -54,6 +54,7 @@
 #define	DWC3_GGPIO		0xc124
 #define	DWC3_GUID		0xc128
 #define	DWC3_GUCTL		0xc12C
+#define	DWC3_GUCTL_HOST_AUTO_RETRY		(1 << 14)
 #define	DWC3_GBUSERRADDRLO	0xc130
 #define	DWC3_GBUSERRADDRHI	0xc134
 #define	DWC3_GPRTBIMAPLO	0xc138



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