Devicetree
 help / color / mirror / Atom feed
* [PATCH v6 0/2] phy: cix: add Sky1 USB/DP combo PHY support
@ 2026-12-01  5:16 Gary Yang
  2026-12-01  5:16 ` [PATCH v6 1/2] dt-bindings: phy: add CIX Sky1 USB/DP combo PHY Gary Yang
  2026-12-01  5:16 ` [PATCH v6 2/2] phy: cix: add Sky1 USB/DP combo PHY driver Gary Yang
  0 siblings, 2 replies; 8+ messages in thread
From: Gary Yang @ 2026-12-01  5:16 UTC (permalink / raw)
  To: vkoul, neil.armstrong, mani, robh, krzk+dt, conor+dt, fugang.duan
  Cc: gary.yang, Luo.Liu, cix-kernel-upstream, linux-phy, devicetree,
	linux-arm-kernel, linux-kernel

This series adds support for the USB/DP combo PHY of the CIX Sky1 SoC.
Each PHY instance drives one SuperSpeedPlus USB lane and up to four
DisplayPort lanes of a USB Type-C port. The USB and the DP controller get
their own PHY through the PHY_TYPE_USB3 and PHY_TYPE_DP cells. Plug
orientation and the USB/DP mode decision are taken by the Type-C connector
driver; the PHY consumes them through the Type-C switch and mux API.

The USB and the DisplayPort controllers and the Type-C connector are not
yet described in the CIX device trees. The graph links and the consumers
will be added together with them.

Patch 1 adds the binding and patch 2 the driver. The MAINTAINERS update
is part of patch 2, so that patch 2 can be applied without patch 1. The
SoC and board nodes are sent separately as a follow-up, since they go
through the SoC tree.

Patch 2 builds on Luo Liu's "Add Sky1 DisplayPort PHY support" series:

https://lore.kernel.org/linux-phy/20261102030425.1957585-1-Luo.Liu@cixtech.com

That series creates drivers/phy/cix/ together with the PHY_CIX_DP Kconfig
symbol and the CIX SKY1 DISPLAYPORT PHY DRIVER MAINTAINERS entry. This
series adds the PHY_CIX_USBDP symbol and the new binding, and renames the
entry to CIX SKY1 PHY DRIVERS. It should be applied on top of Luo's series
to avoid conflicts in drivers/phy/cix/{Kconfig,Makefile} and MAINTAINERS.

Changes in v6:
- Keep the DP lane count, the PHY bus width and the USB mode bit in
  sync with the requested mode when the deferred reprogramming is
  applied from the DP configuration path, instead of leaving the values
  from the previous power-on in place. A rate update that does not
  repeat set_lanes could otherwise program the USB3 lanes after a
  4-lane to 2-lane switch, or skip the lanes that became available
  after a 2-lane to 4-lane switch. Validate the voltage levels against
  the same lane count, so that the verification and the programming
  steps agree.
- Ignore DP configuration requests that arrive after the connector has
  left the DisplayPort alt mode, so that a stale link-training call
  cannot reprogram lanes that no longer belong to DisplayPort.
- Complete a DisplayPort power-on that arrives while the mux still
  reports a USB-only mode when the mux later selects the DisplayPort
  mode. The PHY core has already taken the power reference, so without
  remembering the request the DP PHY would stay unpowered for the
  session and all link configuration would be dropped.
- Only remember that power-on once it succeeded or when it has been
  deferred until the mux selects the DisplayPort mode. A failed
  power-on does not give the PHY core a reference to account, so
  remembering it anyway would let the mux path power the block up
  without a consumer and never power it down again.
- Drop a pending reprogramming request when the PHY is fully powered
  down. The next power-on programs the complete register table for the
  requested mode and orientation, so the request is applied there and
  must not leak into the next session.

Changes in v5:
- Attempt the USB restore on every mux event whose requested mode
  contains USB, instead of only on the plain USB state, so that a
  configuration change or a disconnect after a 4-lane DP session no
  longer leaves the initialized USB3 controller attached to a powered
  down PHY.
- Do not run the power-on sequence when the DP PHY releases the lanes:
  the PHY is still powered at that point, so restoring the USB mode
  there would enable the APB clock a second time and leak a
  prepare/enable reference. Account the USB mode again instead and only
  apply a deferred reprogramming.
- Drop the USB mode bit and power the PHY down when the mux switches to a
  DP-only configuration while USB3 is the only user, instead of keeping
  the PHY powered with a USB bit that the DP-only register table has
  already disconnected. The DP PHY powers the block up again when it is
  powered on.
- Apply a deferred mode or plug orientation reprogramming when the DP
  link parameters are configured, before the link training starts,
  instead of leaving it pending while the DP PHY is powered. A mode
  change that arrives after the DP PHY has been powered on with the
  previous table cannot be applied from the mux notification, and the
  link would otherwise be trained against the previous lane mapping.

Changes in v4:
- Map the safe and USB states signalled by the DP altmode driver to the
  USB+DP mode instead of the USB-only mode, so that a DP PHY power-on
  request that races with the altmode notification no longer leaves the
  PHY unpowered and silently drops the link training writes. Handle the
  deprecated pin assignments A and B the same way as C and D instead of
  mapping them to USB only.
- Apply a deferred mode table or plug orientation reprogramming as soon as
  the DP PHY stops using the lanes, instead of waiting for a USB3 power-on
  that is not guaranteed while the PHY stays initialized.
- Drop the USB mode bit when a 4-lane DP configuration takes over all the
  lanes, so that releasing the DP PHY powers the combo PHY down instead
  of leaving it and its apb clock enabled. Remember whether the USB3
  controller still holds the PHY initialized and power the PHY back up
  to USB once the last DP user releases the lanes, including when the DP
  altmode driver switches the sink back to USB before the DP PHY is
  powered off, so that the controller does not end up driving an
  unpowered PHY.

Patch 1 is unchanged from v4.

Changes in v3:
- Drop the inline keyword from the register access helpers, drop the
  udphy_write() wrapper and use writel() directly.
- Return the actual clk_prepare_enable() error instead of initialising
  the return value to -EBUSY, and reflow the retry comment to use the
  full 80 columns.
- Initialise the PHY mutex with devm_mutex_init().

Changes in v2:
- Replace the hand-written regmap backend over the PHY registers with
  direct writel()/readl() access.
- Take the DP link rate in Mb/s, as defined by struct
  phy_configure_opts_dp, and select the register table from the link
  configuration entry instead of repeating it per case.
- Protect the PHY state with guard(mutex) and drop the goto-based unlock
  paths.
- Use dev_err_probe() consistently in probe().
- Fix local variable ordering in probe() and sky1_udphy_init(), and
  drop the unused register read.
- Lowercase hex constants, fix overlong lines, add the missing copyright
  header and a missing newline before return.
- Move the driver out of ARM/CIX SOC SUPPORT into the CIX SKY1 PHY DRIVERS
  entry, and drop the commit message claim about the bootloader handing
  over an initialized port.
- Validate the DP link rate before the PLL is touched, so that an
  unsupported rate no longer leaves PLL1 disabled.
- Honour set_rate, set_lanes and set_voltages independently, and keep the
  negotiated lane count in the driver, so that a caller that only updates
  the voltage swing and pre-emphasis levels, as dw-dp does, works with an
  uninitialised lanes field. Validate all of the options before any of
  them is applied.
- Program the TX voltage swing and pre-emphasis levels per lane instead
  of applying the settings of lane 0 to all lanes.
- Add .init to the USB3 PHY ops and only touch the PHY registers while
  the PHY is powered.
- Track the active and the requested mode separately and reprogram the
  PHY on the next power-on only when the alt mode or the plug orientation
  has changed, instead of enabling the APB clock a second time.
- Reset the PHY when it is reprogrammed, and only reprogram it when the
  register table actually changes, so that an active USB link is left
  alone when the mode changes between USB and USB+DisplayPort.
- Handle the deprecated DisplayPort pin assignment F as a USB+DP state,
  like the other Type-C mux drivers do.
- Report the DisplayPort lane count only after the PHY has been powered
  on.
- Ignore Type-C mux states of alt modes other than DisplayPort, which
  used to be mistaken for a DisplayPort state because the state numbers
  overlap.
- Describe the two PHYs with #phy-cells = <1> instead of child nodes,
  reference the common USB switch binding, describe the Type-C graph
  connection, and drop the cix,default-conf property.
- Keep the binding example limited to the PHY node and its graph ports,
  and drop the stubbed USB and DisplayPort consumers.

Patch 1 is unchanged from v2.

Gary Yang (2):
  dt-bindings: phy: add CIX Sky1 USB/DP combo PHY
  phy: cix: add Sky1 USB/DP combo PHY driver

 .../bindings/phy/cix,sky1-usbdp-phy.yaml      |  150 ++
 MAINTAINERS                                   |    4 +-
 drivers/phy/cix/Kconfig                       |   16 +
 drivers/phy/cix/Makefile                      |    1 +
 drivers/phy/cix/phy-cix-usbdp.c               | 1665 +++++++++++++++++
 drivers/phy/cix/phy-cix-usbdp.h               |  257 +++
 6 files changed, 2092 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/phy/cix,sky1-usbdp-phy.yaml
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.c
 create mode 100644 drivers/phy/cix/phy-cix-usbdp.h

-- 
2.50.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-12-01  7:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01  5:16 [PATCH v6 0/2] phy: cix: add Sky1 USB/DP combo PHY support Gary Yang
2026-12-01  5:16 ` [PATCH v6 1/2] dt-bindings: phy: add CIX Sky1 USB/DP combo PHY Gary Yang
2026-12-01  5:53   ` Krzysztof Kozlowski
2026-12-01  6:26     ` Gary Yang
2026-12-01  7:26       ` Krzysztof Kozlowski
2026-12-01  7:47         ` Gary Yang
2026-12-01  5:16 ` [PATCH v6 2/2] phy: cix: add Sky1 USB/DP combo PHY driver Gary Yang
2026-12-01  5:34   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox