This series adds USB host support for the SpacemiT K1: a driver for
the K1's USB 2.0 (UTMI) PHY, which the K3 shares, a flat-node entry
for the K1's DWC3 controller in dwc3-generic, which already handles
clocks, resets, PHYs, VBUS and the host child for other flat-node SoCs,
and the defconfig options to use them.

The v2 USB 3 tests also used my combo PHY series [1]. This series
doesn't depend on it, and USB 3 on main without it is untested.

Yixun asked what "polled first and never write" meant in v2 1/2. It
described an earlier FreeBSD driver, not this patch. That driver waited
for PLL_RDY without ever writing PHY_PLL_DIV_CFG, so on the OrangePi
R2S the PLL never locked and the xHCI reset never completed. This
driver writes the divider first, as Linux does, so v3 keeps only that
reason in the commit message.

On VBUS (v2 2/2): the dwc3-generic host driver already gets
vbus-supply and enables it before registering the xHCI controller,
which is what Linux commit 764c2e6e60bf adds for the K1. The R2S
device tree describes VBUS as a GPIO-switched fixed regulator, so the
board needs CONFIG_DM_REGULATOR_FIXED, which 3/3 enables, but no code.
Details are in my reply to v2 2/2.

Changes in v3:
- 1/3: drop the read-back check of the clock enable bits, drop the HS
  DAC +15 % setting and match "spacemit,k3-usb2-phy".
- 2/3: add Marek's Reviewed-by; also match "spacemit,k3-dwc3", which
  shares the K1's flat-node layout (not tested on K3).
- 3/3: new; enable USB host and DM_REGULATOR_FIXED in
  spacemit_k1_defconfig.
- Rebase onto main.

Testing: v3 has only been build-tested. A RISC-V build of main with
the updated spacemit_k1_defconfig compiles the changed driver files
with W=1 and no warnings, and builds SPL and U-Boot proper (the FIT
image needs OpenSBI's fw_dynamic.bin, as before). checkpatch reports
no issues.

v3 has not been run on hardware. The v2 R2S and RV2 USB results were
taken with the HS DAC setting that v3 drops, so they do not cover v3.

[1] https://lists.u-boot-project.org/pipermail/u-boot/2026-October/633775.html

Dave Klotz (3):
  phy: spacemit: add K1 USB 2.0 PHY driver
  usb: dwc3: generic: add SpacemiT K1 and K3 support
  configs: spacemit_k1: enable USB host

 MAINTAINERS                        |   1 +
 configs/spacemit_k1_defconfig      |   8 ++
 drivers/phy/spacemit/Kconfig       |  10 ++
 drivers/phy/spacemit/Makefile      |   1 +
 drivers/phy/spacemit/phy-k1-usb2.c | 153 +++++++++++++++++++++++++++++
 drivers/usb/dwc3/dwc3-generic.c    |   2 +
 6 files changed, 175 insertions(+)
 create mode 100644 drivers/phy/spacemit/phy-k1-usb2.c


base-commit: 32ebe922e574a733d01c3f106fa77d9176bfecad

Reply via email to