* [PATCH v2 0/1] phy: qcom: usb-hs: program MSM8x60 vendor ULPI registers on power-on
@ 2026-06-04 16:23 Herman van Hazendonk
2026-06-04 16:23 ` [PATCH v2 1/1] " Herman van Hazendonk
0 siblings, 1 reply; 2+ messages in thread
From: Herman van Hazendonk @ 2026-06-04 16:23 UTC (permalink / raw)
To: vkoul
Cc: neil.armstrong, andersson, lumag, konrad.dybcio, p.zabel,
linux-arm-msm, linux-phy, linux-kernel, Herman van Hazendonk
v2:
- Drop the new "qcom,vendor-init-seq" DT property entirely, per
Dmitry's review. The values being passed in were
platform-specific (identical across every MSM8x60 SoC) plus one
board-specific value, not per-device. Move all of it into the
driver.
- Drop the corresponding dt-bindings patch (the binding gains
nothing in v2).
- Hardcode the values in the driver behind a runtime flag that
only matches "qcom,usb-hs-phy-msm8660":
* reg 0x32 [5:4] = 11b - pre-emphasis 20% (platform-wide
across every MSM8x60 reference board / HP TouchPad / HTC)
* reg 0x36 bits 1,2 set - CDR auto-reset + SE1 gating
disabled (also platform-wide)
* reg 0x32 [3:0] = 5 - HS driver slope. This is the only
board-specific value; HP TouchPad webOS kernel uses 5, HTC
MSM8660 ports historically used 1. Since the TouchPad is
the only in-tree MSM8x60 consumer, the value is hardcoded
with a comment noting that a per-compatible override will
be needed when a second board lands.
- Comment in the driver also calls out that HTC vendor kernels
additionally write 0x0C to reg 0x31. The HP TouchPad webOS
kernel never touched that register and USB is stable without
it, so those bits are omitted until documentation surfaces.
- The companion DTS patch flipping the TouchPad PHY compatible
from "qcom,usb-hs-phy-apq8064" (a different SoC) to
"qcom,usb-hs-phy-msm8660" will be sent separately to the ARM
DTS tree as that's where it belongs.
On-device validation (HP TouchPad / APQ8060):
- Booted with v2 + the DTS compatible fix. PHY driver bound,
msm_hsusb HS link came up at high-speed, BC 1.2 charger
detection passed, UDC configured cleanly.
- 200 MB scp device->host + 200 MB scp host->device, with a
concurrent ping flood running in parallel:
- both transfers 19.1-19.3 s (~10.5 MB/s, the CPU+stack
ceiling for USB-net on a 1.5 GHz Scorpion)
- md5 round-trip identical both ways (zero corruption in
~400 MB of HS traffic)
- ping flood: 60/60 received, 0% loss
- usb0 counters: 0 errors, 0 dropped, 0 carrier losses,
0 collisions across 151k packets / 220 MB
- dmesg line count unchanged (no link resets, no PHY/USB
warnings emitted during stress)
The on-device test doesn't measure the analog effect of the
pre-emphasis / driver slope settings (that needs an oscilloscope
on D+/D-), but it does confirm the writes don't regress an
already-stable HS link.
Herman van Hazendonk (1):
phy: qcom: usb-hs: program MSM8x60 vendor ULPI registers on power-on
drivers/phy/qualcomm/phy-qcom-usb-hs.c | 79 ++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
base-commit: 944125b4c454b58d2fe6e35f1087a932b2050dff
--
2.43.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2 1/1] phy: qcom: usb-hs: program MSM8x60 vendor ULPI registers on power-on
2026-06-04 16:23 [PATCH v2 0/1] phy: qcom: usb-hs: program MSM8x60 vendor ULPI registers on power-on Herman van Hazendonk
@ 2026-06-04 16:23 ` Herman van Hazendonk
0 siblings, 0 replies; 2+ messages in thread
From: Herman van Hazendonk @ 2026-06-04 16:23 UTC (permalink / raw)
To: vkoul
Cc: neil.armstrong, andersson, lumag, konrad.dybcio, p.zabel,
linux-arm-msm, linux-phy, linux-kernel, Herman van Hazendonk
The MSM8x60-class PHY needs three vendor-register tweaks for stable
USB operation, which the legacy msm_otg driver used to drive from
board platform data:
- reg 0x32 bits [5:4] = 11b: pre-emphasis level set to 20%
(Qualcomm reference setting, identical across every MSM8x60
reference board, HP TouchPad and the HTC MSM8660 ports).
- reg 0x36 bits 1, 2 set: CDR auto-reset and SE1 gating disabled
(also identical across every MSM8x60 board surveyed).
- reg 0x32 bits [3:0] = 5: HS driver slope. This is the only
board-specific value; the HP TouchPad uses 5 (matches the
.hsdrvslope = 0x05 from the legacy mach-msm board file), while
HTC MSM8660 ports use 1. Since the TouchPad is the only in-tree
consumer, the value is hardcoded here with a note; a
per-compatible override can be introduced when a second
MSM8x60 board lands.
The writes live behind a runtime flag that only matches
"qcom,usb-hs-phy-msm8660" so the existing MSM8226/8916/8960/8974
consumers are untouched. They are issued *after* reset_control_reset()
so the values survive the register restore the reset performs.
Note: HTC's MSM8660 vendor kernels additionally write 0x0C to reg
0x31. The HP TouchPad webOS kernel does not touch that register
and USB is stable without it, so those bits are omitted here until
documentation is available to explain what they control.
Signed-off-by: Herman van Hazendonk <github.com@herrie.org>
---
drivers/phy/qualcomm/phy-qcom-usb-hs.c | 79 ++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
index 98a18987f1be..80508885a5b0 100644
--- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c
+++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
@@ -20,6 +20,28 @@
# define ULPI_MISC_A_VBUSVLDEXTSEL BIT(1)
# define ULPI_MISC_A_VBUSVLDEXT BIT(0)
+/*
+ * Raw ULPI vendor-register addresses programmed at probe time for the
+ * MSM8x60 / APQ8060 PHY variant. These are NOT under
+ * ULPI_EXT_VENDOR_SPECIFIC; they live in the standard ULPI vendor
+ * range (0x30-0x3f) and are addressed directly.
+ */
+#define ULPI_MSM_CONFIG_REG3 0x32
+# define ULPI_MSM_HSDRVSLOPE_MASK GENMASK(3, 0)
+# define ULPI_MSM_PRE_EMPHASIS_MASK GENMASK(5, 4)
+# define ULPI_MSM_PRE_EMPHASIS_20PCT (3 << 4)
+#define ULPI_MSM_DIGOUT_CTRL 0x36
+# define ULPI_MSM_CDR_AUTORESET BIT(1)
+# define ULPI_MSM_SE1_GATE BIT(2)
+
+/*
+ * Per-board HS driver slope. Currently only the HP TouchPad (the only
+ * MSM8x60-class consumer that depends on this PHY initialisation) is in
+ * tree; HTC MSM8660 ports historically used a value of 1 here, so when
+ * those boards are added a per-compatible override will be needed.
+ */
+#define ULPI_MSM_HSDRVSLOPE_TENDERLOIN 0x05
+
struct ulpi_seq {
u8 addr;
@@ -37,6 +59,7 @@ struct qcom_usb_hs_phy {
struct ulpi_seq *init_seq;
struct extcon_dev *vbus_edev;
struct notifier_block vbus_notify;
+ bool msm8x60_init;
};
static int qcom_usb_hs_phy_set_mode(struct phy *phy,
@@ -105,6 +128,54 @@ qcom_usb_hs_phy_vbus_notifier(struct notifier_block *nb, unsigned long event,
return ulpi_write(uphy->ulpi, addr, ULPI_MISC_A_VBUSVLDEXT);
}
+/*
+ * Apply the fixed MSM8x60-class vendor-register initialisation that the
+ * legacy msm_otg driver used to drive from board platform data. The PHY
+ * has just been reset by reset_control_reset() in qcom_usb_hs_phy_power_on(),
+ * so the registers are at their POR defaults and an RMW preserves any
+ * reserved bits the silicon expects.
+ *
+ * - reg 0x32 [5:4] pre-emphasis = 20% (Qualcomm reference setting,
+ * identical across MSM8x60 reference boards, HP TouchPad and HTC).
+ * - reg 0x32 [3:0] HS driver slope = 5 (HP TouchPad value; HTC's
+ * MSM8660 boards used 1. This is the only board-specific bit and
+ * is hardcoded for now since the TouchPad is the only in-tree
+ * consumer; a per-compatible override can be added when a second
+ * board lands.)
+ * - reg 0x36 [2:1] CDR auto-reset and SE1 gating disabled (matches
+ * every MSM8x60 reference board and HP/HTC vendor kernels).
+ *
+ * Note: HTC MSM8660 vendor kernels additionally write 0x0C to reg 0x31.
+ * The HP TouchPad webOS kernel does not touch that register and USB is
+ * stable without it, so we omit those bits until documentation is
+ * available to explain what they control.
+ */
+static int qcom_usb_hs_phy_msm8x60_init(struct qcom_usb_hs_phy *uphy)
+{
+ struct ulpi *ulpi = uphy->ulpi;
+ int reg32, reg36, ret;
+
+ reg32 = ulpi_read(ulpi, ULPI_MSM_CONFIG_REG3);
+ if (reg32 < 0)
+ return reg32;
+
+ reg32 &= ~(ULPI_MSM_PRE_EMPHASIS_MASK | ULPI_MSM_HSDRVSLOPE_MASK);
+ reg32 |= ULPI_MSM_PRE_EMPHASIS_20PCT;
+ reg32 |= ULPI_MSM_HSDRVSLOPE_TENDERLOIN & ULPI_MSM_HSDRVSLOPE_MASK;
+
+ ret = ulpi_write(ulpi, ULPI_MSM_CONFIG_REG3, reg32);
+ if (ret)
+ return ret;
+
+ reg36 = ulpi_read(ulpi, ULPI_MSM_DIGOUT_CTRL);
+ if (reg36 < 0)
+ return reg36;
+
+ reg36 |= ULPI_MSM_CDR_AUTORESET | ULPI_MSM_SE1_GATE;
+
+ return ulpi_write(ulpi, ULPI_MSM_DIGOUT_CTRL, reg36);
+}
+
static int qcom_usb_hs_phy_power_on(struct phy *phy)
{
struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);
@@ -154,6 +225,12 @@ static int qcom_usb_hs_phy_power_on(struct phy *phy)
goto err_ulpi;
}
+ if (uphy->msm8x60_init) {
+ ret = qcom_usb_hs_phy_msm8x60_init(uphy);
+ if (ret)
+ goto err_ulpi;
+ }
+
if (uphy->vbus_edev) {
state = extcon_get_state(uphy->vbus_edev, EXTCON_USB);
/* setup initial state */
@@ -214,6 +291,8 @@ static int qcom_usb_hs_phy_probe(struct ulpi *ulpi)
return -ENOMEM;
ulpi_set_drvdata(ulpi, uphy);
uphy->ulpi = ulpi;
+ uphy->msm8x60_init = of_device_is_compatible(ulpi->dev.of_node,
+ "qcom,usb-hs-phy-msm8660");
size = of_property_count_u8_elems(ulpi->dev.of_node, "qcom,init-seq");
if (size < 0)
--
2.43.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-04 16:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 16:23 [PATCH v2 0/1] phy: qcom: usb-hs: program MSM8x60 vendor ULPI registers on power-on Herman van Hazendonk
2026-06-04 16:23 ` [PATCH v2 1/1] " Herman van Hazendonk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox