Skip to contentSkip to conversation

Enable USB3 Super-Speed support for QCM6490/SC7280

PATCH Applied Balaji Selvanathan 3 participants 13 messages Dec 3, 2025 – Apr 29

Subsystems (8)

v3 of 4 Applied Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Enable USB3 Super-Speed support for QCM6490/SC7280

This series enables USB3 Super-Speed functionality on QCM6490 and SC7280 platforms by adding support for the QMP USB3-DP Combo PHY. The combo PHY is a dual-mode PHY that can operate in either USB3 or DisplayPort mode, and this implementation focuses on USB3 mode to enable Super-Speed USB support.

The series adds the necessary clock support, implements the
QMP Combo PHY driver ported from upstream Linux, and automates USB speed
fixup.
---
Changes in v3:
- Corrected regulator names in drivers/phy/qcom/phy-qcom-qmp-combo.c
- Made regulators mandatory in phy probe;
if regulator not present, now probe fails
- Removed support to manually disable the USB HS fixup via Kconfig.
- Instead added code to automatically detect if
SSPHY driver is available and do HS fixup only if SSPHY driver is
not available.
- Link to v2: https://lore.kernel.org/u-boot/[email protected]/

Changes in v2:
- Gave correct commit id for reference linux implementation for
adding mdelay in drivers/usb/dwc3/core.c
- In drivers/phy/qcom/phy-qcom-qmp-combo.c:
- Added pipe clock disable in qmp_combo_power_off sequence
- Added all required clocks except pipe clock
in qmp_combo_phy_clk_l
- All clocks except pipe clock are enabled and disabled
seperate from pipe clock
- Added support for regulator power supplies
- Added a minimal xlate to only return the USB3 phy
- Added "drivers/phy/qcom" to ARM SNAPDRAGON section in MAINTAINERS file
- Link to v1: https://lore.kernel.org/u-boot/[email protected]/
---
Balaji Selvanathan (6):
drivers: clk: qcom: sc7280: Add USB3 PHY pipe clock
drivers: usb: dwc3: Add delay after core soft reset
drivers: phy: qcom: Add QMP USB3-DP Combo PHY driver
arch: arm: mach-snapdragon: Auto-detect USB SSPHY driver support
configs: qcm6490: Enable super-speed USB support
MAINTAINERS: Add entry for Qualcomm PHY drivers

 MAINTAINERS                                |   1 +
 arch/arm/mach-snapdragon/of_fixup.c        | 130 ++++-
 configs/qcm6490_defconfig                  |   2 +
 drivers/clk/qcom/clock-sc7280.c            |   1 +
 drivers/phy/qcom/Kconfig                   |   8 +
 drivers/phy/qcom/Makefile                  |   1 +
 drivers/phy/qcom/phy-qcom-qmp-combo.c      | 644 +++++++++++++++++++++
 drivers/phy/qcom/phy-qcom-qmp-common.h     |  62 ++
 drivers/phy/qcom/phy-qcom-qmp-dp-com-v3.h  |  18 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v4.h |  34 ++
 drivers/phy/qcom/phy-qcom-qmp.h            |  17 +
 drivers/usb/dwc3/core.c                    |   2 +
 12 files changed, 902 insertions(+), 18 deletions(-)
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-combo.c
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-common.h
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-dp-com-v3.h
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v4.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/6 drivers: clk: qcom: sc7280: Add USB3 PHY pipe clock

Add support for GCC_USB3_PRIM_PHY_PIPE_CLK which is required by the USB3 PHY on SC7280/QCM6490 platforms.

---
 drivers/clk/qcom/clock-sc7280.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/qcom/clock-sc7280.c +1 -0
index 55a233df394..a2af73cd976 100644
@@ -111,6 +111,7 @@ static const struct gate_clk sc7280_clks[] = {
 	GATE_CLK(GCC_USB30_PRIM_MOCK_UTMI_CLK, 0xf01c, 1),
 	GATE_CLK(GCC_USB3_PRIM_PHY_AUX_CLK, 0xf054, 1),
 	GATE_CLK(GCC_USB3_PRIM_PHY_COM_AUX_CLK, 0xf058, 1),
+	GATE_CLK(GCC_USB3_PRIM_PHY_PIPE_CLK, 0xf05c, 1),
 	GATE_CLK(GCC_CFG_NOC_USB3_SEC_AXI_CLK, 0x9e07c, 1),
 	GATE_CLK(GCC_USB30_SEC_MASTER_CLK, 0x9e010, 1),
 	GATE_CLK(GCC_AGGRE_USB3_SEC_AXI_CLK, 0x9e080, 1),
Signature · 1 line
2.34.1
#2 lore raw

PATCH v3 2/6 drivers: usb: dwc3: Add delay after core soft reset

In reply to Balaji Selvanathan

Add a 100 ms delay after clearing the core soft reset bit to ensure the DWC3 controller has sufficient time to complete its reset sequence before subsequent register accesses.

Without this delay, USB initialization can fail on some Qualcomm platforms, particularly when using super-speed capable PHYs like the QMP USB3-DP Combo PHY on SC7280/QCM6490.

Taken from Linux commit f88359e1588b ("usb: dwc3: core: Do core softreset when switch mode")

---
v2:
- Gave correct commit id for linux implementation

---
 drivers/usb/dwc3/core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/dwc3/core.c +2 -0
index 847fa1f82c3..ff0bca0dd8e 100644
@@ -94,6 +94,8 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
 	reg &= ~DWC3_GCTL_CORESOFTRESET;
 	dwc3_writel(dwc->regs, DWC3_GCTL, reg);
 
+	mdelay(100);
+
 	return 0;
 }
 
Signature · 1 line
2.34.1
Reviewed-by on v3 2/6
#3 lore raw

Re: [PATCH v3 2/6] drivers: usb: dwc3: Add delay after core soft reset

Quoted 9 lines · Balaji Selvanathan

Add a 100 ms delay after clearing the core soft reset bit to ensure the DWC3 controller has sufficient time to complete its reset sequence before subsequent register accesses.

Without this delay, USB initialization can fail on some Qualcomm platforms, particularly when using super-speed capable PHYs like the QMP USB3-DP Combo PHY on SC7280/QCM6490.

Taken from Linux commit f88359e1588b ("usb: dwc3: core: Do core softreset when switch mode")

Quoted 24 lines

---
v2:
- Gave correct commit id for linux implementation

---
 drivers/usb/dwc3/core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/dwc3/core.c +2 -1
index 847fa1f82c3..ff0bca0dd8e 100644
@@ -94,6 +94,8 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
 	reg &= ~DWC3_GCTL_CORESOFTRESET;
 	dwc3_writel(dwc->regs, DWC3_GCTL, reg);
 
+	mdelay(100);
+
 	return 0;
 }
 
--

2.34.1

#4 lore raw

PATCH v3 3/6 drivers: phy: qcom: Add QMP USB3-DP Combo PHY driver

In reply to Balaji Selvanathan

Add support for the Qualcomm QMP USB3-DP Combo PHY found on SC7280 and QCM6490 platforms. This driver currently implements USB3 super-speed functionality of the combo PHY.

The QMP Combo PHY is a dual-mode PHY
that can operate in either USB3 mode or DisplayPort mode. This initial implementation focuses on USB3 mode to enable Super-Speed USB support.

Taken from Linux commit 3d25d46a255a ("pmdomain: qcom: rpmhpd: Add rpmhpd support for SM8750")

This patch is dependent on this patch: https://lore.kernel.org/u-boot/[email protected]/

Enabled and tested the driver on Qualcomm RB3 Gen2 (QCS6490) board.

---
v3:
- Corrected regulator names
- Made regulators mandatory; if regulator not present, now probe fails

v2:
- Added pipe clock disable in qmp_combo_power_off sequence
- Added all required clocks except pipe clock in qmp_combo_phy_clk_l
- All clocks except pipe clock are enabled and disabled seperate from pipe clock
- Added support for regulator power supplies
- Added a minimal xlate to only return the USB3 phy

---
 drivers/phy/qcom/Kconfig                   |   8 +
 drivers/phy/qcom/Makefile                  |   1 +
 drivers/phy/qcom/phy-qcom-qmp-combo.c      | 644 +++++++++++++++++++++
 drivers/phy/qcom/phy-qcom-qmp-common.h     |  62 ++
 drivers/phy/qcom/phy-qcom-qmp-dp-com-v3.h  |  18 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v4.h |  34 ++
 drivers/phy/qcom/phy-qcom-qmp.h            |  17 +
 7 files changed, 784 insertions(+)
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-combo.c
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-common.h
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-dp-com-v3.h
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v4.h
drivers/phy/qcom/Kconfig +8 -0
index 0dd69f7ffd0..49f830abf01 100644
@@ -12,6 +12,14 @@ config PHY_QCOM_IPQ4019_USB
 	help
 	  Support for the USB PHY-s on Qualcomm IPQ40xx SoC-s.
 
+config PHY_QCOM_QMP_COMBO
+	bool "Qualcomm QMP USB3-DP Combo PHY driver"
+	depends on PHY && ARCH_SNAPDRAGON
+	help
+	  Enable this to support the USB3-DP Combo QMP PHY on various Qualcomm
+	  chipsets. This driver supports the USB3 PHY functionality of the combo
+	  PHY (USB3 + DisplayPort). Currently only USB3 mode is supported.
+
 config PHY_QCOM_QMP_PCIE
 	tristate "Qualcomm QMP PCIe PHY driver"
 	depends on PHY && ARCH_SNAPDRAGON
drivers/phy/qcom/Makefile +1 -0
index 1c4e7d8d391..714013dc572 100644
@@ -1,5 +1,6 @@
 obj-$(CONFIG_PHY_QCOM_IPQ4019_USB) += phy-qcom-ipq4019-usb.o
 obj-$(CONFIG_MSM8916_USB_PHY) += msm8916-usbh-phy.o
+obj-$(CONFIG_PHY_QCOM_QMP_COMBO) += phy-qcom-qmp-combo.o
 obj-$(CONFIG_PHY_QCOM_QMP_PCIE) += phy-qcom-qmp-pcie.o
 obj-$(CONFIG_PHY_QCOM_QMP_UFS) += phy-qcom-qmp-ufs.o
 obj-$(CONFIG_PHY_QCOM_QUSB2) += phy-qcom-qusb2.o
drivers/phy/qcom/phy-qcom-qmp-combo.c new file +644 -0

644 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-common.h new file +62 -0

62 lines not on this page · raw message

drivers/phy/qcom/phy-qcom-qmp-dp-com-v3.h new file +18 -0
new file mode 100644
index 00000000000..396179ef38b
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef QCOM_PHY_QMP_DP_COM_V3_H_
+#define QCOM_PHY_QMP_DP_COM_V3_H_
+
+/* Only for QMP V3 & V4 PHY - DP COM registers */
+#define QPHY_V3_DP_COM_PHY_MODE_CTRL			0x00
+#define QPHY_V3_DP_COM_SW_RESET				0x04
+#define QPHY_V3_DP_COM_POWER_DOWN_CTRL			0x08
+#define QPHY_V3_DP_COM_SWI_CTRL				0x0c
+#define QPHY_V3_DP_COM_TYPEC_CTRL			0x10
+#define QPHY_V3_DP_COM_TYPEC_PWRDN_CTRL			0x14
+#define QPHY_V3_DP_COM_RESET_OVRD_CTRL			0x1c
+
+#endif
drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v4.h new file +34 -0
new file mode 100644
index 00000000000..d7fd4ac0fc5
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef QCOM_PHY_QMP_PCS_USB_V4_H_
+#define QCOM_PHY_QMP_PCS_USB_V4_H_
+
+/* Only for QMP V4 PHY - USB3 PCS registers */
+#define QPHY_V4_PCS_USB3_POWER_STATE_CONFIG1		0x000
+#define QPHY_V4_PCS_USB3_AUTONOMOUS_MODE_STATUS		0x004
+#define QPHY_V4_PCS_USB3_AUTONOMOUS_MODE_CTRL		0x008
+#define QPHY_V4_PCS_USB3_AUTONOMOUS_MODE_CTRL2		0x00c
+#define QPHY_V4_PCS_USB3_LFPS_RXTERM_IRQ_SOURCE_STATUS	0x010
+#define QPHY_V4_PCS_USB3_LFPS_RXTERM_IRQ_CLEAR		0x014
+#define QPHY_V4_PCS_USB3_LFPS_DET_HIGH_COUNT_VAL	0x018
+#define QPHY_V4_PCS_USB3_LFPS_TX_ECSTART		0x01c
+#define QPHY_V4_PCS_USB3_LFPS_PER_TIMER_VAL		0x020
+#define QPHY_V4_PCS_USB3_LFPS_TX_END_CNT_U3_START	0x024
+#define QPHY_V4_PCS_USB3_RXEQTRAINING_LOCK_TIME		0x028
+#define QPHY_V4_PCS_USB3_RXEQTRAINING_WAIT_TIME		0x02c
+#define QPHY_V4_PCS_USB3_RXEQTRAINING_CTLE_TIME		0x030
+#define QPHY_V4_PCS_USB3_RXEQTRAINING_WAIT_TIME_S2	0x034
+#define QPHY_V4_PCS_USB3_RXEQTRAINING_DFE_TIME_S2	0x038
+#define QPHY_V4_PCS_USB3_RCVR_DTCT_DLY_U3_L		0x03c
+#define QPHY_V4_PCS_USB3_RCVR_DTCT_DLY_U3_H		0x040
+#define QPHY_V4_PCS_USB3_ARCVR_DTCT_EN_PERIOD		0x044
+#define QPHY_V4_PCS_USB3_ARCVR_DTCT_CM_DLY		0x048
+#define QPHY_V4_PCS_USB3_TXONESZEROS_RUN_LENGTH		0x04c
+#define QPHY_V4_PCS_USB3_ALFPS_DEGLITCH_VAL		0x050
+#define QPHY_V4_PCS_USB3_SIGDET_STARTUP_TIMER_VAL	0x054
+#define QPHY_V4_PCS_USB3_TEST_CONTROL			0x058
+
+#endif
drivers/phy/qcom/phy-qcom-qmp.h +17 -0
index 99f4d447caf..06dac21ddc4 100644
@@ -12,12 +12,17 @@
 #include "phy-qcom-qmp-qserdes-com-v3.h"
 #include "phy-qcom-qmp-qserdes-txrx-v3.h"
 
+#include "phy-qcom-qmp-qserdes-com-v4.h"
+#include "phy-qcom-qmp-qserdes-txrx-v4.h"
+
 #include "phy-qcom-qmp-qserdes-pll.h"
 
 #include "phy-qcom-qmp-pcs-v2.h"
 
 #include "phy-qcom-qmp-pcs-v3.h"
 
+#include "phy-qcom-qmp-pcs-v4.h"
+
 /* Only for QMP V3 & V4 PHY - DP COM registers */
 #define QPHY_V3_DP_COM_PHY_MODE_CTRL			0x00
 #define QPHY_V3_DP_COM_SW_RESET				0x04
@@ -112,4 +117,16 @@
 #define QSERDES_V6_DP_PHY_AUX_INTERRUPT_STATUS		0x0e0
 #define QSERDES_V6_DP_PHY_STATUS			0x0e4
 
+/* QPHY_SW_RESET bit */
+#define SW_RESET                                BIT(0)
+/* QPHY_POWER_DOWN_CONTROL */
+#define SW_PWRDN                                BIT(0)
+
+/* QPHY_START_CONTROL bits */
+#define SERDES_START                            BIT(0)
+#define PCS_START                               BIT(1)
+
+/* QPHY_PCS_STATUS bit */
+#define PHYSTATUS                               BIT(6)
+
 #endif
Signature · 1 line
2.34.1
Reviewed-by on v3 3/6
#5 lore raw

Re: [PATCH v3 3/6] drivers: phy: qcom: Add QMP USB3-DP Combo PHY driver

Quoted 9 lines · Balaji Selvanathan

Add support for the Qualcomm QMP USB3-DP Combo PHY found on SC7280 and QCM6490 platforms. This driver currently implements USB3 super-speed functionality of the combo PHY.

The QMP Combo PHY is a dual-mode PHY
that can operate in either USB3 mode or DisplayPort mode. This initial implementation focuses on USB3 mode to enable Super-Speed USB support.

Quoted 5 lines

Taken from Linux commit 3d25d46a255a ("pmdomain: qcom: rpmhpd: Add rpmhpd support for SM8750")

This patch is dependent on this patch: https://lore.kernel.org/u-boot/[email protected]/

Enabled and tested the driver on Qualcomm RB3 Gen2 (QCS6490) board.

Quoted 25 lines

---
v3:
- Corrected regulator names
- Made regulators mandatory; if regulator not present, now probe fails

v2:
- Added pipe clock disable in qmp_combo_power_off sequence
- Added all required clocks except pipe clock in qmp_combo_phy_clk_l
- All clocks except pipe clock are enabled and disabled seperate from pipe clock
- Added support for regulator power supplies
- Added a minimal xlate to only return the USB3 phy

---
 drivers/phy/qcom/Kconfig                   |   8 +
 drivers/phy/qcom/Makefile                  |   1 +
 drivers/phy/qcom/phy-qcom-qmp-combo.c      | 644 +++++++++++++++++++++
 drivers/phy/qcom/phy-qcom-qmp-common.h     |  62 ++
 drivers/phy/qcom/phy-qcom-qmp-dp-com-v3.h  |  18 +
 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v4.h |  34 ++
 drivers/phy/qcom/phy-qcom-qmp.h            |  17 +
 7 files changed, 784 insertions(+)
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-combo.c
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-common.h
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-dp-com-v3.h
 create mode 100644 drivers/phy/qcom/phy-qcom-qmp-pcs-usb-v4.h
#6 lore raw

PATCH v3 4/6 arch: arm: mach-snapdragon: Auto-detect USB SSPHY driver support

In reply to Balaji Selvanathan

Automatically detect super-speed USB PHY driver availability and skip the USB speed fixup if driver is available, eliminating the need for manual configuration.

Previously, U-Boot unconditionally limited USB to high-speed mode on all Qualcomm platforms because most lacked super-speed PHY drivers.

This change implements runtime detection that checks if a PHY driver exists for the super-speed PHY node referenced by the DWC3 controller. The fixup is automatically skipped when a compatible driver is found, allowing the hardware to operate at full capability. Platforms without super-speed PHY drivers continue to receive the fixup automatically.
---
v3:
- Removed support to manually disable the fixup via Kconfig.
- Instead added code to automatically detect if
SSPHY driver is available.

---
 arch/arm/mach-snapdragon/of_fixup.c | 130 ++++++++++++++++++++++++----
 1 file changed, 112 insertions(+), 18 deletions(-)
arch/arm/mach-snapdragon/of_fixup.c +112 -18
index eec2c0c757e..85dc1c4573d 100644
@@ -4,7 +4,7 @@
  *
  * This file implements runtime fixups for Qualcomm DT to improve
  * compatibility with U-Boot. This includes adjusting the USB nodes
- * to only use USB high-speed.
+ * to only use USB high-speed if SSPHY driver is not available.
  *
  * We use OF_LIVE for this rather than early FDT fixup for a couple
  * of reasons: it has a much nicer API, is most likely more efficient,
@@ -21,32 +21,108 @@
 #include <dt-bindings/input/linux-event-codes.h>
 #include <dm/of_access.h>
 #include <dm/of.h>
+#include <dm/device.h>
+#include <dm/lists.h>
 #include <event.h>
 #include <fdt_support.h>
 #include <linux/errno.h>
+#include <linker_lists.h>
 #include <stdlib.h>
 #include <time.h>
 
-/* U-Boot only supports USB high-speed mode on Qualcomm platforms with DWC3
- * USB controllers. Rather than requiring source level DT changes, we fix up
- * DT here. This improves compatibility with upstream DT and simplifies the
- * porting process for new devices.
+/**
+ * find_ssphy_node() - Find the super-speed PHY node referenced by DWC3
+ * @dwc3: DWC3 device node
+ *
+ * Returns: Pointer to SS-PHY node if found, NULL otherwise
+ */
+static struct device_node *find_ssphy_node(struct device_node *dwc3)
+{
+	const __be32 *phandles;
+	const char *phy_name;
+	int len, i, ret;
+
+	phandles = of_get_property(dwc3, "phys", &len);
+	if (!phandles)
+		return NULL;
+
+	len /= sizeof(*phandles);
+
+	/* Iterate through PHY phandles to find the SS-PHY */
+	for (i = 0; i < len; i++) {
+		ret = of_property_read_string_index(dwc3, "phy-names", i, &phy_name);
+		if (ret)
+			continue;
+
+		/* Check if this is the super-speed PHY */
+		if (!strncmp("usb3-phy", phy_name, strlen("usb3-phy")) ||
+		    !strncmp("usb3_phy", phy_name, strlen("usb3_phy"))) {
+			return of_find_node_by_phandle(NULL, be32_to_cpu(phandles[i]));
+		}
+	}
+
+	return NULL;
+}
+
+/**
+ * has_driver_for_node() - Check if any PHY driver can bind to this node
+ * @np: Device node to check
+ *
+ * Returns: true if a PHY driver with matching compatible string exists, false otherwise
  */
+static bool has_driver_for_node(struct device_node *np)
+{
+	struct driver *driver = ll_entry_start(struct driver, driver);
+	const int n_ents = ll_entry_count(struct driver, driver);
+	const char *compat_list, *compat;
+	int compat_length, i;
+	struct driver *entry;
+
+	if (!np)
+		return false;
+
+	/* Get compatible strings from the node */
+	compat_list = of_get_property(np, "compatible", &compat_length);
+	if (!compat_list)
+		return false;
+
+	/* Check each compatible string against PHY drivers only */
+	for (i = 0; i < compat_length; i += strlen(compat) + 1) {
+		compat = compat_list + i;
+
+		/* Iterate through all registered drivers */
+		for (entry = driver; entry != driver + n_ents; entry++) {
+			const struct udevice_id *of_match = entry->of_match;
+
+			/* Skip non-PHY drivers to improve performance */
+			if (entry->id != UCLASS_PHY)
+				continue;
+
+			if (!of_match)
+				continue;
+
+			while (of_match->compatible) {
+				if (!strcmp(of_match->compatible, compat)) {
+					debug("Found PHY driver '%s' for SS-PHY compatible '%s'\n",
+					      entry->name, compat);
+					return true;
+				}
+				of_match++;
+			}
+		}
+	}
+
+	return false;
+}
+
 static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np)
 {
-	struct device_node *dwc3;
+	struct device_node *dwc3, *ssphy_np;
 	int ret, len, hsphy_idx = 1;
 	const __be32 *phandles;
 	const char *second_phy_name;
 
-	debug("Fixing up %s\n", glue_np->name);
-
-	/* Tell the glue driver to configure the wrapper for high-speed only operation */
-	ret = of_write_prop(glue_np, "qcom,select-utmi-as-pipe-clk", 0, NULL);
-	if (ret) {
-		log_err("Failed to add property 'qcom,select-utmi-as-pipe-clk': %d\n", ret);
-		return ret;
-	}
+	debug("Checking USB configuration for %s\n", glue_np->name);
 
 	/* Find the DWC3 node itself */
 	dwc3 = of_find_compatible_node(glue_np, NULL, "snps,dwc3");
@@ -58,20 +134,38 @@ static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np
 	phandles = of_get_property(dwc3, "phys", &len);
 	len /= sizeof(*phandles);
 	if (len == 1) {
-		log_debug("Only one phy, not a superspeed controller\n");
+		debug("Only one phy, not a superspeed controller\n");
 		return 0;
 	}
 
-	/* Figure out if the superspeed phy is present and if so then which phy is it? */
+	/* Figure out if the superspeed phy is present */
 	ret = of_property_read_string_index(dwc3, "phy-names", 1, &second_phy_name);
 	if (ret == -ENODATA) {
-		log_debug("Only one phy, not a super-speed controller\n");
+		debug("Only one phy, not a super-speed controller\n");
 		return 0;
 	} else if (ret) {
 		log_err("Failed to read second phy name: %d\n", ret);
 		return ret;
 	}
 
+	/* Find the super-speed PHY node and check if a driver is available */
+	ssphy_np = find_ssphy_node(dwc3);
+	if (ssphy_np && has_driver_for_node(ssphy_np)) {
+		debug("Skipping USB fixup for %s (SS-PHY driver available)\n",
+		      glue_np->name);
+		return 0;
+	}
+
+	/* No driver available - apply the fixup */
+	debug("Applying USB high-speed fixup to %s\n", glue_np->name);
+
+	/* Tell the glue driver to configure the wrapper for high-speed only operation */
+	ret = of_write_prop(glue_np, "qcom,select-utmi-as-pipe-clk", 0, NULL);
+	if (ret) {
+		log_err("Failed to add property 'qcom,select-utmi-as-pipe-clk': %d\n", ret);
+		return ret;
+	}
+
 	/*
 	 * Determine which phy is the superspeed phy by checking the name of the second phy
 	 * since it is typically the superspeed one.
@@ -150,7 +244,7 @@ static void fixup_power_domains(struct device_node *root)
 	do { \
 		u64 start = timer_get_us(); \
 		func(__VA_ARGS__); \
-		debug(#func " took %lluus\n", timer_get_us() - start); \
+		printf(#func " took %lluus\n", timer_get_us() - start); \
 	} while (0)
 
 static int qcom_of_fixup_nodes(void * __maybe_unused ctx, struct event *event)
Signature · 1 line
2.34.1
#7 lore raw

Re: [PATCH v3 4/6] arch: arm: mach-snapdragon: Auto-detect USB SSPHY driver support

Quoted 20 lines · Balaji Selvanathan

Automatically detect super-speed USB PHY driver availability and skip the USB speed fixup if driver is available, eliminating the need for manual configuration.

Previously, U-Boot unconditionally limited USB to high-speed mode on all Qualcomm platforms because most lacked super-speed PHY drivers.

This change implements runtime detection that checks if a PHY driver exists for the super-speed PHY node referenced by the DWC3 controller. The fixup is automatically skipped when a compatible driver is found, allowing the hardware to operate at full capability. Platforms without super-speed PHY drivers continue to receive the fixup automatically.
---
v3:
- Removed support to manually disable the fixup via Kconfig.
- Instead added code to automatically detect if
SSPHY driver is available.

Quoted 1 line

Move 'Signed-off-by:' above the '---' line.

Quoted 54 lines
---
 arch/arm/mach-snapdragon/of_fixup.c | 130 ++++++++++++++++++++++++----
 1 file changed, 112 insertions(+), 18 deletions(-)
arch/arm/mach-snapdragon/of_fixup.c +24 -5
index eec2c0c757e..85dc1c4573d 100644
@@ -4,7 +4,7 @@
  *
  * This file implements runtime fixups for Qualcomm DT to improve
  * compatibility with U-Boot. This includes adjusting the USB nodes
- * to only use USB high-speed.
+ * to only use USB high-speed if SSPHY driver is not available.
  *
  * We use OF_LIVE for this rather than early FDT fixup for a couple
  * of reasons: it has a much nicer API, is most likely more efficient,
@@ -21,32 +21,108 @@
 #include <dt-bindings/input/linux-event-codes.h>
 #include <dm/of_access.h>
 #include <dm/of.h>
+#include <dm/device.h>
+#include <dm/lists.h>
 #include <event.h>
 #include <fdt_support.h>
 #include <linux/errno.h>
+#include <linker_lists.h>
 #include <stdlib.h>
 #include <time.h>
 
-/* U-Boot only supports USB high-speed mode on Qualcomm platforms with DWC3
- * USB controllers. Rather than requiring source level DT changes, we fix up
- * DT here. This improves compatibility with upstream DT and simplifies the
- * porting process for new devices.
+/**
+ * find_ssphy_node() - Find the super-speed PHY node referenced by DWC3
+ * @dwc3: DWC3 device node
+ *
+ * Returns: Pointer to SS-PHY node if found, NULL otherwise
+ */
+static struct device_node *find_ssphy_node(struct device_node *dwc3)
+{
+	const __be32 *phandles;
+	const char *phy_name;
+	int len, i, ret;
+
+	phandles = of_get_property(dwc3, "phys", &len);
+	if (!phandles)
+		return NULL;
+
+	len /= sizeof(*phandles);
+
+	/* Iterate through PHY phandles to find the SS-PHY */
+	for (i = 0; i < len; i++) {

arch/arm/mach-snapdragon/of_fixup.c line 62

Quoted 10 lines
arch/arm/mach-snapdragon/of_fixup.c +10 -0
+		ret = of_property_read_string_index(dwc3, "phy-names", i, &phy_name);
+		if (ret)
+			continue;
+
+		/* Check if this is the super-speed PHY */
+		if (!strncmp("usb3-phy", phy_name, strlen("usb3-phy")) ||
+		    !strncmp("usb3_phy", phy_name, strlen("usb3_phy"))) {
+			return of_find_node_by_phandle(NULL, be32_to_cpu(phandles[i]));
+		}
+	}

fixup_qcom_dwc3() somehow assumes the second phandle *will* be usb3 phy. Can't we continue with the assumption here too?

Quoted 30 lines
arch/arm/mach-snapdragon/of_fixup.c +29 -0
+
+	return NULL;
+}
+
+/**
+ * has_driver_for_node() - Check if any PHY driver can bind to this node
+ * @np: Device node to check
+ *
+ * Returns: true if a PHY driver with matching compatible string exists, false otherwise
  */
+static bool has_driver_for_node(struct device_node *np)
+{
+	struct driver *driver = ll_entry_start(struct driver, driver);
+	const int n_ents = ll_entry_count(struct driver, driver);
+	const char *compat_list, *compat;
+	int compat_length, i;
+	struct driver *entry;
+
+	if (!np)
+		return false;
+
+	/* Get compatible strings from the node */
+	compat_list = of_get_property(np, "compatible", &compat_length);
+	if (!compat_list)
+		return false;
+
+	/* Check each compatible string against PHY drivers only */
+	for (i = 0; i < compat_length; i += strlen(compat) + 1) {
+		compat = compat_list + i;
+

arch/arm/mach-snapdragon/of_fixup.c line 102

Quoted 10 lines
arch/arm/mach-snapdragon/of_fixup.c +10 -0
+		/* Iterate through all registered drivers */
+		for (entry = driver; entry != driver + n_ents; entry++) {
+			const struct udevice_id *of_match = entry->of_match;
+
+			/* Skip non-PHY drivers to improve performance */
+			if (entry->id != UCLASS_PHY)
+				continue;
+
+			if (!of_match)
+				continue;
		if (entry->id != UCLASS_PHY || !of_match)
			continue;
Quoted 35 lines
arch/arm/mach-snapdragon/of_fixup.c +16 -9
+			while (of_match->compatible) {
+				if (!strcmp(of_match->compatible, compat)) {
+					debug("Found PHY driver '%s' for SS-PHY compatible '%s'\n",
+					      entry->name, compat);
+					return true;
+				}
+				of_match++;
+			}
+		}
+	}
+
+	return false;
+}
+
 static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np)
 {
-	struct device_node *dwc3;
+	struct device_node *dwc3, *ssphy_np;
 	int ret, len, hsphy_idx = 1;
 	const __be32 *phandles;
 	const char *second_phy_name;
 
-	debug("Fixing up %s\n", glue_np->name);
-
-	/* Tell the glue driver to configure the wrapper for high-speed only operation */
-	ret = of_write_prop(glue_np, "qcom,select-utmi-as-pipe-clk", 0, NULL);
-	if (ret) {
-		log_err("Failed to add property 'qcom,select-utmi-as-pipe-clk': %d\n", ret);
-		return ret;
-	}
+	debug("Checking USB configuration for %s\n", glue_np->name);
 
 	/* Find the DWC3 node itself */
 	dwc3 = of_find_compatible_node(glue_np, NULL, "snps,dwc3");

arch/arm/mach-snapdragon/of_fixup.c static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np · line 137

Quoted 5 lines
arch/arm/mach-snapdragon/of_fixup.c +1 -1
@@ -58,20 +134,38 @@ static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np
 	phandles = of_get_property(dwc3, "phys", &len);
 	len /= sizeof(*phandles);
 	if (len == 1) {
-		log_debug("Only one phy, not a superspeed controller\n");
+		debug("Only one phy, not a superspeed controller\n");

Undo.

arch/arm/mach-snapdragon/of_fixup.c static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np · line 138

Quoted 1 line
arch/arm/mach-snapdragon/of_fixup.c +0 -0
 		return 0;

Earlier, the fixup was at the top, so you can return here. Now you have to apply the fixup in this case.

arch/arm/mach-snapdragon/of_fixup.c static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np · line 144

Quoted 8 lines
arch/arm/mach-snapdragon/of_fixup.c +2 -2
 	}
 
-	/* Figure out if the superspeed phy is present and if so then which phy is it? */
+	/* Figure out if the superspeed phy is present */
 	ret = of_property_read_string_index(dwc3, "phy-names", 1, &second_phy_name);
 	if (ret == -ENODATA) {
-		log_debug("Only one phy, not a super-speed controller\n");
+		debug("Only one phy, not a super-speed controller\n");

Undo.

arch/arm/mach-snapdragon/of_fixup.c static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np · line 145

Quoted 1 line
arch/arm/mach-snapdragon/of_fixup.c +0 -0
 		return 0;

Can't return. Same as above.

arch/arm/mach-snapdragon/of_fixup.c static int fixup_qcom_dwc3(struct device_node *root, struct device_node *glue_np · line 156

Quoted 11 lines
arch/arm/mach-snapdragon/of_fixup.c +6 -0
 	} else if (ret) {
 		log_err("Failed to read second phy name: %d\n", ret);
 		return ret;
 	}
 
+	/* Find the super-speed PHY node and check if a driver is available */
+	ssphy_np = find_ssphy_node(dwc3);
+	if (ssphy_np && has_driver_for_node(ssphy_np)) {
+		debug("Skipping USB fixup for %s (SS-PHY driver available)\n",
+		      glue_np->name);
+		return 0;

Both the node and driver can be present. Should we consider the possibility of phy DT node status = "disabled"?

Quoted 27 lines
arch/arm/mach-snapdragon/of_fixup.c +13 -2
+	}
+
+	/* No driver available - apply the fixup */
+	debug("Applying USB high-speed fixup to %s\n", glue_np->name);
+
+	/* Tell the glue driver to configure the wrapper for high-speed only operation */
+	ret = of_write_prop(glue_np, "qcom,select-utmi-as-pipe-clk", 0, NULL);
+	if (ret) {
+		log_err("Failed to add property 'qcom,select-utmi-as-pipe-clk': %d\n", ret);
+		return ret;
+	}
+
 	/*
 	 * Determine which phy is the superspeed phy by checking the name of the second phy
 	 * since it is typically the superspeed one.
@@ -150,7 +244,7 @@ static void fixup_power_domains(struct device_node *root)
 	do { \
 		u64 start = timer_get_us(); \
 		func(__VA_ARGS__); \
-		debug(#func " took %lluus\n", timer_get_us() - start); \
+		printf(#func " took %lluus\n", timer_get_us() - start); \
 	} while (0)
 
 static int qcom_of_fixup_nodes(void * __maybe_unused ctx, struct event *event)
--

2.34.1

#8 lore raw

PATCH v3 5/6 configs: qcm6490: Enable super-speed USB support

In reply to Balaji Selvanathan

Enable the QMP Combo PHY driver to allow super-speed USB operation on QCM6490 platforms.

---
v3:
- Removed disabling CONFIG_QCOM_USB_FIXUP as it now removed.

---
 configs/qcm6490_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/qcm6490_defconfig +2 -0
index 54eb5dedaec..2418645003e 100644
@@ -13,3 +13,5 @@ CONFIG_TEXT_BASE=0x9fc00000
 CONFIG_REMAKE_ELF=y
 
 CONFIG_DEFAULT_DEVICE_TREE="qcom/qcs6490-rb3gen2"
+
+CONFIG_PHY_QCOM_QMP_COMBO=y
Signature · 1 line
2.34.1
Reviewed-by on v3 5/6
#9 lore raw

Re: [PATCH v3 5/6] configs: qcm6490: Enable super-speed USB support

Quoted 3 lines · Balaji Selvanathan

Enable the QMP Combo PHY driver to allow super-speed USB operation on QCM6490 platforms.

Quoted 21 lines

---
v3:
- Removed disabling CONFIG_QCOM_USB_FIXUP as it now removed.

---
 configs/qcm6490_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/qcm6490_defconfig +2 -1
index 54eb5dedaec..2418645003e 100644
@@ -13,3 +13,5 @@ CONFIG_TEXT_BASE=0x9fc00000
 CONFIG_REMAKE_ELF=y
 
 CONFIG_DEFAULT_DEVICE_TREE="qcom/qcs6490-rb3gen2"
+
+CONFIG_PHY_QCOM_QMP_COMBO=y
--

2.34.1

#10 lore raw

PATCH v3 6/6 MAINTAINERS: Add entry for Qualcomm PHY drivers

In reply to Balaji Selvanathan

Add the file pattern for Qualcomm PHY drivers to the MAINTAINERS file.

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index b43dae882b3..9093ae35b65 100644
@@ -672,6 +672,7 @@ F:	drivers/*/*/pm8???-*
 F:	drivers/gpio/msm_gpio.c
 F:	drivers/mmc/msm_sdhci.c
 F:	drivers/phy/msm8916-usbh-phy.c
+F:	drivers/phy/qcom/
 F:	drivers/serial/serial_msm.c
 F:	drivers/serial/serial_msm_geni.c
 F:	drivers/smem/msm_smem.c
Signature · 1 line
2.34.1
Reviewed-by on v3 6/6
#11 lore raw

Re: [PATCH v3 6/6] MAINTAINERS: Add entry for Qualcomm PHY drivers

Quoted 2 lines · Balaji Selvanathan

Add the file pattern for Qualcomm PHY drivers to the MAINTAINERS file.

Quoted 20 lines
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -1
index b43dae882b3..9093ae35b65 100644
@@ -672,6 +672,7 @@ F:	drivers/*/*/pm8???-*
 F:	drivers/gpio/msm_gpio.c
 F:	drivers/mmc/msm_sdhci.c
 F:	drivers/phy/msm8916-usbh-phy.c
+F:	drivers/phy/qcom/
 F:	drivers/serial/serial_msm.c
 F:	drivers/serial/serial_msm_geni.c
 F:	drivers/smem/msm_smem.c
--

2.34.1

#12 lore raw
In reply to Balaji Selvanathan
Quoted 9 lines · Balaji Selvanathan

Enable USB3 Super-Speed support for QCM6490/SC7280

This series enables USB3 Super-Speed functionality on QCM6490 and SC7280 platforms by adding support for the QMP USB3-DP Combo PHY. The combo PHY is a dual-mode PHY that can operate in either USB3 or DisplayPort mode, and this implementation focuses on USB3 mode to enable Super-Speed USB support.

[...]

Applied, thanks!

First and last time I use b4 review, the commit shas are wrong but you can find the patches in https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commits/casey/qcom-main-13Apr2026?ref_type=heads

Apologies

[1/6] drivers: clk: qcom: sc7280: Add USB3 PHY pipe clock

      https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/c91a35ea6ec2
[2/6] drivers: usb: dwc3: Add delay after core soft reset
      https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/f69a20002995
[3/6] drivers: phy: qcom: Add QMP USB3-DP Combo PHY driver
      https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/1811eae79f52
[4/6] arch: arm: mach-snapdragon: Auto-detect USB SSPHY driver support
      https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/d7a4a156fce6
[5/6] configs: qcm6490: Enable super-speed USB support
      https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/450d50e25a02

[6/6] MAINTAINERS: Add entry for Qualcomm PHY drivers
https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/78e0bcbb6cd9

Best regards,

Signature · 1 line
// Casey (she/they)