Linux PCI subsystem development
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/3] PCI: Describe the reference clock architecture of a Link
@ 2026-11-30 22:52 Niklas Cassel
  2026-11-30 22:52 ` [RFC PATCH v2 1/3] schemas: pci: bridge: Document the REFCLK supplied to the Link Niklas Cassel
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Niklas Cassel @ 2026-11-30 22:52 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-pci, devicetree, Bjorn Helgaas, Manivannan Sadhasivam,
	Krzysztof Wilczyński, Damien Le Moal, Vincent Guittot,
	Marek Vasut, Koichiro Den, Niklas Cassel

This is v2 of the ref-clk-mode proposal [1]. Hopefully this RFC v2 can be
a basis for further discussion. Anyone is welcome to take over the series.
I've personally mostly moved on from PCI stuff, but still want to help
contribute to a generic binding to describe the refclock architecture.

A generic property is still needed: S32G dropped "nxp,phy-mode" until
we agree on a generic binding [2], and a patch for R-Car Gen4 hardcodes
SRIS mode per SoC [3], although the reference clock (REFCLK)
architecture depends on the board.

Having a generic property would allow e.g. R-Car Gen4 and S32G to use
this property rather than to hardcode.


Patches 1-2 are for dt-schema, patch 3 is for the kernel.

Rob, in your review of v1 [4] you wrote:

> I think we're mixing SSC and clock sources which are mostly
> independent things to describe. SSC is configuration on top of what
> the clocking topology looks like.

Agreed. The property no longer encodes SSC, nor which end supplies the
REFCLK:
- The REFCLK that a Root Port supplies to its Link is described with
  the clock binding in the Root Port node (patch 1), as you suggested
  for Marek's slot clock [5], and as several R-Car DTs already do.
- SSC is configured with assigned-clock-sscs (frequency, depth and
  method, not just on/off).
- The same property is used for both ends of a Link (patches 2-3).

> Let's assume we define a 'clocks' entry to represent the PCIe clock.
> We could define no clock to mean 'using the slot clock'.

I tried, but the clocks cannot reliably tell the architecture:
1) An absent clock would need a meaning ("no REFCLK supplied", "uses
   the REFCLK of the host"), but in existing DTs it only means "not
   described", so this would change how existing DTBs are interpreted.
2) A supplied REFCLK does not have to be used, e.g. by an FPGA card set
   to its local oscillator, or by a ROCK 5B in endpoint mode. The DT of
   the host is then correct, but does not tell the architecture, unless
   it describes the oscillator of the card.
3) Both ends need SRIS mode if either REFCLK uses SSC, but the SSC of
   the other end is unknown. Always using SRIS is not free either: DWC
   based controllers do not support L0s in SRIS mode, and send SKP
   Ordered Sets about ten times as often.

So v2 keeps one property, for what the clock binding cannot express:

  refclk-mode = "common" | "srns" | "sris";

i.e. Common Refclk, Separate Refclk with No SSC, and Separate Refclk
with Independent SSC. It can replace vendor specific properties like
"nvidia,enable-ext-refclk", "nvidia,enable-srns" and
"rockchip,rx-common-refclk-mode", and drivers keep their default when it
is absent. It also helps discoverability: an endpoint which does not use
the REFCLK of the slot can report Slot Clock Configuration = 0, so that
the host does not enable Common Clock Configuration.

Examples:

  /* Sparrow Hawk: one 9FGV0441 feeds the Root Port and the M.2 slot */
  &pciec0_rp {
          clocks = <&pcie_clk 1>;
          refclk-mode = "common";
  };

  /* ROCK 5B in RC mode, connected to a ROCK 5B in EP mode */
  &pcie3x4 {
          refclk-mode = "srns";
  };

  /* ROCK 5B in EP mode, in a host whose REFCLK uses SSC */
  &pcie3x4_ep {
          refclk-mode = "sris";
  };

  /* Endpoint with an on-board REFCLK that uses SSC */
  &pcie_ep {
          assigned-clocks = <&refclk_gen 0>;
          assigned-clock-sscs = <31500 50 CLK_SSC_DOWN_SPREAD>;
          refclk-mode = "sris";
  };

Open questions:
- Should refclk-mode be valid in host bridge nodes (pci-bus-common.yaml,
  like num-lanes), or only in Root Port nodes (pci-pci-bridge.yaml)?
- SSC generated inside a PHY, e.g. by the RK3588 PCIe 3.0 PHY (needed
  for SRIS between two ROCK 5Bs), has no clock to put
  assigned-clock-sscs on. Today, PHY bindings use vendor specific
  booleans for this, e.g. "rockchip,enable-ssc", "brcm,enable-ssc" and
  "st,ssc-on". The PHY could instead expose its PLL output as a clock,
  like the Qcom QMP PHYs do for the PIPE clock, and document that any
  request within the PCIe limits selects its built-in SSC profile:

    assigned-clocks = <&pcie30phy>;
    assigned-clock-sscs = <31500 50 CLK_SSC_DOWN_SPREAD>;

  Is that acceptable, or would you rather see a generic boolean?

Changes since v1:
- Rename ref-clk-mode to refclk-mode (Mani).
- Drop common-clk-ep and common-clk-ep-ssc, and describe the REFCLK
  source and SSC with the clock binding instead (Rob).
- Add the property for Downstream Ports as well (Rob).

[1] https://lore.kernel.org/linux-pci/20250425092012.95418-2-cassel@kernel.org/
[2] https://lore.kernel.org/linux-pci/20251121164920.2008569-1-vincent.guittot@linaro.org/
[3] https://lore.kernel.org/linux-pci/20261129154135.277882-1-marek.vasut+renesas@mailbox.org/
[4] https://lore.kernel.org/linux-pci/20250519145636.GA2090206-robh@kernel.org/
[5] https://lore.kernel.org/linux-pci/20250410204845.GA1027003-robh@kernel.org/

Niklas Cassel (3):
  schemas: pci: bridge: Document the REFCLK supplied to the Link
  schemas: pci-bus-common: Add 'refclk-mode' property
  dt-bindings: PCI: pci-ep: Add refclk-mode property

 dtschema/schemas/pci/pci-bus-common.yaml          | 21 +++++++++++++++++++++
 dtschema/schemas/pci/pci-pci-bridge.yaml          |  9 +++++++++
 Documentation/devicetree/bindings/pci/pci-ep.yaml | 24 +++++++++++++++++++++++
 3 files changed, 54 insertions(+)

-- 
2.56.1

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

end of thread, other threads:[~2026-11-30 23:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 22:52 [RFC PATCH v2 0/3] PCI: Describe the reference clock architecture of a Link Niklas Cassel
2026-11-30 22:52 ` [RFC PATCH v2 1/3] schemas: pci: bridge: Document the REFCLK supplied to the Link Niklas Cassel
2026-11-30 22:52 ` [RFC PATCH v2 2/3] schemas: pci-bus-common: Add 'refclk-mode' property Niklas Cassel
2026-11-30 22:52 ` [RFC PATCH v2 3/3] dt-bindings: PCI: pci-ep: Add refclk-mode property Niklas Cassel
2026-11-30 23:38 ` [RFC PATCH v2 0/3] PCI: Describe the reference clock architecture of a Link Niklas Cassel

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