RFC PCI: Describe the reference clock architecture of a Link
Get series with b4
b4 am [email protected]Versions newest first
- v2 RFC Latest3 patches 1 replyIn review
Changes in v2 from the cover letter
- 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/[email protected]/
[2] https://lore.kernel.org/linux-pci/[email protected]/
[3] https://lore.kernel.org/linux-pci/[email protected]/
[4] https://lore.kernel.org/linux-pci/[email protected]/
[5] https://lore.kernel.org/linux-pci/[email protected]/
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | schemas: pci: bridge: Document the REFCLK supplied to the Linkdtschema/ | +9 | 0 replies | |
| 2/3 | schemas: pci-bus-common: Add 'refclk-mode' propertydtschema/ | +21 | 0 replies | |
| 3/3 | dt-bindings: PCI: pci-ep: Add refclk-mode propertyDocumentation/ | +24 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.
Cover letter [RFC PATCH v2 0/3] PCI: Describe the reference clock architecture of a Link
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.
Quoted 3 lines · 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).
Quoted 2 lines
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/[email protected]/
[2] https://lore.kernel.org/linux-pci/[email protected]/
[3] https://lore.kernel.org/linux-pci/[email protected]/
[4] https://lore.kernel.org/linux-pci/[email protected]/
[5] https://lore.kernel.org/linux-pci/[email protected]/
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(+)
Signature · 1 line
2.56.1