From: Alastair D'Silva <alastair@d-silva.org>
To: Vinod Koul <vkoul@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Chen-Yu Tsai <wens@kernel.org>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Samuel Holland <samuel@sholland.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Stephen Boyd <sboyd@kernel.org>,
Brian Masney <bmasney+clk@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Mathias Nyman <mathias.nyman@intel.com>
Cc: linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, linux-usb@vger.kernel.org,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
Alastair D'Silva <alastair@d-silva.org>
Subject: [PATCH 08/11] usb: dwc3: Add Allwinner A733 DWC3 support
Date: Fri, 27 Nov 2026 18:32:28 +1100 [thread overview]
Message-ID: <20261127073231.1776847-9-alastair@d-silva.org> (raw)
In-Reply-To: <20261127073231.1776847-1-alastair@d-silva.org>
Add inverted sync header support, A733 match data, and post-reset PHY
calibration on host start.
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
drivers/usb/dwc3/core.c | 18 +++++++++++++++---
drivers/usb/dwc3/core.h | 8 ++++++++
drivers/usb/dwc3/dwc3-generic-plat.c | 15 +++++++++++++--
drivers/usb/dwc3/glue.h | 6 ++++++
drivers/usb/dwc3/host.c | 10 ++++++++++
5 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index f4aa6a01e500..3fe68d085a85 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1503,13 +1503,16 @@ int dwc3_core_init(struct dwc3 *dwc)
dwc3_config_threshold(dwc);
if (hw_mode != DWC3_GHWPARAMS0_MODE_GADGET &&
- (DWC3_IP_IS(DWC31)) &&
- dwc->maximum_speed == USB_SPEED_SUPER) {
+ DWC3_IP_IS(DWC31) &&
+ (dwc->maximum_speed == USB_SPEED_SUPER || dwc->inv_sync_hdr)) {
int i;
for (i = 0; i < dwc->num_usb3_ports; i++) {
reg = dwc3_readl(dwc, DWC3_LLUCTL(i));
- reg |= DWC3_LLUCTL_FORCE_GEN1;
+ if (dwc->maximum_speed == USB_SPEED_SUPER)
+ reg |= DWC3_LLUCTL_FORCE_GEN1;
+ if (dwc->inv_sync_hdr)
+ reg |= DWC3_LLUCTL_INV_SYNC_HDR;
dwc3_writel(dwc, DWC3_LLUCTL(i), reg);
}
}
@@ -1694,6 +1697,15 @@ static void dwc3_get_software_properties(struct dwc3 *dwc,
if (properties->needs_full_reinit)
dwc->needs_full_reinit = true;
+ if (properties->inv_sync_hdr)
+ dwc->inv_sync_hdr = true;
+
+ if (properties->calibrate_on_start)
+ dwc->calibrate_on_start = true;
+
+ if (properties->xhci_w1c_port_change)
+ dwc->xhci_w1c_port_change = true;
+
dwc->gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED;
if (properties->gsbuscfg0_reqinfo !=
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index f635a9fbc151..e65629f9d437 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -677,6 +677,8 @@
/* Force Gen1 speed on Gen2 link */
#define DWC3_LLUCTL_FORCE_GEN1 BIT(10)
+/* Invert sync header on Cadence SerDes */
+#define DWC3_LLUCTL_INV_SYNC_HDR BIT(30)
/* Structures */
@@ -1151,6 +1153,9 @@ struct dwc3_glue_ops {
* @dis_u1_entry_quirk: set if link entering into U1 state needs to be disabled.
* @dis_u2_entry_quirk: set if link entering into U2 state needs to be disabled.
* @dis_rxdet_inp3_quirk: set if we disable Rx.Detect in P3
+ * @inv_sync_hdr: set if Cadence SerDes requires inverted sync header
+ * @calibrate_on_start: calibrate USB3 PHYs after xHCI reset
+ * @xhci_w1c_port_change: enable xHCI W1C port change quirk
* @async_callbacks: if set, indicate that async callbacks will be used.
*
* @dis_u2_freeclk_exists_quirk : set if we clear u2_freeclk_exists
@@ -1419,6 +1424,9 @@ struct dwc3 {
unsigned dis_u1_entry_quirk:1;
unsigned dis_u2_entry_quirk:1;
unsigned dis_rxdet_inp3_quirk:1;
+ unsigned inv_sync_hdr:1;
+ unsigned calibrate_on_start:1;
+ unsigned xhci_w1c_port_change:1;
unsigned dis_u2_freeclk_exists_quirk:1;
unsigned dis_del_phy_power_chg_quirk:1;
unsigned dis_tx_ipgap_linecheck_quirk:1;
diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
index 3e90ddf25809..568fa1a26379 100644
--- a/drivers/usb/dwc3/dwc3-generic-plat.c
+++ b/drivers/usb/dwc3/dwc3-generic-plat.c
@@ -72,7 +72,7 @@ static int dwc3_eic7700_init(struct dwc3_generic *dwc3g)
return 0;
}
-static int dwc3_spacemit_k1_init(struct dwc3_generic *dwc3g)
+static int dwc3_host_vbus_init(struct dwc3_generic *dwc3g)
{
struct device *dev = dwc3g->dev;
@@ -219,10 +219,20 @@ static const struct dev_pm_ops dwc3_generic_dev_pm_ops = {
};
static const struct dwc3_generic_config spacemit_k1_dwc3 = {
- .init = dwc3_spacemit_k1_init,
+ .init = dwc3_host_vbus_init,
.properties = DWC3_DEFAULT_PROPERTIES,
};
+static const struct dwc3_generic_config sun60i_a733_dwc3 = {
+ .init = dwc3_host_vbus_init,
+ .properties = {
+ .gsbuscfg0_reqinfo = DWC3_GSBUSCFG0_REQINFO_UNSPECIFIED,
+ .inv_sync_hdr = true,
+ .calibrate_on_start = true,
+ .xhci_w1c_port_change = true,
+ },
+};
+
static const struct dwc3_generic_config fsl_ls1028_dwc3 = {
.properties.gsbuscfg0_reqinfo = 0x2222,
};
@@ -233,6 +243,7 @@ static const struct dwc3_generic_config eic7700_dwc3 = {
};
static const struct of_device_id dwc3_generic_of_match[] = {
+ { .compatible = "allwinner,sun60i-a733-dwc3", &sun60i_a733_dwc3 },
{ .compatible = "spacemit,k1-dwc3", &spacemit_k1_dwc3},
{ .compatible = "spacemit,k3-dwc3", },
{ .compatible = "fsl,ls1028a-dwc3", &fsl_ls1028_dwc3},
diff --git a/drivers/usb/dwc3/glue.h b/drivers/usb/dwc3/glue.h
index a1284c481390..12a24e9016eb 100644
--- a/drivers/usb/dwc3/glue.h
+++ b/drivers/usb/dwc3/glue.h
@@ -14,10 +14,16 @@
* @gsbuscfg0_reqinfo: Value to be programmed in the GSBUSCFG0.REQINFO field
* @needs_full_reinit: indicate the controller may not remain power during system
* pm and need full initialization
+ * @inv_sync_hdr: set DWC3_LLUCTL_INV_SYNC_HDR for Cadence SerDes
+ * @calibrate_on_start: calibrate USB3 PHYs after xHCI reset
+ * @xhci_w1c_port_change: enable xHCI W1C port change quirk
*/
struct dwc3_properties {
u32 gsbuscfg0_reqinfo;
unsigned needs_full_reinit:1;
+ unsigned inv_sync_hdr:1;
+ unsigned calibrate_on_start:1;
+ unsigned xhci_w1c_port_change:1;
};
#define DWC3_DEFAULT_PROPERTIES ((struct dwc3_properties){ \
diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
index cd1e5204ac3a..e45d8b14b60c 100644
--- a/drivers/usb/dwc3/host.c
+++ b/drivers/usb/dwc3/host.c
@@ -68,6 +68,7 @@ static void dwc3_xhci_plat_start(struct usb_hcd *hcd)
{
struct platform_device *pdev;
struct dwc3 *dwc;
+ int i;
if (!usb_hcd_is_primary_hcd(hcd))
return;
@@ -75,6 +76,12 @@ static void dwc3_xhci_plat_start(struct usb_hcd *hcd)
pdev = to_platform_device(hcd->self.controller);
dwc = dev_get_drvdata(pdev->dev.parent);
+ /* Calibrate PHYs after xHCI reset to complete clock handover. */
+ if (dwc->calibrate_on_start) {
+ for (i = 0; i < dwc->num_usb3_ports; i++)
+ phy_calibrate(dwc->usb3_generic_phy[i]);
+ }
+
dwc3_enable_susphy(dwc, true);
}
@@ -174,6 +181,9 @@ int dwc3_host_init(struct dwc3 *dwc)
if (dwc->usb2_lpm_disable)
props[prop_idx++] = PROPERTY_ENTRY_BOOL("usb2-lpm-disable");
+ if (dwc->xhci_w1c_port_change)
+ props[prop_idx++] = PROPERTY_ENTRY_BOOL("xhci-w1c-port-change-quirk");
+
/**
* WORKAROUND: dwc3 revisions <=3.00a have a limitation
* where Port Disable command doesn't work.
--
2.53.0
next prev parent reply other threads:[~2026-11-27 7:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 7:32 [PATCH 00/11] arm64: dts: allwinner: Add Allwinner A733 USB 3.0 support Alastair D'Silva
2026-11-27 7:32 ` [PATCH 01/11] dt-bindings: phy: allwinner,sun60i-a733-u2phy: Add Allwinner A733 USB 2.0 PHY Alastair D'Silva
2026-11-27 7:32 ` [PATCH 02/11] dt-bindings: phy: allwinner,sun60i-a733-combophy: Add combophy0 USB 3.0 support Alastair D'Silva
2026-11-27 7:32 ` [PATCH 03/11] dt-bindings: clock: sun60i-a733: Add USB2 bus and sys clock IDs Alastair D'Silva
2026-11-27 7:32 ` [PATCH 04/11] clk: sunxi-ng: sun60i-a733: Add USB2 bus and sys clocks Alastair D'Silva
2026-11-27 7:32 ` [PATCH 05/11] dt-bindings: usb: allwinner,sun60i-a733-dwc3: Add Allwinner A733 DWC3 Alastair D'Silva
2026-11-27 7:32 ` [PATCH 06/11] phy: allwinner: Add Allwinner A733 USB 2.0 PHY driver Alastair D'Silva
2026-11-27 7:32 ` [PATCH 07/11] phy: allwinner: sun60i-combophy: Add USB 3.0 PHY mode support Alastair D'Silva
2026-11-27 7:32 ` Alastair D'Silva [this message]
2026-11-27 7:32 ` [PATCH 09/11] usb: host: xhci: Add W1C port change quirk for Allwinner A733 Alastair D'Silva
2026-11-27 7:32 ` [PATCH 10/11] arm64: dts: allwinner: sun60i-a733: Add USB 3.0 controller and PHYs Alastair D'Silva
2026-11-27 7:32 ` [PATCH 11/11] arm64: dts: allwinner: sun60i-a733-orangepi-4-pro: Enable USB 3.0 Alastair D'Silva
2026-11-27 9:56 ` [PATCH 00/11] arm64: dts: allwinner: Add Allwinner A733 USB 3.0 support Andre Przywara
2026-11-27 10:26 ` Alastair D'Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127073231.1776847-9-alastair@d-silva.org \
--to=alastair@d-silva.org \
--cc=Thinh.Nguyen@synopsys.com \
--cc=bmasney+clk@redhat.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jbrunet+clk@baylibre.com \
--cc=jernej.skrabec@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=neil.armstrong@linaro.org \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=sboyd@kernel.org \
--cc=vkoul@kernel.org \
--cc=wens@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®